Documentation ¶
Index ¶
- Constants
- func ParseNotifyResultToBodyMap(req *http.Request) (bm gopay.BodyMap, err error)
- func VerifySign(apiKey, signType string, bean interface{}) (ok bool, err error)
- type Client
- func (q *Client) AccRoll(bm gopay.BodyMap) (qqRsp string, err error)
- func (q *Client) AddCertFilePath(certFilePath, keyFilePath, pkcs12FilePath string) (err error)
- func (q *Client) CloseOrder(bm gopay.BodyMap) (qqRsp *CloseOrderResponse, err error)
- func (q *Client) MicroPay(bm gopay.BodyMap) (qqRsp *MicroPayResponse, err error)
- func (q *Client) OrderQuery(bm gopay.BodyMap) (qqRsp *OrderQueryResponse, err error)
- func (q *Client) Refund(bm gopay.BodyMap, certFilePath, keyFilePath, pkcs12FilePath string) (qqRsp *RefundResponse, err error)
- func (q *Client) RefundQuery(bm gopay.BodyMap) (qqRsp *RefundQueryResponse, err error)
- func (q *Client) Reverse(bm gopay.BodyMap) (qqRsp *ReverseResponse, err error)
- func (q *Client) StatementDown(bm gopay.BodyMap) (qqRsp string, err error)
- func (q *Client) UnifiedOrder(bm gopay.BodyMap) (qqRsp *UnifiedOrderResponse, err error)
- type CloseOrderResponse
- type MicroPayResponse
- type NotifyRequest
- type NotifyResponse
- type OrderQueryResponse
- type RefundQueryResponse
- type RefundResponse
- type ReverseResponse
- type UnifiedOrderResponse
Constants ¶
View Source
const ( // 支付类型 TradeType_MicroPay = "MICROPAY" // 提交付款码支付 TradeType_JsApi = "JSAPI" // 公众号支付 TradeType_Native = "NATIVE" // 原生扫码支付 TradeType_App = "APP" // APP支付 TradeType_Mini = "MINIAPP" // QQ小程序支付 // 签名方式 SignType_MD5 = "MD5" SignType_HMAC_SHA256 = "HMAC-SHA256" )
Variables ¶
This section is empty.
Functions ¶
func ParseNotifyResultToBodyMap ¶
解析QQ支付异步通知的结果到BodyMap
req:*http.Request 返回参数bm:Notify请求的参数 返回参数err:错误信息
func VerifySign ¶ added in v2.0.3
QQ同步返回参数验签或异步通知参数验签
ApiKey:API秘钥值 signType:签名类型(调用API方法时填写的类型) bean:微信同步返回的结构体 qqRsp 或 异步通知解析的结构体 notifyReq 返回参数ok:是否验签通过 返回参数err:错误信息
Types ¶
type Client ¶
type Client struct { MchId string ApiKey string IsProd bool // contains filtered or unexported fields }
func (*Client) AddCertFilePath ¶
添加QQ证书 Path 路径
certFilePath:apiclient_cert.pem 路径 keyFilePath:apiclient_key.pem 路径 pkcs12FilePath:apiclient_cert.p12 路径 返回err
func (*Client) CloseOrder ¶
func (q *Client) CloseOrder(bm gopay.BodyMap) (qqRsp *CloseOrderResponse, err error)
关闭订单
文档地址:https://qpay.qq.com/buss/wiki/38/1206
func (*Client) MicroPay ¶
func (q *Client) MicroPay(bm gopay.BodyMap) (qqRsp *MicroPayResponse, err error)
提交付款码支付
文档地址:https://qpay.qq.com/buss/wiki/1/1122
func (*Client) OrderQuery ¶
func (q *Client) OrderQuery(bm gopay.BodyMap) (qqRsp *OrderQueryResponse, err error)
订单查询
文档地址:https://qpay.qq.com/buss/wiki/38/1205
func (*Client) Refund ¶
func (q *Client) Refund(bm gopay.BodyMap, certFilePath, keyFilePath, pkcs12FilePath string) (qqRsp *RefundResponse, err error)
申请退款
注意:如已使用client.AddCertFilePath()添加过证书,参数certFilePath、keyFilePath、pkcs12FilePath全传空字符串 "",否则,3证书Path均不可空 文档地址:https://qpay.qq.com/buss/wiki/38/1207
func (*Client) RefundQuery ¶
func (q *Client) RefundQuery(bm gopay.BodyMap) (qqRsp *RefundQueryResponse, err error)
退款查询
文档地址:https://qpay.qq.com/buss/wiki/38/1208
func (*Client) Reverse ¶
func (q *Client) Reverse(bm gopay.BodyMap) (qqRsp *ReverseResponse, err error)
撤销订单
文档地址:https://qpay.qq.com/buss/wiki/1/1125
func (*Client) UnifiedOrder ¶
func (q *Client) UnifiedOrder(bm gopay.BodyMap) (qqRsp *UnifiedOrderResponse, err error)
统一下单
文档地址:https://qpay.qq.com/buss/wiki/38/1203
type CloseOrderResponse ¶
type CloseOrderResponse struct { ReturnCode string `xml:"return_code,omitempty" json:"return_code,omitempty"` ReturnMsg string `xml:"return_msg,omitempty" json:"return_msg,omitempty"` RetCode string `xml:"retcode,omitempty" json:"retcode,omitempty"` RetMsg string `xml:"retmsg,omitempty" json:"retmsg,omitempty"` Appid string `xml:"appid,omitempty" json:"appid,omitempty"` MchId string `xml:"mch_id,omitempty" json:"mch_id,omitempty"` Sign string `xml:"sign,omitempty" json:"sign,omitempty"` ResultCode string `xml:"result_code,omitempty" json:"result_code,omitempty"` ErrCode string `xml:"err_code,omitempty" json:"err_code,omitempty"` ErrCodeDes string `xml:"err_code_des,omitempty" json:"err_code_des,omitempty"` NonceStr string `xml:"nonce_str,omitempty" json:"nonce_str,omitempty"` }
type MicroPayResponse ¶
type MicroPayResponse struct { ReturnCode string `xml:"return_code,omitempty" json:"return_code,omitempty"` ReturnMsg string `xml:"return_msg,omitempty" json:"return_msg,omitempty"` RetCode string `xml:"retcode,omitempty" json:"retcode,omitempty"` RetMsg string `xml:"retmsg,omitempty" json:"retmsg,omitempty"` Appid string `xml:"appid,omitempty" json:"appid,omitempty"` MchId string `xml:"mch_id,omitempty" json:"mch_id,omitempty"` Sign string `xml:"sign,omitempty" json:"sign,omitempty"` ResultCode string `xml:"result_code,omitempty" json:"result_code,omitempty"` ErrCode string `xml:"err_code,omitempty" json:"err_code,omitempty"` ErrCodeDes string `xml:"err_code_des,omitempty" json:"err_code_des,omitempty"` NonceStr string `xml:"nonce_str,omitempty" json:"nonce_str,omitempty"` DeviceInfo string `xml:"device_info,omitempty" json:"device_info,omitempty"` TradeType string `xml:"trade_type,omitempty" json:"trade_type,omitempty"` TradeState string `xml:"trade_state,omitempty" json:"trade_state,omitempty"` BankType string `xml:"bank_type,omitempty" json:"bank_type,omitempty"` FeeType string `xml:"fee_type,omitempty" json:"fee_type,omitempty"` TotalFee int `xml:"total_fee,omitempty" json:"total_fee,omitempty"` CashFee int `xml:"cash_fee,omitempty" json:"cash_fee,omitempty"` CouponFee int `xml:"coupon_fee,omitempty" json:"coupon_fee,omitempty"` CouponFee0 int `xml:"coupon_fee_0,omitempty" json:"coupon_fee_0,omitempty"` CouponFee1 int `xml:"coupon_fee_1,omitempty" json:"coupon_fee_1,omitempty"` TransactionId string `xml:"transaction_id,omitempty" json:"transaction_id,omitempty"` OutTradeNo string `xml:"out_trade_no,omitempty" json:"out_trade_no,omitempty"` Attach string `xml:"attach,omitempty" json:"attach,omitempty"` TimeEnd string `xml:"time_end,omitempty" json:"time_end,omitempty"` TradeStateDesc string `xml:"trade_state_desc,omitempty" json:"trade_state_desc,omitempty"` Openid string `xml:"openid,omitempty" json:"openid,omitempty"` }
type NotifyRequest ¶
type NotifyRequest struct { Appid string `xml:"appid,omitempty" json:"appid,omitempty"` MchId string `xml:"mch_id,omitempty" json:"mch_id,omitempty"` NonceStr string `xml:"nonce_str,omitempty" json:"nonce_str,omitempty"` Sign string `xml:"sign,omitempty" json:"sign,omitempty"` DeviceInfo string `xml:"device_info,omitempty" json:"device_info,omitempty"` TradeType string `xml:"trade_type,omitempty" json:"trade_type,omitempty"` TradeState string `xml:"trade_state,omitempty" json:"trade_state,omitempty"` BankType string `xml:"bank_type,omitempty" json:"bank_type,omitempty"` FeeType string `xml:"fee_type,omitempty" json:"fee_type,omitempty"` TotalFee int `xml:"total_fee,omitempty" json:"total_fee,omitempty"` CashFee int `xml:"cash_fee,omitempty" json:"cash_fee,omitempty"` CouponFee int `xml:"coupon_fee,omitempty" json:"coupon_fee,omitempty"` TransactionId string `xml:"transaction_id,omitempty" json:"transaction_id,omitempty"` OutTradeNo string `xml:"out_trade_no,omitempty" json:"out_trade_no,omitempty"` Attach string `xml:"attach,omitempty" json:"attach,omitempty"` TimeEnd string `xml:"time_end,omitempty" json:"time_end,omitempty"` Openid string `xml:"openid,omitempty" json:"openid,omitempty"` }
func ParseNotifyResult ¶
func ParseNotifyResult(req *http.Request) (notifyReq *NotifyRequest, err error)
解析QQ支付异步通知的参数
req:*http.Request 返回参数notifyReq:Notify请求的参数 返回参数err:错误信息
type NotifyResponse ¶ added in v2.0.3
type NotifyResponse struct { ReturnCode string `xml:"return_code"` ReturnMsg string `xml:"return_msg"` }
func (*NotifyResponse) ToXmlString ¶ added in v2.0.3
func (w *NotifyResponse) ToXmlString() (xmlStr string)
返回数据给QQ
type OrderQueryResponse ¶
type OrderQueryResponse struct { ReturnCode string `xml:"return_code,omitempty" json:"return_code,omitempty"` ReturnMsg string `xml:"return_msg,omitempty" json:"return_msg,omitempty"` RetCode string `xml:"retcode,omitempty" json:"retcode,omitempty"` RetMsg string `xml:"retmsg,omitempty" json:"retmsg,omitempty"` Appid string `xml:"appid,omitempty" json:"appid,omitempty"` MchId string `xml:"mch_id,omitempty" json:"mch_id,omitempty"` Sign string `xml:"sign,omitempty" json:"sign,omitempty"` ResultCode string `xml:"result_code,omitempty" json:"result_code,omitempty"` ErrCode string `xml:"err_code,omitempty" json:"err_code,omitempty"` ErrCodeDes string `xml:"err_code_des,omitempty" json:"err_code_des,omitempty"` NonceStr string `xml:"nonce_str,omitempty" json:"nonce_str,omitempty"` DeviceInfo string `xml:"device_info,omitempty" json:"device_info,omitempty"` TradeType string `xml:"trade_type,omitempty" json:"trade_type,omitempty"` TradeState string `xml:"trade_state,omitempty" json:"trade_state,omitempty"` BankType string `xml:"bank_type,omitempty" json:"bank_type,omitempty"` FeeType string `xml:"fee_type,omitempty" json:"fee_type,omitempty"` TotalFee int `xml:"total_fee,omitempty" json:"total_fee,omitempty"` CashFee int `xml:"cash_fee,omitempty" json:"cash_fee,omitempty"` CouponFee int `xml:"coupon_fee,omitempty" json:"coupon_fee,omitempty"` TransactionId string `xml:"transaction_id,omitempty" json:"transaction_id,omitempty"` OutTradeNo string `xml:"out_trade_no,omitempty" json:"out_trade_no,omitempty"` Attach string `xml:"attach,omitempty" json:"attach,omitempty"` TimeEnd string `xml:"time_end,omitempty" json:"time_end,omitempty"` TradeStateDesc string `xml:"trade_state_desc,omitempty" json:"trade_state_desc,omitempty"` Openid string `xml:"openid,omitempty" json:"openid,omitempty"` }
type RefundQueryResponse ¶
type RefundQueryResponse struct { ReturnCode string `xml:"return_code,omitempty" json:"return_code,omitempty"` ReturnMsg string `xml:"return_msg,omitempty" json:"return_msg,omitempty"` RetCode string `xml:"retcode,omitempty" json:"retcode,omitempty"` RetMsg string `xml:"retmsg,omitempty" json:"retmsg,omitempty"` Appid string `xml:"appid,omitempty" json:"appid,omitempty"` MchId string `xml:"mch_id,omitempty" json:"mch_id,omitempty"` Sign string `xml:"sign,omitempty" json:"sign,omitempty"` ResultCode string `xml:"result_code,omitempty" json:"result_code,omitempty"` ErrCode string `xml:"err_code,omitempty" json:"err_code,omitempty"` ErrCodeDes string `xml:"err_code_des,omitempty" json:"err_code_des,omitempty"` NonceStr string `xml:"nonce_str,omitempty" json:"nonce_str,omitempty"` TransactionId string `xml:"transaction_id,omitempty" json:"transaction_id,omitempty"` OutTradeNo string `xml:"out_trade_no,omitempty" json:"out_trade_no,omitempty"` TotalFee int `xml:"total_fee,omitempty" json:"total_fee,omitempty"` CashFee int `xml:"cash_fee,omitempty" json:"cash_fee,omitempty"` FeeType string `xml:"fee_type,omitempty" json:"fee_type,omitempty"` OutRefundNo0 string `xml:"out_refund_no_0,omitempty" json:"out_refund_no_0,omitempty"` OutRefundNo1 string `xml:"out_refund_no_1,omitempty" json:"out_refund_no_1,omitempty"` RefundId0 string `xml:"refund_id_0,omitempty" json:"refund_id_0,omitempty"` RefundId1 string `xml:"refund_id_1,omitempty" json:"refund_id_1,omitempty"` RefundChannel0 string `xml:"refund_channel_0,omitempty" json:"refund_channel_0,omitempty"` RefundChannel1 string `xml:"refund_channel_1,omitempty" json:"refund_channel_1,omitempty"` RefundFee0 int `xml:"refund_fee_0,omitempty" json:"refund_fee_0,omitempty"` RefundFee1 int `xml:"refund_fee_1,omitempty" json:"refund_fee_1,omitempty"` CouponRefundFee0 int `xml:"coupon_refund_fee_0,omitempty" json:"coupon_refund_fee_0,omitempty"` CouponRefundFee1 int `xml:"coupon_refund_fee_1,omitempty" json:"coupon_refund_fee_1,omitempty"` CashRefundFee0 int `xml:"cash_refund_fee_0,omitempty" json:"cash_refund_fee_0,omitempty"` CashRefundFee1 int `xml:"cash_refund_fee_1,omitempty" json:"cash_refund_fee_1,omitempty"` RefundStatus0 string `xml:"refund_status_0,omitempty" json:"refund_status_0,omitempty"` RefundStatus1 string `xml:"refund_status_1,omitempty" json:"refund_status_1,omitempty"` RefundRecvAccout0 string `xml:"refund_recv_accout_0,omitempty" json:"refund_recv_accout_0,omitempty"` RefundRecvAccout1 string `xml:"refund_recv_accout_1,omitempty" json:"refund_recv_accout_1,omitempty"` }
type RefundResponse ¶
type RefundResponse struct { ReturnCode string `xml:"return_code,omitempty" json:"return_code,omitempty"` ReturnMsg string `xml:"return_msg,omitempty" json:"return_msg,omitempty"` RetCode string `xml:"retcode,omitempty" json:"retcode,omitempty"` RetMsg string `xml:"retmsg,omitempty" json:"retmsg,omitempty"` Appid string `xml:"appid,omitempty" json:"appid,omitempty"` MchId string `xml:"mch_id,omitempty" json:"mch_id,omitempty"` Sign string `xml:"sign,omitempty" json:"sign,omitempty"` ResultCode string `xml:"result_code,omitempty" json:"result_code,omitempty"` ErrCode string `xml:"err_code,omitempty" json:"err_code,omitempty"` ErrCodeDes string `xml:"err_code_des,omitempty" json:"err_code_des,omitempty"` NonceStr string `xml:"nonce_str,omitempty" json:"nonce_str,omitempty"` TransactionId string `xml:"transaction_id,omitempty" json:"transaction_id,omitempty"` OutTradeNo string `xml:"out_trade_no,omitempty" json:"out_trade_no,omitempty"` TotalFee int `xml:"total_fee,omitempty" json:"total_fee,omitempty"` OutRefundNo string `xml:"out_refund_no,omitempty" json:"out_refund_no,omitempty"` RefundId string `xml:"refund_id,omitempty" json:"refund_id,omitempty"` RefundChannel string `xml:"refund_channel,omitempty" json:"refund_channel,omitempty"` RefundFee int `xml:"refund_fee,omitempty" json:"refund_fee,omitempty"` }
type ReverseResponse ¶
type ReverseResponse struct { ReturnCode string `xml:"return_code,omitempty" json:"return_code,omitempty"` ReturnMsg string `xml:"return_msg,omitempty" json:"return_msg,omitempty"` RetCode string `xml:"retcode,omitempty" json:"retcode,omitempty"` RetMsg string `xml:"retmsg,omitempty" json:"retmsg,omitempty"` Appid string `xml:"appid,omitempty" json:"appid,omitempty"` SubAppid string `xml:"sub_appid,omitempty" json:"sub_appid,omitempty"` MchId string `xml:"mch_id,omitempty" json:"mch_id,omitempty"` SubMchId string `xml:"sub_mch_id,omitempty" json:"sub_mch_id,omitempty"` Sign string `xml:"sign,omitempty" json:"sign,omitempty"` ResultCode string `xml:"result_code,omitempty" json:"result_code,omitempty"` ErrCode string `xml:"err_code,omitempty" json:"err_code,omitempty"` ErrCodeDes string `xml:"err_code_des,omitempty" json:"err_code_des,omitempty"` NonceStr string `xml:"nonce_str,omitempty" json:"nonce_str,omitempty"` Recall string `json:"recall,omitempty"` }
type UnifiedOrderResponse ¶
type UnifiedOrderResponse struct { ReturnCode string `xml:"return_code,omitempty" json:"return_code,omitempty"` ReturnMsg string `xml:"return_msg,omitempty" json:"return_msg,omitempty"` RetCode string `xml:"retcode,omitempty" json:"retcode,omitempty"` RetMsg string `xml:"retmsg,omitempty" json:"retmsg,omitempty"` Appid string `xml:"appid,omitempty" json:"appid,omitempty"` MchId string `xml:"mch_id,omitempty" json:"mch_id,omitempty"` Sign string `xml:"sign,omitempty" json:"sign,omitempty"` ResultCode string `xml:"result_code,omitempty" json:"result_code,omitempty"` ErrCode string `xml:"err_code,omitempty" json:"err_code,omitempty"` ErrCodeDes string `xml:"err_code_des,omitempty" json:"err_code_des,omitempty"` NonceStr string `xml:"nonce_str,omitempty" json:"nonce_str,omitempty"` TradeType string `xml:"trade_type,omitempty" json:"trade_type,omitempty"` PrepayId string `xml:"prepay_id,omitempty" json:"prepay_id,omitempty"` CodeUrl string `xml:"code_url,omitempty" json:"code_url,omitempty"` }
Click to show internal directories.
Click to hide internal directories.