pay

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: May 15, 2020 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppPayConfig

type AppPayConfig struct {
	AppID     string `xml:"appid" json:"appid"`
	PartnerID string `xml:"partnerid" json:"partnerid"`
	PrePayID  string `xml:"prepayid" json:"prepayid"`
	Package   string `xml:"package" json:"package"`
	NonceStr  string `xml:"noncestr" json:"noncestr"`
	Timestamp string `xml:"timestamp" json:"timestamp"`
	Sign      string `xml:"sign" json:"sign"`
}

type MchTransfersParams

type MchTransfersParams struct {
	InputCharset   string `xml:"input_charset"`
	MchID          string `xml:"mch_id"`
	NonceStr       string `xml:"nonce_str"`
	Sign           string `xml:"sign"`
	OutTradeNo     string `xml:"out_trade_no"`
	TotalFee       int    `xml:"total_fee"`
	Memo           string `xml:"memo"`
	AppID          string `xml:"appid"`
	OpenID         string `xml:"openid"`
	OpUserID       string `xml:"op_user_id"`
	OpUserPasswd   string `xml:"op_user_passwd"`
	SpbillCreateIp string `xml:"spbill_create_ip"`
}

type NotifyResult

type NotifyResult struct {
	ReturnCode    string `xml:"return_code"`
	ReturnMsg     string `xml:"return_msg"`
	Appid         string `xml:"appid"`
	MchID         string `xml:"mch_id"`
	NonceStr      string `xml:"nonce_str"`
	Sign          string `xml:"sign"`
	DeviceInfo    string `xml:"device_info"`
	TradeType     string `xml:"trade_type"`
	BankType      string `xml:"bank_type"`
	FeeType       string `xml:"fee_type"`
	TotalFee      string `xml:"total_fee"`
	CashFee       string `xml:"cash_fee"`
	CouponFee     string `xml:"coupon_fee"`
	TransactionId string `xml:"transaction_id"`
	OutTradeNo    string `xml:"out_trade_no"`
	Attach        string `xml:"attach"`
	TimeEnd       string `xml:"time_end"`
	Openid        string `xml:"openid"`
	ResultCode    string `xml:"result_code"`
	ErrCode       string `xml:"err_code"`
	ErrCodeDes    string `xml:"err_code_des"`
}

type NotifyReturn

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

type Params

type Params struct {
	TotalFee     int
	CreateIP     string
	Body         string
	OutTradeNo   string
	TradeType    string
	MiniAppParam string
	OpenID       string
	ContractCode string
	PromotionTag string
	Attach       string
	//以下红包使用
	Wishing   string
	SendName  string
	ActName   string
	IconID    int
	BannerID  int
	NotifyUrl string
}

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

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) AppPayParams

func (pcf *Pay) AppPayParams(prePayID string) AppPayConfig

func (*Pay) JSPayParams

func (pcf *Pay) JSPayParams(prePayID string) PayConfig

func (*Pay) MchPay

func (pcf *Pay) MchPay(p *Params) 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

func (*Pay) PrePayIdByApp

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

func (*Pay) PrePayIdByJs

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

func (*Pay) PrePayOrder

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

func (*Pay) PrePayOrderByApp

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

func (*Pay) PrePayOrderByJs

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

func (*Pay) PrePayOrderByMiniApp

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

func (*Pay) SendRed

func (pcf *Pay) SendRed(p *Params) (string, error)

func (*Pay) Sign

func (pcf *Pay) Sign(variable interface{}, key string) (sign string, err error)

func (*Pay) SignByJson

func (pcf *Pay) SignByJson(variable interface{}, key string) (sign string, err error)

type PayConfig

type PayConfig struct {
	AppID     string `xml:"appId" json:"appId"`
	TimeStamp string `xml:"timeStamp" json:"timeStamp"`
	NonceStr  string `xml:"nonceStr" json:"nonceStr"`
	Package   string `xml:"package" json:"package"`
	SignType  string `xml:"signType" json:"signType"`
	PaySign   string `xml:"paySign" json:"paySign"`
}

PayConfig 是传出用于 jsdk 用的参数

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

type RedParams

type RedParams struct {
	Charset     int    `json:"charset" xml:"charset"`           //必填 1 utf8 , 2 gbk
	NonceStr    string `json:"nonce_str" xml:"nonce_str"`       //必填
	Sign        string `json:"sign" xml:"sign"`                 //必填
	MchBillno   string `json:"mch_billno" xml:"mch_billno"`     //必填 订单号
	MchID       string `json:"mch_id" xml:"mch_id"`             //必填
	MchName     string `json:"mch_name" xml:"mch_name"`         //必填//商户名称,会展示在红包领取页面上
	QqAppID     string `json:"qqappid" xml:"qqappid"`           //必填
	ReOpenID    string `json:"re_openid" xml:"re_openid"`       //必填
	TotalAmount int    `json:"total_amount" xml:"total_amount"` //必填
	TotalNum    int    `json:"total_num" xml:"total_num"`       //必填
	Wishing     string `json:"wishing" xml:"wishing"`           //必填
	ActName     string `json:"act_name" xml:"act_name"`         //必填
	IconID      int    `json:"icon_id" xml:"icon_id"`           //必填
	BannerID    int    `json:"banner_id,omitempty" xml:"banner_id,omitempty"`
	NotifyUrl   string `json:"notify_url,omitempty" xml:"notify_url,omitempty"`
	NotSendMsg  int    `json:"not_send_msg,omitempty" xml:"not_send_msg,omitempty"`
	MinValue    int    `json:"min_value" xml:"min_value"` //必填 1
	MaxValue    int    `json:"max_value" xml:"max_value"` //必填 100
}

type RedResult

type RedResult struct {
	Retcode string `json:"retcode"`
	Retmsg  string `json:"retmsg"`
	Listid  string `json:"listid"`
}

type SignStruct

type SignStruct struct {
	Elements map[string]string `json:"elements"`
	Keys     []string          `json:"keys"`
	ToLower  bool              `doc:"是否自动将key小写"`
	Tag      string            `json:"tag" doc:"使用xml/json或者直接字段名"`
}

func (SignStruct) Sign

func (this SignStruct) Sign(variable interface{}, fn func() hash.Hash, apiKey string) (sign string, err error)

Jump to

Keyboard shortcuts

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