Documentation ¶
Index ¶
- Constants
- func DecodeBytesToUint32(b []byte) uint32
- func EncodeUint32ToBytes(i uint32) []byte
- func EventDecrypt(receiveID, encodingAESKey, cipherText string) ([]byte, error)
- func EventEncrypt(receiveID, encodingAESKey, nonce string, plainText []byte) (*xcrypto.CipherText, error)
- func EventReply(receiveID, token, encodingAESKey string, msg value.V) (value.V, error)
- func SignWithSHA1(token string, items ...string) string
- func ValueToXML(vals value.V) (string, error)
- func XMLToValue(b []byte) (value.V, error)
- type APIResult
- type AuthScope
- type Corp
- func (c *Corp) AccessToken(ctx context.Context) (gjson.Result, error)
- func (c *Corp) AutoLoadAccessToken(fn func(ctx context.Context, c *Corp) (string, error), interval time.Duration) error
- func (c *Corp) CorpID() string
- func (c *Corp) DecodeEventMsg(signature, timestamp, nonce, encryptMsg string) (value.V, error)
- func (c *Corp) GetBuffer(ctx context.Context, path string, query url.Values) ([]byte, error)
- func (c *Corp) GetJSON(ctx context.Context, path string, query url.Values) (gjson.Result, error)
- func (c *Corp) OAuthURL(scope AuthScope, redirectURI, state, agentID string) string
- func (c *Corp) PostBuffer(ctx context.Context, path string, params lib.X) ([]byte, error)
- func (c *Corp) PostJSON(ctx context.Context, path string, params lib.X) (gjson.Result, error)
- func (c *Corp) ReplyEventMsg(msg value.V) (value.V, error)
- func (c *Corp) Secret() string
- func (c *Corp) Upload(ctx context.Context, reqPath, fieldName, filePath string, formData lib.Form, ...) (gjson.Result, error)
- func (c *Corp) UploadWithReader(ctx context.Context, reqPath, fieldName, fileName string, reader io.Reader, ...) (gjson.Result, error)
- func (c *Corp) VerifyURL(signature, timestamp, nonce, echoStr string) (string, error)
- type CorpOption
- type DownloadResult
- type MPOption
- func WithMPAesKey(serialNO, key string) MPOption
- func WithMPClient(cli *http.Client) MPOption
- func WithMPLogger(fn func(ctx context.Context, err error, data map[string]string)) MPOption
- func WithMPPrivateKey(key *xcrypto.PrivateKey) MPOption
- func WithMPPublicKey(serialNO string, key *xcrypto.PublicKey) MPOption
- func WithMPSrvCfg(token, aeskey string) MPOption
- type MiniProgram
- func (mp *MiniProgram) AccessToken(ctx context.Context) (gjson.Result, error)
- func (mp *MiniProgram) AppID() string
- func (mp *MiniProgram) AutoLoadAccessToken(interval time.Duration) error
- func (mp *MiniProgram) Code2Session(ctx context.Context, code string) (gjson.Result, error)
- func (mp *MiniProgram) CustomAccessTokenLoad(fn func(ctx context.Context, mp *MiniProgram) (string, error), ...) error
- func (mp *MiniProgram) DecodeEncryptData(sessionKey, iv, encryptData string) ([]byte, error)
- func (mp *MiniProgram) DecodeEventMsg(signature, timestamp, nonce, encryptMsg string) (value.V, error)
- func (mp *MiniProgram) GetBuffer(ctx context.Context, path string, query url.Values) ([]byte, error)
- func (mp *MiniProgram) GetJSON(ctx context.Context, path string, query url.Values) (gjson.Result, error)
- func (mp *MiniProgram) PostBuffer(ctx context.Context, path string, params lib.X) ([]byte, error)
- func (mp *MiniProgram) PostJSON(ctx context.Context, path string, params lib.X) (gjson.Result, error)
- func (mp *MiniProgram) ReplyEventMsg(msg value.V) (value.V, error)
- func (mp *MiniProgram) SafePostBuffer(ctx context.Context, path string, params lib.X) ([]byte, error)
- func (mp *MiniProgram) SafePostJSON(ctx context.Context, path string, params lib.X) (gjson.Result, error)
- func (mp *MiniProgram) Secret() string
- func (mp *MiniProgram) StableAccessToken(ctx context.Context, forceRefresh bool) (gjson.Result, error)
- func (mp *MiniProgram) Upload(ctx context.Context, reqPath, fieldName, filePath string, formData lib.Form, ...) (gjson.Result, error)
- func (mp *MiniProgram) UploadWithReader(ctx context.Context, reqPath, fieldName, fileName string, reader io.Reader, ...) (gjson.Result, error)
- func (mp *MiniProgram) VerifyURL(signature, timestamp, nonce string) error
- type OAOption
- type OfficialAccount
- func (oa *OfficialAccount) AccessToken(ctx context.Context) (gjson.Result, error)
- func (oa *OfficialAccount) AppID() string
- func (oa *OfficialAccount) AutoLoadAccessToken(interval time.Duration) error
- func (oa *OfficialAccount) Code2OAuthToken(ctx context.Context, code string) (gjson.Result, error)
- func (oa *OfficialAccount) CustomAccessTokenLoad(fn func(ctx context.Context, oa *OfficialAccount) (string, error), ...) error
- func (oa *OfficialAccount) DecodeEventMsg(signature, timestamp, nonce, encryptMsg string) (value.V, error)
- func (oa *OfficialAccount) GetBuffer(ctx context.Context, path string, query url.Values) ([]byte, error)
- func (oa *OfficialAccount) GetJSON(ctx context.Context, path string, query url.Values) (gjson.Result, error)
- func (oa *OfficialAccount) OAuth2URL(scope AuthScope, redirectURI, state string) string
- func (oa *OfficialAccount) PostBuffer(ctx context.Context, path string, params lib.X) ([]byte, error)
- func (oa *OfficialAccount) PostJSON(ctx context.Context, path string, params lib.X) (gjson.Result, error)
- func (oa *OfficialAccount) RefreshOAuthToken(ctx context.Context, refreshToken string) (gjson.Result, error)
- func (oa *OfficialAccount) ReplyEventMsg(msg value.V) (value.V, error)
- func (oa *OfficialAccount) Secret() string
- func (oa *OfficialAccount) StableAccessToken(ctx context.Context, forceRefresh bool) (gjson.Result, error)
- func (oa *OfficialAccount) SubscribeMsgAuthURL(scene, templateID, redirectURL, reserved string) string
- func (oa *OfficialAccount) Upload(ctx context.Context, reqPath, fieldName, filePath string, formData lib.Form, ...) (gjson.Result, error)
- func (oa *OfficialAccount) UploadWithReader(ctx context.Context, reqPath, fieldName, fileName string, reader io.Reader, ...) (gjson.Result, error)
- func (oa *OfficialAccount) VerifyURL(signature, timestamp, nonce string) error
- type Pay
- func (p *Pay) APPAPI(appid, prepayID string) value.V
- func (p *Pay) ApiKey() string
- func (p *Pay) DecryptRefund(encrypt string) (value.V, error)
- func (p *Pay) JSAPI(appid, prepayID string) value.V
- func (p *Pay) MchID() string
- func (p *Pay) MinipRedpackJSAPI(appid, pkg string) value.V
- func (p *Pay) PostBuffer(ctx context.Context, path string, params value.V) ([]byte, error)
- func (p *Pay) PostTLSXML(ctx context.Context, path string, params value.V) (value.V, error)
- func (p *Pay) PostTlsBuffer(ctx context.Context, path string, params value.V) ([]byte, error)
- func (p *Pay) PostXML(ctx context.Context, path string, params value.V) (value.V, error)
- func (p *Pay) Sign(v value.V) string
- func (p *Pay) Verify(v value.V) error
- type PayOption
- type PayV3
- func (p *PayV3) APPAPI(appid, prepayID string) (value.V, error)
- func (p *PayV3) ApiKey() string
- func (p *PayV3) Authorization(method, path string, query url.Values, body string) (string, error)
- func (p *PayV3) AutoLoadCerts() error
- func (p *PayV3) Download(ctx context.Context, downloadURL string, w io.Writer) error
- func (p *PayV3) GetJSON(ctx context.Context, path string, query url.Values) (*APIResult, error)
- func (p *PayV3) JSAPI(appid, prepayID string) (value.V, error)
- func (p *PayV3) MchID() string
- func (p *PayV3) PostJSON(ctx context.Context, path string, params lib.X) (*APIResult, error)
- func (p *PayV3) Upload(ctx context.Context, reqPath, fieldName, filePath, metadata string, ...) (*APIResult, error)
- func (p *PayV3) UploadWithReader(ctx context.Context, reqPath, fieldName, fileName string, reader io.Reader, ...) (*APIResult, error)
- func (p *PayV3) Verify(ctx context.Context, header http.Header, body []byte) error
- type PayV3Option
- type SafeMode
- type ServerConfig
- type SignAlgo
Constants ¶
const ( HeaderRequestID = "Request-ID" HeaderPayNonce = "Wechatpay-Nonce" HeaderPayTimestamp = "Wechatpay-Timestamp" HeaderPaySerial = "Wechatpay-Serial" HeaderPaySignature = "Wechatpay-Signature" HeaderMPAppID = "Wechatmp-Appid" HeaderMPTimestamp = "Wechatmp-TimeStamp" HeaderMPSerial = "Wechatmp-Serial" HeaderMPSignature = "Wechatmp-Signature" HeaderMPSerialDeprecated = "Wechatmp-Serial-Deprecated" HeaderMPSignatureDeprecated = "Wechatmp-Signature-Deprecated" )
const ( ResultSuccess = "SUCCESS" ResultFail = "FAIL" ResultNull = "RESULT NULL" // 查询结果为空 )
支付v2返回结果
const ( SystemError = "SYSTEMERROR" // 系统繁忙,请稍后再试 ParamError = "PARAM_ERROR" // 参数错误 SignError = "SIGNERROR" // 签名错误 LackParams = "LACK_PARAMS" // 缺少参数 NotUTF8 = "NOT_UTF8" // 编码格式错误 NoAuth = "NOAUTH" // 商户无权限 NotFound = "NOT_FOUND" // 数据不存在 NotEnough = "NOTENOUGH" // 余额不足 NotSupportCard = "NOTSUPORTCARD" // 不支持的卡类型 UserPaying = "USERPAYING" // 用户支付中,需要输入密码 AppIDNotExist = "APPID_NOT_EXIST" // APPID不存在 MchIDNotExist = "MCHID_NOT_EXIST" // MCHID不存在 AppIDMchIDNotMatch = "APPID_MCHID_NOT_MATCH" // appid和mch_id不匹配 AuthCodeExpire = "AUTHCODEEXPIRE" // 二维码已过期,请用户在微信上刷新后再试 AuthCodeError = "AUTH_CODE_ERROR" // 付款码参数错误 AuthCodeInvalid = "AUTH_CODE_INVALID" // 付款码检验错误 BankError = "BANKERROR" // 银行系统异常 OrderNotExist = "ORDERNOTEXIST" // 订单不存在 OrderPaid = "ORDERPAID" // 订单已支付 OrderClosed = "ORDERCLOSED" // 订单已关闭 OrderReversed = "ORDERREVERSED" // 订单已撤销 RefundNotExist = "REFUNDNOTEXIST" // 退款不存在 BuyerMismatch = "BUYER_MISMATCH" // 支付账号错误 OutTradeNoUsed = "OUT_TRADE_NO_USED" // 商户订单号重复 XmlFormatError = "XML_FORMAT_ERROR" // XML格式错误 RequestPostMethod = "REQUIRE_POST_METHOD" // 请使用post方法 PostDataEmpty = "POST_DATA_EMPTY" // post数据为空 InvalidRequest = "INVALID_REQUEST" // 无效请求 TradeError = "TRADE_ERROR" // 交易错误 URLFormatError = "URLFORMATERROR" // URL格式错误 )
支付v2错误码
const AccessToken = "access_token"
Variables ¶
This section is empty.
Functions ¶
func DecodeBytesToUint32 ¶
DecodeBytesToUint32 从 4 字节的网络字节序里解析出整数 uint32
func EncodeUint32ToBytes ¶
EncodeUint32ToBytes 把整数 uint32 格式化成 4 字节的网络字节序
func EventDecrypt ¶
EventDecrypt 事件消息解密 [参考](https://developer.work.weixin.qq.com/document/path/90968)
func EventEncrypt ¶
func EventEncrypt(receiveID, encodingAESKey, nonce string, plainText []byte) (*xcrypto.CipherText, error)
EventEncrypt 时间消息加密 [参考](https://developer.work.weixin.qq.com/document/path/90968)
func EventReply ¶
func ValueToXML ¶ added in v1.1.1
ValueToXML value to xml
Types ¶
type Corp ¶
type Corp struct {
// contains filtered or unexported fields
}
Corp 企业微信(企业内部开发)
func NewCorp ¶
func NewCorp(corpid, secret string, options ...CorpOption) *Corp
NewCorp 生成一个企业微信(企业内部开发)实例
func (*Corp) AccessToken ¶
AccessToken 获取接口调用凭据
func (*Corp) AutoLoadAccessToken ¶ added in v1.2.0
func (c *Corp) AutoLoadAccessToken(fn func(ctx context.Context, c *Corp) (string, error), interval time.Duration) error
AutoLoadAccessToken 自动加载AccessToken
func (*Corp) DecodeEventMsg ¶
DecodeEventMsg 解析事件消息,使用:msg_signature、timestamp、nonce、msg_encrypt [参考](https://developer.work.weixin.qq.com/document/path/90930)
func (*Corp) OAuthURL ¶
OAuthURL 生成网页授权URL [参考](https://developer.work.weixin.qq.com/document/path/91022)
func (*Corp) PostBuffer ¶
PostBuffer POST请求获取buffer (如:获取二维码)
func (*Corp) ReplyEventMsg ¶
ReplyEventMsg 事件消息回复
func (*Corp) Upload ¶
func (c *Corp) Upload(ctx context.Context, reqPath, fieldName, filePath string, formData lib.Form, query url.Values) (gjson.Result, error)
Upload 上传媒体资源
type CorpOption ¶
type CorpOption func(c *Corp)
CorpOption 企业微信设置项
func WithCorpClient ¶ added in v1.2.0
func WithCorpClient(cli *http.Client) CorpOption
WithCorpClient 设置企业微信请求的 HTTP Client
func WithCorpLogger ¶
WithCorpLogger 设置企业微信日志记录
func WithCorpSrvCfg ¶
func WithCorpSrvCfg(token, aeskey string) CorpOption
WithCorpSrvCfg 设置企业微信服务器配置 [参考](https://developer.work.weixin.qq.com/document/path/90968)
type DownloadResult ¶
DownloadResult 资源下载结果 (支付v3)
type MPOption ¶
type MPOption func(mp *MiniProgram)
MPOption 小程序设置项
func WithMPAesKey ¶
WithMPAesKey 设置小程序 AES-GCM 加密Key
func WithMPClient ¶ added in v1.2.0
WithMPClient 设置小程序请求的 HTTP Client
func WithMPLogger ¶
WithMPLogger 设置小程序日志记录
func WithMPPrivateKey ¶
func WithMPPrivateKey(key *xcrypto.PrivateKey) MPOption
WithMPPrivateKey 设置小程序RSA私钥
func WithMPPublicKey ¶
WithMPPublicKey 设置小程序平台RSA公钥
func WithMPSrvCfg ¶
WithMPSrvCfg 设置小程序服务器配置 [参考](https://developers.weixin.qq.com/miniprogram/dev/framework/server-ability/message-push.html)
type MiniProgram ¶
type MiniProgram struct {
// contains filtered or unexported fields
}
MiniProgram 小程序
func NewMiniProgram ¶
func NewMiniProgram(appid, secret string, options ...MPOption) *MiniProgram
NewMiniProgram 生成一个小程序实例
func (*MiniProgram) AccessToken ¶
AccessToken 获取接口调用凭据
func (*MiniProgram) AutoLoadAccessToken ¶ added in v1.1.0
func (mp *MiniProgram) AutoLoadAccessToken(interval time.Duration) error
AutoLoadAccessToken 自动加载AccessToken(使用StableAccessToken接口)
func (*MiniProgram) Code2Session ¶
Code2Session 通过临时登录凭证code完成登录流程
func (*MiniProgram) CustomAccessTokenLoad ¶ added in v1.2.0
func (mp *MiniProgram) CustomAccessTokenLoad(fn func(ctx context.Context, mp *MiniProgram) (string, error), interval time.Duration) error
CustomAccessTokenLoad 自定义加载AccessToken
func (*MiniProgram) DecodeEncryptData ¶
func (mp *MiniProgram) DecodeEncryptData(sessionKey, iv, encryptData string) ([]byte, error)
DecodeEncryptData 解析加密数据,如:授权的用户信息和手机号 [参考](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html)
func (*MiniProgram) DecodeEventMsg ¶
func (mp *MiniProgram) DecodeEventMsg(signature, timestamp, nonce, encryptMsg string) (value.V, error)
DecodeEventMsg 解析事件消息,使用:msg_signature、timestamp、nonce、msg_encrypt [参考](https://developers.weixin.qq.com/miniprogram/dev/framework/server-ability/message-push.html)
func (*MiniProgram) GetBuffer ¶
func (mp *MiniProgram) GetBuffer(ctx context.Context, path string, query url.Values) ([]byte, error)
GetBuffer GET请求获取buffer (如:获取媒体资源)
func (*MiniProgram) GetJSON ¶
func (mp *MiniProgram) GetJSON(ctx context.Context, path string, query url.Values) (gjson.Result, error)
GetJSON GET请求JSON数据
func (*MiniProgram) PostBuffer ¶
PostBuffer POST请求获取buffer (如:获取二维码)
func (*MiniProgram) PostJSON ¶
func (mp *MiniProgram) PostJSON(ctx context.Context, path string, params lib.X) (gjson.Result, error)
PostJSON POST请求JSON数据
func (*MiniProgram) ReplyEventMsg ¶
ReplyEventMsg 事件消息回复
func (*MiniProgram) SafePostBuffer ¶
func (mp *MiniProgram) SafePostBuffer(ctx context.Context, path string, params lib.X) ([]byte, error)
SafePostBuffer POST请求获取buffer (如:获取二维码) 安全鉴权模式 https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc/getting_started/api_signature.html 支持的api可参考 https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc
func (*MiniProgram) SafePostJSON ¶
func (mp *MiniProgram) SafePostJSON(ctx context.Context, path string, params lib.X) (gjson.Result, error)
SafePostJSON POST请求JSON数据 安全鉴权模式 https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc/getting_started/api_signature.html 支持的api可参考 https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc
func (*MiniProgram) StableAccessToken ¶
func (mp *MiniProgram) StableAccessToken(ctx context.Context, forceRefresh bool) (gjson.Result, error)
StableAccessToken 获取稳定版接口调用凭据,有两种调用模式: 1. 普通模式,access_token有效期内重复调用该接口不会更新access_token,绝大部分场景下使用该模式; 2. 强制刷新模式,会导致上次获取的access_token失效,并返回新的access_token
func (*MiniProgram) Upload ¶
func (mp *MiniProgram) Upload(ctx context.Context, reqPath, fieldName, filePath string, formData lib.Form, query url.Values) (gjson.Result, error)
Upload 上传媒体资源
func (*MiniProgram) UploadWithReader ¶ added in v1.2.0
func (mp *MiniProgram) UploadWithReader(ctx context.Context, reqPath, fieldName, fileName string, reader io.Reader, formData lib.Form, query url.Values) (gjson.Result, error)
UploadWithReader 上传媒体资源
func (*MiniProgram) VerifyURL ¶
func (mp *MiniProgram) VerifyURL(signature, timestamp, nonce string) error
VerifyURL 服务器URL验证,使用:signature、timestamp、nonce(若验证成功,请原样返回echostr参数内容) [参考](https://developers.weixin.qq.com/miniprogram/dev/framework/server-ability/message-push.html)
type OAOption ¶
type OAOption func(oa *OfficialAccount)
OAOption 公众号设置项
func WithOAClient ¶ added in v1.2.0
WithOAClient 设置公众号请求的 HTTP Client
func WithOALogger ¶
WithOALogger 设置公众号日志记录
func WithOASrvCfg ¶
WithOASrvCfg 设置公众号服务器配置 [参考](https://developers.weixin.qq.com/doc/offiaccount/Basic_Information/Access_Overview.html)
type OfficialAccount ¶
type OfficialAccount struct {
// contains filtered or unexported fields
}
OfficialAccount 微信公众号
func NewOfficialAccount ¶
func NewOfficialAccount(appid, secret string, options ...OAOption) *OfficialAccount
NewOfficialAccount 生成一个公众号实例
func (*OfficialAccount) AccessToken ¶
AccessToken 获取接口调用凭据
func (*OfficialAccount) AutoLoadAccessToken ¶ added in v1.1.0
func (oa *OfficialAccount) AutoLoadAccessToken(interval time.Duration) error
AutoLoadAccessToken 自动加载AccessToken(使用StableAccessToken接口)
func (*OfficialAccount) Code2OAuthToken ¶
Code2OAuthToken 获取网页授权Token
func (*OfficialAccount) CustomAccessTokenLoad ¶ added in v1.2.0
func (oa *OfficialAccount) CustomAccessTokenLoad(fn func(ctx context.Context, oa *OfficialAccount) (string, error), interval time.Duration) error
CustomAccessTokenLoad 自定义加载AccessToken
func (*OfficialAccount) DecodeEventMsg ¶
func (oa *OfficialAccount) DecodeEventMsg(signature, timestamp, nonce, encryptMsg string) (value.V, error)
DecodeEventMsg 解析事件消息,使用:msg_signature、timestamp、nonce、msg_encrypt [参考](https://developers.weixin.qq.com/miniprogram/dev/framework/server-ability/message-push.html)
func (*OfficialAccount) GetBuffer ¶
func (oa *OfficialAccount) GetBuffer(ctx context.Context, path string, query url.Values) ([]byte, error)
GetBuffer GET请求获取buffer (如:获取媒体资源)
func (*OfficialAccount) GetJSON ¶
func (oa *OfficialAccount) GetJSON(ctx context.Context, path string, query url.Values) (gjson.Result, error)
GetJSON GET请求JSON数据
func (*OfficialAccount) OAuth2URL ¶
func (oa *OfficialAccount) OAuth2URL(scope AuthScope, redirectURI, state string) string
OAuth2URL 生成网页授权URL [参考](https://developers.weixin.qq.com/doc/offiaccount/OA_Web_Apps/Wechat_webpage_authorization.html)
func (*OfficialAccount) PostBuffer ¶
func (oa *OfficialAccount) PostBuffer(ctx context.Context, path string, params lib.X) ([]byte, error)
PostBuffer POST请求获取buffer (如:获取二维码)
func (*OfficialAccount) PostJSON ¶
func (oa *OfficialAccount) PostJSON(ctx context.Context, path string, params lib.X) (gjson.Result, error)
PostJSON POST请求JSON数据
func (*OfficialAccount) RefreshOAuthToken ¶
func (oa *OfficialAccount) RefreshOAuthToken(ctx context.Context, refreshToken string) (gjson.Result, error)
RefreshOAuthToken 刷新网页授权Token
func (*OfficialAccount) ReplyEventMsg ¶
ReplyEventMsg 事件消息回复
func (*OfficialAccount) Secret ¶
func (oa *OfficialAccount) Secret() string
Secret returns app secret
func (*OfficialAccount) StableAccessToken ¶
func (oa *OfficialAccount) StableAccessToken(ctx context.Context, forceRefresh bool) (gjson.Result, error)
StableAccessToken 获取稳定版接口调用凭据,有两种调用模式: 1. 普通模式,access_token 有效期内重复调用该接口不会更新 access_token,绝大部分场景下使用该模式; 2. 强制刷新模式,会导致上次获取的 access_token 失效,并返回新的 access_token
func (*OfficialAccount) SubscribeMsgAuthURL ¶
func (oa *OfficialAccount) SubscribeMsgAuthURL(scene, templateID, redirectURL, reserved string) string
SubscribeMsgAuthURL 公众号一次性订阅消息授权URL [参考](https://developers.weixin.qq.com/doc/offiaccount/Message_Management/One-time_subscription_info.html)
func (*OfficialAccount) Upload ¶
func (oa *OfficialAccount) Upload(ctx context.Context, reqPath, fieldName, filePath string, formData lib.Form, query url.Values) (gjson.Result, error)
Upload 上传媒体资源
func (*OfficialAccount) UploadWithReader ¶ added in v1.2.0
func (oa *OfficialAccount) UploadWithReader(ctx context.Context, reqPath, fieldName, fileName string, reader io.Reader, formData lib.Form, query url.Values) (gjson.Result, error)
UploadWithReader 上传媒体资源
func (*OfficialAccount) VerifyURL ¶
func (oa *OfficialAccount) VerifyURL(signature, timestamp, nonce string) error
VerifyURL 服务器URL验证,使用:signature、timestamp、nonce(若验证成功,请原样返回echostr参数内容) [参考](https://developers.weixin.qq.com/miniprogram/dev/framework/server-ability/message-push.html)
type Pay ¶
type Pay struct {
// contains filtered or unexported fields
}
Pay 微信支付
func (*Pay) DecryptRefund ¶
DecryptRefund 退款结果通知解密
func (*Pay) MinipRedpackJSAPI ¶
MinipRedpackJSAPI 小程序领取红包
func (*Pay) PostBuffer ¶
PostBuffer POST请求获取buffer (无证书请求,如:下载交易订单)
func (*Pay) PostTLSXML ¶
PostTLSXML POST请求XML数据 (带证书请求)
func (*Pay) PostTlsBuffer ¶ added in v1.2.0
PostBuffer POST请求获取buffer (带证书请求,如:下载资金账单)
type PayOption ¶
type PayOption func(p *Pay)
PayOption 微信支付设置项
func WithPayCert ¶ added in v1.2.0
func WithPayCert(cert tls.Certificate) PayOption
WithPayTLSCert 设置支付TLS证书
func WithPayClient ¶ added in v1.2.0
WithPayClient 设置支付无证书 HTTP Client
func WithPayLogger ¶
WithPayLogger 设置支付日志记录
func WithPayTlsClient ¶ added in v1.2.0
WithPayTlsClient 设置支付带证书 HTTP Client
type PayV3 ¶
type PayV3 struct {
// contains filtered or unexported fields
}
PayV3 微信支付V3
func NewPayV3 ¶
func NewPayV3(mchid, apikey string, options ...PayV3Option) *PayV3
NewPayV3 生成一个微信支付(v3)实例
func (*PayV3) Authorization ¶
Authorization 生成签名并返回 HTTP Authorization
func (*PayV3) AutoLoadCerts ¶ added in v1.1.0
AutoLoadCerts 自动加载平台证书
func (*PayV3) Upload ¶
func (p *PayV3) Upload(ctx context.Context, reqPath, fieldName, filePath, metadata string, query url.Values) (*APIResult, error)
Upload 上传资源
type PayV3Option ¶
type PayV3Option func(p *PayV3)
PayV3Option 微信支付(v3)设置项
func WithPayV3Client ¶ added in v1.2.0
func WithPayV3Client(cli *http.Client) PayV3Option
WithPayV3Client 设置支付(v3)请求的 HTTP Client
func WithPayV3Logger ¶
WithPayV3Logger 设置支付(v3)日志记录
func WithPayV3PrivateKey ¶
func WithPayV3PrivateKey(serialNO string, key *xcrypto.PrivateKey) PayV3Option
WithPayV3PrivateKey 设置支付(v3)商户RSA私钥
type SafeMode ¶
type SafeMode struct {
// contains filtered or unexported fields
}
SafeMode 安全鉴权模式配置
type ServerConfig ¶
type ServerConfig struct {
// contains filtered or unexported fields
}
ServerConfig 服务器配置