allinpay

package
v0.0.0-...-6a8dd4b Latest Latest
Warning

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

Go to latest
Published: May 23, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RSA = "RSA"
	SM2 = "SM2"

	// OrderTypeReqSN 商家自由订单号
	OrderTypeReqSN = "reqsn"
	// OrderTypeTrxId 通联生产支付号
	OrderTypeTrxId = "trxid"

	// PayTypeWXScan 微信扫码支付
	PayTypeWXScan = "W01"
	// PayTypeWXJS 微信JS支付
	PayTypeWXJS = "W02"
	// PayTypeWXMini 微信小程序支付
	PayTypeWXMini = "W03"
	// PayTypeAliScan 支付宝扫码支付
	PayTypeAliScan = "A01"
	// PayTypeAliJS 支付宝JS支付
	PayTypeAliJS = "A02"
	// PayTypeAliApp 支付宝APP支付
	PayTypeAliApp = "A03"
	// PayTypeQQScan 手机QQ扫码支付
	PayTypeQQScan = "Q01"
	// PayTypeQQJS 手机QQ JS支付
	PayTypeQQJS = "Q02"
	// PayTypeUniPay 银联扫码支付(CSB)
	PayTypeUniPay = "U01"
	// PayTypeUniJS 银联JS支付
	PayTypeUniJS = "U02"
	// PayTypeNumH5 数字货币H5
	PayTypeNumH5 = "S01"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BizErr

type BizErr struct {
	Code string `json:"code"`
	Msg  string `json:"msg"`
}

BizErr 用于判断通联的业务逻辑是否有错误

func (*BizErr) Error

func (e *BizErr) Error() string

type Client

type Client struct {
	CusId    string // 实际交易商户号
	AppId    string // 平台分配的APPID
	SignType string // 签名类型
	// contains filtered or unexported fields
}

func NewClient

func NewClient(cusId, appId, privateKey, publicKey string, isProd bool) (*Client, error)

NewClient 初始化通联客户端 cusId:实际交易商户号 appid:平台分配的APPID privateKey:商户的RSA私钥 publicKey:通联的公钥 isProd:是否是正式环境

func (*Client) Cancel

func (c *Client) Cancel(ctx context.Context, bm gopay.BodyMap) (rsp *RefundRsp, err error)

Cancel 统一撤销接口 https://aipboss.allinpay.com/know/devhelp/main.php?pid=15#mid=837

func (*Client) Close

func (c *Client) Close(ctx context.Context, bm gopay.BodyMap) (rsp *CloseRsp, err error)

Close 订单关闭 https://aipboss.allinpay.com/know/devhelp/main.php?pid=15#mid=424

func (*Client) Pay

func (c *Client) Pay(ctx context.Context, bm gopay.BodyMap) (rsp *PayRsp, err error)

Pay 统一支付接口 https://aipboss.allinpay.com/know/devhelp/main.php?pid=15#mid=88

func (*Client) Query

func (c *Client) Query(ctx context.Context, orderType string, no string) (rsp *ScanPayRsp, err error)

Query 统一查询接口 https://aipboss.allinpay.com/know/devhelp/main.php?pid=15#mid=836

func (*Client) Refund

func (c *Client) Refund(ctx context.Context, bm gopay.BodyMap) (rsp *RefundRsp, err error)

Refund 统一退款接口 https://aipboss.allinpay.com/know/devhelp/main.php?pid=15#mid=838

func (*Client) ScanPay

func (c *Client) ScanPay(ctx context.Context, bm gopay.BodyMap) (rsp *ScanPayRsp, err error)

ScanPay 统一扫码接口 https://aipboss.allinpay.com/know/devhelp/main.php?pid=15#mid=89

func (*Client) SetOrgId

func (c *Client) SetOrgId(id string) *Client

SetOrgId 集团/代理商商户号(因orgid非必填)因此单开方法

type CloseRsp

type CloseRsp struct {
	RspBase
	TrxStatus string `json:"trxstatus"`
}

CloseRsp 关闭响应

type PayRsp

type PayRsp struct {
	RspBase
	Trxid     string `json:"trxid"`
	ChnlTrxId string `json:"chnltrxid"`
	Reqsn     string `json:"reqsn"`
	RandomStr string `json:"randomstr"`
	TrxStatus string `json:"trxstatus"`
	FinTime   string `json:"fintime"`
	ErrMsg    string `json:"errmsg"`
	PayInfo   string `json:"payinfo"`
}

PayRsp 通用支付响应

type RefundRsp

type RefundRsp struct {
	RspBase
	Trxid     string `json:"trxid"`
	Reqsn     string `json:"reqsn"`
	TrxStatus string `json:"trxstatus"`
	FinTime   string `json:"fintime"`
	ErrMsg    string `json:"errmsg"`
	Fee       string `json:"fee"`
	TrxCode   string `json:"trxCode"`
	RandomStr string `json:"randomstr"`
	ChnlTrxId string `json:"chnltrxid"`
}

RefundRsp 退款响应

type RspBase

type RspBase struct {
	RetCode string `json:"retcode"`
	RetMsg  string `json:"retmsg"`
	Sign    string `json:"sign"`
	Cusid   string `json:"cusid"`
	Appid   string `json:"appid"`
}

type ScanPayRsp

type ScanPayRsp struct {
	RspBase
	Trxid     string `json:"trxid"`
	ChnlTrxId string `json:"chnltrxid"`
	Reqsn     string `json:"reqsn"`
	TrxStatus string `json:"trxstatus"`
	Acct      string `json:"acct"`
	TrxCode   string `json:"trxcode"`
	FinTime   string `json:"fintime"`
	ErrMsg    string `json:"errmsg"`
	RandomStr string `json:"randomstr"`
	InitAmt   string `json:"initamt"`
	TrxAmt    string `json:"trxamt"`
	Fee       string `json:"fee"`
	Cmid      string `json:"cmid"`
	Chnlid    string `json:"chnlid"`
	ChnlData  string `json:"chnldata"`
	AcctType  string `json:"accttype"`
}

ScanPayRsp 扫码支付、订单查询响应

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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