order

package
v0.0.0-...-a0c205e Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const SUCCESS = "SUCCESS"

SUCCESS 表示支付成功

Variables

This section is empty.

Functions

This section is empty.

Types

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 Order

type Order struct {
	*config.Config
}

Order struct extends context

func NewOrder

func NewOrder(cfg *config.Config) *Order

NewOrder return an instance of order package

func (*Order) BridgeConfig

func (o *Order) BridgeConfig(p *Params) (cfg Config, err error)

BridgeConfig get js bridge config

func (*Order) PrePayID

func (o *Order) PrePayID(p *Params) (prePayID string, err error)

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

func (*Order) PrePayOrder

func (o *Order) PrePayOrder(p *Params) (payOrder PreOrder, err error)

PrePayOrder return data for invoke wechat payment

func (*Order) QueryOrder

func (o *Order) QueryOrder(p *QueryParams) (paidResult notify.PaidResult, err error)

QueryOrder 查询订单

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 Unified order 传入的参数,用于生成 prepay_id 的必需参数

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"`
	MWebURL    string `xml:"mweb_url,omitempty"`
	ErrCode    string `xml:"err_code,omitempty"`
	ErrCodeDes string `xml:"err_code_des,omitempty"`
}

PreOrder 是 Unified order 接口的返回

type QueryParams

type QueryParams struct {
	OutTradeNo    string // 商户订单号
	SignType      string // 签名类型
	TransactionID string // 微信订单号
}

QueryParams 传入的参数

Jump to

Keyboard shortcuts

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