constant.go 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. /*
  2. * Copyright silenceper/wechat Author(https://silenceper.com/wechat/). All Rights Reserved.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. *
  16. * You can obtain one at https://github.com/silenceper/wechat.
  17. *
  18. */
  19. package virtualpayment
  20. const (
  21. // EnvProduction 环境 0-正式环境 1-沙箱环境
  22. EnvProduction Env = 0
  23. // EnvSandbox 环境 0-正式环境 1-沙箱环境
  24. EnvSandbox Env = 1
  25. )
  26. const (
  27. // Success 错误码 0、成功
  28. Success ErrCode = 0
  29. // SystemError 错误码 -1、系统错误
  30. SystemError ErrCode = -1
  31. // OpenIDError 错误码 268490001、openid 错误
  32. OpenIDError ErrCode = 268490001
  33. // RequestParamError 错误码 268490002、请求参数字段错误,具体看 errmsg
  34. RequestParamError ErrCode = 268490002
  35. // SignError 错误码 268490003、签名错误
  36. SignError ErrCode = 268490003
  37. // RepeatOperationError 错误码 268490004、重复操作(赠送和代币支付相关接口会返回,表示之前的操作已经成功)
  38. RepeatOperationError ErrCode = 268490004
  39. // OrderRefundedError 错误码 268490005、订单已经通过 cancel_currency_pay 接口退款,不支持再退款
  40. OrderRefundedError ErrCode = 268490005
  41. // InsufficientBalanceError 错误码 268490006、代币的退款/支付操作金额不足
  42. InsufficientBalanceError ErrCode = 268490006
  43. // SensitiveContentError 错误码 268490007、图片或文字存在敏感内容,禁止使用
  44. SensitiveContentError ErrCode = 268490007
  45. // TokenNotPublishedError 错误码 268490008、代币未发布,不允许进行代币操作
  46. TokenNotPublishedError ErrCode = 268490008
  47. // SessionKeyExpiredError 错误码 268490009、用户 session_key 不存在或已过期,请重新登录
  48. SessionKeyExpiredError ErrCode = 268490009
  49. // BillGeneratingError 错误码 268490011、账单数据生成中,请稍后调用本接口获取
  50. BillGeneratingError ErrCode = 268490011
  51. )
  52. const (
  53. // OrderStatusInit 订单状态 当前状态 0-订单初始化(未创建成功,不可用于支付)
  54. OrderStatusInit OrderStatus = 0
  55. // OrderStatusCreated 订单状态 当前状态 1-订单创建成功
  56. OrderStatusCreated OrderStatus = 1
  57. // OrderStatusPaid 订单状态 当前状态 2-订单已经支付,待发货
  58. OrderStatusPaid OrderStatus = 2
  59. // OrderStatusDelivering 订单状态 当前状态 3-订单发货中
  60. OrderStatusDelivering OrderStatus = 3
  61. // OrderStatusDelivered 订单状态 当前状态 4-订单已发货
  62. OrderStatusDelivered OrderStatus = 4
  63. // OrderStatusRefunded 订单状态 当前状态 5-订单已经退款
  64. OrderStatusRefunded OrderStatus = 5
  65. // OrderStatusClosed 订单状态 当前状态 6-订单已经关闭(不可再使用)
  66. OrderStatusClosed OrderStatus = 6
  67. // OrderStatusRefundFailed 订单状态 当前状态 7-订单退款失败
  68. OrderStatusRefundFailed OrderStatus = 7
  69. )
  70. const (
  71. // baseSite 基础网址
  72. baseSite = "https://api.weixin.qq.com"
  73. // queryUserBalance 查询虚拟支付余额
  74. queryUserBalance = "/xpay/query_user_balance"
  75. // currencyPay 扣减代币(一般用于代币支付)
  76. currencyPay = "/xpay/currency_pay"
  77. // queryOrder 查询创建的订单(现金单,非代币单)
  78. queryOrder = "/xpay/query_order"
  79. // cancelCurrencyPay 代币支付退款 (currency_pay 接口的逆操作)
  80. cancelCurrencyPay = "/xpay/cancel_currency_pay"
  81. // notifyProvideGoods 通知已经发货完成(只能通知现金单),正常通过 xpay_goods_deliver_notify 消息推送返回成功就不需要调用这个 api 接口。这个接口用于异常情况推送不成功时手动将单改成已发货状态
  82. notifyProvideGoods = "/xpay/notify_provide_goods"
  83. // presentCurrency 代币赠送接口,由于目前不支付按单号查赠送单的功能,所以当需要赠送的时候可以一直重试到返回 0 或者返回 268490004(重复操作)为止
  84. presentCurrency = "/xpay/present_currency"
  85. // downloadBill 下载账单
  86. downloadBill = "/xpay/download_bill"
  87. // refundOrder 退款 对使用 jsapi 接口下的单进行退款
  88. refundOrder = "/xpay/refund_order"
  89. // createWithdrawOrder 创建提现单
  90. createWithdrawOrder = "/xpay/create_withdraw_order"
  91. // queryWithdrawOrder 查询提现单
  92. queryWithdrawOrder = "/xpay/query_withdraw_order"
  93. // startUploadGoods 启动批量上传道具任务
  94. startUploadGoods = "/xpay/start_upload_goods"
  95. // queryUploadGoods 查询批量上传道具任务状态
  96. queryUploadGoods = "/xpay/query_upload_goods"
  97. // startPublishGoods 启动批量发布道具任务
  98. startPublishGoods = "/xpay/start_publish_goods"
  99. // queryPublishGoods 查询批量发布道具任务状态
  100. queryPublishGoods = "/xpay/query_publish_goods"
  101. )
  102. const (
  103. // signature user mode signature
  104. signature = "signature"
  105. // paySignature payment signature
  106. paySignature = "pay_sig"
  107. // accessToken access_token authorization tokens
  108. accessToken = "access_token"
  109. // EmptyString empty string
  110. EmptyString = ""
  111. )