client

package
v0.0.0-...-009aeea Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2023 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	HTTPC  *HTTPClient
	HTTPSC *HTTPSClient
)

Functions

func InitAliAppClient

func InitAliAppClient(c *AliAppClient)

func InitAliWebClient

func InitAliWebClient(c *AliWebClient)

func InitWechatClient

func InitWechatClient(c *WechatAppClient)

Types

type AliAppClient

type AliAppClient struct {
	PartnerID  string //合作者ID
	SellerID   string
	AppID      string // 应用ID
	PrivateKey *rsa.PrivateKey
	PublicKey  *rsa.PublicKey
}

func DefaultAliAppClient

func DefaultAliAppClient() *AliAppClient

DefaultAliAppClient 得到默认支付宝app客户端

func (*AliAppClient) CheckSign

func (aa *AliAppClient) CheckSign(data string, sign string) error

CheckSign 检测签名

func (*AliAppClient) GenSign

func (aa *AliAppClient) GenSign(m map[string]string) (string, error)

GenSign 产生签名

func (*AliAppClient) Pay

func (aa *AliAppClient) Pay(charge *common.Charge) (string, error)

type AliWebClient

type AliWebClient struct {
	PartnerID   string          // 支付宝合作身份ID
	SellerID    string          // 卖家支付宝用户号
	AppID       string          // 支付宝分配给开发者的应用ID ps: 查询订单用
	CallbackURL string          // 回调接口
	PrivateKey  *rsa.PrivateKey // 私钥
	PublicKey   *rsa.PublicKey  // 公钥
	PayURL      string          // 支付网管地址
}

AliWebClient 支付宝网页支付

func DefaultAliWebClient

func DefaultAliWebClient() *AliWebClient

DefaultAliWebClient 默认支付宝网页支付客户端

func (*AliWebClient) CheckSign

func (ac *AliWebClient) CheckSign(signData, sign string) error

CheckSign 检测签名

func (*AliWebClient) GenSign

func (ac *AliWebClient) GenSign(m map[string]string) (string, error)

GenSign 产生签名

func (*AliWebClient) Pay

func (ac *AliWebClient) Pay(charge *common.Charge) (string, error)

Pay 实现支付接口

func (*AliWebClient) ToHTML

func (ac *AliWebClient) ToHTML(m map[string]string) string

ToHTML 转换form表单

func (*AliWebClient) ToURL

func (ac *AliWebClient) ToURL(m map[string]string) string

ToURL

type HTTPClient

type HTTPClient struct {
	http.Client
}

HTTPClient http客户端

func (*HTTPClient) PostData

func (c *HTTPClient) PostData(url, format string, data string) ([]byte, error)

PostData post数据

type HTTPSClient

type HTTPSClient struct {
	http.Client
}

HTTPSClient HTTPS客户端结构

func GetDefaultClient

func GetDefaultClient() *HTTPSClient

GetDefaultClient 返回默认的客户端

func NewHTTPSClient

func NewHTTPSClient() *HTTPSClient

NewHTTPSClient 获取默认https客户端

func (*HTTPSClient) PostData

func (c *HTTPSClient) PostData(url string, contentType string, data string) ([]byte, error)

PostData 提交post数据

type WechatAppClient

type WechatAppClient struct {
	AppID string // AppID
	MchID string // 商户号ID

	Key    string // 密钥
	PayURL string // 支付地址
	// contains filtered or unexported fields
}

WechatAppClient 微信app支付

func DefaultWechatAppClient

func DefaultWechatAppClient() *WechatAppClient

DefaultWechatAppClient 默认微信app客户端

func (*WechatAppClient) CheckSign

func (wechat *WechatAppClient) CheckSign(data string, sign string) error

CheckSign 检查签名

func (*WechatAppClient) GenSign

func (wechat *WechatAppClient) GenSign(m map[string]string) (string, error)

GenSign 产生签名

func (*WechatAppClient) Pay

func (wechat *WechatAppClient) Pay(charge *common.Charge) (string, error)

Pay 支付

type WechatWebClient

type WechatWebClient struct {
	AppID       string // 公众账号ID
	MchID       string // 商户号ID
	CallbackURL string // 回调地址
	Key         string // 密钥
	PayURL      string // 支付地址
	QueryURL    string // 查询地址
}

WechatWebClient 微信公众号支付

func DefaultWechatWebClient

func DefaultWechatWebClient() *WechatWebClient

func (*WechatWebClient) CheckSign

func (wechat *WechatWebClient) CheckSign(data string, sign string) error

CheckSign 检查签名

func (*WechatWebClient) GenSign

func (wechat *WechatWebClient) GenSign(m map[string]string) (string, error)

GenSign 产生签名

func (*WechatWebClient) Pay

func (wechat *WechatWebClient) Pay(charge *common.Charge) (string, error)

Pay 支付

func (*WechatWebClient) QueryOrder

func (wechat *WechatWebClient) QueryOrder(tradeNum string) (*common.WeChatQueryResult, error)

QueryOrder 查询订单

Jump to

Keyboard shortcuts

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