Documentation
¶
Index ¶
- Constants
- type AsyncNotifyResult
- type Client
- func (c *Client) AnswerAsyncNotify(returnCode, returnMsg string) string
- func (c *Client) AsyncNotify(req *http.Request) (*AsyncNotifyResult, error)
- func (c *Client) GetSandBoxSignKey() (*GetSandBoxSignKeyRsp, error)
- func (c *Client) QueryOrder(transID string, tradeNo string) (*QueryOrderRsp, error)
- func (c *Client) QueryRefund(transID, tradeNo, refundNo, refundID string) (*QueryRefundRsp, error)
- func (c *Client) RefundOrder(transID, tradeNo, refundNo string, totalFee, refundFee int) (*RefundOrderRsp, error)
- func (c *Client) ToPayment(prePayID string) Payment
- func (c *Client) UnifiedOrder(totalFee int, desc, orderID, clientIP string, times ...time.Time) (*UnifiedOrderRsp, error)
- func (c *Client) WithCertificate(certF, keyF, rootCAF string) error
- type Config
- type GetSandBoxSignKeyRsp
- type Payment
- type QueryOrderRsp
- type QueryRefundRsp
- type RefundOrderRsp
- type UnifiedOrderRsp
Constants ¶
const (
Success = "SUCCESS"
)
constants for response.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AsyncNotifyResult ¶
type AsyncNotifyResult struct { ReturnCode string `xml:"return_code"` // 返回状态码 ReturnMsg string `xml:"return_msg"` // 返回信息 AppID string `xml:"appid"` // 应用ID MchID string `xml:"mch_id"` // 商户号 DeviceInfo string `xml:"device_info"` // 设备号 NonceStr string `xml:"nonce_str"` // 随机字符串 Sign string `xml:"sign"` // 签名 ResultCode string `xml:"result_code"` // 业务结果 ErrCode string `xml:"err_code"` // 错误代码 ErrCodeDesc string `xml:"err_code_des"` // 错误代码描述 OpenID string `xml:"openid"` // 用户标识 IsSubscribe string `xml:"is_subscribe"` // 是否关注公众账号 TradeType string `xml:"trade_type"` // 交易类型 BankType string `xml:"bank_type"` // 付款银行 TotalFee string `xml:"total_fee"` // 总金额 FeeType string `xml:"fee_type"` // 货币种类 CashFee string `xml:"cash_fee"` // 现金支付金额 CashFeeType string `xml:"cash_fee_type"` // 现金支付货币类型 CouponFee string `xml:"coupon_fee"` // 代金券或立减优惠金额 CouponCount string `xml:"coupon_count"` // 代金券或立减优惠使用数量 TransactionID string `xml:"transaction_id"` // 微信支付订单号 OutTradeNo string `xml:"out_trade_no"` // 商户订单号 Attach string `xml:"attach"` // 商家数据包 TimeEnd string `xml:"time_end"` // 支付完成时间 }
AsyncNotifyResult is the result return from Weixin.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client handles all transactions.
func (*Client) AnswerAsyncNotify ¶
AnswerAsyncNotify returns a xml in string answering Weixin asynchronous notification.
func (*Client) AsyncNotify ¶
func (c *Client) AsyncNotify(req *http.Request) (*AsyncNotifyResult, error)
AsyncNotify retrieves the asynchronous notification from Weixin.
func (*Client) GetSandBoxSignKey ¶
func (c *Client) GetSandBoxSignKey() (*GetSandBoxSignKeyRsp, error)
GetSandBoxSignKey gets sandox sign key from Weixin.
func (*Client) QueryOrder ¶
func (c *Client) QueryOrder(transID string, tradeNo string) (*QueryOrderRsp, error)
QueryOrder queries order info from Weixin.
func (*Client) QueryRefund ¶
func (c *Client) QueryRefund(transID, tradeNo, refundNo, refundID string) (*QueryRefundRsp, error)
func (*Client) RefundOrder ¶
func (c *Client) RefundOrder(transID, tradeNo, refundNo string, totalFee, refundFee int) (*RefundOrderRsp, error)
func (*Client) UnifiedOrder ¶
func (c *Client) UnifiedOrder(totalFee int, desc, orderID, clientIP string, times ...time.Time) (*UnifiedOrderRsp, error)
UnifiedOrder creates new order from Weixin.
func (*Client) WithCertificate ¶
WithCertificate configures a *Client with certificates.
type Config ¶
type Config struct { AppID string AppKey string MchID string NotifyURL string TradeType string SandBox bool }
Config contains all configuration info.
type GetSandBoxSignKeyRsp ¶
type GetSandBoxSignKeyRsp struct { ReturnCode string `xml:"return_code"` ReturnMsg string `xml:"return_msg"` MchID string `xml:"mch_id"` SandBoxSignKey string `xml:"sandbox_signkey"` }
GetSandBoxSignKeyRsp is the response returned by
type Payment ¶
type Payment struct { AppID string PartnerID string PrepayID string NonceStr string Timestamp string Package string Sign string }
Payment returns to App.
type QueryOrderRsp ¶
type QueryOrderRsp struct { XMLName xml.Name `xml:"xml"` ReturnCode string `xml:"return_code"` // 返回状态码 ReturnMsg string `xml:"return_msg"` // 返回信息 AppID string `xml:"appid"` // 应用APPID MchID string `xml:"mch_id"` // 商户号 NonceStr string `xml:"nonce_str"` // 随机字符串 Sign string `xml:"sign"` // 签名 ResultCode string `xml:"result_code"` // 业务结果 ErrCode string `xml:"err_code"` // 错误代码 ErrCodeDesc string `xml:"err_code_des"` // 错误代码描述 DeviceInfo string `xml:"device_info"` // 设备号 OpenID string `xml:"openid"` // 用户标识 IsSubscribe string `xml:"is_subscribe"` // 是否关注公众账号 TradeType string `xml:"trade_type"` // 交易类型 TradeState string `xml:"trade_state"` // 交易状态 BankType string `xml:"bank_type"` // 付款银行 TotalFee string `xml:"total_fee"` // 总金额 FeeType string `xml:"fee_type"` // 货币种类 CashFee string `xml:"cash_fee"` // 现金支付金额 CashFeeType string `xml:"cash_fee_type"` // 现金支付货币类型 CouponFee string `xml:"coupon_fee"` // 代金券或立减优惠金额 CouponCount string `xml:"coupon_count"` // 代金券或立减优惠使用数量 TransactionID string `xml:"transaction_id"` // 微信支付订单号 OutTradeNo string `xml:"out_trade_no"` // 商户订单号 Attach string `xml:"attach"` // 附加数据 TimeEnd string `xml:"time_end"` // 支付完成时间 TradeStateDesc string `xml:"trade_state_desc"` // 交易状态描述 }
QueryOrderRsp is the response returned by /pay/orderquery
type QueryRefundRsp ¶
type QueryRefundRsp struct { XMLName xml.Name `xml:"xml"` ReturnCode string `xml:"return_code"` // 返回状态码 ReturnMsg string `xml:"return_msg"` // 返回信息 ResultCode string `xml:"result_code"` // 业务结果 ErrCode string `xml:"err_code"` // 错误代码 ErrCodeDesc string `xml:"err_code_des"` // 错误代码描述 AppID string `xml:"appid"` // 应用APPID MchID string `xml:"mch_id"` // 商户号 NonceStr string `xml:"nonce_str"` // 随机字符串 TransactionID string `xml:"transaction_id"` // 微信订单号 OutTradeNo string `xml:"out_trade_no"` // 商户订单号 TotalFee string `xml:"total_fee"` // 标价金额 CashFee string `xml:"cash_fee"` // 现金支付金额 RefundCount string `xml:"refund_count"` // 退款笔数 }
type RefundOrderRsp ¶
type RefundOrderRsp struct { XMLName xml.Name `xml:"xml"` ReturnCode string `xml:"return_code"` // 返回状态码 ReturnMsg string `xml:"return_msg"` // 返回信息 ResultCode string `xml:"result_code"` // 业务结果 ErrCode string `xml:"err_code"` // 错误代码 ErrCodeDesc string `xml:"err_code_des"` // 错误代码描述 AppID string `xml:"appid"` // 应用APPID MchID string `xml:"mch_id"` // 商户号 NonceStr string `xml:"nonce_str"` // 随机字符串 TransactionID string `xml:"transaction_id"` // 微信订单号 OutTradeNo string `xml:"out_trade_no"` // 商户订单号 OutRefundNo string `xml:"out_refund_no"` // 商户退款单号 RefundID string `xml:"refund_id"` // 微信退款单号 RefundFee string `xml:"refund_fee"` // 退款金额 TotalFee string `xml:"total_fee"` // 标价金额 CashFee string `xml:"cash_fee"` // 现金支付金额 }
type UnifiedOrderRsp ¶
type UnifiedOrderRsp struct { XMLName xml.Name `xml:"xml"` ReturnCode string `xml:"return_code"` // 返回状态码 ReturnMsg string `xml:"return_msg"` // 返回信息 AppID string `xml:"appid"` // 应用APPID MchID string `xml:"mch_id"` // 商户号 DeviceInfo string `xml:"device_info"` // 设备号 NonceStr string `xml:"nonce_str"` // 随机字符串 Sign string `xml:"sign"` // 签名 ResultCode string `xml:"result_code"` // 业务结果 ErrCode string `xml:"err_code"` // 错误代码 ErrCodeDesc string `xml:"err_code_des"` // 错误代码描述 TradeType string `xml:"trade_type"` // 交易类型 PrepayID string `xml:"prepay_id"` // 预支付交易会话标识 }
UnifiedOrderRsp is the response returned by /pay/unifiedorder.