client

package
v0.0.0-...-a6cfbfe Latest Latest
Warning

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

Go to latest
Published: May 10, 2021 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	HTTPC  *HTTPClient
	HTTPSC *HTTPSClient
)

Functions

func AesDecryptECB

func AesDecryptECB(encrypted []byte, key []byte) (decrypted []byte)

func AliyunMoneyFeeToString

func AliyunMoneyFeeToString(moneyFee float64) string

支付宝金额转字符串

func FilterTheSpecialSymbol

func FilterTheSpecialSymbol(data string) string

过滤特殊符号

func GetAlipay

func GetAlipay(url string) (common.AliWebQueryResult, error)

对支付宝者查订单

func GetAlipayApp

func GetAlipayApp(urls string) (common.AliWebAppQueryResult, error)

对支付宝者查订单

func InitAliAppClient

func InitAliAppClient(c *AliAppClient)

func InitAliWebClient

func InitAliWebClient(c *AliWebClient)

func InitWxAppClient

func InitWxAppClient(c *WechatAppClient)

func InitWxMiniProgramClient

func InitWxMiniProgramClient(c *WechatMiniProgramClient)

func InitWxWebClient

func InitWxWebClient(c *WechatWebClient)

func PostWechat

func PostWechat(url string, data map[string]string, h *HTTPSClient) (common.WeChatQueryResult, error)

对微信下订单或者查订单

func ToURL

func ToURL(payUrl string, m map[string]string) string

ToURL

func TruncatedText

func TruncatedText(data string, length int) string

func WachatCloseOrder

func WachatCloseOrder(appid, mchid, key string, outTradeNo string) (common.WeChatQueryResult, error)

微信关闭订单

func WachatCompanyChange

func WachatCompanyChange(mchAppid, mchid, key string, conn *HTTPSClient, charge *common.Charge) (map[string]string, error)

微信企业付款到零钱

func WachatQueryOrder

func WachatQueryOrder(appID, mchID, key, tradeNum string) (common.WeChatQueryResult, error)

微信订单查询

func WechatDecode

func WechatDecode(data string, key string) ([]byte, error)

func WechatGenSign

func WechatGenSign(key string, m map[string]string) (string, error)

func WechatMoneyFeeToString

func WechatMoneyFeeToString(moneyFee float64) string

微信金额浮点转字符串

Types

type AliAppClient

type AliAppClient struct {
	*AliPayClient
	SellerID string //合作者ID

}

func DefaultAliAppClient

func DefaultAliAppClient() *AliAppClient

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

func (*AliAppClient) CloseOrder

func (this *AliAppClient) CloseOrder(charge *common.Charge) (map[string]string, error)

func (*AliAppClient) Pay

func (this *AliAppClient) Pay(charge *common.Charge) (map[string]string, error)

func (*AliAppClient) QueryOrder

func (this *AliAppClient) QueryOrder(outTradeNo string) (common.AliWebAppQueryResult, error)

订单查询

type AliPayClient

type AliPayClient struct {
	AppID string // 应用ID

	PrivateKey *rsa.PrivateKey
	PublicKey  *rsa.PublicKey

	RSAType string // RSA or RSA2
}

func (*AliPayClient) CheckSign

func (this *AliPayClient) CheckSign(signData, sign string)

CheckSign 检测签名

func (*AliPayClient) GenSign

func (this *AliPayClient) GenSign(m map[string]string) string

GenSign 产生签名

func (*AliPayClient) PayToClient

func (this *AliPayClient) PayToClient(charge *common.Charge) (map[string]string, error)

func (*AliPayClient) ToURL

func (this *AliPayClient) ToURL(m map[string]string) string

ToURL

type AliWebClient

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

AliWebClient 支付宝网页支付

func DefaultAliWebClient

func DefaultAliWebClient() *AliWebClient

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

func (*AliWebClient) CheckSign

func (this *AliWebClient) CheckSign(signData, sign string)

CheckSign 检测签名

func (*AliWebClient) CloseOrder

func (this *AliWebClient) CloseOrder(charge *common.Charge) (map[string]string, error)

func (*AliWebClient) GenSign

func (this *AliWebClient) GenSign(m map[string]string) string

GenSign 产生签名

func (*AliWebClient) Pay

func (this *AliWebClient) Pay(charge *common.Charge) (map[string]string, error)

Pay 实现支付接口

func (*AliWebClient) PayToClient

func (this *AliWebClient) PayToClient(charge *common.Charge) (map[string]string, error)

func (*AliWebClient) QueryOrder

func (this *AliWebClient) QueryOrder(outTradeNo string) (common.AliWebQueryResult, error)

订单查询

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(certPEMBlock, keyPEMBlock []byte) *HTTPSClient

NewHTTPSClient 获取默认https客户端

func (*HTTPSClient) GetData

func (c *HTTPSClient) GetData(url string) ([]byte, error)

GetData get数据

func (*HTTPSClient) PostData

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

PostData 提交post数据

type WechatAppClient

type WechatAppClient struct {
	AppID      string // 公众账号ID
	MchID      string // 商户号ID
	Key        string // 密钥
	PrivateKey []byte // 私钥文件内容
	PublicKey  []byte // 公钥文件内容
	// contains filtered or unexported fields
}

WechatAppClient 微信app支付

func DefaultWechatAppClient

func DefaultWechatAppClient() *WechatAppClient

DefaultWechatAppClient 默认微信app客户端

func (*WechatAppClient) CloseOrder

func (this *WechatAppClient) CloseOrder(outTradeNo string) (common.WeChatQueryResult, error)

关闭订单

func (*WechatAppClient) Pay

func (this *WechatAppClient) Pay(charge *common.Charge) (map[string]string, error)

Pay 支付

func (*WechatAppClient) PayToClient

func (this *WechatAppClient) PayToClient(charge *common.Charge) (map[string]string, error)

支付到用户的微信账号

func (*WechatAppClient) QueryOrder

func (this *WechatAppClient) QueryOrder(tradeNum string) (common.WeChatQueryResult, error)

QueryOrder 查询订单

type WechatMiniProgramClient

type WechatMiniProgramClient struct {
	AppID      string // 公众账号ID
	MchID      string // 商户号ID
	Key        string // 密钥
	PrivateKey []byte // 私钥文件内容
	PublicKey  []byte // 公钥文件内容
	// contains filtered or unexported fields
}

WechatMiniProgramClient 微信小程序

func DefaultWechatMiniProgramClient

func DefaultWechatMiniProgramClient() *WechatMiniProgramClient

func (*WechatMiniProgramClient) CloseOrder

func (this *WechatMiniProgramClient) CloseOrder(outTradeNo string) (common.WeChatQueryResult, error)

关闭订单

func (*WechatMiniProgramClient) Pay

func (this *WechatMiniProgramClient) Pay(charge *common.Charge) (map[string]string, error)

Pay 支付

func (*WechatMiniProgramClient) PayToClient

func (this *WechatMiniProgramClient) PayToClient(charge *common.Charge) (map[string]string, error)

支付到用户的微信账号

func (*WechatMiniProgramClient) QueryOrder

func (this *WechatMiniProgramClient) QueryOrder(tradeNum string) (common.WeChatQueryResult, error)

QueryOrder 查询订单

func (*WechatMiniProgramClient) Refund

func (this *WechatMiniProgramClient) Refund(charge *common.RefundCharge) (map[string]string, error)

type WechatWebClient

type WechatWebClient struct {
	AppID      string // 公众账号ID
	MchID      string // 商户号ID
	Key        string // 密钥
	PrivateKey []byte // 私钥文件内容
	PublicKey  []byte // 公钥文件内容
	// contains filtered or unexported fields
}

WechatWebClient 微信公众号支付

func DefaultWechatWebClient

func DefaultWechatWebClient() *WechatWebClient

func (*WechatWebClient) CloseOrder

func (this *WechatWebClient) CloseOrder(outTradeNo string) (common.WeChatQueryResult, error)

关闭订单

func (*WechatWebClient) Pay

func (this *WechatWebClient) Pay(charge *common.Charge) (map[string]string, error)

Pay 支付

func (*WechatWebClient) PayToClient

func (this *WechatWebClient) PayToClient(charge *common.Charge) (map[string]string, error)

支付到用户的微信账号

func (*WechatWebClient) QueryOrder

func (this *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