model.go 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512
  1. package wechat
  2. const (
  3. // 境外国家地区
  4. China Country = 1 // 中国国内
  5. China2 Country = 2 // 中国国内(冗灾方案)
  6. SoutheastAsia Country = 3 // 东南亚
  7. Other Country = 4 // 其他国家
  8. // URL
  9. baseUrlCh = "https://api.mch.weixin.qq.com/" // 中国国内
  10. baseUrlCh2 = "https://api2.mch.weixin.qq.com/" // 中国国内
  11. baseUrlHk = "https://apihk.mch.weixin.qq.com/" // 东南亚
  12. baseUrlUs = "https://apius.mch.weixin.qq.com/" // 其他
  13. // 正式
  14. microPay = "pay/micropay" // 提交付款码支付
  15. unifiedOrder = "pay/unifiedorder" // 统一下单
  16. orderQuery = "pay/orderquery" // 查询订单
  17. closeOrder = "pay/closeorder" // 关闭订单
  18. refund = "secapi/pay/refund" // 申请退款
  19. reverse = "secapi/pay/reverse" // 撤销订单
  20. refundQuery = "pay/refundquery" // 查询退款
  21. downloadBill = "pay/downloadbill" // 下载对账单
  22. downloadFundFlow = "pay/downloadfundflow" // 下载资金账单
  23. report = "payitil/report" // 交易保障
  24. batchQueryComment = "billcommentsp/batchquerycomment" // 拉取订单评价数据
  25. transfers = "mmpaymkttransfers/promotion/transfers" // 企业向微信用户个人付款
  26. authCodeToOpenid = "tools/authcodetoopenid" // 授权码查询openid
  27. entrustPublic = "papay/entrustweb" // 公众号纯签约
  28. entrustApp = "papay/preentrustweb" // APP纯签约
  29. entrustH5 = "papay/h5entrustweb" // H5纯签约
  30. entrustPaying = "pay/contractorder" // 支付中签约
  31. entrustQuery = "papay/querycontract" // 查询签约关系
  32. entrustApplyPay = "pay/pappayapply" // 申请扣款
  33. entrustDelete = "papay/deletecontract" // 申请解约
  34. entrustQueryOrder = "pay/paporderquery" // 查询扣款订单
  35. // SanBox
  36. sandboxGetSignKey = "https://api.mch.weixin.qq.com/sandboxnew/pay/getsignkey"
  37. sandboxMicroPay = "sandboxnew/pay/micropay"
  38. sandboxUnifiedOrder = "sandboxnew/pay/unifiedorder"
  39. sandboxOrderQuery = "sandboxnew/pay/orderquery"
  40. sandboxCloseOrder = "sandboxnew/pay/closeorder"
  41. sandboxRefund = "sandboxnew/pay/refund"
  42. sandboxReverse = "sandboxnew/pay/reverse"
  43. sandboxRefundQuery = "sandboxnew/pay/refundquery"
  44. sandboxDownloadBill = "sandboxnew/pay/downloadbill"
  45. sandboxReport = "sandboxnew/payitil/report"
  46. // 支付类型
  47. TradeType_Mini = "JSAPI" // 小程序支付
  48. TradeType_JsApi = "JSAPI" // JSAPI支付
  49. TradeType_App = "APP" // app支付
  50. TradeType_H5 = "MWEB" // H5支付
  51. TradeType_Native = "NATIVE" // Native支付
  52. // 签名方式
  53. SignType_MD5 = "MD5"
  54. SignType_HMAC_SHA256 = "HMAC-SHA256"
  55. )
  56. // Notify
  57. type NotifyRequest struct {
  58. ReturnCode string `xml:"return_code,omitempty" json:"return_code,omitempty"`
  59. ReturnMsg string `xml:"return_msg,omitempty" json:"return_msg,omitempty"`
  60. ResultCode string `xml:"result_code,omitempty" json:"result_code,omitempty"`
  61. ErrCode string `xml:"err_code,omitempty" json:"err_code,omitempty"`
  62. ErrCodeDes string `xml:"err_code_des,omitempty" json:"err_code_des,omitempty"`
  63. Appid string `xml:"appid,omitempty" json:"appid,omitempty"`
  64. MchId string `xml:"mch_id,omitempty" json:"mch_id,omitempty"`
  65. DeviceInfo string `xml:"device_info,omitempty" json:"device_info,omitempty"`
  66. NonceStr string `xml:"nonce_str,omitempty" json:"nonce_str,omitempty"`
  67. Sign string `xml:"sign,omitempty" json:"sign,omitempty"`
  68. SignType string `xml:"sign_type,omitempty" json:"sign_type,omitempty"`
  69. Openid string `xml:"openid,omitempty" json:"openid,omitempty"`
  70. IsSubscribe string `xml:"is_subscribe,omitempty" json:"is_subscribe,omitempty"`
  71. TradeType string `xml:"trade_type,omitempty" json:"trade_type,omitempty"`
  72. BankType string `xml:"bank_type,omitempty" json:"bank_type,omitempty"`
  73. TotalFee string `xml:"total_fee,omitempty" json:"total_fee,omitempty"`
  74. SettlementTotalFee string `xml:"settlement_total_fee,omitempty" json:"settlement_total_fee,omitempty"`
  75. FeeType string `xml:"fee_type,omitempty" json:"fee_type,omitempty"`
  76. CashFee string `xml:"cash_fee,omitempty" json:"cash_fee,omitempty"`
  77. CashFeeType string `xml:"cash_fee_type,omitempty" json:"cash_fee_type,omitempty"`
  78. CouponFee string `xml:"coupon_fee,omitempty" json:"coupon_fee,omitempty"`
  79. CouponCount string `xml:"coupon_count,omitempty" json:"coupon_count,omitempty"`
  80. CouponType0 string `xml:"coupon_type_0,omitempty" json:"coupon_type_0,omitempty"`
  81. CouponType1 string `xml:"coupon_type_1,omitempty" json:"coupon_type_1,omitempty"`
  82. CouponId0 string `xml:"coupon_id_0,omitempty" json:"coupon_id_0,omitempty"`
  83. CouponId1 string `xml:"coupon_id_1,omitempty" json:"coupon_id_1,omitempty"`
  84. CouponFee0 string `xml:"coupon_fee_0,omitempty" json:"coupon_fee_0,omitempty"`
  85. CouponFee1 string `xml:"coupon_fee_1,omitempty" json:"coupon_fee_1,omitempty"`
  86. TransactionId string `xml:"transaction_id,omitempty" json:"transaction_id,omitempty"`
  87. OutTradeNo string `xml:"out_trade_no,omitempty" json:"out_trade_no,omitempty"`
  88. Attach string `xml:"attach,omitempty" json:"attach,omitempty"`
  89. TimeEnd string `xml:"time_end,omitempty" json:"time_end,omitempty"`
  90. }
  91. type UnifiedOrderResponse struct {
  92. ReturnCode string `xml:"return_code,omitempty" json:"return_code,omitempty"`
  93. ReturnMsg string `xml:"return_msg,omitempty" json:"return_msg,omitempty"`
  94. Appid string `xml:"appid,omitempty" json:"appid,omitempty"`
  95. MchId string `xml:"mch_id,omitempty" json:"mch_id,omitempty"`
  96. DeviceInfo string `xml:"device_info,omitempty" json:"device_info,omitempty"`
  97. NonceStr string `xml:"nonce_str,omitempty" json:"nonce_str,omitempty"`
  98. Sign string `xml:"sign,omitempty" json:"sign,omitempty"`
  99. ResultCode string `xml:"result_code,omitempty" json:"result_code,omitempty"`
  100. ErrCode string `xml:"err_code,omitempty" json:"err_code,omitempty"`
  101. ErrCodeDes string `xml:"err_code_des,omitempty" json:"err_code_des,omitempty"`
  102. TradeType string `xml:"trade_type,omitempty" json:"trade_type,omitempty"`
  103. PrepayId string `xml:"prepay_id,omitempty" json:"prepay_id,omitempty"`
  104. CodeUrl string `xml:"code_url,omitempty" json:"code_url,omitempty"`
  105. MwebUrl string `xml:"mweb_url,omitempty" json:"mweb_url,omitempty"`
  106. }
  107. type QueryOrderResponse struct {
  108. ReturnCode string `xml:"return_code,omitempty" json:"return_code,omitempty"`
  109. ReturnMsg string `xml:"return_msg,omitempty" json:"return_msg,omitempty"`
  110. Appid string `xml:"appid,omitempty" json:"appid,omitempty"`
  111. MchId string `xml:"mch_id,omitempty" json:"mch_id,omitempty"`
  112. NonceStr string `xml:"nonce_str,omitempty" json:"nonce_str,omitempty"`
  113. Sign string `xml:"sign,omitempty" json:"sign,omitempty"`
  114. ResultCode string `xml:"result_code,omitempty" json:"result_code,omitempty"`
  115. ErrCode string `xml:"err_code,omitempty" json:"err_code,omitempty"`
  116. ErrCodeDes string `xml:"err_code_des,omitempty" json:"err_code_des,omitempty"`
  117. DeviceInfo string `xml:"device_info,omitempty" json:"device_info,omitempty"`
  118. Openid string `xml:"openid,omitempty" json:"openid,omitempty"`
  119. IsSubscribe string `xml:"is_subscribe,omitempty" json:"is_subscribe,omitempty"`
  120. TradeType string `xml:"trade_type,omitempty" json:"trade_type,omitempty"`
  121. TradeState string `xml:"trade_state,omitempty" json:"trade_state,omitempty"`
  122. BankType string `xml:"bank_type,omitempty" json:"bank_type,omitempty"`
  123. TotalFee string `xml:"total_fee,omitempty" json:"total_fee,omitempty"`
  124. SettlementTotalFee string `xml:"settlement_total_fee,omitempty" json:"settlement_total_fee,omitempty"`
  125. FeeType string `xml:"fee_type,omitempty" json:"fee_type,omitempty"`
  126. CashFee string `xml:"cash_fee,omitempty" json:"cash_fee,omitempty"`
  127. CashFeeType string `xml:"cash_fee_type,omitempty" json:"cash_fee_type,omitempty"`
  128. CouponFee string `xml:"coupon_fee,omitempty" json:"coupon_fee,omitempty"`
  129. CouponCount string `xml:"coupon_count,omitempty" json:"coupon_count,omitempty"`
  130. CouponType0 string `xml:"coupon_type_0,omitempty" json:"coupon_type_0,omitempty"`
  131. CouponType1 string `xml:"coupon_type_1,omitempty" json:"coupon_type_1,omitempty"`
  132. CouponId0 string `xml:"coupon_id_0,omitempty" json:"coupon_id_0,omitempty"`
  133. CouponId1 string `xml:"coupon_id_1,omitempty" json:"coupon_id_1,omitempty"`
  134. CouponFee0 string `xml:"coupon_fee_0,omitempty" json:"coupon_fee_0,omitempty"`
  135. CouponFee1 string `xml:"coupon_fee_1,omitempty" json:"coupon_fee_1,omitempty"`
  136. TransactionId string `xml:"transaction_id,omitempty" json:"transaction_id,omitempty"`
  137. OutTradeNo string `xml:"out_trade_no,omitempty" json:"out_trade_no,omitempty"`
  138. Attach string `xml:"attach,omitempty" json:"attach,omitempty"`
  139. TimeEnd string `xml:"time_end,omitempty" json:"time_end,omitempty"`
  140. TradeStateDesc string `xml:"trade_state_desc,omitempty" json:"trade_state_desc,omitempty"`
  141. }
  142. type CloseOrderResponse struct {
  143. ReturnCode string `xml:"return_code,omitempty" json:"return_code,omitempty"`
  144. ReturnMsg string `xml:"return_msg,omitempty" json:"return_msg,omitempty"`
  145. Appid string `xml:"appid,omitempty" json:"appid,omitempty"`
  146. MchId string `xml:"mch_id,omitempty" json:"mch_id,omitempty"`
  147. DeviceInfo string `xml:"device_info,omitempty" json:"device_info,omitempty"`
  148. NonceStr string `xml:"nonce_str,omitempty" json:"nonce_str,omitempty"`
  149. Sign string `xml:"sign,omitempty" json:"sign,omitempty"`
  150. ResultCode string `xml:"result_code,omitempty" json:"result_code,omitempty"`
  151. ErrCode string `xml:"err_code,omitempty" json:"err_code,omitempty"`
  152. ErrCodeDes string `xml:"err_code_des,omitempty" json:"err_code_des,omitempty"`
  153. }
  154. type ReverseResponse struct {
  155. ReturnCode string `xml:"return_code,omitempty" json:"return_code,omitempty"`
  156. ReturnMsg string `xml:"return_msg,omitempty" json:"return_msg,omitempty"`
  157. Appid string `xml:"appid,omitempty" json:"appid,omitempty"`
  158. MchId string `xml:"mch_id,omitempty" json:"mch_id,omitempty"`
  159. NonceStr string `xml:"nonce_str,omitempty" json:"nonce_str,omitempty"`
  160. Sign string `xml:"sign,omitempty" json:"sign,omitempty"`
  161. ResultCode string `xml:"result_code,omitempty" json:"result_code,omitempty"`
  162. ErrCode string `xml:"err_code,omitempty" json:"err_code,omitempty"`
  163. ErrCodeDes string `xml:"err_code_des,omitempty" json:"err_code_des,omitempty"`
  164. Recall string `xml:"recall,omitempty" json:"recall,omitempty"`
  165. }
  166. type RefundResponse struct {
  167. ReturnCode string `xml:"return_code,omitempty" json:"return_code,omitempty"`
  168. ReturnMsg string `xml:"return_msg,omitempty" json:"return_msg,omitempty"`
  169. ResultCode string `xml:"result_code,omitempty" json:"result_code,omitempty"`
  170. ErrCode string `xml:"err_code,omitempty" json:"err_code,omitempty"`
  171. ErrCodeDes string `xml:"err_code_des,omitempty" json:"err_code_des,omitempty"`
  172. Appid string `xml:"appid,omitempty" json:"appid,omitempty"`
  173. MchId string `xml:"mch_id,omitempty" json:"mch_id,omitempty"`
  174. NonceStr string `xml:"nonce_str,omitempty" json:"nonce_str,omitempty"`
  175. Sign string `xml:"sign,omitempty" json:"sign,omitempty"`
  176. TransactionId string `xml:"transaction_id,omitempty" json:"transaction_id,omitempty"`
  177. OutTradeNo string `xml:"out_trade_no,omitempty" json:"out_trade_no,omitempty"`
  178. OutRefundNo string `xml:"out_refund_no,omitempty" json:"out_refund_no,omitempty"`
  179. RefundId string `xml:"refund_id,omitempty" json:"refund_id,omitempty"`
  180. RefundFee string `xml:"refund_fee,omitempty" json:"refund_fee,omitempty"`
  181. SettlementRefundFee string `xml:"settlement_refund_fee,omitempty" json:"settlement_refund_fee,omitempty"`
  182. TotalFee string `xml:"total_fee,omitempty" json:"total_fee,omitempty"`
  183. SettlementTotalFee string `xml:"settlement_total_fee,omitempty" json:"settlement_total_fee,omitempty"`
  184. FeeType string `xml:"fee_type,omitempty" json:"fee_type,omitempty"`
  185. CashFee string `xml:"cash_fee,omitempty" json:"cash_fee,omitempty"`
  186. CashFeeType string `xml:"cash_fee_type,omitempty" json:"cash_fee_type,omitempty"`
  187. CashRefundFee string `xml:"cash_refund_fee,omitempty" json:"cash_refund_fee,omitempty"`
  188. CouponType0 string `xml:"coupon_type_0,omitempty" json:"coupon_type_0,omitempty"`
  189. CouponType1 string `xml:"coupon_type_1,omitempty" json:"coupon_type_1,omitempty"`
  190. CouponRefundFee string `xml:"coupon_refund_fee,omitempty" json:"coupon_refund_fee,omitempty"`
  191. CouponRefundFee0 string `xml:"coupon_refund_fee_0,omitempty" json:"coupon_refund_fee_0,omitempty"`
  192. CouponRefundFee1 string `xml:"coupon_refund_fee_1,omitempty" json:"coupon_refund_fee_1,omitempty"`
  193. CouponRefundCount string `xml:"coupon_refund_count,omitempty" json:"coupon_refund_count,omitempty"`
  194. CouponRefundId0 string `xml:"coupon_refund_id_0,omitempty" json:"coupon_refund_id_0,omitempty"`
  195. CouponRefundId1 string `xml:"coupon_refund_id_1,omitempty" json:"coupon_refund_id_1,omitempty"`
  196. }
  197. type QueryRefundResponse struct {
  198. ReturnCode string `xml:"return_code,omitempty" json:"return_code,omitempty"`
  199. ReturnMsg string `xml:"return_msg,omitempty" json:"return_msg,omitempty"`
  200. ResultCode string `xml:"result_code,omitempty" json:"result_code,omitempty"`
  201. ErrCode string `xml:"err_code,omitempty" json:"err_code,omitempty"`
  202. ErrCodeDes string `xml:"err_code_des,omitempty" json:"err_code_des,omitempty"`
  203. Appid string `xml:"appid,omitempty" json:"appid,omitempty"`
  204. MchId string `xml:"mch_id,omitempty" json:"mch_id,omitempty"`
  205. NonceStr string `xml:"nonce_str,omitempty" json:"nonce_str,omitempty"`
  206. Sign string `xml:"sign,omitempty" json:"sign,omitempty"`
  207. TotalRefundCount string `xml:"total_refund_count,omitempty" json:"total_refund_count,omitempty"`
  208. TransactionId string `xml:"transaction_id,omitempty" json:"transaction_id,omitempty"`
  209. OutTradeNo string `xml:"out_trade_no,omitempty" json:"out_trade_no,omitempty"`
  210. TotalFee string `xml:"total_fee,omitempty" json:"total_fee,omitempty"`
  211. SettlementTotalFee string `xml:"settlement_total_fee,omitempty" json:"settlement_total_fee,omitempty"`
  212. FeeType string `xml:"fee_type,omitempty" json:"fee_type,omitempty"`
  213. CashFee string `xml:"cash_fee,omitempty" json:"cash_fee,omitempty"`
  214. RefundCount string `xml:"refund_count,omitempty" json:"refund_count,omitempty"`
  215. OutRefundNo0 string `xml:"out_refund_no_0,omitempty" json:"out_refund_no_0,omitempty"`
  216. OutRefundNo1 string `xml:"out_refund_no_1,omitempty" json:"out_refund_no_1,omitempty"`
  217. RefundId0 string `xml:"refund_id_0,omitempty" json:"refund_id_0,omitempty"`
  218. RefundId1 string `xml:"refund_id_1,omitempty" json:"refund_id_1,omitempty"`
  219. RefundChannel0 string `xml:"refund_channel_0,omitempty" json:"refund_channel_0,omitempty"`
  220. RefundChannel1 string `xml:"refund_channel_1,omitempty" json:"refund_channel_1,omitempty"`
  221. RefundFee string `xml:"refund_fee,omitempty" json:"refund_fee,omitempty"`
  222. RefundFee0 string `xml:"refund_fee_0,omitempty" json:"refund_fee_0,omitempty"`
  223. RefundFee1 string `xml:"refund_fee_1,omitempty" json:"refund_fee_1,omitempty"`
  224. SettlementRefundFee0 string `xml:"settlement_refund_fee_0,omitempty" json:"settlement_refund_fee_0,omitempty"`
  225. SettlementRefundFee1 string `xml:"settlement_refund_fee_1,omitempty" json:"settlement_refund_fee_1,omitempty"`
  226. CouponType00 string `xml:"coupon_type_0_0,omitempty" json:"coupon_type_0_0,omitempty"`
  227. CouponType01 string `xml:"coupon_type_0_1,omitempty" json:"coupon_type_0_1,omitempty"`
  228. CouponType10 string `xml:"coupon_type_1_0,omitempty" json:"coupon_type_1_0,omitempty"`
  229. CouponType11 string `xml:"coupon_type_1_1,omitempty" json:"coupon_type_1_1,omitempty"`
  230. CouponRefundFee0 string `xml:"coupon_refund_fee_0,omitempty" json:"coupon_refund_fee_0,omitempty"`
  231. CouponRefundFee1 string `xml:"coupon_refund_fee_1,omitempty" json:"coupon_refund_fee_1,omitempty"`
  232. CouponRefundCount0 string `xml:"coupon_refund_count_0,omitempty" json:"coupon_refund_count_0,omitempty"`
  233. CouponRefundCount1 string `xml:"coupon_refund_count_1,omitempty" json:"coupon_refund_count_1,omitempty"`
  234. CouponRefundId00 string `xml:"coupon_refund_id_0_0,omitempty" json:"coupon_refund_id_0_0,omitempty"`
  235. CouponRefundId01 string `xml:"coupon_refund_id_0_1,omitempty" json:"coupon_refund_id_0_1,omitempty"`
  236. CouponRefundId10 string `xml:"coupon_refund_id_1_0,omitempty" json:"coupon_refund_id_1_0,omitempty"`
  237. CouponRefundId11 string `xml:"coupon_refund_id_1_1,omitempty" json:"coupon_refund_id_1_1,omitempty"`
  238. CouponRefundFee00 string `xml:"coupon_refund_fee_0_0,omitempty" json:"coupon_refund_fee_0_0,omitempty"`
  239. CouponRefundFee01 string `xml:"coupon_refund_fee_0_1,omitempty" json:"coupon_refund_fee_0_1,omitempty"`
  240. CouponRefundFee10 string `xml:"coupon_refund_fee_1_0,omitempty" json:"coupon_refund_fee_1_0,omitempty"`
  241. CouponRefundFee11 string `xml:"coupon_refund_fee_1_1,omitempty" json:"coupon_refund_fee_1_1,omitempty"`
  242. RefundStatus0 string `xml:"refund_status_0,omitempty" json:"refund_status_0,omitempty"`
  243. RefundStatus1 string `xml:"refund_status_1,omitempty" json:"refund_status_1,omitempty"`
  244. RefundAccount0 string `xml:"refund_account_0,omitempty" json:"refund_account_0,omitempty"`
  245. RefundAccount1 string `xml:"refund_account_1,omitempty" json:"refund_account_1,omitempty"`
  246. RefundRecvAccout0 string `xml:"refund_recv_accout_0,omitempty" json:"refund_recv_accout_0,omitempty"`
  247. RefundRecvAccout1 string `xml:"refund_recv_accout_1,omitempty" json:"refund_recv_accout_1,omitempty"`
  248. RefundSuccessTime0 string `xml:"refund_success_time_0,omitempty" json:"refund_success_time_0,omitempty"`
  249. RefundSuccessTime1 string `xml:"refund_success_time_1,omitempty" json:"refund_success_time_1,omitempty"`
  250. }
  251. type MicropayResponse struct {
  252. ReturnCode string `xml:"return_code,omitempty" json:"return_code,omitempty"`
  253. ReturnMsg string `xml:"return_msg,omitempty" json:"return_msg,omitempty"`
  254. Appid string `xml:"appid,omitempty" json:"appid,omitempty"`
  255. MchId string `xml:"mch_id,omitempty" json:"mch_id,omitempty"`
  256. DeviceInfo string `xml:"device_info,omitempty" json:"device_info,omitempty"`
  257. NonceStr string `xml:"nonce_str,omitempty" json:"nonce_str,omitempty"`
  258. Sign string `xml:"sign,omitempty" json:"sign,omitempty"`
  259. ResultCode string `xml:"result_code,omitempty" json:"result_code,omitempty"`
  260. ErrCode string `xml:"err_code,omitempty" json:"err_code,omitempty"`
  261. ErrCodeDes string `xml:"err_code_des,omitempty" json:"err_code_des,omitempty"`
  262. Openid string `xml:"openid,omitempty" json:"openid,omitempty"`
  263. IsSubscribe string `xml:"is_subscribe,omitempty" json:"is_subscribe,omitempty"`
  264. TradeType string `xml:"trade_type,omitempty" json:"trade_type,omitempty"`
  265. BankType string `xml:"bank_type,omitempty" json:"bank_type,omitempty"`
  266. FeeType string `xml:"fee_type,omitempty" json:"fee_type,omitempty"`
  267. TotalFee string `xml:"total_fee,omitempty" json:"total_fee,omitempty"`
  268. SettlementTotalFee string `xml:"settlement_total_fee,omitempty" json:"settlement_total_fee,omitempty"`
  269. CouponFee string `xml:"coupon_fee,omitempty" json:"coupon_fee,omitempty"`
  270. CashFeeType string `xml:"cash_fee_type,omitempty" json:"cash_fee_type,omitempty"`
  271. CashFee string `xml:"cash_fee,omitempty" json:"cash_fee,omitempty"`
  272. TransactionId string `xml:"transaction_id,omitempty" json:"transaction_id,omitempty"`
  273. OutTradeNo string `xml:"out_trade_no,omitempty" json:"out_trade_no,omitempty"`
  274. Attach string `xml:"attach,omitempty" json:"attach,omitempty"`
  275. TimeEnd string `xml:"time_end,omitempty" json:"time_end,omitempty"`
  276. PromotionDetail string `xml:"promotion_detail,omitempty" json:"promotion_detail,omitempty"`
  277. }
  278. type AuthCodeToOpenIdResponse struct {
  279. ReturnCode string `xml:"return_code,omitempty" json:"return_code,omitempty"`
  280. ReturnMsg string `xml:"return_msg,omitempty" json:"return_msg,omitempty"`
  281. Appid string `xml:"appid,omitempty" json:"appid,omitempty"`
  282. MchId string `xml:"mch_id,omitempty" json:"mch_id,omitempty"`
  283. NonceStr string `xml:"nonce_str,omitempty" json:"nonce_str,omitempty"`
  284. Sign string `xml:"sign,omitempty" json:"sign,omitempty"`
  285. ResultCode string `xml:"result_code,omitempty" json:"result_code,omitempty"`
  286. ErrCode string `xml:"err_code,omitempty" json:"err_code,omitempty"`
  287. Openid string `xml:"openid,omitempty" json:"openid,omitempty"`
  288. }
  289. type TransfersResponse struct {
  290. ReturnCode string `xml:"return_code,omitempty" json:"return_code,omitempty"`
  291. ReturnMsg string `xml:"return_msg,omitempty" json:"return_msg,omitempty"`
  292. MchAppid string `xml:"mch_appid,omitempty" json:"mch_appid,omitempty"`
  293. Mchid string `xml:"mchid,omitempty" json:"mchid,omitempty"`
  294. DeviceInfo string `xml:"device_info,omitempty" json:"device_info,omitempty"`
  295. NonceStr string `xml:"nonce_str,omitempty" json:"nonce_str,omitempty"`
  296. ResultCode string `xml:"result_code,omitempty" json:"result_code,omitempty"`
  297. ErrCode string `xml:"err_code,omitempty" json:"err_code,omitempty"`
  298. ErrCodeDes string `xml:"err_code_des,omitempty" json:"err_code_des,omitempty"`
  299. PartnerTradeNo string `xml:"partner_trade_no,omitempty" json:"partner_trade_no,omitempty"`
  300. PaymentNo string `xml:"payment_no,omitempty" json:"payment_no,omitempty"`
  301. PaymentTime string `xml:"payment_time,omitempty" json:"payment_time,omitempty"`
  302. }
  303. type ReportResponse struct {
  304. ReturnCode string `xml:"return_code,omitempty" json:"return_code,omitempty"`
  305. ReturnMsg string `xml:"return_msg,omitempty" json:"return_msg,omitempty"`
  306. ResultCode string `xml:"result_code,omitempty" json:"result_code,omitempty"`
  307. }
  308. type EntrustPublicResponse struct {
  309. ReturnCode string `xml:"return_code,omitempty" json:"return_code,omitempty"`
  310. ReturnMsg string `xml:"return_msg,omitempty" json:"return_msg,omitempty"`
  311. ResultCode string `xml:"result_code,omitempty" json:"result_code,omitempty"`
  312. ResultMsg string `xml:"result_msg,omitempty" json:"result_msg,omitempty"`
  313. }
  314. type EntrustAppPreResponse struct {
  315. ReturnCode string `xml:"return_code,omitempty" json:"return_code,omitempty"`
  316. ReturnMsg string `xml:"return_msg,omitempty" json:"return_msg,omitempty"`
  317. ResultCode string `xml:"result_code,omitempty" json:"result_code,omitempty"`
  318. ErrCode string `xml:"err_code,omitempty" json:"err_code,omitempty"`
  319. Appid string `xml:"appid,omitempty" json:"appid,omitempty"`
  320. MchId string `xml:"mch_id,omitempty" json:"mch_id,omitempty"`
  321. Sign string `xml:"sign,omitempty" json:"sign,omitempty"`
  322. NonceStr string `xml:"nonce_str,omitempty" json:"nonce_str,omitempty"`
  323. PreEntrustwebId string `xml:"pre_entrustweb_id,omitempty" json:"pre_entrustweb_id,omitempty"`
  324. }
  325. type EntrustH5Response struct {
  326. ReturnCode string `xml:"return_code,omitempty" json:"return_code,omitempty"`
  327. ReturnMsg string `xml:"return_msg,omitempty" json:"return_msg,omitempty"`
  328. ResultCode string `xml:"result_code,omitempty" json:"result_code,omitempty"`
  329. ResultMsg string `xml:"result_msg,omitempty" json:"result_msg,omitempty"`
  330. RedirectUrl string `xml:"redirect_url,omitempty" json:"redirect_url,omitempty"`
  331. }
  332. type EntrustPayingResponse struct {
  333. ReturnCode string `xml:"return_code,omitempty" json:"return_code,omitempty"`
  334. ReturnMsg string `xml:"return_msg,omitempty" json:"return_msg,omitempty"`
  335. ResultCode string `xml:"result_code,omitempty" json:"result_code,omitempty"`
  336. Appid string `xml:"appid,omitempty" json:"appid,omitempty"`
  337. MchId string `xml:"mch_id,omitempty" json:"mch_id,omitempty"`
  338. DeviceInfo string `xml:"device_info,omitempty" json:"device_info,omitempty"`
  339. NonceStr string `xml:"nonce_str,omitempty" json:"nonce_str,omitempty"`
  340. Sign string `xml:"sign,omitempty" json:"sign,omitempty"`
  341. ErrCode string `xml:"err_code,omitempty" json:"err_code,omitempty"`
  342. ErrCodeDes string `xml:"err_code_des,omitempty" json:"err_code_des,omitempty"`
  343. ContractResultCode string `xml:"contract_result_code,omitempty" json:"contract_result_code,omitempty"`
  344. ContractErrCode string `xml:"contract_err_code,omitempty" json:"contract_err_code,omitempty"`
  345. ContractErrCodeDes string `xml:"contract_err_code_des,omitempty" json:"contract_err_code_des,omitempty"`
  346. PrepayId string `xml:"prepay_id,omitempty" json:"prepay_id,omitempty"`
  347. TradeType string `xml:"trade_type,omitempty" json:"trade_type,omitempty"`
  348. CodeUrl string `xml:"code_url,omitempty" json:"code_url,omitempty"`
  349. PlanId string `xml:"plan_id,omitempty" json:"plan_id,omitempty"`
  350. RequestSerial string `xml:"request_serial,omitempty" json:"request_serial,omitempty"`
  351. ContractCode string `xml:"contract_code,omitempty" json:"contract_code,omitempty"`
  352. ContractDisplayAccount string `xml:"contract_display_account,omitempty" json:"contract_display_account,omitempty"`
  353. MwebUrl string `xml:"mweb_url,omitempty" json:"mweb_url,omitempty"`
  354. OutTradeNo string `xml:"out_trade_no,omitempty" json:"out_trade_no,omitempty"`
  355. }
  356. type getSignKeyResponse struct {
  357. ReturnCode string `xml:"return_code,omitempty" json:"return_code,omitempty"`
  358. ReturnMsg string `xml:"return_msg,omitempty" json:"return_msg,omitempty"`
  359. MchId string `xml:"mch_id,omitempty" json:"mch_id,omitempty"`
  360. SandboxSignkey string `xml:"sandbox_signkey,omitempty" json:"sandbox_signkey,omitempty"`
  361. }
  362. type RefundNotifyRequest struct {
  363. ReturnCode string `xml:"return_code,omitempty" json:"return_code,omitempty"`
  364. ReturnMsg string `xml:"return_msg,omitempty" json:"return_msg,omitempty"`
  365. Appid string `xml:"appid,omitempty" json:"appid,omitempty"`
  366. MchId string `xml:"mch_id,omitempty" json:"mch_id,omitempty"`
  367. NonceStr string `xml:"nonce_str,omitempty" json:"nonce_str,omitempty"`
  368. ReqInfo string `xml:"req_info,omitempty" json:"req_info,omitempty"`
  369. }
  370. type RefundNotify struct {
  371. TransactionId string `xml:"transaction_id,omitempty" json:"transaction_id,omitempty"`
  372. OutTradeNo string `xml:"out_trade_no,omitempty" json:"out_trade_no,omitempty"`
  373. RefundId string `xml:"refund_id,omitempty" json:"refund_id,omitempty"`
  374. OutRefundNo string `xml:"out_refund_no,omitempty" json:"out_refund_no,omitempty"`
  375. TotalFee string `xml:"total_fee,omitempty" json:"total_fee,omitempty"`
  376. SettlementTotalFee string `xml:"settlement_total_fee,omitempty" json:"settlement_total_fee,omitempty"`
  377. RefundFee string `xml:"refund_fee,omitempty" json:"refund_fee,omitempty"`
  378. SettlementRefundFee string `xml:"settlement_refund_fee,omitempty" json:"settlement_refund_fee,omitempty"`
  379. RefundStatus string `xml:"refund_status,omitempty" json:"refund_status,omitempty"`
  380. SuccessTime string `xml:"success_time,omitempty" json:"success_time,omitempty"`
  381. RefundRecvAccout string `xml:"refund_recv_accout,omitempty" json:"refund_recv_accout,omitempty"`
  382. RefundAccount string `xml:"refund_account,omitempty" json:"refund_account,omitempty"`
  383. RefundRequestSource string `xml:"refund_request_source,omitempty" json:"refund_request_source,omitempty"`
  384. }
  385. type Code2SessionRsp struct {
  386. SessionKey string `json:"session_key,omitempty"` // 会话密钥
  387. Openid string `json:"openid,omitempty"` // 用户唯一标识
  388. Unionid string `json:"unionid,omitempty"` // 用户在开放平台的唯一标识符
  389. Errcode int `json:"errcode,omitempty"` // 错误码
  390. Errmsg string `json:"errmsg,omitempty"` // 错误信息
  391. }
  392. type PaidUnionId struct {
  393. Unionid string `json:"unionid,omitempty"` // 用户在开放平台的唯一标识符
  394. Errcode int `json:"errcode,omitempty"` // 错误码
  395. Errmsg string `json:"errmsg,omitempty"` // 错误信息
  396. }
  397. type AccessToken struct {
  398. AccessToken string `json:"access_token,omitempty"` // 获取到的凭证
  399. ExpiresIn int `json:"expires_in,omitempty"` // SessionKey超时时间(秒)
  400. Errcode int `json:"errcode,omitempty"` // 错误码
  401. Errmsg string `json:"errmsg,omitempty"` // 错误信息
  402. }
  403. type UserInfo struct {
  404. Subscribe int `json:"subscribe,omitempty"` // 用户是否订阅该公众号标识,值为0时,代表此用户没有关注该公众号,拉取不到其余信息。
  405. Openid string `json:"openid,omitempty"` // 用户唯一标识
  406. Nickname string `json:"nickname,omitempty"` // 用户的昵称
  407. Sex int `json:"sex,omitempty"` // 用户的性别,值为1时是男性,值为2时是女性,值为0时是未知
  408. Language string `json:"language,omitempty"` // 用户的语言,简体中文为zh_CN
  409. City string `json:"city,omitempty"` // 用户所在城市
  410. Province string `json:"province,omitempty"` // 用户所在省份
  411. Country string `json:"country,omitempty"` // 用户所在国家
  412. Headimgurl string `json:"headimgurl,omitempty"` // 用户头像,最后一个数值代表正方形头像大小(有0、46、64、96、132数值可选,0代表640*640正方形头像),用户没有头像时该项为空。若用户更换头像,原有头像URL将失效。
  413. SubscribeTime int `json:"subscribe_time,omitempty"` // 用户关注时间,为时间戳。如果用户曾多次关注,则取最后关注时间
  414. Unionid string `json:"unionid,omitempty"` // 只有在用户将公众号绑定到微信开放平台帐号后,才会出现该字段。
  415. Remark string `json:"remark,omitempty"` // 公众号运营者对粉丝的备注,公众号运营者可在微信公众平台用户管理界面对粉丝添加备注
  416. Groupid int `json:"groupid,omitempty"` // 用户所在的分组ID(兼容旧的用户分组接口)
  417. TagidList []int `json:"tagid_list,omitempty"` // 用户被打上的标签ID列表
  418. SubscribeScene string `json:"subscribe_scene,omitempty"` // 返回用户关注的渠道来源,ADD_SCENE_SEARCH 公众号搜索,ADD_SCENE_ACCOUNT_MIGRATION 公众号迁移,ADD_SCENE_PROFILE_CARD 名片分享,ADD_SCENE_QR_CODE 扫描二维码,ADD_SCENEPROFILE LINK 图文页内名称点击,ADD_SCENE_PROFILE_ITEM 图文页右上角菜单,ADD_SCENE_PAID 支付后关注,ADD_SCENE_OTHERS 其他
  419. QrScene int `json:"qr_scene,omitempty"` // 二维码扫码场景(开发者自定义)
  420. Errcode int `json:"errcode,omitempty"` // 错误码
  421. Errmsg string `json:"errmsg,omitempty"` // 错误信息
  422. }
  423. // 微信小程序解密后 用户手机号结构体
  424. type UserPhone struct {
  425. PhoneNumber string `json:"phoneNumber,omitempty"`
  426. PurePhoneNumber string `json:"purePhoneNumber,omitempty"`
  427. CountryCode string `json:"countryCode,omitempty"`
  428. Watermark *watermarkInfo `json:"watermark,omitempty"`
  429. }
  430. // 微信小程序解密后 用户信息结构体
  431. type AppletUserInfo struct {
  432. OpenId string `json:"openId,omitempty"`
  433. NickName string `json:"nickName,omitempty"`
  434. Gender int `json:"gender,omitempty"`
  435. City string `json:"city,omitempty"`
  436. Province string `json:"province,omitempty"`
  437. Country string `json:"country,omitempty"`
  438. AvatarUrl string `json:"avatarUrl,omitempty"`
  439. UnionId string `json:"unionId,omitempty"`
  440. Watermark *watermarkInfo `json:"watermark,omitempty"`
  441. }
  442. type watermarkInfo struct {
  443. Appid string `json:"appid,omitempty"`
  444. Timestamp int `json:"timestamp,omitempty"`
  445. }
  446. // 授权码查询openid 返回
  447. type OpenIdByAuthCodeRsp struct {
  448. ReturnCode string `xml:"return_code,omitempty" json:"return_code,omitempty"`
  449. ReturnMsg string `xml:"return_msg,omitempty" json:"return_msg,omitempty"`
  450. Appid string `xml:"appid,omitempty" json:"appid,omitempty"`
  451. MchId string `xml:"mch_id,omitempty" json:"mch_id,omitempty"`
  452. NonceStr string `xml:"nonce_str,omitempty" json:"nonce_str,omitempty"`
  453. Sign string `xml:"sign,omitempty" json:"sign,omitempty"`
  454. ResultCode string `xml:"result_code,omitempty" json:"result_code,omitempty"`
  455. ErrCode string `xml:"err_code,omitempty" json:"err_code,omitempty"`
  456. Openid string `xml:"openid,omitempty" json:"openid,omitempty"` // 用户唯一标识
  457. }
  458. // App应用微信第三方登录,code换取access_token
  459. type AppLoginAccessToken struct {
  460. AccessToken string `json:"access_token,omitempty"`
  461. ExpiresIn int `json:"expires_in,omitempty"`
  462. RefreshToken string `json:"refresh_token,omitempty"`
  463. Openid string `json:"openid,omitempty"`
  464. Scope string `json:"scope,omitempty"`
  465. Unionid string `json:"unionid,omitempty"`
  466. Errcode int `json:"errcode,omitempty"` // 错误码
  467. Errmsg string `json:"errmsg,omitempty"` // 错误信息
  468. }
  469. // 刷新App应用微信第三方登录后,获取的 access_token
  470. type RefreshAppLoginAccessTokenRsp struct {
  471. AccessToken string `json:"access_token,omitempty"`
  472. ExpiresIn int `json:"expires_in,omitempty"`
  473. RefreshToken string `json:"refresh_token,omitempty"`
  474. Openid string `json:"openid,omitempty"`
  475. Scope string `json:"scope,omitempty"`
  476. Errcode int `json:"errcode,omitempty"` // 错误码
  477. Errmsg string `json:"errmsg,omitempty"` // 错误信息
  478. }