xpay

package
v0.2.56 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2020 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Pay

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

用户下单支付接口

func PayToClient

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

付款给用户接口

Types

type AppTrans

type AppTrans struct {
	Config *UnionpayConfig
}

AppTrans is client for submit order and get back the TN(transaction number) from china unionpay

func NewAppTrans

func NewAppTrans(cfg *UnionpayConfig) (*AppTrans, error)

NewApppTrans initial the AppTrans with specific configuration

func (*AppTrans) Sign

func (this *AppTrans) Sign(param map[string]string) error

Sign the data to comform with specs, more info refer to https://open.unionpay.com/ajweb/help/faq/detail?id=38

func (*AppTrans) Submit

func (this *AppTrans) Submit(orderId string, amount float64, desc string) (string, error)

Submit the order to china unionpay and return the TN(transaction number) if success, TN is used by mobile app. If fail, error is not nil, check error for more information

func (*AppTrans) Validate

func (this *AppTrans) Validate(param map[string]string) error

Validate the response message with verfy certificate, more info refer to https://open.unionpay.com/ajweb/help/faq/detail?id=38

type UnionpayConfig

type UnionpayConfig struct {
	SignKeyPath    string //加密密钥路径(openssl pkcs12 -in PM_700000000000001_acp.pfx -clcerts -nokeys -out key.cert)
	SignCertPath   string //加密证书路径(openssl pkcs12 -in PM_700000000000001_acp.pfx -nocerts -nodes -out key.pem)
	VerifyCertPath string //验证证书路径

	CallbackUrl string //回调地址
	MerId       string //商户号
	AppTransUrl string //App方式交易提交地址
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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