common

package
Version: v0.0.0-...-fc85a51 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2019 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseConfig

type BaseConfig struct {
	ConfigWxData   ConfigWxData
	ConfigAliData  ConfigAliData
	ConfigPubData  ConfigPubData
	PayThirdServer constant.PayServer
}

type BaseData

type BaseData struct {
	ReqData ReqData
	ResData ResData
}

type ChargeClient

type ChargeClient struct {
	ConfigData BaseConfig
	ReqData    ReqData
	ChargeClientInterface
}

func NewChargeClient

func NewChargeClient(configData BaseConfig, intface ChargeClientInterface) *ChargeClient

type ChargeClientInterface

type ChargeClientInterface interface {
	Charge(data ReqData) interface{}
}

type ConfigAliData

type ConfigAliData struct {
	UseSandbox bool `json:"use_sandbox"` // 是否使用沙盒模式
	OldMd5     bool `json:"old_md5"`     //老版本还保留了MD5的加密方式
	//安全检验码
	Key string `json:"key"`
	//签约支付宝账号
	SellerEmail string `json:"seller_email"`
	//合作身份者id
	Partner  string `json:"partner"`
	AppId    string `json:"app_id"`
	SignType string `json:"sign_type"` // RSA  RSA2
	// 可以填写文件路径,或者密钥字符串  当前字符串是 rsa2 的支付宝公钥
	AliPublicKey string `json:"ali_public_key"`
	// 可以填写文件路径,或者密钥字符串  我的沙箱模式,rsa与rsa2的私钥相同,为了方便测试
	RsaPrivateKey string   `json:"rsa_private_key"`
	LimitPay      []string `json:"limit_pay"` // 指定不能使用信用卡支付   不传入,则均可使用
	// 		'limit_pay' => [
	// 			//'balance',// 余额
	// 			//'moneyFund',// 余额宝
	// 			//'debitCardExpress',//     借记卡快捷
	// //        'creditCard',//信用卡
	// 			//'creditCardExpress',// 信用卡快捷
	// 			//'creditCardCartoon',//信用卡卡通
	// 			//'credit_group',// 信用支付类型(包含信用卡卡通、信用卡快捷、花呗、花呗分期)
	// 		],// 用户不可用指定渠道支付当有多个渠道时用“,”分隔
	// 与业务相关参数
	NotifyUrl string `json:"notify_url"`
	ReturnUrl string `json:"return_url"`
}

type ConfigPubData

type ConfigPubData struct {
	ReturnRaw bool `json:"return_raw"` // 在处理回调时,是否直接返回原始数据,默认为false
}

type ConfigWxData

type ConfigWxData struct {
	AppId       string   `json:"app_id"`  // 公众账号ID
	MchId       string   `json:"mch_id"`  // 商户id
	Md5Key      string   `json:"md5_key"` // md5 秘钥
	AppCertPem  string   `json:"app_cert_pem"`
	AppKeyPem   string   `json:"app_key_pem"`
	SignType    string   `json:"sign_type"` // MD5  HMAC-SHA256
	LimitPay    []string `json:"limit_pay"` // 指定不能使用信用卡支付   不传入,则均可使用
	FeeType     string   `json:"fee_type"`  // 货币类型  当前仅支持该字段
	NotifyUrl   string   `json:"notify_url"`
	RedirectUrl string   `json:"redirect_url"` // 如果是h5支付,可以设置该值,返回到指定页面
}

type HttpClient

type HttpClient struct {
	HttpClientInterface
}

func NewHttpClient

func NewHttpClient(hci HttpClientInterface) *HttpClient

type HttpClientInterface

type HttpClientInterface interface {
	Post(url string, paramData map[string]interface{}, headerParam map[string]string) (interface{}, error)
	Put(url string, paramData map[string]interface{}, headerParam map[string]string) (interface{}, error)
	Get(url string, paramData map[string]interface{}, headerParam map[string]string) (interface{}, error)
	Delete(url string, paramData map[string]interface{}, headerParam map[string]string) ([]byte, error)
	PostBodyJson(url string, body interface{}) (interface{}, error)
	PostBodyXml(url string, body interface{}) ([]byte, error)
}

type LogClient

type LogClient struct {
	LogClientInterface
}

func NewLogClient

func NewLogClient(hci LogClientInterface) *LogClient

type LogClientInterface

type LogClientInterface interface {
	Write(message interface{})
}

type NotifyClient

type NotifyClient struct {
	ConfigData BaseConfig
	ResData    ResData
	NotifyClientInterface
}

func NewNotifyClient

func NewNotifyClient(configData BaseConfig, intface NotifyClientInterface) *NotifyClient

type NotifyClientInterface

type NotifyClientInterface interface {
	Notify(d []byte, process notify.NotifyInterface) string
}

type ReqData

type ReqData struct {
	Body           string  `json:"body" form:"body"  xml:"body"`
	Subject        string  `json:"subject" form:"subject"  xml:"subject"`
	Openid         string  `json:"openid" form:"openid"  xml:"openid"`
	OrderNo        string  `json:"order_no" form:"order_no"  xml:"order_no"`
	TimeoutExpress int64   `json:"timeout_express" form:"timeout_express"  xml:"timeout_express"`
	Amount         float64 `json:"amount" form:"amount"  xml:"amount"` //单位元两位小数
	ReturnParam    string  `json:"return_param" form:"return_param"  xml:"return_param"`
	// 支付宝公有
	GoodsType int8   `json:"goods_type" form:"goods_type"  xml:"goods_type"`
	StoreId   string `json:"store_id" form:"store_id"  xml:"store_id"`

	// 条码支付
	OperatorId    string `json:"operator_id" form:"operator_id"  xml:"operator_id"`
	TerminalId    string `json:"terminal_id" form:"terminal_id"  xml:"terminal_id"`
	AlipayStoreId string `json:"alipay_store_id" form:"alipay_store_id"  xml:"alipay_store_id"`
	Scene         string `json:"scene" form:"scene"  xml:"scene"`
	AuthCode      string `json:"auth_code" form:"auth_code"  xml:"auth_code"`

	// Web支付
	QrMod     string `json:"qr_mod" form:"qr_mod"  xml:"qr_mod"`
	Paymethod string `json:"paymethod" form:"paymethod"  xml:"paymethod"`

	ClientIp  string `json:"client_ip" form:"client_ip"  xml:"client_ip"`
	ProductId string `json:"product_id" form:"product_id"  xml:"product_id"`
}

type ResData

type ResData struct {
	notify.NotifyProcessData
}

type SignClientInterface

type SignClientInterface interface {
	BuildSignData() string
}

type SignConfig

type SignConfig struct {
	SignType constant.SignWay
	SignKey
}

type SignHandle

type SignHandle struct {
	SignClientInterface
	SignConfig
}

func NewSignClient

func NewSignClient(sc SignConfig, sci SignClientInterface) *SignHandle

func (*SignHandle) CheckSign

func (pc *SignHandle) CheckSign(sign string) error

CheckSign 检测签名

func (*SignHandle) Md5Sign

func (pc *SignHandle) Md5Sign(signData string) string

func (*SignHandle) Rsa2Sign

func (pc *SignHandle) Rsa2Sign(signData string) string

func (*SignHandle) RsaSign

func (pc *SignHandle) RsaSign(signData string) string

func (*SignHandle) Sign

func (sh *SignHandle) Sign() (string, error)

type SignKey

type SignKey struct {
	PrivateKey string
	PublicKey  string
}

Directories

Path Synopsis
ali
wx

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL