package pay_service import ( "fmt" "hudongzhuanjia/utils/define" ) var ( WxCertPath = `./cacert/apiclient_cert.pem` WxKeyPath = `./cacert/apiclient_key.pem` WxCaPath = `./cacert/rootca.pem` Appid = "wx7b0bcf476552c5e9" Secret = "f6aabdd40ea25272f4442603a7dc8028" Mchid = `1394404502` ApiKey = `2c82c64ceec6ba89ffc9f593c671a12f` mainHost = `https://api.mch.weixin.qq.com` backHost = `https://api2.mch.weixin.qq.com` ) var ( NotifyURL = fmt.Sprintf("%s/wechat/callback", define.HOST) // 微信回调通知 UnifiedOrderURL = fmt.Sprintf("%s/pay/unifiedorder", mainHost) // 统一下单url QueryOrderURL = fmt.Sprintf("%s/pay/orderquery", mainHost) // 微信查询订单 CloseOrderURL = fmt.Sprintf("%s/pay/closeorder", mainHost) // 微信关闭订单 RefundURL = fmt.Sprintf("%s/secapi/pay/refund", mainHost) // 微信退款 RefundQueryURL = fmt.Sprintf("%s/pay/refundquery", mainHost) // 微信查询退款 DownloadBillURL = fmt.Sprintf("%s/pay/downloadbill", mainHost) // 微信下载账单 DownloadFundFlowURL = fmt.Sprintf("%s/pay/downloadfundflow", mainHost) TransfersURL = fmt.Sprintf("%s/mmpaymkttransfers/promotion/transfers", mainHost) SendRedPackURL = fmt.Sprintf("%s/mmpaymkttransfers/sendredpack", mainHost) QueryRedPackURL = fmt.Sprintf("%s/mmpaymkttransfers/gethbinfo", mainHost) ) const ( CODE_SUCCESS = "SUCCESS" // 成功 CODE_FAIL = "FAIL" // 失败 CODE_NOTPAY = "NOTPAY" // 未支付 CODE_CHANGE = "CHANGE" // 退款异常 CODE_REFUNDCLOSE = "REFUNDCLOSE" // 退款关闭 CODE_ERROR = "ERROR" // 业务错误 CODE_INVALID_REQUEST = "INVALID_REQUEST" // 无效请求 CODE_NOAUTH = "NOAUTH" // 异常IP请求不予受理 CODE_NOTENOUGH = "NOTENOUGH" // 余额不足 CODE_ORDERPAID = "ORDERPAID" // 订单已支付 CODE_ORDERCLOSED = "ORDERCLOSED" // 订单已关闭 CODE_SYSTEMERROR = "SYSTEMERROR" // 系统错误 CODE_APPID_NOT_EXIST = "APPID_NOT_EXIST" // APPID不存在 CODE_MCHID_NOT_EXIST = "MCHID_NOT_EXIST" // MCHID不存在 CODE_APPID_MCHID_NOT_MATCH = "APPID_MCHID_NOT_MATCH" // APPID MCHID 不匹配 CODE_LACK_PARAMS = "LACK_PARAMS" // 缺少参数 CODE_OUT_TRADE_NO_USED = "OUT_TRADE_NO_USED" // 商户订单号重复 CODE_SIGNERROR = "SIGNERROR" // 签名错误 CODE_XML_FORMAT_ERROR = "XML_FORMAT_ERROR" // xml格式错误 CODE_REQUIRE_POST_METHOD = "REQUIRE_POST_METHOD" // 请使用post请求方法 CODE_POST_DATA_EMPTY = "POST_DATA_EMPTY" // post数据为空 CODE_NOT_UTF8 = "NOT_UTF8" // 编码错误 CODE_ORDERNOTEXIST = "ORDERNOTEXIST" // 交易订单号不存在 CODE_BIZERR_NEED_RETRY = "BIZERR_NEED_RETRY" // 退款业务流程错误,需要商户触发重试来解决 CODE_TRADE_OVERDUE = "TRADE_OVERDUE" // 订单已经超过退款期限 CODE_USER_ACCOUNT_ABNORMAL = "USER_ACCOUNT_ABNORMAL" // 退款请求失败用户帐号注销 CODE_INVALID_REQ_TOO_MUCH = "INVALID_REQ_TOO_MUCH" // 无效请求过多 CODE_INVALID_TRANSACTIONID = "INVALID_TRANSACTIONID" // 无效transaction_id CODE_PARAM_ERROR = "PARAM_ERROR" // 参数错误 CODE_FREQUENCY_LIMITED = "FREQUENCY_LIMITED" // 请求频率限制 CODE_TRADE_SUCCESS = "SUCCESS" // 交易成功 CODE_TRADE_REFUND = "REFUND" // 转入退款 CODE_TRADE_NOTPAY = "NOTPAY" // 尚未支付 CODE_TRADE_CLOSED = "CLOSED" // 已关闭 CODE_TRADE_REVOKED = "REVOKED" // 已撤销 CODE_TRADE_USERPAYING = "USERPAYING" // 用户支付中 CODE_TRADE_PAYERROR = "PAYERROR" // 支付失败 CODE_TRANSFER_PROCESSING = "PROCESSING" // 转账处理中 CODE_TRANSFER_NOT_FOUND = "NOT_FOUND" // 账单消息 ) type CommonReturn struct { ReturnCode string `xml:"return_code,omitempty" json:"return_code,omitempty"` ReturnMsg string `xml:"return_msg,omitempty" json:"return_msg,omitempty"` } type CommonResult struct { ResultCode string `xml:"result_code,omitempty" json:"result_code,omitempty"` ResultMsg string `xml:"result_msg,omitempty" json:"result_msg,omitempty"` ErrCode string `xml:"err_code,omitempty" json:"err_code,omitempty"` ErrCodeDes string `xml:"err_code_des,omitempty" json:"err_code_des,omitempty"` }