pay

package
v1.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 8, 2020 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bank

type Bank struct {
	*context.Context
}

Bank struct extends context

func NewWithdrawBank

func NewWithdrawBank(ctx *context.Context) *Bank

NewWithdrawBank return an instance of Bank package

func (*Bank) PreBankOrder

func (pcf *Bank) PreBankOrder(p *OrderData) (payOrder BankResponse, err error)

PreBankOrder return data for invoke wechat payment

type BankRequest

type BankRequest struct {
	// MchID 商户号
	MchID string `xml:"mch_id"`
	// PartnerTradeNo 商户企业付款单号
	PartnerTradeNo string `xml:"partner_trade_no"`
	// NonceStr 随机字符串
	NonceStr string `xml:"nonce_str"`
	// Sign sign
	Sign string `xml:"sign"`
	// EncBankNo 收款方银行卡号
	EncBankNo string `xml:"enc_bank_no"`
	// EncTrueName 收款方用户名
	EncTrueName string `xml:"enc_true_name"`
	// BankCode 收款方开户行
	BankCode string `xml:"bank_code"`
	// Amount 付款金额
	Amount int `xml:"amount"`
	// Desc 付款说明
	Desc string `xml:"desc"`
}

BankRequest 接口请求参数

type BankResponse

type BankResponse struct {
	// ReturnCode 通信标识
	ReturnCode string `xml:"return_code"`
	// ReturnMsg 错误信息
	ReturnMsg string `xml:"return_msg"`
	// ResultCode 业务结果
	ResultCode string `xml:"result_code,omitempty"`
	// ErrCode 错误代码
	ErrCode string `xml:"err_code,omitempty"`
	// ErrCodeDes 错误代码描述
	ErrCodeDes string `xml:"err_code_des,omitempty"`
	// MchID 商户ID
	MchID string `xml:"mch_id,omitempty"`
	// PartnerTradeNo 企业商户付款单号
	PartnerTradeNo string `xml:"partner_trade_no,omitempty"`
	// Amount 付款金额
	Amount int `xml:"amount"`
	// NonceStr 随机字符串
	NonceStr string `xml:"nonce_str,omitempty"`
	// Sign 签名
	Sign string `xml:"sign,omitempty"`
	// PaymentNo 微信企业付款单号
	PaymentNo string `xml:"payment_no"`
	// CmmsAmt 手续费金额
	CmmsAmt int `xml:"cmms_amt"`
}

BankResponse 微信提款接口的返回

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

type NotifyResp struct {
	ReturnCode string `xml:"return_code"`
	ReturnMsg  string `xml:"return_msg"`
}

NotifyResp 消息通知返回

func NewNotifyResp added in v1.3.0

func NewNotifyResp(isSucc bool, msg ...string) *NotifyResp

NewNotifyResp 商户处理后同步返回给微信的参数

type NotifyResult

type NotifyResult map[string]string

NotifyResult 下单回调

func (NotifyResult) Attach

func (n NotifyResult) Attach() string

func (NotifyResult) BankType

func (n NotifyResult) BankType() string

func (NotifyResult) CashFee

func (n NotifyResult) CashFee() int

func (NotifyResult) CashFeeType

func (n NotifyResult) CashFeeType() string

func (NotifyResult) FeeType

func (n NotifyResult) FeeType() string

func (NotifyResult) IsSubscribe

func (n NotifyResult) IsSubscribe() string

func (NotifyResult) IsSucc added in v1.3.0

func (n NotifyResult) IsSucc() bool

IsSucc 返回是否为成功

func (NotifyResult) OpenID

func (n NotifyResult) OpenID() string

func (NotifyResult) OutTradeNo

func (n NotifyResult) OutTradeNo() string

func (NotifyResult) ResultCode

func (n NotifyResult) ResultCode() string

func (NotifyResult) ReturnCode

func (n NotifyResult) ReturnCode() string

func (NotifyResult) ReturnMsg

func (n NotifyResult) ReturnMsg() string

func (NotifyResult) TimeEnd

func (n NotifyResult) TimeEnd() string

func (NotifyResult) TotalFee

func (n NotifyResult) TotalFee() int

func (NotifyResult) TradeType

func (n NotifyResult) TradeType() string

func (NotifyResult) TransactionID

func (n NotifyResult) TransactionID() string

func (*NotifyResult) UnmarshalXML added in v1.3.0

func (m *NotifyResult) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

type OrderData

type OrderData struct {
	EncBankNo      string
	EncTrueName    string
	BankCode       string
	Amount         int
	Desc           string
	PartnerTradeNo string
}

OrderData 提款所需传入参数

type Params

type Params struct {
	TotalFee   string
	CreateIP   string
	Body       string
	OutTradeNo string
	OpenID     string
	TradeType  string
	SignType   string
	Detail     string
	Attach     string
	GoodsTag   string
	NotifyURL  string
}

Params was NEEDED when request unifiedorder 传入的参数,用于生成 prepay_id 的必需参数

type Pay

type Pay struct {
	*context.Context
}

Pay struct extends context

func NewPay

func NewPay(ctx *context.Context) *Pay

NewPay return an instance of Pay package

func (*Pay) BridgeConfig

func (pcf *Pay) BridgeConfig(p *Params) (cfg Config, err error)

BridgeConfig get js bridge config

func (*Pay) PrePayID

func (pcf *Pay) PrePayID(p *Params) (prePayID string, err error)

PrePayID will request wechat merchant api and request for a pre payment order id

func (*Pay) PrePayOrder

func (pcf *Pay) PrePayOrder(p *Params) (payOrder PreOrder, err error)

PrePayOrder return data for invoke wechat payment

func (*Pay) Refund

func (pcf *Pay) Refund(p *RefundParams) (rsp RefundResponse, err error)

Refund 退款申请

func (*Pay) VerifySign

func (pcf *Pay) VerifySign(notifyRes NotifyResult) bool

VerifySign 验签

type PreOrder

type PreOrder struct {
	ReturnCode string `xml:"return_code"`
	ReturnMsg  string `xml:"return_msg"`
	AppID      string `xml:"appid,omitempty"`
	MchID      string `xml:"mch_id,omitempty"`
	NonceStr   string `xml:"nonce_str,omitempty"`
	Sign       string `xml:"sign,omitempty"`
	ResultCode string `xml:"result_code,omitempty"`
	TradeType  string `xml:"trade_type,omitempty"`
	PrePayID   string `xml:"prepay_id,omitempty"`
	CodeURL    string `xml:"code_url,omitempty"`
	ErrCode    string `xml:"err_code,omitempty"`
	ErrCodeDes string `xml:"err_code_des,omitempty"`
}

PreOrder 是 unifie order 接口的返回

type RefundParams

type RefundParams struct {
	TransactionID string
	OutRefundNo   string
	TotalFee      string
	RefundFee     string
	RefundDesc    string
	RootCa        string //ca证书
}

RefundParams 调用参数

type RefundResponse

type RefundResponse struct {
	ReturnCode          string `xml:"return_code"`
	ReturnMsg           string `xml:"return_msg"`
	AppID               string `xml:"appid,omitempty"`
	MchID               string `xml:"mch_id,omitempty"`
	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"`
	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 接口返回

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL