order

package
v2.1.3 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2022 License: Apache-2.0 Imports: 8 Imported by: 5

Documentation

Index

Constants

View Source
const SUCCESS = "SUCCESS"

SUCCESS 表示支付成功

Variables

This section is empty.

Functions

This section is empty.

Types

type CloseParams added in v2.0.9

type CloseParams struct {
	OutTradeNo string // 商户订单号
	SignType   string // 签名类型
}

CloseParams 传入的参数

type CloseResult added in v2.0.9

type CloseResult struct {
	ReturnCode *string `xml:"return_code"`
	ReturnMsg  *string `xml:"return_msg"`

	AppID      *string `xml:"appid" json:"appid"`
	MchID      *string `xml:"mch_id"`
	NonceStr   *string `xml:"nonce_str"`
	Sign       *string `xml:"sign"`
	ResultCode *string `xml:"result_code"`
	ResultMsg  *string `xml:"result_msg"`
	ErrCode    *string `xml:"err_code"`
	ErrCodeDes *string `xml:"err_code_des"`
}

CloseResult 关闭订单返回结果

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 ConfigForApp added in v2.0.7

type ConfigForApp struct {
	AppID     string `json:"appid"`
	MchID     string `json:"partnerid"` // 微信支付分配的商户号
	PrePayID  string `json:"prepayid"`
	Package   string `json:"package"`
	NonceStr  string `json:"nonceStr"`
	Timestamp string `json:"timestamp"`
	Sign      string `json:"sign"`
}

ConfigForApp 是传出用于 app 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) BridgeAppConfig added in v2.0.7

func (o *Order) BridgeAppConfig(p *Params) (cfg ConfigForApp, err error)

BridgeAppConfig get app bridge config

func (*Order) BridgeConfig

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

BridgeConfig get js bridge config

func (*Order) CloseOrder added in v2.0.9

func (o *Order) CloseOrder(p *CloseParams) (closeResult CloseResult, err error)

CloseOrder 关闭订单

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 added in v2.0.6

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
	TimeExpire string // 订单失效时间,格式为yyyyMMddHHmmss,如2009年12月27日9点10分10秒表示为20091227091010。
	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 added in v2.0.6

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