v2wechat

package
v0.6.25 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2021 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UnifiedOrderUrl = "/pay/unifiedorder"
)

Variables

This section is empty.

Functions

func GetRandomString

func GetRandomString(length int) string

func StringMapJointByDictionaryOrder

func StringMapJointByDictionaryOrder(data map[string]string) (str string)

func ToKeyValueStr

func ToKeyValueStr(v interface{}) string

func WeChatPaySignHMACSHA256

func WeChatPaySignHMACSHA256(v interface{}, apikey string) string

func WeChatPaySignHMACSHA256ByMap

func WeChatPaySignHMACSHA256ByMap(data map[string]string, apikey string) string

func WeChatPaySignHMACSHA256ByString

func WeChatPaySignHMACSHA256ByString(data string, apikey string) string

func WeChatPaySignMd5WithString

func WeChatPaySignMd5WithString(data string, apikey string) string

func WeChatPaySignMd5WithStringMap

func WeChatPaySignMd5WithStringMap(data map[string]string, apikey string) string

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(mchId string, options ...Option) *Client

func (*Client) OrderQuery

func (c *Client) OrderQuery(appid, subAppid, mchId, outTradeNo string) (rsp StringMap, err error)

func (*Client) UnifiedOrder

func (c *Client) UnifiedOrder(reqS *UnifiedOrderReq) (rsp StringMap, err error)

type MchInfo

type MchInfo struct {
	MchId      string
	PublicKey  string
	PrivateKey string
	ApiKey     string
}

type Option

type Option func(c *Client)

func GetMchInfoOptions

func GetMchInfoOptions(f func(c *Client) *MchInfo) Option

type OrderQueryReq

type OrderQueryReq struct {
	Appid         string `xml:"appid"`
	MchId         string `xml:"mch_id"`
	NonceStr      string `xml:"nonce_str"`
	OutTradeNo    string `xml:"out_trade_no,omitempty"`
	Sign          string `xml:"sign"`
	SignType      string `xml:"sign_type"`
	SubAppid      string `xml:"sub_appid,omitempty"`
	SubMchId      string `xml:"sub_mch_id,omitempty"`
	TransactionId string `xml:"transaction_id,omitempty"`
}

type PayNotifyInfo

type PayNotifyInfo struct {
	Appid              string `xml:"appid"`
	Attach             string `xml:"attach,omitempty"`
	BankType           string `xml:"bank_type"`
	CashFee            int    `xml:"cash_fee"`
	CashFeeType        string `xml:"cash_fee_type,omitempty"`
	CouponCount        int    `xml:"coupon_count,omitempty"`
	CouponFee          int    `xml:"coupon_fee,omitempty"`
	DeviceInfo         string `xml:"device_info,omitempty"`
	ErrCode            string `xml:"err_code,omitempty"`
	ErrCodeDes         string `xml:"err_code_des,omitempty"`
	FeeType            string `xml:"fee_type,omitempty"`
	IsSubscribe        string `xml:"is_subscribe"`
	MchId              string `xml:"mch_id"`
	NonceStr           string `xml:"nonce_str"`
	OutTradeNo         string `xml:"out_trade_no"`
	Openid             string `xml:"openid"`
	ResultCode         string `xml:"result_code,omitempty"`
	SettlementTotalFee int    `xml:"settlement_total_fee,omitempty"`
	Sign               string `xml:"sign"`
	SignType           string `xml:"sign_type"`
	TotalFee           int    `xml:"total_fee"`
	TimeEnd            string `xml:"time_end"`
	TradeType          string `xml:"trade_type"`
	TransactionId      string `xml:"transaction_id"`
}

type PayNotifyRsp

type PayNotifyRsp struct {
	xml.Name
	ReturnCode string `xml:"return_code"`
	ReturnMsg  string `xml:"return_msg,omitempty"`
}

type SceneInfo

type SceneInfo struct {
	Address  string `xml:"address,omitempty"`
	AreaCode string `xml:"area_code,omitempty"`
	Id       string `xml:"id"`
	Name     string `xml:"name,omitempty"`
}

type StringMap

type StringMap map[string]string

func (StringMap) MarshalXML

func (m StringMap) MarshalXML(e *xml.Encoder, start xml.StartElement) error

func (*StringMap) UnmarshalXML

func (m *StringMap) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

type UnifiedOrderReq

type UnifiedOrderReq struct {
	Appid          string    `xml:"appid"`
	Attach         string    `xml:"attach,omitempty"`
	Body           string    `xml:"body"`
	Detail         string    `xml:"detail,omitempty"`
	DeviceInfo     string    `xml:"device_info,omitempty"`
	GoodsTag       string    `xml:"goods_tag,omitempty"`
	FeeType        string    `xml:"fee_type,omitempty"`
	LimitPay       string    `xml:"limit_pay,omitempty"`
	MchId          string    `xml:"mch_id"`
	NonceStr       string    `xml:"nonce_str"`
	NotifyUrl      string    `xml:"notify_url"`
	Openid         string    `xml:"openid,omitempty"`
	OutTradeNo     string    `xml:"out_trade_no"`
	ProductId      string    `xml:"product_id,omitempty"`
	ProfitSharing  string    `xml:"profit_sharing,omitempty"`
	Receipt        string    `xml:"receipt,omitempty"`
	SceneInfo      SceneInfo `xml:"scene_info,omitempty"`
	Sign           string    `xml:"sign"`
	SignType       string    `xml:"sign_type,omitempty"`
	SpbillCreateIp string    `xml:"spbill_create_ip"`
	SubAppid       string    `xml:"sub_appid,omitempty"`
	SubMchId       string    `xml:"sub_mch_id,omitempty"`
	SubOpenid      string    `xml:"sub_openid,omitempty"`
	TimeExpire     string    `xml:"time_expire,omitempty"`
	TimeStart      string    `xml:"time_start,omitempty"`
	TotalFee       int       `xml:"total_fee"`
	TradeType      string    `xml:"trade_type"`
}

Jump to

Keyboard shortcuts

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