client

package
v0.5.29 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2022 License: Zlib Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	HTTPC  *HTTPClient
	HTTPSC *HTTPSClient
)

Functions

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 *WxAppClient)

func InitWxMiniProgramClient

func InitWxMiniProgramClient(c *WxMPClient)

func InitWxWebClient

func InitWxWebClient(c *WxWebClient)

func PostWx

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

对微信下订单或者查订单

func ToURL

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

ToURL

func TruncatedText

func TruncatedText(data string, length int) string

func WxCloseOrder

func WxCloseOrder(appid, mchid, key string, outTradeNo string) (common.WxQueryResult, error)

微信关闭订单

func WxCompanyChange

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

微信企业付款到零钱

func WxGenSign

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

func WxMoneyFeeToString

func WxMoneyFeeToString(moneyFee float64) string

微信金额浮点转字符串

func WxQueryOrder

func WxQueryOrder(appID, mchID, key, tradeNum string) (common.WxQueryResult, error)

微信订单查询

Types

type AliAppClient

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

func DefaultAliAppClient

func DefaultAliAppClient() *AliAppClient

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

func (*AliAppClient) CloseOrder

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

func (*AliAppClient) Pay

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

func (*AliAppClient) QueryOrder

func (client *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
	PayURL  string // https://openapi.alipay.com/gateway.do
}

func (*AliPayClient) CheckSign

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

CheckSign 检测签名

func (*AliPayClient) GenSign

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

GenSign 产生签名

func (*AliPayClient) PayToClient

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

func (*AliPayClient) ToURL

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

ToURL

type AliWebClient

type AliWebClient struct {
	AliPayClient
	PartnerID string // 支付宝合作身份ID
	SellerID  string // 卖家支付宝用户号
}

AliWebClient 支付宝网页支付 PayURL: https://mapi.alipay.com/gateway.do"

func DefaultAliWebClient

func DefaultAliWebClient() *AliWebClient

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

func (*AliWebClient) CheckSign

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

CheckSign 检测签名

func (*AliWebClient) CloseOrder

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

func (*AliWebClient) GenSign

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

GenSign 产生签名

func (*AliWebClient) Pay

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

Pay 实现支付接口

func (*AliWebClient) PayToClient

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

func (*AliWebClient) QueryOrder

func (client *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 WxAppClient

type WxAppClient struct {
	WxClient
}

WxAppClient 微信app支付

func DefaultWxAppClient

func DefaultWxAppClient() *WxAppClient

DefaultWxAppClient 默认微信app客户端

func (*WxAppClient) CloseOrder

func (client *WxAppClient) CloseOrder(outTradeNo string) (common.WxQueryResult, error)

关闭订单

func (*WxAppClient) Pay

func (client *WxAppClient) Pay(charge *common.Charge) (map[string]string, error)

Pay 支付

func (*WxAppClient) PayToClient

func (client *WxAppClient) PayToClient(charge *common.Charge) (map[string]string, error)

支付到用户的微信账号

func (*WxAppClient) QueryOrder

func (client *WxAppClient) QueryOrder(tradeNum string) (common.WxQueryResult, error)

QueryOrder 查询订单

type WxClient

type WxClient struct {
	AppID      string // 公众账号ID
	MchID      string // 商户号ID
	Key        string // 密钥
	PrivateKey []byte // 私钥文件内容
	PublicKey  []byte // 公钥文件内容
	PayURL     string // "https://api.mch.weixin.qq.com/pay/unifiedorder"
	// contains filtered or unexported fields
}

WxClient

type WxMPClient

type WxMPClient struct {
	WxClient
}

WxMPClient 微信小程序

func DefaultWxMPClient

func DefaultWxMPClient() *WxMPClient

func (*WxMPClient) CloseOrder

func (client *WxMPClient) CloseOrder(outTradeNo string) (common.WxQueryResult, error)

关闭订单

func (*WxMPClient) Pay

func (client *WxMPClient) Pay(charge *common.Charge) (map[string]string, error)

Pay 支付

func (*WxMPClient) PayToClient

func (client *WxMPClient) PayToClient(charge *common.Charge) (map[string]string, error)

支付到用户的微信账号

func (*WxMPClient) QueryOrder

func (client *WxMPClient) QueryOrder(tradeNum string) (common.WxQueryResult, error)

QueryOrder 查询订单

type WxWebClient

type WxWebClient struct {
	WxClient
}

WxWebClient 微信公众号支付

func DefaultWxWebClient

func DefaultWxWebClient() *WxWebClient

func (*WxWebClient) CloseOrder

func (client *WxWebClient) CloseOrder(outTradeNo string) (common.WxQueryResult, error)

关闭订单

func (*WxWebClient) Pay

func (client *WxWebClient) Pay(charge *common.Charge) (map[string]string, error)

Pay 支付

func (*WxWebClient) PayToClient

func (client *WxWebClient) PayToClient(charge *common.Charge) (map[string]string, error)

支付到用户的微信账号

func (*WxWebClient) QueryOrder

func (client *WxWebClient) QueryOrder(tradeNum string) (common.WxQueryResult, error)

QueryOrder 查询订单

Jump to

Keyboard shortcuts

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