wechat

package
v0.0.0-...-89bd553 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2022 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const NonceLen = 32
View Source
const SignTypeMd5 = "MD5"
View Source
const SignTypeSha = "HMAC-SHA256"

Variables

This section is empty.

Functions

This section is empty.

Types

type Base

type Base struct {
	Config *Config
	Http   http.Client
	// common properties
	GatewayUrl string
}

func NewBase

func NewBase(config *Config) *Base

func (*Base) BuildSign

func (b *Base) BuildSign(timestamp string, retMap map[string]interface{}) string

func (*Base) GetFullGatewayUrl

func (b *Base) GetFullGatewayUrl(method string) string

func (*Base) MakeSign

func (b *Base) MakeSign(signStr string) string

func (*Base) Request

func (b *Base) Request(uri string, params map[string]string) (*BaseResponse, error)

type BaseResponse

type BaseResponse struct {
	Resp string
}

func NewBaseResponse

func NewBaseResponse(resp string) *BaseResponse

func (*BaseResponse) ToJson

func (w *BaseResponse) ToJson() (string, error)

func (*BaseResponse) ToMap

func (w *BaseResponse) ToMap() (map[string]interface{}, error)

func (*BaseResponse) ToXml

func (w *BaseResponse) ToXml() (string, error)

type CancelTrade

type CancelTrade struct {
	Base *Base
}

*

  • @package gateway.wechat
  • @author : Benny
  • @email : benny_a8@qq.com
  • @date : 2020/04/11 *

func (CancelTrade) BuildParams

func (w CancelTrade) BuildParams(params map[string]string) map[string]string

func (CancelTrade) Request

func (w CancelTrade) Request(params map[string]string) *payloads.UnionPaymentResult

type CloseTrade

type CloseTrade struct {
	Base *Base
}

*

  • @package gateway.wechat
  • @author : Benny
  • @email : benny_a8@qq.com
  • @date : 2020/04/11 *

func (CloseTrade) BuildParams

func (w CloseTrade) BuildParams(params map[string]string) map[string]string

func (CloseTrade) Request

func (w CloseTrade) Request(params map[string]string) *payloads.UnionPaymentResult

type CommentQuery

type CommentQuery struct {
	Base *Base
}

*

  • @package gateway.wechat
  • @author : Benny
  • @email : benny_a8@qq.com
  • @date : 2020/04/11 *

func (CommentQuery) BuildParams

func (w CommentQuery) BuildParams(params map[string]string) map[string]string

func (CommentQuery) Request

func (w CommentQuery) Request(params map[string]string) *payloads.UnionPaymentResult

type Config

type Config struct {
	UseSandbox  bool     `json:"use_sandbox" yaml:"use_sandbox"`
	UseBackup   bool     `json:"use_backup" yaml:"use_backup"`
	AppId       string   `json:"app_id" yaml:"app_id"`
	SubAppId    string   `json:"sub_app_id" yaml:"sub_app_id"`
	SubMchId    string   `json:"sub_mch_id" yaml:"sub_mch_id"`
	MchId       string   `json:"mch_id" yaml:"mch_id"`
	Md5Key      string   `json:"md5_key" yaml:"md5_key"`
	AppCertPem  string   `json:"app_cert_pem" yaml:"app_cert_pem"`
	AppKeyPem   string   `json:"app_key_pem" yaml:"app_key_pem"`
	SignType    string   `json:"sign_type" yaml:"sign_type"`
	LimitPay    []string `json:"limit_pay" yaml:"limit_pay"`
	FeeType     string   `json:"fee_type" yaml:"fee_type"`
	ReturnRaw   bool     `json:"return_raw" yaml:"return_raw"`
	NotifyUrl   string   `json:"notify_url" yaml:"notify_url"`
	RedirectUrl string   `json:"redirect_url" yaml:"redirect_url"`
	SandboxKey  string   `json:"sandbox_key" yaml:"sandbox_key"`
}

func NewConfigWithJson

func NewConfigWithJson(content []byte) (*Config, error)

func NewConfigWithYaml

func NewConfigWithYaml(content []byte) (*Config, error)

func (Config) CheckConfig

func (c Config) CheckConfig() error

func (Config) ParseConfig

func (c Config) ParseConfig() interface{}

type Coupon

type Coupon struct {
	Base *Base
}

*

  • @package gateway.wechat
  • @author : Benny
  • @email : benny_a8@qq.com
  • @date : 2020/04/11 *

func (Coupon) BuildParams

func (w Coupon) BuildParams(params map[string]string) map[string]string

func (Coupon) Request

func (w Coupon) Request(params map[string]string) *payloads.UnionPaymentResult

type CouponQuery

type CouponQuery struct {
	Base *Base
}

*

  • @package gateway.wechat
  • @author : Benny
  • @email : benny_a8@qq.com
  • @date : 2020/04/11 *

func (CouponQuery) BuildParams

func (w CouponQuery) BuildParams(params map[string]string) map[string]string

func (CouponQuery) Request

func (w CouponQuery) Request(params map[string]string) *payloads.UnionPaymentResult

type Gateway

type Gateway struct {
	Base *Base
}

func (*Gateway) Request

type GroupRedPack

type GroupRedPack struct {
	Base *Base
}

*

  • @package gateway.wechat
  • @author : Benny
  • @email : benny_a8@qq.com
  • @date : 2020/04/11 *

func (GroupRedPack) BuildParams

func (w GroupRedPack) BuildParams(params map[string]string) map[string]string

func (GroupRedPack) Request

func (w GroupRedPack) Request(params map[string]string) *payloads.UnionPaymentResult

type PayApp

type PayApp struct {
	Base *Base
}

*

  • @package gateway.wechat
  • @author : Benny
  • @email : benny_a8@qq.com
  • @date : 2020/04/11
  • @modified: 2020/04/11 *

func (PayApp) BuildParams

func (w PayApp) BuildParams(params map[string]string) map[string]string

func (PayApp) Request

func (w PayApp) Request(params map[string]string) *payloads.UnionPaymentResult

type PayBar

type PayBar struct {
	Base *Base
}

func (PayBar) BuildParams

func (w PayBar) BuildParams(params map[string]string) map[string]string

func (PayBar) Request

func (w PayBar) Request(params map[string]string) *payloads.UnionPaymentResult

type PayLite

type PayLite struct {
	Base *Base
}

func (PayLite) BuildParams

func (w PayLite) BuildParams(params map[string]string) map[string]string

func (PayLite) Request

func (w PayLite) Request(params map[string]string) *payloads.UnionPaymentResult

type PayPub

type PayPub struct {
	Base *Base
}

func (PayPub) BuildParams

func (w PayPub) BuildParams(params map[string]string) map[string]string

func (PayPub) ParseResult

func (w PayPub) ParseResult(response payloads.IGatewayResponse) map[string]string

func (PayPub) Request

func (w PayPub) Request(params map[string]string) *payloads.UnionPaymentResult

type PayQr

type PayQr struct {
	Base *Base
}

func (PayQr) BuildParams

func (w PayQr) BuildParams(params map[string]string) map[string]string

func (PayQr) Request

func (w PayQr) Request(params map[string]string) *payloads.UnionPaymentResult

type PayWap

type PayWap struct {
	Base *Base
}

func (PayWap) BuildParams

func (w PayWap) BuildParams(params map[string]string) map[string]string

func (PayWap) Request

func (w PayWap) Request(params map[string]string) *payloads.UnionPaymentResult

type QueryRefund

type QueryRefund struct {
	Base *Base
}

*

  • @package gateway.wechat
  • @author : Benny
  • @email : benny_a8@qq.com
  • @created : 2021/03/13 *

func (QueryRefund) BuildParams

func (w QueryRefund) BuildParams(params map[string]string) map[string]string

func (QueryRefund) Request

func (w QueryRefund) Request(params map[string]string) *payloads.UnionPaymentResult

type QueryTrade

type QueryTrade struct {
	Base *Base
}

*

  • @package gateway.wechat
  • @author : Benny
  • @email : benny_a8@qq.com
  • @created : 2021/03/13 *

func (QueryTrade) BuildParams

func (w QueryTrade) BuildParams(params map[string]string) map[string]string

func (QueryTrade) Request

func (w QueryTrade) Request(params map[string]string) *payloads.UnionPaymentResult

type Refund

type Refund struct {
	Base *Base
}

*

  • @package gateway.wechat
  • @author : Benny
  • @email : benny_a8@qq.com
  • @date : 2021/03/13 *

func (Refund) BuildParams

func (w Refund) BuildParams(params map[string]string) map[string]string

func (Refund) Request

func (w Refund) Request(params map[string]string) *payloads.UnionPaymentResult

type WxNotifyPayResponse

type WxNotifyPayResponse struct {
	AppId         string `json:"appid" xml:"appid"`
	Attach        string `json:"attach" xml:"attach"`
	BankType      string `json:"bank_type" xml:"bank_type"`
	CouponCount   string `json:"coupon_count" xml:"coupon_count"`
	CouponFee     string `json:"coupon_fee" xml:"coupon_fee"`
	CouponId      string `json:"coupon_id" xml:"coupon_id"`
	CouponType    string `json:"coupon_type" xml:"coupon_type"`
	IsSubscribe   string `json:"is_subscribe" xml:"is_subscribe"`
	MchId         string `json:"mch_id" xml:"mch_id"`
	NonceStr      string `json:"nonce_str" xml:"nonce_str"`
	Openid        string `json:"openid" xml:"openid"`
	OutTradeNo    string `json:"out_trade_no" xml:"out_trade_no"`
	ResultCode    string `json:"result_code" xml:"result_code"`
	ReturnCode    string `json:"return_code" xml:"return_code"`
	Sign          string `json:"sign" xml:"sign"`
	TimeEnd       string `json:"time_end" xml:"time_end"`
	TotalFee      string `json:"total_fee" xml:"total_fee"`
	TradeType     string `json:"trade_type" xml:"trade_type"`
	TransactionId string `json:"transaction_id" xml:"transaction_id"`
}

type WxNotifyRefundResponse

type WxNotifyRefundResponse struct {
	AppId      string `json:"appid" xml:"app_id"`
	MchId      string `json:"mch_id" xml:"mch_id"`
	NonceStr   string `json:"nonce_str" xml:"nonce_str"`
	ReturnCode string `json:"return_code" xml:"return_code"`
	ReqInfo    string `json:"req_info" xml:"req_info"`
}

Jump to

Keyboard shortcuts

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