v3wechat

package
v0.6.9 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2021 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetRandomString

func GetRandomString(length int) string

func PrivateKeySignSHA256

func PrivateKeySignSHA256(signData string, key string) (sign string, err error)

func RsaVerySignWithSHA256Base64

func RsaVerySignWithSHA256Base64(originalData, signData string, key string) (err error)

func SHA256BAS64

func SHA256BAS64(signstr string, key *rsa.PrivateKey) (string, error)

func Sign

func Sign(method string, url string, timestamp string, nonce string, body []byte, key string) (sign string, err error)

func VerifySign

func VerifySign(body, timestamp, nonceStr, sign, publicKey string) (err error)

Types

type Client

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

func NewClient

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

func (*Client) QueryUserCoupon

func (c *Client) QueryUserCoupon(openid string, couponId string, appid string) (rsp *QueryUserCouponRsp, err error)

func (*Client) SendCouponStock

func (c *Client) SendCouponStock(openid string, req *SendCouponStockReq) (rsp *SendCouponStockRsp, err error)

type MchInfo

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

type Option

type Option func(c *Client)

func GetMchInfoOptions

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

type QueryUserCouponConsumeInformation

type QueryUserCouponConsumeInformation struct {
	ConsumeTime   string `json:"consume_time"`
	ConsumeMchid  string `json:"consume_mchid"`
	TransactionId string `json:"transaction_id"`
}

type QueryUserCouponCutToMessage

type QueryUserCouponCutToMessage struct {
	SinglePriceMax int64 `json:"single_price_max"`
	CutToPrice     int64 `json:"cut_to_price"`
}

type QueryUserCouponGoodsDetail

type QueryUserCouponGoodsDetail struct {
	GoodsId        string `json:"goods_id"`
	Quantity       uint32 `json:"quantity"`
	Price          uint64 `json:"price"`
	DiscountAmount uint64 `json:"discount_amount"`
}

type QueryUserCouponNormalCouponInformation

type QueryUserCouponNormalCouponInformation struct {
	CouponAmount       uint64 `json:"coupon_amount"`
	TransactionMinimum uint64 `json:"transaction_minimum"`
}

type QueryUserCouponReq

type QueryUserCouponReq struct {
}

type QueryUserCouponRsp

type QueryUserCouponRsp struct {
	StockCreateMchId        string                                 `json:"stock_creator_mchid"`
	StockId                 string                                 `json:"stock_id"`
	CouponId                string                                 `json:"coupon_id"`
	CutToMessage            QueryUserCouponCutToMessage            `json:"cut_to_message"`
	CouponName              string                                 `json:"coupon_name"`
	Status                  string                                 `json:"status"`
	Description             string                                 `json:"description"`
	CreateTime              string                                 `json:"create_time"`
	CouponType              string                                 `json:"coupon_type"`
	NoCash                  bool                                   `json:"no_cash"`
	AvailableBeginTime      string                                 `json:"available_begin_time"`
	AvailableEndTime        string                                 `json:"available_end_time"`
	Singleitem              bool                                   `json:"singleitem"`
	NormalCouponInformation QueryUserCouponNormalCouponInformation `json:"normal_coupon_information"`
	ConsumeInformation      QueryUserCouponConsumeInformation      `json:"consume_information"`
	GoodsDetail             QueryUserCouponGoodsDetail             `json:"goods_detail"`
}

type RequestErr

type RequestErr struct {
	Code    string      `json:"code"`
	Message string      `json:"message"`
	Field   string      `json:"field"`
	Value   string      `json:"value"`
	Issue   string      `json:"issue"`
	Detail  interface{} `json:"detail"`
	ReqText string      `json:"req_text"`
}

func (*RequestErr) Error

func (e *RequestErr) Error() string

type SendCouponStockReq

type SendCouponStockReq struct {
	Appid             string `json:"appid"`
	CouponMinimum     uint64 `json:"coupon_minimum,omitempty"`
	CouponValue       uint64 `json:"coupon_value,omitempty"`
	OutRequestNo      string `json:"out_request_no"`
	StockCreatorMchid string `json:"stock_creator_mchid"`
	StockId           string `json:"stock_id"`
}

type SendCouponStockRsp

type SendCouponStockRsp struct {
	CouponId string `json:"coupon_id"`
}

Jump to

Keyboard shortcuts

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