pay

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CloseOrderResult

type CloseOrderResult struct {
	ReturnCode string `xml:"return_code"`
	ReturnMsg  string `xml:"return_msg"`
	AppId      string `xml:"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"`
	ErrCodeDes string `xml:"err_code_des"`
}

type Config

type Config struct {
	Timestamp int64
	NonceStr  string
	PrePayID  string
	SignType  string
	Sign      string
}

Config 是传出用于 jsdk 用的参数

type NotifyResponse

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

notifyResult 是 支付成功后回调返回

type NotifyResult

type NotifyResult struct {
	AppID         string `xml:"appid,omitempty"`
	Attach        string `xml:"attach,omitempty"`
	BankType      string `xml:"bank_type,omitempty"`
	FeeType       string `xml:"fee_type,omitempty"`
	IsSubscribe   string `xml:"is_subscribe,omitempty"`
	MchId         string `xml:"mch_id,omitempty"`
	NonceStr      string `xml:"nonce_str,omitempty"`
	Openid        string `xml:"openid,omitempty"`
	OutTradeNo    string `xml:"out_trade_no,omitempty"`
	ResultCode    string `xml:"result_code,omitempty"`
	ReturnCode    string `xml:"return_code,omitempty"`
	Sign          string `xml:"sign,omitempty"`
	SubMchId      string `xml:"sub_mch_id,omitempty"`
	TimeEnd       string `xml:"time_end,omitempty"`
	TotalFee      string `xml:"total_fee,omitempty"`
	CouponFee     string `xml:"coupon_fee,omitempty"`
	CouponCount   string `xml:"coupon_count,omitempty"`
	CouponType    string `xml:"coupon_type,omitempty"`
	CouponId      string `xml:"coupon_id,omitempty"`
	TradeType     string `xml:"trade_type,omitempty"`
	TransactionId string `xml:"transaction_id,omitempty"`
}

notifyResult 是 支付成功后回调返回

type Params

type Params struct {
	TotalFee   string
	CreateIP   string
	Body       string
	Attach     string
	OutTradeNo string
	OpenID     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) CloseOrder

func (pcf *Pay) CloseOrder(outTradeNo string) (*CloseOrderResult, error)

func (*Pay) PreNative

func (pcf *Pay) PreNative(p *Params) (*PayResult, error)

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

type PayResult

type PayResult 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"`
}

Jump to

Keyboard shortcuts

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