wxpay

package
v0.0.0-...-8837064 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2021 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Fail                       = "FAIL"
	Success                    = "SUCCESS"
	HMACSHA256                 = "HMAC-SHA256"
	MD5                        = "MD5"
	Sign                       = "sign"
	MicroPayUrl                = "https://api.mch.weixin.qq.com/pay/micropay"
	UnifiedOrderUrl            = "https://api.mch.weixin.qq.com/pay/unifiedorder"
	OrderQueryUrl              = "https://api.mch.weixin.qq.com/pay/orderquery"
	ReverseUrl                 = "https://api.mch.weixin.qq.com/secapi/pay/reverse"
	CloseOrderUrl              = "https://api.mch.weixin.qq.com/pay/closeorder"
	RefundUrl                  = "https://api.mch.weixin.qq.com/secapi/pay/refund"
	RefundQueryUrl             = "https://api.mch.weixin.qq.com/pay/refundquery"
	DownloadBillUrl            = "https://api.mch.weixin.qq.com/pay/downloadbill"
	DownloadFundFlowUrl        = "https://api.mch.weixin.qq.com/pay/downloadfundflow"
	ReportUrl                  = "https://api.mch.weixin.qq.com/payitil/report"
	ShortUrl                   = "https://api.mch.weixin.qq.com/tools/shorturl"
	AuthCodeToOpenidUrl        = "https://api.mch.weixin.qq.com/tools/authcodetoopenid"
	SandboxMicroPayUrl         = "https://api.mch.weixin.qq.com/sandboxnew/pay/micropay"
	SandboxUnifiedOrderUrl     = "https://api.mch.weixin.qq.com/sandboxnew/pay/unifiedorder"
	SandboxOrderQueryUrl       = "https://api.mch.weixin.qq.com/sandboxnew/pay/orderquery"
	SandboxReverseUrl          = "https://api.mch.weixin.qq.com/sandboxnew/secapi/pay/reverse"
	SandboxCloseOrderUrl       = "https://api.mch.weixin.qq.com/sandboxnew/pay/closeorder"
	SandboxRefundUrl           = "https://api.mch.weixin.qq.com/sandboxnew/secapi/pay/refund"
	SandboxRefundQueryUrl      = "https://api.mch.weixin.qq.com/sandboxnew/pay/refundquery"
	SandboxDownloadBillUrl     = "https://api.mch.weixin.qq.com/sandboxnew/pay/downloadbill"
	SandboxDownloadFundFlowUrl = "https://api.mch.weixin.qq.com/sandboxnew/pay/downloadfundflow"
	SandboxReportUrl           = "https://api.mch.weixin.qq.com/sandboxnew/payitil/report"
	SandboxShortUrl            = "https://api.mch.weixin.qq.com/sandboxnew/tools/shorturl"
	SandboxAuthCodeToOpenidUrl = "https://api.mch.weixin.qq.com/sandboxnew/tools/authcodetoopenid"
	SandboxGetSignKeyUrl       = "https://api.mch.weixin.qq.com/sandboxnew/pay/getsignkey"
)

Variables

This section is empty.

Functions

func GenOrderID

func GenOrderID() string

func MD5Sum

func MD5Sum(str string) string

MD5 md5加密

func MapToXml

func MapToXml(params Params) string

Types

type Client

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

func NewClient

func NewClient(appID string, mchID string, paySignKey string, isSanbox bool) (*Client, error)

创建微信支付客户端

func (*Client) AuthCodeToOpenid

func (c *Client) AuthCodeToOpenid(params Params) (Params, error)

授权码查询OPENID接口

func (*Client) CloseOrder

func (c *Client) CloseOrder(params Params) (Params, error)

关闭订单

func (*Client) DownloadBill

func (c *Client) DownloadBill(params Params) (Params, error)

对账单下载

func (*Client) DownloadFundFlow

func (c *Client) DownloadFundFlow(params Params) (Params, error)

func (*Client) GetSandboxSignKey

func (c *Client) GetSandboxSignKey() (string, error)

获取沙箱 sandbox_signkey

func (*Client) MicroPay

func (c *Client) MicroPay(params Params) (Params, error)

刷卡支付

func (*Client) OnPayCallback

func (c *Client) OnPayCallback(xmlStr string) (Params, error)

支付结果通知

func (*Client) OrderQuery

func (c *Client) OrderQuery(params Params) (Params, error)

订单查询

func (*Client) Refund

func (c *Client) Refund(params Params) (Params, error)

退款

func (*Client) RefundQuery

func (c *Client) RefundQuery(params Params) (Params, error)

退款查询

func (*Client) Report

func (c *Client) Report(params Params) (Params, error)

交易保障

func (*Client) Reverse

func (c *Client) Reverse(params Params) (Params, error)

撤销订单

func (*Client) SetCertData

func (c *Client) SetCertData(certPath string) error

设置证书

func (*Client) SetHttpConnectTimeoutMs

func (c *Client) SetHttpConnectTimeoutMs(ms int)

func (*Client) SetHttpReadTimeoutMs

func (c *Client) SetHttpReadTimeoutMs(ms int)

func (*Client) SetSignType

func (c *Client) SetSignType(signType string)

func (*Client) ShortUrl

func (c *Client) ShortUrl(params Params) (Params, error)

转换短链接

func (*Client) Sign

func (c *Client) Sign(params Params) string

签名

func (*Client) UnifiedOrder

func (c *Client) UnifiedOrder(params Params) (Params, error)

统一下单

func (*Client) ValidSign

func (c *Client) ValidSign(params Params) bool

验证签名

type Notifies

type Notifies struct{}

func (*Notifies) NotOK

func (n *Notifies) NotOK(errMsg string) string

通知不成功

func (*Notifies) OK

func (n *Notifies) OK() string

通知成功

type Params

type Params map[string]string

func XmlToMap

func XmlToMap(xmlStr string) Params

func (Params) ContainsKey

func (p Params) ContainsKey(key string) bool

判断key是否存在

func (Params) GetInt64

func (p Params) GetInt64(k string) int64

func (Params) GetString

func (p Params) GetString(k string) string

func (Params) SetInt64

func (p Params) SetInt64(k string, i int64) Params

func (Params) SetString

func (p Params) SetString(k, s string) Params

map本来已经是引用类型了,所以不需要 *Params

Jump to

Keyboard shortcuts

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