option

package
v0.2.12 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package option 微信支付 API v3 Go SDK Client 初始化参数工具包,你可以使用其中的方法快速构建 core.Client 的初始化参数。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithHTTPClient

func WithHTTPClient(client *http.Client) core.ClientOption

WithHTTPClient 返回一个指定网络通信为HttpClient的ClientOption,指定后使用用户自动创建的的http.client,如果用户不创建,则帮助用户 创建一个默认的http.client

func WithMerchantCredential

func WithMerchantCredential(mchID, certificateSerialNo string, privateKey *rsa.PrivateKey) core.ClientOption

WithMerchantCredential 通过商户号、商户证书序列号、商户私钥构建一对 Credential/Signer,用于生成请求头中的 Authorization 信息

func WithSigner

func WithSigner(signer auth.Signer) core.ClientOption

WithSigner 返回一个指定signer的ClientOption

func WithVerifier

func WithVerifier(verifier auth.Verifier) core.ClientOption

WithVerifier 返回一个指定verifier的ClientOption,用于校验http response header

func WithWechatPayAuthCipher

func WithWechatPayAuthCipher(
	mchID string, certificateSerialNo string, privateKey *rsa.PrivateKey, certificateList []*x509.Certificate,
) core.ClientOption

WithWechatPayAuthCipher 一键初始化 Client,使其具备「签名/验签/敏感字段加解密」能力

func WithWechatPayAutoAuthCipher

func WithWechatPayAutoAuthCipher(
	mchID string, certificateSerialNo string, privateKey *rsa.PrivateKey, mchAPIv3Key string,
) core.ClientOption

WithWechatPayAutoAuthCipher 一键初始化 Client,使其具备「签名/验签/敏感字段加解密」能力。 同时提供证书定时更新功能(因此需要提供 mchAPIv3Key 用于证书解密),不再需要本地提供平台证书

func WithWechatPayAutoAuthCipherUsingDownloaderMgr

func WithWechatPayAutoAuthCipherUsingDownloaderMgr(
	mchID string, certificateSerialNo string, privateKey *rsa.PrivateKey, mgr *downloader.CertificateDownloaderMgr,
) core.ClientOption

WithWechatPayAutoAuthCipherUsingDownloaderMgr 一键初始化 Client,使其具备「签名/验签/敏感字段加解密」能力。 需要使用者自行提供 CertificateDownloaderMgr 已实现平台证书的自动更新

【注意】本函数的能力与 WithWechatPayAutoAuthCipher 完全一致,除非有自行管理 CertificateDownloaderMgr 的需求, 否则推荐直接使用 WithWechatPayAutoAuthCipher

func WithWechatPayCertificate

func WithWechatPayCertificate(certificateList []*x509.Certificate) core.ClientOption

WithWechatPayCertificate 设置微信支付平台证书信息,返回一个指定validator的ClientOption,用于校验http response header

func WithWechatPayCipher

func WithWechatPayCipher(encryptor cipher.Encryptor, decryptor cipher.Decryptor) core.ClientOption

WithWechatPayCipher 返回一个为 Client 设置 WechatPayCipher 的 core.ClientOption

func WithoutValidator

func WithoutValidator() core.ClientOption

WithoutValidator 返回一个指定validator的ClientOption,不进行验签 用于下载证书和下载账单等不需要进行验签的接口

Types

This section is empty.

Jump to

Keyboard shortcuts

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