wechat_model.go 30 KB

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