Documentation ¶
Index ¶
- type CloseOrderParams
- type CloseResponse
- type CommonRequest
- type CommonResponse
- type Config
- type NotifyResp
- type NotifyResult
- type Params
- type Pay
- func (pcf *Pay) BridgeConfig(p *Params) (cfg Config, err error)
- func (pcf *Pay) CloseOrder(c *CloseOrderParams) (rsp CloseResponse, err error)
- func (pcf *Pay) PrePayID(p *Params) (prePayID string, err error)
- func (pcf *Pay) PrePayOrder(p *Params) (payOrder PreOrder, err error)
- func (pcf *Pay) QueryOrder(c *CloseOrderParams) (rsp QueryResponse, err error)
- func (pcf *Pay) Refund(p *RefundParams) (rsp RefundResponse, err error)
- func (pcf *Pay) VerifySign(notifyRes NotifyResult) bool
- type PreOrder
- type QueryOrderParams
- type QueryResponse
- type RefundParams
- type RefundResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CloseOrderParams ¶ added in v1.2.5
CloseOrderParams close order params
type CloseResponse ¶ added in v1.2.5
type CloseResponse struct { CommonResponse ResultMsg string `xml:"result_msg,omitempty"` }
type CommonRequest ¶ added in v1.2.5
type CommonRequest struct { AppID string `xml:"appid"` MchID string `xml:"mch_id"` SubAppID string `xml:"sub_appid"` SubMchID string `xml:"sub_mch_id"` NonceStr string `xml:"nonce_str"` Sign string `xml:"sign"` SignType string `xml:"sign_type,omitempty"` }
CommonRequest common request
type CommonResponse ¶ added in v1.2.5
type CommonResponse struct { ReturnCode string `xml:"return_code"` ReturnMsg string `xml:"return_msg"` AppID string `xml:"appid,omitempty"` MchID string `xml:"mch_id,omitempty"` SubAppID string `xml:"sub_appid"` SubMchID string `xml:"sub_mch_id"` NonceStr string `xml:"nonce_str,omitempty"` Sign string `xml:"sign,omitempty"` ResultCode string `xml:"result_code,omitempty"` ErrCode string `xml:"err_code,omitempty"` ErrCodeDes string `xml:"err_code_des,omitempty"` }
CommonResponse wechat pay common response
type Config ¶
type Config struct { Timestamp string `json:"timestamp"` NonceStr string `json:"nonceStr"` PrePayID string `json:"prePayId"` SignType string `json:"signType"` Package string `json:"package"` PaySign string `json:"paySign"` }
Config 是传出用于 js sdk 用的参数
type NotifyResp ¶ added in v1.2.1
type NotifyResp struct { ReturnCode string `xml:"return_code"` ReturnMsg string `xml:"return_msg"` }
NotifyResp 消息通知返回
type NotifyResult ¶ added in v1.2.1
type NotifyResult struct { ReturnCode *string `xml:"return_code"` ReturnMsg *string `xml:"return_msg"` AppID *string `xml:"appid" json:"appid"` MchID *string `xml:"mch_id"` SubAppID *string `xml:"appid" json:"sub_appid"` SubMchID *string `xml:"sub_mch_id"` DeviceInfo *string `xml:"device_info"` NonceStr *string `xml:"nonce_str"` Sign *string `xml:"sign"` SignType *string `xml:"sign_type"` ResultCode *string `xml:"result_code"` ErrCode *string `xml:"err_code"` ErrCodeDes *string `xml:"err_code_des"` OpenID *string `xml:"openid"` SubOpenID *string `xml:"sub_openid"` IsSubscribe *string `xml:"is_subscribe"` TradeType *string `xml:"trade_type"` BankType *string `xml:"bank_type"` TotalFee *int `xml:"total_fee"` SettlementTotalFee *int `xml:"settlement_total_fee"` FeeType *string `xml:"fee_type"` CashFee *string `xml:"cash_fee"` CashFeeType *string `xml:"cash_fee_type"` CouponFee *int `xml:"coupon_fee"` CouponCount *int `xml:"coupon_count"` // coupon_type_$n 这里只声明 3 个,如果有更多的可以自己组合 CouponType0 *string `xml:"coupon_type_0"` CouponType1 *string `xml:"coupon_type_1"` CouponType2 *string `xml:"coupon_type_2"` CouponID0 *string `xml:"coupon_id_0"` CouponID1 *string `xml:"coupon_id_1"` CouponID2 *string `xml:"coupon_id_2"` CouponFeed0 *string `xml:"coupon_fee_0"` CouponFeed1 *string `xml:"coupon_fee_1"` CouponFeed2 *string `xml:"coupon_fee_2"` TransactionID *string `xml:"transaction_id"` OutTradeNo *string `xml:"out_trade_no"` Attach *string `xml:"attach"` TimeEnd *string `xml:"time_end"` }
NotifyResult 下单回调
type Params ¶
type Params struct { SubAppID string SubMchID string TotalFee string CreateIP string Body string OutTradeNo string OpenID string SubOpenID string TradeType string SignType string Detail string Attach string GoodsTag string NotifyURL string }
Params was NEEDED when request unifiedorder 传入的参数,用于生成 prepay_id 的必需参数
type Pay ¶
Pay struct extends context
func (*Pay) BridgeConfig ¶ added in v1.2.1
BridgeConfig get js bridge config
func (*Pay) CloseOrder ¶ added in v1.2.5
func (pcf *Pay) CloseOrder(c *CloseOrderParams) (rsp CloseResponse, err error)
CloseOrder close order
func (*Pay) PrePayID ¶
PrePayID will request wechat merchant api and request for a pre payment order id
func (*Pay) PrePayOrder ¶ added in v1.2.0
PrePayOrder return data for invoke wechat payment
func (*Pay) QueryOrder ¶ added in v1.2.5
func (pcf *Pay) QueryOrder(c *CloseOrderParams) (rsp QueryResponse, err error)
QueryOrder query order
func (*Pay) Refund ¶ added in v1.2.0
func (pcf *Pay) Refund(p *RefundParams) (rsp RefundResponse, err error)
Refund 退款申请
func (*Pay) VerifySign ¶ added in v1.2.1
func (pcf *Pay) VerifySign(notifyRes NotifyResult) bool
VerifySign 验签
type PreOrder ¶ added in v1.2.0
type PreOrder struct { CommonResponse TradeType string `xml:"trade_type,omitempty"` PrePayID string `xml:"prepay_id,omitempty"` CodeURL string `xml:"code_url,omitempty"` }
PreOrder 是 unifie order 接口的返回
type QueryOrderParams ¶ added in v1.2.5
type QueryOrderParams struct { SubAppID string SubMchID string TransactionID string OutTradeNo string SignType string }
CloseOrderParams close order params
type QueryResponse ¶ added in v1.2.5
type QueryResponse struct { CommonResponse ResultMsg string `xml:"result_msg,omitempty"` OpenID string `xml:"openid"` SubOpenID string `xml:"sub_openid"` IsSubscribe string `xml:"is_subscribe"` TradeType string `xml:"trade_type"` BankType string `xml:"bank_type"` TotalFee int `xml:"total_fee"` SettlementTotalFee int `xml:"settlement_total_fee"` FeeType string `xml:"fee_type"` CashFee string `xml:"cash_fee"` CashFeeType string `xml:"cash_fee_type"` CouponFee int `xml:"coupon_fee"` CouponCount int `xml:"coupon_count"` // coupon_type_$n 这里只声明 3 个,如果有更多的可以自己组合 CouponType0 string `xml:"coupon_type_0"` CouponType1 string `xml:"coupon_type_1"` CouponType2 string `xml:"coupon_type_2"` CouponID0 string `xml:"coupon_id_0"` CouponID1 string `xml:"coupon_id_1"` CouponID2 string `xml:"coupon_id_2"` CouponFeed0 string `xml:"coupon_fee_0"` CouponFeed1 string `xml:"coupon_fee_1"` CouponFeed2 string `xml:"coupon_fee_2"` 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"` }
type RefundParams ¶ added in v1.2.0
type RefundParams struct { TransactionID string OutRefundNo string TotalFee string RefundFee string RefundDesc string RootCa string //ca证书 }
RefundParams 调用参数
type RefundResponse ¶ added in v1.2.0
type RefundResponse struct { CommonResponse TransactionID string `xml:"transaction_id,omitempty"` OutTradeNo string `xml:"out_trade_no,omitempty"` OutRefundNo string `xml:"out_refund_no,omitempty"` RefundID string `xml:"refund_id,omitempty"` RefundFee string `xml:"refund_fee,omitempty"` SettlementRefundFee string `xml:"settlement_refund_fee,omitempty"` TotalFee string `xml:"total_fee,omitempty"` SettlementTotalFee string `xml:"settlement_total_fee,omitempty"` FeeType string `xml:"fee_type,omitempty"` CashFee string `xml:"cash_fee,omitempty"` CashFeeType string `xml:"cash_fee_type,omitempty"` }
RefundResponse 接口返回
Click to show internal directories.
Click to hide internal directories.