model.go 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. package qq
  2. const (
  3. // URL
  4. unifiedOrder = "https://qpay.qq.com/cgi-bin/pay/qpay_unified_order.cgi" // 统一下单
  5. microPay = "https://qpay.qq.com/cgi-bin/pay/qpay_micro_pay.cgi" // 提交付款码支付
  6. orderQuery = "https://qpay.qq.com/cgi-bin/pay/qpay_order_query.cgi" // 订单查询
  7. orderClose = "https://qpay.qq.com/cgi-bin/pay/qpay_close_order.cgi" // 关闭订单
  8. refundQuery = "https://qpay.qq.com/cgi-bin/pay/qpay_refund_query.cgi" // 退款查询
  9. statementDown = "https://qpay.qq.com/cgi-bin/sp_download/qpay_mch_statement_down.cgi" // 交易账单
  10. accRoll = "https://qpay.qq.com/cgi-bin/sp_download/qpay_mch_acc_roll.cgi" // 资金账单
  11. reverse = "https://api.qpay.qq.com/cgi-bin/pay/qpay_reverse.cgi" // 撤销订单
  12. refund = "https://api.qpay.qq.com/cgi-bin/pay/qpay_refund.cgi" // 申请退款
  13. // 支付类型
  14. TradeType_MicroPay = "MICROPAY" // 提交付款码支付
  15. TradeType_JsApi = "JSAPI" // 公众号支付
  16. TradeType_Native = "NATIVE" // 原生扫码支付
  17. TradeType_App = "APP" // APP支付
  18. TradeType_Mini = "MINIAPP" // QQ小程序支付
  19. // 签名方式
  20. SignType_MD5 = "MD5"
  21. SignType_HMAC_SHA256 = "HMAC-SHA256"
  22. )
  23. type NotifyRequest struct {
  24. Appid string `xml:"appid,omitempty" json:"appid,omitempty"`
  25. MchId string `xml:"mch_id,omitempty" json:"mch_id,omitempty"`
  26. NonceStr string `xml:"nonce_str,omitempty" json:"nonce_str,omitempty"`
  27. Sign string `xml:"sign,omitempty" json:"sign,omitempty"`
  28. DeviceInfo string `xml:"device_info,omitempty" json:"device_info,omitempty"`
  29. TradeType string `xml:"trade_type,omitempty" json:"trade_type,omitempty"`
  30. TradeState string `xml:"trade_state,omitempty" json:"trade_state,omitempty"`
  31. BankType string `xml:"bank_type,omitempty" json:"bank_type,omitempty"`
  32. FeeType string `xml:"fee_type,omitempty" json:"fee_type,omitempty"`
  33. TotalFee string `xml:"total_fee,omitempty" json:"total_fee,omitempty"`
  34. CashFee string `xml:"cash_fee,omitempty" json:"cash_fee,omitempty"`
  35. CouponFee string `xml:"coupon_fee,omitempty" json:"coupon_fee,omitempty"`
  36. TransactionId string `xml:"transaction_id,omitempty" json:"transaction_id,omitempty"`
  37. OutTradeNo string `xml:"out_trade_no,omitempty" json:"out_trade_no,omitempty"`
  38. Attach string `xml:"attach,omitempty" json:"attach,omitempty"`
  39. TimeEnd string `xml:"time_end,omitempty" json:"time_end,omitempty"`
  40. Openid string `xml:"openid,omitempty" json:"openid,omitempty"`
  41. }
  42. type MicroPayResponse struct {
  43. ReturnCode string `xml:"return_code,omitempty" json:"return_code,omitempty"`
  44. ReturnMsg string `xml:"return_msg,omitempty" json:"return_msg,omitempty"`
  45. RetCode string `xml:"retcode,omitempty" json:"retcode,omitempty"`
  46. RetMsg string `xml:"retmsg,omitempty" json:"retmsg,omitempty"`
  47. Appid string `xml:"appid,omitempty" json:"appid,omitempty"`
  48. MchId string `xml:"mch_id,omitempty" json:"mch_id,omitempty"`
  49. Sign string `xml:"sign,omitempty" json:"sign,omitempty"`
  50. ResultCode string `xml:"result_code,omitempty" json:"result_code,omitempty"`
  51. ErrCode string `xml:"err_code,omitempty" json:"err_code,omitempty"`
  52. ErrCodeDes string `xml:"err_code_des,omitempty" json:"err_code_des,omitempty"`
  53. NonceStr string `xml:"nonce_str,omitempty" json:"nonce_str,omitempty"`
  54. DeviceInfo string `xml:"device_info,omitempty" json:"device_info,omitempty"`
  55. TradeType string `xml:"trade_type,omitempty" json:"trade_type,omitempty"`
  56. TradeState string `xml:"trade_state,omitempty" json:"trade_state,omitempty"`
  57. BankType string `xml:"bank_type,omitempty" json:"bank_type,omitempty"`
  58. FeeType string `xml:"fee_type,omitempty" json:"fee_type,omitempty"`
  59. TotalFee string `xml:"total_fee,omitempty" json:"total_fee,omitempty"`
  60. CashFee string `xml:"cash_fee,omitempty" json:"cash_fee,omitempty"`
  61. CouponFee string `xml:"coupon_fee,omitempty" json:"coupon_fee,omitempty"`
  62. CouponFee0 string `xml:"coupon_fee_0,omitempty" json:"coupon_fee_0,omitempty"`
  63. CouponFee1 string `xml:"coupon_fee_1,omitempty" json:"coupon_fee_1,omitempty"`
  64. TransactionId string `xml:"transaction_id,omitempty" json:"transaction_id,omitempty"`
  65. OutTradeNo string `xml:"out_trade_no,omitempty" json:"out_trade_no,omitempty"`
  66. Attach string `xml:"attach,omitempty" json:"attach,omitempty"`
  67. TimeEnd string `xml:"time_end,omitempty" json:"time_end,omitempty"`
  68. TradeStateDesc string `xml:"trade_state_desc,omitempty" json:"trade_state_desc,omitempty"`
  69. Openid string `xml:"openid,omitempty" json:"openid,omitempty"`
  70. }
  71. type ReverseResponse struct {
  72. ReturnCode string `xml:"return_code,omitempty" json:"return_code,omitempty"`
  73. ReturnMsg string `xml:"return_msg,omitempty" json:"return_msg,omitempty"`
  74. RetCode string `xml:"retcode,omitempty" json:"retcode,omitempty"`
  75. RetMsg string `xml:"retmsg,omitempty" json:"retmsg,omitempty"`
  76. Appid string `xml:"appid,omitempty" json:"appid,omitempty"`
  77. SubAppid string `xml:"sub_appid,omitempty" json:"sub_appid,omitempty"`
  78. MchId string `xml:"mch_id,omitempty" json:"mch_id,omitempty"`
  79. SubMchId string `xml:"sub_mch_id,omitempty" json:"sub_mch_id,omitempty"`
  80. Sign string `xml:"sign,omitempty" json:"sign,omitempty"`
  81. ResultCode string `xml:"result_code,omitempty" json:"result_code,omitempty"`
  82. ErrCode string `xml:"err_code,omitempty" json:"err_code,omitempty"`
  83. ErrCodeDes string `xml:"err_code_des,omitempty" json:"err_code_des,omitempty"`
  84. NonceStr string `xml:"nonce_str,omitempty" json:"nonce_str,omitempty"`
  85. Recall string `json:"recall,omitempty"`
  86. }
  87. type UnifiedOrderResponse struct {
  88. ReturnCode string `xml:"return_code,omitempty" json:"return_code,omitempty"`
  89. ReturnMsg string `xml:"return_msg,omitempty" json:"return_msg,omitempty"`
  90. RetCode string `xml:"retcode,omitempty" json:"retcode,omitempty"`
  91. RetMsg string `xml:"retmsg,omitempty" json:"retmsg,omitempty"`
  92. Appid string `xml:"appid,omitempty" json:"appid,omitempty"`
  93. MchId string `xml:"mch_id,omitempty" json:"mch_id,omitempty"`
  94. Sign string `xml:"sign,omitempty" json:"sign,omitempty"`
  95. ResultCode string `xml:"result_code,omitempty" json:"result_code,omitempty"`
  96. ErrCode string `xml:"err_code,omitempty" json:"err_code,omitempty"`
  97. ErrCodeDes string `xml:"err_code_des,omitempty" json:"err_code_des,omitempty"`
  98. NonceStr string `xml:"nonce_str,omitempty" json:"nonce_str,omitempty"`
  99. TradeType string `xml:"trade_type,omitempty" json:"trade_type,omitempty"`
  100. PrepayId string `xml:"prepay_id,omitempty" json:"prepay_id,omitempty"`
  101. CodeUrl string `xml:"code_url,omitempty" json:"code_url,omitempty"`
  102. }
  103. type OrderQueryResponse struct {
  104. ReturnCode string `xml:"return_code,omitempty" json:"return_code,omitempty"`
  105. ReturnMsg string `xml:"return_msg,omitempty" json:"return_msg,omitempty"`
  106. RetCode string `xml:"retcode,omitempty" json:"retcode,omitempty"`
  107. RetMsg string `xml:"retmsg,omitempty" json:"retmsg,omitempty"`
  108. Appid string `xml:"appid,omitempty" json:"appid,omitempty"`
  109. MchId string `xml:"mch_id,omitempty" json:"mch_id,omitempty"`
  110. Sign string `xml:"sign,omitempty" json:"sign,omitempty"`
  111. ResultCode string `xml:"result_code,omitempty" json:"result_code,omitempty"`
  112. ErrCode string `xml:"err_code,omitempty" json:"err_code,omitempty"`
  113. ErrCodeDes string `xml:"err_code_des,omitempty" json:"err_code_des,omitempty"`
  114. NonceStr string `xml:"nonce_str,omitempty" json:"nonce_str,omitempty"`
  115. DeviceInfo string `xml:"device_info,omitempty" json:"device_info,omitempty"`
  116. TradeType string `xml:"trade_type,omitempty" json:"trade_type,omitempty"`
  117. TradeState string `xml:"trade_state,omitempty" json:"trade_state,omitempty"`
  118. BankType string `xml:"bank_type,omitempty" json:"bank_type,omitempty"`
  119. FeeType string `xml:"fee_type,omitempty" json:"fee_type,omitempty"`
  120. TotalFee string `xml:"total_fee,omitempty" json:"total_fee,omitempty"`
  121. CashFee string `xml:"cash_fee,omitempty" json:"cash_fee,omitempty"`
  122. CouponFee string `xml:"coupon_fee,omitempty" json:"coupon_fee,omitempty"`
  123. TransactionId string `xml:"transaction_id,omitempty" json:"transaction_id,omitempty"`
  124. OutTradeNo string `xml:"out_trade_no,omitempty" json:"out_trade_no,omitempty"`
  125. Attach string `xml:"attach,omitempty" json:"attach,omitempty"`
  126. TimeEnd string `xml:"time_end,omitempty" json:"time_end,omitempty"`
  127. TradeStateDesc string `xml:"trade_state_desc,omitempty" json:"trade_state_desc,omitempty"`
  128. Openid string `xml:"openid,omitempty" json:"openid,omitempty"`
  129. }
  130. type CloseOrderResponse struct {
  131. ReturnCode string `xml:"return_code,omitempty" json:"return_code,omitempty"`
  132. ReturnMsg string `xml:"return_msg,omitempty" json:"return_msg,omitempty"`
  133. RetCode string `xml:"retcode,omitempty" json:"retcode,omitempty"`
  134. RetMsg string `xml:"retmsg,omitempty" json:"retmsg,omitempty"`
  135. Appid string `xml:"appid,omitempty" json:"appid,omitempty"`
  136. MchId string `xml:"mch_id,omitempty" json:"mch_id,omitempty"`
  137. Sign string `xml:"sign,omitempty" json:"sign,omitempty"`
  138. ResultCode string `xml:"result_code,omitempty" json:"result_code,omitempty"`
  139. ErrCode string `xml:"err_code,omitempty" json:"err_code,omitempty"`
  140. ErrCodeDes string `xml:"err_code_des,omitempty" json:"err_code_des,omitempty"`
  141. NonceStr string `xml:"nonce_str,omitempty" json:"nonce_str,omitempty"`
  142. }
  143. type RefundResponse struct {
  144. ReturnCode string `xml:"return_code,omitempty" json:"return_code,omitempty"`
  145. ReturnMsg string `xml:"return_msg,omitempty" json:"return_msg,omitempty"`
  146. RetCode string `xml:"retcode,omitempty" json:"retcode,omitempty"`
  147. RetMsg string `xml:"retmsg,omitempty" json:"retmsg,omitempty"`
  148. Appid string `xml:"appid,omitempty" json:"appid,omitempty"`
  149. MchId string `xml:"mch_id,omitempty" json:"mch_id,omitempty"`
  150. Sign string `xml:"sign,omitempty" json:"sign,omitempty"`
  151. ResultCode string `xml:"result_code,omitempty" json:"result_code,omitempty"`
  152. ErrCode string `xml:"err_code,omitempty" json:"err_code,omitempty"`
  153. ErrCodeDes string `xml:"err_code_des,omitempty" json:"err_code_des,omitempty"`
  154. NonceStr string `xml:"nonce_str,omitempty" json:"nonce_str,omitempty"`
  155. TransactionId string `xml:"transaction_id,omitempty" json:"transaction_id,omitempty"`
  156. OutTradeNo string `xml:"out_trade_no,omitempty" json:"out_trade_no,omitempty"`
  157. TotalFee string `xml:"total_fee,omitempty" json:"total_fee,omitempty"`
  158. OutRefundNo string `xml:"out_refund_no,omitempty" json:"out_refund_no,omitempty"`
  159. RefundId string `xml:"refund_id,omitempty" json:"refund_id,omitempty"`
  160. RefundChannel string `xml:"refund_channel,omitempty" json:"refund_channel,omitempty"`
  161. RefundFee string `xml:"refund_fee,omitempty" json:"refund_fee,omitempty"`
  162. }
  163. type RefundQueryResponse struct {
  164. ReturnCode string `xml:"return_code,omitempty" json:"return_code,omitempty"`
  165. ReturnMsg string `xml:"return_msg,omitempty" json:"return_msg,omitempty"`
  166. RetCode string `xml:"retcode,omitempty" json:"retcode,omitempty"`
  167. RetMsg string `xml:"retmsg,omitempty" json:"retmsg,omitempty"`
  168. Appid string `xml:"appid,omitempty" json:"appid,omitempty"`
  169. MchId string `xml:"mch_id,omitempty" json:"mch_id,omitempty"`
  170. Sign string `xml:"sign,omitempty" json:"sign,omitempty"`
  171. ResultCode string `xml:"result_code,omitempty" json:"result_code,omitempty"`
  172. ErrCode string `xml:"err_code,omitempty" json:"err_code,omitempty"`
  173. ErrCodeDes string `xml:"err_code_des,omitempty" json:"err_code_des,omitempty"`
  174. NonceStr string `xml:"nonce_str,omitempty" json:"nonce_str,omitempty"`
  175. TransactionId string `xml:"transaction_id,omitempty" json:"transaction_id,omitempty"`
  176. OutTradeNo string `xml:"out_trade_no,omitempty" json:"out_trade_no,omitempty"`
  177. TotalFee string `xml:"total_fee,omitempty" json:"total_fee,omitempty"`
  178. CashFee string `xml:"cash_fee,omitempty" json:"cash_fee,omitempty"`
  179. FeeType string `xml:"fee_type,omitempty" json:"fee_type,omitempty"`
  180. OutRefundNo0 string `xml:"out_refund_no_0,omitempty" json:"out_refund_no_0,omitempty"`
  181. OutRefundNo1 string `xml:"out_refund_no_1,omitempty" json:"out_refund_no_1,omitempty"`
  182. RefundId0 string `xml:"refund_id_0,omitempty" json:"refund_id_0,omitempty"`
  183. RefundId1 string `xml:"refund_id_1,omitempty" json:"refund_id_1,omitempty"`
  184. RefundChannel0 string `xml:"refund_channel_0,omitempty" json:"refund_channel_0,omitempty"`
  185. RefundChannel1 string `xml:"refund_channel_1,omitempty" json:"refund_channel_1,omitempty"`
  186. RefundFee0 string `xml:"refund_fee_0,omitempty" json:"refund_fee_0,omitempty"`
  187. RefundFee1 string `xml:"refund_fee_1,omitempty" json:"refund_fee_1,omitempty"`
  188. CouponRefundFee0 string `xml:"coupon_refund_fee_0,omitempty" json:"coupon_refund_fee_0,omitempty"`
  189. CouponRefundFee1 string `xml:"coupon_refund_fee_1,omitempty" json:"coupon_refund_fee_1,omitempty"`
  190. CashRefundFee0 string `xml:"cash_refund_fee_0,omitempty" json:"cash_refund_fee_0,omitempty"`
  191. CashRefundFee1 string `xml:"cash_refund_fee_1,omitempty" json:"cash_refund_fee_1,omitempty"`
  192. RefundStatus0 string `xml:"refund_status_0,omitempty" json:"refund_status_0,omitempty"`
  193. RefundStatus1 string `xml:"refund_status_1,omitempty" json:"refund_status_1,omitempty"`
  194. RefundRecvAccout0 string `xml:"refund_recv_accout_0,omitempty" json:"refund_recv_accout_0,omitempty"`
  195. RefundRecvAccout1 string `xml:"refund_recv_accout_1,omitempty" json:"refund_recv_accout_1,omitempty"`
  196. }