model.go 30 KB

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