client

package
v0.0.0-...-045469b Latest Latest
Warning

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

Go to latest
Published: May 10, 2018 License: Apache-2.0 Imports: 21 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 *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 WachatCompanyChange

func WachatCompanyChange(mchAppid, mchid, key string, conn *HTTPSClient, charge *common.Charge) (map[string]string, 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 {
	SellerID   string //合作者ID
	AppID      string // 应用ID
	PrivateKey *rsa.PrivateKey
	PublicKey  *rsa.PublicKey
}

func DefaultAliAppClient

func DefaultAliAppClient() *AliAppClient

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

func (*AliAppClient) CheckSign

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

CheckSign 检测签名

func (*AliAppClient) GenSign

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

GenSign 产生签名

func (*AliAppClient) Pay

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

func (*AliAppClient) PayToClient

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

func (*AliAppClient) QueryOrder

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

订单查询

func (*AliAppClient) ToURL

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

PostData 提交post数据

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) 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) 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 查询订单

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