pay

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2021 License: Apache-2.0 Imports: 15 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 {
	MchAppID       string `xml:"mch_appid"`
	MchID          string `xml:"mchid"`
	NonceStr       string `xml:"nonce_str"`
	Sign           string `xml:"sign"`
	PartnerTradeNo string `xml:"partner_trade_no"`
	OpenID         string `xml:"openid"`
	CheckName      string `xml:"check_name"`   //NO_CHECK:不校验真实姓名 FORCE_CHECK:强校验真实姓名
	ReUserName     string `xml:"re_user_name"` //收款用户真实姓名。 如果check_name设置为FORCE_CHECK,则必填用户真实姓名
	Amount         int    `xml:"amount"`       //分
	Desc           string `xml:"desc"`
	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"`
	DeviceInfo         string `xml:"device_info"`
	NonceStr           string `xml:"nonce_str"`
	Sign               string `xml:"sign"`
	SignType           string `xml:"sign_type"`
	ResultCode         string `xml:"result_code"`
	ErrCode            string `xml:"err_code"`
	ErrCodeDes         string `xml:"err_code_des"`
	Openid             string `xml:"openid"`
	IsSubscribe        string `xml:"is_subscribe"`
	TradeType          string `xml:"trade_type"`
	BankType           string `xml:"bank_type"`
	TotalFee           string `xml:"total_fee"`
	SettlementTotalFee string `xml:"settlement_total_fee"`
	FeeType            string `xml:"fee_type"`
	CashFee            string `xml:"cash_fee"`
	CashFeeType        string `xml:"cash_fee_type"`
	CouponFee          string `xml:"coupon_fee"`
	CouponCount        string `xml:"coupon_count"`
	TransactionId      string `xml:"transaction_id"`
	OutTradeNo         string `xml:"out_trade_no"`
	Attach             string `xml:"attach"`
	TimeEnd            string `xml:"time_end"`
}

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
	OpenID     string
	TradeType  string
	//以下红包使用
	Wishing  string
	SendName string
	ActName  string
	Remark   string
	SceneID  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) Refund

func (pcf *Pay) Refund(p *RefundParams) error

func (*Pay) SendRed

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

func (*Pay) Sign

func (pcf *Pay) Sign(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 {
	NonceStr     string `xml:"nonce_str"`
	Sign         string `xml:"sign"`
	MchBillno    string `xml:"mch_billno"`
	MchID        string `xml:"mch_id"`
	WxAppID      string `xml:"wxappid"`
	SendName     string `xml:"send_name"`
	ReOpenID     string `xml:"re_openid"`
	TotalAmount  int    `xml:"total_amount"`
	TotalNum     int    `xml:"total_num"`
	Wishing      string `xml:"wishing"`
	ClientIP     string `xml:"client_ip"`
	ActName      string `xml:"act_name"`
	Remark       string `xml:"remark"`
	SceneID      string `xml:"scene_id"`
	RiskInfo     string `xml:"risk_info"`
	ConsumeMchID string `xml:"consume_mch_id"`
}

type RedResult

type RedResult struct {
	ReturnCode  string `xml:"return_code"`
	ReturnMsg   string `xml:"return_msg"`
	ResultCode  string `xml:"result_code"`
	ErrCode     string `xml:"err_code"`
	ErrCodeDes  string `xml:"err_code_des"`
	MchBillno   string `xml:"mch_billno"`
	MchID       string `xml:"mch_id"`
	WxAppID     string `xml:"wxappid"`
	ReOpenID    string `xml:"re_openid"`
	TotalAmount int    `xml:"total_amount"`
	SendListid  string `xml:"send_listid"`
}

type RefundParams

type RefundParams struct {
	TotalFee      int
	RefundFee     int
	CreateIP      string
	OutRefundNo   string
	TransactionID *string
	OutTradeNo    *string
}

type RefundResult

type RefundResult struct {
	ReturnCode          string `xml:"return_code"`
	ReturnMsg           string `xml:"return_msg"`
	ResultCode          string `xml:"result_code"`
	ErrCode             string `xml:"err_code"`
	ErrCodeDes          string `xml:"err_code_des"`
	AppID               string `xml:"appid"`
	MchID               string `xml:"mch_id"`
	NonceStr            string `xml:"nonce_str"`
	Sign                string `xml:"sign"`
	TransactionID       string `xml:"transaction_id"`
	OutTradeNo          string `xml:"out_trade_no"`
	OutRefundNo         string `xml:"out_refund_no"`
	RefundID            string `xml:"refund_id"`
	RefundFee           int    `xml:"refund_fee"`
	SettlementRefundFee int    `xml:"settlement_refund_fee"`
	TotalFee            int    `xml:"total_fee"`
	SettlementTotalFee  int    `xml:"settlement_total_fee"`
	FeeType             string `xml:"fee_type"`
	CashFee             int    `xml:"cash_fee"`
	CashFeeType         string `xml:"cash_fee_type"`
	CashRefundFee       int    `xml:"cash_refund_fee"`
}

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)

type WxRefundParams

type WxRefundParams struct {
	AppID         string  `xml:"appid"`
	MchID         string  `xml:"mch_id"`
	NonceStr      string  `xml:"nonce_str"`
	Sign          string  `xml:"sign"`
	SignType      *string `xml:"sign_type"`
	TransactionID *string `xml:"transaction_id"`
	OutTradeNo    *string `xml:"out_trade_no"`
	OutRefundNo   string  `xml:"out_refund_no"`
	TotalFee      int     `xml:"total_fee"`
	RefundFee     int     `xml:"refund_fee"`
	RefundFeeType *string `xml:"refund_fee_type"`
	RefundDesc    *string `xml:"refund_desc"`
	RefundAccount *string `xml:"refund_account"`
	NotifyUrl     *string `xml:"notify_url"`
}

Jump to

Keyboard shortcuts

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