互动
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

88 lines
5.0 KiB

5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
  1. package pay_service
  2. import ()
  3. //var (
  4. // WxCertPath = `./cacert/apiclient_cert.pem`
  5. // WxKeyPath = `./cacert/apiclient_key.pem`
  6. // WxCaPath = `./cacert/rootca.pem`
  7. // //MchId = `1394404502`
  8. // //AppId = "wx7b0bcf476552c5e9"
  9. // Secret = "f6aabdd40ea25272f4442603a7dc8028"
  10. // AppId = `wx662a1633304bfd42`
  11. // MchId = `1441266702`
  12. // SubMchId = `1594049151`
  13. // ApiKey = `5x201c8zn43cg675204594cab5423320`
  14. // //ApiKey = `2c82c64ceec6ba89ffc9f593c671a12f`
  15. // ClientIp = `123.207.246.51`
  16. // mainHost = `https://api.mch.weixin.qq.com`
  17. // backHost = `https://api2.mch.weixin.qq.com`
  18. //)
  19. //var (
  20. // NotifyURL = fmt.Sprintf("%s/wechat/callback", define.HOST) // 微信回调通知
  21. // UnifiedOrderURL = fmt.Sprintf("%s/pay/unifiedorder", mainHost) // 统一下单url
  22. // QueryOrderURL = fmt.Sprintf("%s/pay/orderquery", mainHost) // 微信查询订单
  23. // CloseOrderURL = fmt.Sprintf("%s/pay/closeorder", mainHost) // 微信关闭订单
  24. // RefundURL = fmt.Sprintf("%s/secapi/pay/refund", mainHost) // 微信退款
  25. // RefundQueryURL = fmt.Sprintf("%s/pay/refundquery", mainHost) // 微信查询退款
  26. // DownloadBillURL = fmt.Sprintf("%s/pay/downloadbill", mainHost) // 微信下载账单
  27. // DownloadFundFlowURL = fmt.Sprintf("%s/pay/downloadfundflow", mainHost)
  28. // TransfersURL = fmt.Sprintf("%s/mmpaymkttransfers/promotion/transfers", mainHost)
  29. // SendRedPackURL = fmt.Sprintf("%s/mmpaymkttransfers/sendredpack", mainHost)
  30. // QueryRedPackURL = fmt.Sprintf("%s/mmpaymkttransfers/gethbinfo", mainHost)
  31. //)
  32. //const (
  33. // CODE_SUCCESS = "SUCCESS" // 成功
  34. // CODE_FAIL = "FAIL" // 失败
  35. // CODE_NOTPAY = "NOTPAY" // 未支付
  36. // CODE_CHANGE = "CHANGE" // 退款异常
  37. // CODE_REFUNDCLOSE = "REFUNDCLOSE" // 退款关闭
  38. // CODE_ERROR = "ERROR" // 业务错误
  39. // CODE_INVALID_REQUEST = "INVALID_REQUEST" // 无效请求
  40. // CODE_NOAUTH = "NOAUTH" // 异常IP请求不予受理
  41. // CODE_NOTENOUGH = "NOTENOUGH" // 余额不足
  42. // CODE_ORDERPAID = "ORDERPAID" // 订单已支付
  43. // CODE_ORDERCLOSED = "ORDERCLOSED" // 订单已关闭
  44. // CODE_SYSTEMERROR = "SYSTEMERROR" // 系统错误
  45. // CODE_APPID_NOT_EXIST = "APPID_NOT_EXIST" // APPID不存在
  46. // CODE_MCHID_NOT_EXIST = "MCHID_NOT_EXIST" // MCHID不存在
  47. // CODE_APPID_MCHID_NOT_MATCH = "APPID_MCHID_NOT_MATCH" // APPID MCHID 不匹配
  48. // CODE_LACK_PARAMS = "LACK_PARAMS" // 缺少参数
  49. // CODE_OUT_TRADE_NO_USED = "OUT_TRADE_NO_USED" // 商户订单号重复
  50. // CODE_SIGNERROR = "SIGNERROR" // 签名错误
  51. // CODE_XML_FORMAT_ERROR = "XML_FORMAT_ERROR" // xml格式错误
  52. // CODE_REQUIRE_POST_METHOD = "REQUIRE_POST_METHOD" // 请使用post请求方法
  53. // CODE_POST_DATA_EMPTY = "POST_DATA_EMPTY" // post数据为空
  54. // CODE_NOT_UTF8 = "NOT_UTF8" // 编码错误
  55. // CODE_ORDERNOTEXIST = "ORDERNOTEXIST" // 交易订单号不存在
  56. // CODE_BIZERR_NEED_RETRY = "BIZERR_NEED_RETRY" // 退款业务流程错误,需要商户触发重试来解决
  57. // CODE_TRADE_OVERDUE = "TRADE_OVERDUE" // 订单已经超过退款期限
  58. // CODE_USER_ACCOUNT_ABNORMAL = "USER_ACCOUNT_ABNORMAL" // 退款请求失败用户帐号注销
  59. // CODE_INVALID_REQ_TOO_MUCH = "INVALID_REQ_TOO_MUCH" // 无效请求过多
  60. // CODE_INVALID_TRANSACTIONID = "INVALID_TRANSACTIONID" // 无效transaction_id
  61. // CODE_PARAM_ERROR = "PARAM_ERROR" // 参数错误
  62. // CODE_FREQUENCY_LIMITED = "FREQUENCY_LIMITED" // 请求频率限制
  63. // CODE_TRADE_SUCCESS = "SUCCESS" // 交易成功
  64. // CODE_TRADE_REFUND = "REFUND" // 转入退款
  65. // CODE_TRADE_NOTPAY = "NOTPAY" // 尚未支付
  66. // CODE_TRADE_CLOSED = "CLOSED" // 已关闭
  67. // CODE_TRADE_REVOKED = "REVOKED" // 已撤销
  68. // CODE_TRADE_USERPAYING = "USERPAYING" // 用户支付中
  69. // CODE_TRADE_PAYERROR = "PAYERROR" // 支付失败
  70. // CODE_TRANSFER_PROCESSING = "PROCESSING" // 转账处理中
  71. // CODE_TRANSFER_NOT_FOUND = "NOT_FOUND" // 账单不见了
  72. //)
  73. type CommonReturn struct {
  74. ReturnCode string `xml:"return_code,omitempty" json:"return_code,omitempty"`
  75. ReturnMsg string `xml:"return_msg,omitempty" json:"return_msg,omitempty"`
  76. }
  77. type CommonResult struct {
  78. ResultCode string `xml:"result_code,omitempty" json:"result_code,omitempty"`
  79. ResultMsg string `xml:"result_msg,omitempty" json:"result_msg,omitempty"`
  80. ErrCode string `xml:"err_code,omitempty" json:"err_code,omitempty"`
  81. ErrCodeDes string `xml:"err_code_des,omitempty" json:"err_code_des,omitempty"`
  82. }