unionpay

package module
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2023 License: MIT Imports: 23 Imported by: 1

README

银联支付

鸣谢

jetbrains.svg

帮助

在集成的过程中有遇到问题,欢迎加 QQ 群 203357977 讨论。

安装

go get github.com/smartwalle/unionpay
import github.com/smartwalle/unionpay
关于错误 x509: certificate signed by unknown authority (possibly because of "x509: cannot verify signature: insecure algorithm SHA1-RSA (temporarily override with GODEBUG=x509sha1=1)" while trying to verify candidate authority certificate "CFCA TEST OCA1")

由于安全问题,从 Go 1.18 开始,其 crypto/x509 包默认将拒绝使用 SHA-1 哈希函数签名的证书(自签发的除外)。

银联测试环境签发的证书目前使用的是 SHA-1 签名(没有生产环境,无法得知生产环境信息是否也是使用 SHA-1 进行签名)。

解决办法

可以通过设置 GODEBUG=x509sha1=1 环境变量暂时恢复。

GODEBUG=x509sha1=1 go run main.go 

其它支付

支付宝 https://github.com/smartwalle/alipay

苹果支付 https://github.com/smartwalle/apple

PayPal https://github.com/smartwalle/paypal

测试环境

可从 https://open.unionpay.com/tjweb/ij/user/mchTest/param 获取测试环境信息。

示例

https://github.com/smartwalle/unionpay/tree/master/examples 包含一个完整示例。

运行该示例代码之后,可以在浏览器中访问 http://127.0.0.1:9988/unionpay 以打开测试页面。

已实现接口

  • 消费接口-创建网页支付 - CreateWebPayment()
  • 消费接口-创建 App 支付 - CreateAppPayment()
  • 交易状态查询接口 - GetTransaction()
  • 消费撤销接口 - Revoke()
  • 退货接口接口 - Refund()

关于交易状态

在银联系统中,发起消费(支付)、消费撤销(退款)和退货(退款)都会产生交易,都可以通过交易状态查询接口查询相关信息。

退款状态不会在原支付交易中体现。

重要资料

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ACKNotification

func ACKNotification(w http.ResponseWriter)

ACKNotification 返回异步通知成功处理的消息给银联。

后台通知以标准的HTTP协议的POST方法向商户的后台通知URL发送,超时时间为10秒。

由于网络等原因,商户可能会收到重复的后台通知,商户应能正确识别并处理。

商户返回码为200时,银联判定为通知成功,其他返回码为通知失败。

如10秒内未收到应答,银联判定为通知失败。

第一次通知失败后,银联会重发,最多发送五次(间隔1、2、4、5分钟)。

func DecodeValues

func DecodeValues(values url.Values, dst interface{}) error

func EncodeValues added in v0.0.4

func EncodeValues(values url.Values) string

func PINBlock added in v0.0.4

func PINBlock(pan, pin string) []byte

PINBlock https://paymentcardtools.com/pin-block-calculators/iso9564-format-0

Types

type AccountPayment added in v0.0.4

type AccountPayment struct {
	Error
	QueryId      string `query:"queryId"`      // 查询流水号
	AcqInsCode   string `query:"acqInsCode"`   // 收单机构代码
	TN           string `query:"tn"`           // 银联受理订单号, 客户端调用银联 SDK 需要的银联订单号(tn)
	AccNo        string `query:"accNo"`        // 账号
	PayType      string `query:"payType"`      // 支付方式
	PayCardType  string `query:"payCardType"`  // 支付卡类型
	BizType      string `query:"bizType"`      // 产品类型
	TxnTime      string `query:"txnTime"`      // 订单发送时间
	CurrencyCode string `query:"currencyCode"` // 交易币种
	TxnAmt       string `query:"txnAmt"`       // 交易金额
	TxnType      string `query:"txnType"`      // 交易类型
	TxnSubType   string `query:"txnSubType"`   // 交易子类
	AccessType   string `query:"accessType"`   // 接入类型
	ReqReserved  string `query:"reqReserved"`  // 请求方保留域
	MerId        string `query:"merId"`        // 商户代码
	OrderId      string `query:"orderId"`      // 商户订单号
	Reserved     string `query:"reserved"`     // 保留域
	Version      string `query:"version"`      // 版本号
}

type AppPayment

type AppPayment struct {
	Error
	TN          string `query:"tn"`          // 银联受理订单号, 客户端调用银联 SDK 需要的银联订单号(tn)
	AcqInsCode  string `query:"acqInsCode"`  // 收单机构代码
	Version     string `query:"version"`     // 版本号
	BizType     string `query:"bizType"`     // 产品类型
	TxnTime     string `query:"txnTime"`     // 订单发送时间
	TxnType     string `query:"txnType"`     // 交易类型
	TxnSubType  string `query:"txnSubType"`  // 交易子类
	AccessType  string `query:"accessType"`  // 接入类型
	ReqReserved string `query:"reqReserved"` // 请求方保留域
	MerId       string `query:"merId"`       // 商户代码
	OrderId     string `query:"orderId"`     // 商户订单号
	Reserved    string `query:"reserved"`    // 保留域
}

type CallOption

type CallOption func(values url.Values)

func WithPayload

func WithPayload(payload *Payload) CallOption

type Client

type Client struct {
	Client *http.Client
	// contains filtered or unexported fields
}

func New

func New(pfx []byte, password, merchantId string, isProduction bool, opts ...OptionFunc) (*Client, error)

New 初始银联客户端

pfx - 商户私钥证书

password - 商户私钥证书密码

merchantId - 商户号

isProduction - 是否为生产环境,传 false 的时候为沙箱环境,用于开发测试,正式上线的时候需要改为 true

func NewWithPFXFile

func NewWithPFXFile(filename, password, merchantId string, isProduction bool) (*Client, error)

NewWithPFXFile 初始银联客户端

filename - 商户私钥证书文件

password - 商户私钥证书密码

merchantId - 商户号

isProduction - 是否为生产环境,传 false 的时候为沙箱环境,用于开发测试,正式上线的时候需要改为 true

func (*Client) ACKNotification

func (c *Client) ACKNotification(w http.ResponseWriter)

func (*Client) CreateAccountPayment added in v0.0.4

func (c *Client) CreateAccountPayment(orderId, amount, backURL, accNo string, customer *Customer, opts ...CallOption) (*AccountPayment, error)

CreateAccountPayment 无跳转支付-消费接口。

文档地址:https://open.unionpay.com/tjweb/acproduct/APIList?acpAPIId=814&apiservId=449&version=V2.2&bussType=0

文档地址:https://open.unionpay.com/upload/download/%E6%97%A0%E8%B7%B3%E8%BD%AC%E6%94%AF%E4%BB%98%E4%BA%A7%E5%93%81%E6%8E%A5%E5%8F%A3%E8%A7%84%E8%8C%83V2.0.pdf

orderId:商户消费订单号。

amount:交易金额,单位分,不要带小数点。

backURL:后台通知地址。

accNo:账号、卡号。

func (*Client) CreateAppPayment

func (c *Client) CreateAppPayment(orderId, amount, backURL string, opts ...CallOption) (*AppPayment, error)

CreateAppPayment 消费接口-创建 App 支付。

文档地址:https://open.unionpay.com/tjweb/acproduct/APIList?apiservId=3021&acpAPIId=961&bussType=0

orderId:商户消费订单号。

amount:交易金额,单位分,不要带小数点。

backURL:后台通知地址。

func (*Client) CreateWebPayment

func (c *Client) CreateWebPayment(orderId, amount, frontURL, backURL string, opts ...CallOption) (*WebPayment, error)

CreateWebPayment 消费接口-创建网页支付。

文档地址:https://open.unionpay.com/tjweb/acproduct/APIList?acpAPIId=754&apiservId=448&version=V2.2&bussType=0

orderId:商户消费订单号。

amount:交易金额,单位分,不要带小数点。

frontURL:前台通知地址。

backURL:后台通知地址。

func (*Client) DecodeNotification

func (c *Client) DecodeNotification(values url.Values) (interface{}, error)

DecodeNotification 解析通知。

各通知结构体会尽量包含前台通知(frontURL)和后台通知(backURL)已知字段,所以本方法可用于解析前台通知(frontURL)和后台通知(backURL)。

返回以下类型中的一种:

*PaymentNotification

*RevokeNotification

*RefundNotification

func (*Client) Decrypt

func (c *Client) Decrypt(s string) (string, error)

Decrypt 用于解密从银联获取到的敏感信息。

如果商户号开通了【商户对敏感信息加密】的权限,那么需要对获取到的 accNo、pin、phoneNo、cvn2、expired 进行解密。

如果商户号未开通【商户对敏感信息加密】权限,那么不需要对敏感信息进行解密。

https://open.unionpay.com/tjweb/support/faq/mchlist?id=537

func (*Client) Encrypt

func (c *Client) Encrypt(s string) (string, error)

Encrypt 对数据进行加密,并对加密的结果使用 base64 进行编码,(用于加密敏感信息)。

如果商户号开通了【商户对敏感信息加密】的权限,那么需要对提交的 accNo、pin、phoneNo、cvn2、expired 进行加密。

如果商户号未开通【商户对敏感信息加密】权限,那么不需要对敏感信息进行加密。

https://open.unionpay.com/tjweb/support/faq/mchlist?id=537

func (*Client) EncryptBytes added in v0.0.4

func (c *Client) EncryptBytes(b []byte) (string, error)

func (*Client) EncryptCertId

func (c *Client) EncryptCertId() string

EncryptCertId 获取敏感信息加密证书 id。

用于各接口中的 encryptCertId 字段。

func (*Client) EncryptCustomer added in v0.0.4

func (c *Client) EncryptCustomer(customer *Customer, accNo string) (string, error)

EncryptCustomer 对 Customer 进行编码,会对 phoneNo,cvn2,expired 进行加密。

func (*Client) EncryptPIN added in v0.0.4

func (c *Client) EncryptPIN(pan, pin string) (string, error)

EncryptPIN 对 PIN 进行加密,并对加密的结果使用 base64 进行编码。

func (*Client) GetTransaction

func (c *Client) GetTransaction(orderId, txnTime string, opts ...CallOption) (*Transaction, error)

GetTransaction 交易状态查询接口

文档地址:https://open.unionpay.com/tjweb/acproduct/APIList?acpAPIId=757&apiservId=448&version=V2.2&bussType=0

orderId:商户订单号。

txnTime:订单发送时间,格式为 YYYYMMDDhhmmss,orderId 和 txnTime 组成唯一订单信息。

注: 应答报文中,“应答码”即respCode字段,表示的是查询交易本身的应答,即查询这个动作是否成功,不代表被查询交易的状态; 若查询动作成功,即应答码为“00“,则根据“原交易应答码”即origRespCode来判断被查询交易是否成功。此时若origRespCode为00,则表示被查询交易成功。

func (*Client) LoadEncryptKey

func (c *Client) LoadEncryptKey() error

LoadEncryptKey 银联加密公钥更新查询接口(敏感加密证书)。

商户定期(1天1次)向银联全渠道系统发起获取加密公钥信息交易。在加密公钥证书更新期间,全渠道系统支持新老证书的共同使用,新老证书并行期为1个月。全渠道系统向商户返回最新的加密公钥证书,由商户服务器替换本地证书。

文档地址:https://open.unionpay.com/tjweb/acproduct/APIList?acpAPIId=758&apiservId=448&version=V2.2&bussType=0

func (*Client) LoadEncryptKeyFromFile added in v0.0.4

func (c *Client) LoadEncryptKeyFromFile(filename string) error

LoadEncryptKeyFromFile 从文件加载银联敏感加密证书。

func (*Client) LoadIntermediateCert

func (c *Client) LoadIntermediateCert(s string) error

LoadIntermediateCert 加载银联中间证书

func (*Client) LoadIntermediateCertFromFile

func (c *Client) LoadIntermediateCertFromFile(filename string) error

LoadIntermediateCertFromFile 从文件加载银联中间证书

func (*Client) LoadRootCert

func (c *Client) LoadRootCert(s string) error

LoadRootCert 加载银联根证书

func (*Client) LoadRootCertFromFile

func (c *Client) LoadRootCertFromFile(filename string) error

LoadRootCertFromFile 从文件加载银联根证书

func (*Client) LoadWebPaymentTemplate

func (c *Client) LoadWebPaymentTemplate(tpl string) error

LoadWebPaymentTemplate 用于加载跳转银联支付页面的网页模版。

网页支付需要先在浏览器中打开业务方(商户)提供的网页,通过该网页跳转到银联的支付页面。

CreateWebPayment 方法中会构建相应的参数,然后把本方法加载的模版渲染成 HTML 代码。

模版参考 unionpay_type.go 文件中的 kWebPaymentTemplate 常量,该常量也是本库默认使用的模版。

func (*Client) Refund

func (c *Client) Refund(queryId, orderId, amount, backURL string, opts ...CallOption) (*Refund, error)

Refund 退货接口。

文档地址:https://open.unionpay.com/tjweb/acproduct/APIList?acpAPIId=756&apiservId=448&version=V2.2&bussType=0

queryId:原消费交易返回的的queryId,可以从消费交易后台通知接口中或者交易状态查询接口(GetTransaction)中获取。

orderId:商户退货订单号,和要退款的订单号没有关系。后续可用本 orderId 和返回结构体中的 TxnTime 通过交易状态查询接口(GetTransaction) 查询退货信息。

amount:退货金额,单位分,不要带小数点。

backURL:后台通知地址。

消费撤销和退货的区别:

消费撤销仅能对当天的消费做,必须为全额,一般当日或第二日到账,可能存在极少数银行不支持。

退货(除二维码产品外)能对90天内(见注1、2)的消费做(包括当天),支持部分退货或全额退货,到账时间较长,一般1-10天(多数发卡行5天内,但工行可能会10天),所有银行都支持。

二维码产品退货支持30天,30天以上的退货可能可以发成功(失败应该会同步报错“原交易不存在或状态不正确[2011000]”之类的信息),但不保证一定可以成功。

注1:以上的天均指清算日,一般前一日23点至当天23点为一个清算日。

注2:系统实际支持330天的退货,但银联对发卡行的退货支持要求仅为90天,超过90天的退货发卡行虽然也会承兑,但可能为人工处理,到账速度较慢。330天以上的退货也可能成功,但不保证一定可以成功(失败应该会同步报错4040007之类的应答码),建议直接给用户转账来退款。

func (*Client) Request

func (c *Client) Request(api string, values url.Values) (url.Values, error)

func (*Client) ReverseAccountPayment added in v0.0.4

func (c *Client) ReverseAccountPayment(orderId, txnTime string, opts ...CallOption) (*Reverse, error)

ReverseAccountPayment 无跳转支付-冲正(退货)。

文档地址:https://open.unionpay.com/tjweb/acproduct/APIList?acpAPIId=815&apiservId=449&version=V2.2&bussType=0

orderId:商户订单号。

txnTime:订单发送时间,格式为 YYYYMMDDhhmmss,orderId 和 txnTime 组成唯一订单信息。

冲正必须与原始消费在同一天(准确讲是昨日23:00至本日23:00之间)。 冲正交易,仅用于超时无应答等异常场景,只有发生支付系统超时或者支付结果未知时可调用冲正,其他正常支付的订单如果需要实现相通功能,请调用消费撤销或者退货。

func (*Client) Revoke

func (c *Client) Revoke(queryId, orderId, amount, backURL string, opts ...CallOption) (*Revoke, error)

Revoke 消费撤销接口。

文档地址:https://open.unionpay.com/tjweb/acproduct/APIList?acpAPIId=755&apiservId=448&version=V2.2&bussType=0

queryId:原消费交易返回的的queryId,可以从消费交易后台通知接口中或者交易状态查询接口(GetTransaction)中获取。

orderId:商户撤销订单号,和要消费撤销的订单号没有关系。后续可用本 orderId 和返回结构体中的 TxnTime 通过交易状态查询接口(GetTransaction) 查询消费撤销信息。

amount:退货金额,单位分,不要带小数点。

backURL:后台通知地址。

消费撤销和退货的区别:

消费撤销仅能对当天的消费做,必须为全额,一般当日或第二日到账,可能存在极少数银行不支持。

退货(除二维码产品外)能对90天内(见注1、2)的消费做(包括当天),支持部分退货或全额退货,到账时间较长,一般1-10天(多数发卡行5天内,但工行可能会10天),所有银行都支持。

二维码产品退货支持30天,30天以上的退货可能可以发成功(失败应该会同步报错“原交易不存在或状态不正确[2011000]”之类的信息),但不保证一定可以成功。

注1:以上的天均指清算日,一般前一日23点至当天23点为一个清算日。

注2:系统实际支持330天的退货,但银联对发卡行的退货支持要求仅为90天,超过90天的退货发卡行虽然也会承兑,但可能为人工处理,到账速度较慢。330天以上的退货也可能成功,但不保证一定可以成功(失败应该会同步报错4040007之类的应答码),建议直接给用户转账来退款。

func (*Client) URLValues

func (c *Client) URLValues(values url.Values) (url.Values, error)

func (*Client) VerifySign

func (c *Client) VerifySign(values url.Values) error

type Code

type Code string
const (
	CodeSuccess Code = "00" // 接口调用成功
)

func (Code) IsFailure

func (c Code) IsFailure() bool

func (Code) IsSuccess

func (c Code) IsSuccess() bool

type Customer added in v0.0.4

type Customer struct {
	CertType string // 证件类型 01:身份证  02:军官证 03:护照 04:回乡证 05:台胞证 06:警官证 07:士兵证 99:其它证件
	CertId   string // 证件号码
	Name     string // 姓名
	SMSCode  string // 短信验证码
	PIN      string // 持卡人密码
	CVN2     string // CVN2
	Expired  string // 有效期
	PhoneNo  string // 手机号
}

type Error

type Error struct {
	Code Code   `query:"respCode"`
	Msg  string `query:"respMsg"`
}

func (Error) Error

func (e Error) Error() string

func (Error) IsFailure

func (e Error) IsFailure() bool

func (Error) IsSuccess

func (e Error) IsSuccess() bool

type OptionFunc

type OptionFunc func(c *Client)

func WithHTTPClient

func WithHTTPClient(client *http.Client) OptionFunc

type Payload

type Payload struct {
	// contains filtered or unexported fields
}

func NewPayload

func NewPayload() *Payload

func (*Payload) AddParam added in v0.0.3

func (p *Payload) AddParam(key, value string) *Payload

type PaymentNotification

type PaymentNotification struct {
	Error
	TxnType            string `query:"txnType"`            // 交易类型
	TxnSubType         string `query:"txnSubType"`         // 交易子类
	BizType            string `query:"bizType"`            // 产品类型
	AccessType         string `query:"accessType"`         // 接入类型
	AcqInsCode         string `query:"acqInsCode"`         // 收单机构代码
	MerId              string `query:"merId"`              // 商户代码
	OrderId            string `query:"orderId"`            // 商户订单号
	TxnTime            string `query:"txnTime"`            // 订单发送时间
	TxnAmt             string `query:"txnAmt"`             // 交易金额
	CurrencyCode       string `query:"currencyCode"`       // 交易币种
	ReqReserved        string `query:"reqReserved"`        // 请求方保留域
	Reserved           string `query:"reserved"`           // 保留域
	QueryId            string `query:"queryId"`            // 查询流水号
	SettleAmt          string `query:"settleAmt"`          // 清算金额
	SettleCurrencyCode string `query:"settleCurrencyCode"` // 清算币种
	SettleDate         string `query:"settleDate"`         // 清算日期
	TraceNo            string `query:"traceNo"`            // 系统跟踪号
	TraceTime          string `query:"traceTime"`          // 交易传输时间
	ExchangeDate       string `query:"exchangeDate"`       // 兑换日期
	ExchangeRate       string `query:"exchangeRate"`       // 清算汇率
	AccNo              string `query:"accNo"`              // 账号
	PayCardType        string `query:"payCardType"`        // 支付卡类型
	PayType            string `query:"payType"`            // 支付方式
	PayCardNo          string `query:"payCardNo"`          // 支付卡标识
	PayCardIssueName   string `query:"payCardIssueName"`   // 支付卡名称
	BindId             string `query:"bindId"`             // 绑定标识号
	InstalTransInfo    string `query:"instalTransInfo"`    // 分期付款信息域
	Version            string `query:"version"`            // 版本号
	CardDigest         string `query:"cardDigest"`         // 真实卡号摘要 https://open.unionpay.com/tjweb/acproduct/APIList?acpAPIId=961&apiservId=3021&version=V1.0&bussType=0#nav08
	IssAddnData        string `query:"issAddnData"`        // 订单优惠信息 https://open.unionpay.com/tjweb/acproduct/APIList?acpAPIId=961&apiservId=3021&version=V1.0&bussType=0#nav08
	TN                 string `query:"tn"`                 // 银联受理订单号 https://open.unionpay.com/tjweb/acproduct/APIList?acpAPIId=754&apiservId=448&version=V2.2&bussType=0#nav05
	AccSplitData       string `query:"accSplitData"`       // 分账域 https://open.unionpay.com/tjweb/acproduct/APIList?acpAPIId=754&apiservId=448&version=V2.2&bussType=0#nav08
}

func DecodePaymentNotification

func DecodePaymentNotification(values url.Values) (*PaymentNotification, error)

type Refund

type Refund struct {
	Error
	TxnType     string `query:"txnType"`     // 交易类型
	TxnSubType  string `query:"txnSubType"`  // 交易子类
	BizType     string `query:"bizType"`     // 产品类型
	AccessType  string `query:"accessType"`  // 接入类型
	AcqInsCode  string `query:"acqInsCode"`  // 收单机构代码
	MerId       string `query:"merId"`       // 商户代码
	OrderId     string `query:"orderId"`     // 商户退货订单号
	OrgQryId    string `query:"origQryId"`   // 原始交易流水号
	TxnTime     string `query:"txnTime"`     // 订单发送时间
	TxnAmt      string `query:"txnAmt"`      // 交易金额
	ReqReserved string `query:"reqReserved"` // 请求方保留域
	Reserved    string `query:"reserved"`    // 保留域
	QueryId     string `query:"queryId"`     // 银联交易流水号
	Version     string `query:"version"`     // 版本号
}

type RefundNotification

type RefundNotification struct {
	Refund
	CurrencyCode       string `query:"currencyCode"`       // 交易币种
	SettleAmt          string `query:"settleAmt"`          // 清算金额
	SettleCurrencyCode string `query:"settleCurrencyCode"` // 清算币种
	SettleDate         string `query:"settleDate"`         // 清算日期
	TraceNo            string `query:"traceNo"`            // 系统跟踪号
	TraceTime          string `query:"traceTime"`          // 交易传输时间
	ExchangeDate       string `query:"exchangeDate"`       // 兑换日期
	ExchangeRate       string `query:"exchangeRate"`       // 清算汇率
	AccNo              string `query:"accNo"`              // 账号
}

func DecodeRefundNotification

func DecodeRefundNotification(values url.Values) (*RefundNotification, error)

type Reverse added in v0.0.4

type Reverse struct {
	Error
	BizType     string `query:"bizType"`     // 产品类型
	TxnTime     string `query:"txnTime"`     // 订单发送时间
	TxnType     string `query:"txnType"`     // 交易类型
	TxnSubType  string `query:"txnSubType"`  // 交易子类
	AccessType  string `query:"accessType"`  // 接入类型
	ReqReserved string `query:"reqReserved"` // 请求方保留域
	MerId       string `query:"merId"`       // 商户代码
	OrderId     string `query:"orderId"`     // 商户订单号
	Reserved    string `query:"reserved"`    // 保留域
	Version     string `query:"version"`     // 版本号
}

type Revoke

type Revoke struct {
	Error
	TxnType     string `query:"txnType"`     // 交易类型
	TxnSubType  string `query:"txnSubType"`  // 交易子类
	BizType     string `query:"bizType"`     // 产品类型
	AccessType  string `query:"accessType"`  // 接入类型
	AcqInsCode  string `query:"acqInsCode"`  // 收单机构代码
	MerId       string `query:"merId"`       // 商户代码
	OrderId     string `query:"orderId"`     // 商户消费撤销订单号
	OrgQryId    string `query:"origQryId"`   // 原始交易流水号
	TxnTime     string `query:"txnTime"`     // 订单发送时间
	TxnAmt      string `query:"txnAmt"`      // 交易金额
	ReqReserved string `query:"reqReserved"` // 请求方保留域
	Reserved    string `query:"reserved"`    // 保留域
	QueryId     string `query:"queryId"`     // 银联交易流水号
	Version     string `query:"version"`     // 版本号
}

type RevokeNotification

type RevokeNotification struct {
	Refund
	CurrencyCode       string `query:"currencyCode"`       // 交易币种
	SettleAmt          string `query:"settleAmt"`          // 清算金额
	SettleCurrencyCode string `query:"settleCurrencyCode"` // 清算币种
	SettleDate         string `query:"settleDate"`         // 清算日期
	TraceNo            string `query:"traceNo"`            // 系统跟踪号
	TraceTime          string `query:"traceTime"`          // 交易传输时间
	ExchangeDate       string `query:"exchangeDate"`       // 兑换日期
	ExchangeRate       string `query:"exchangeRate"`       // 清算汇率
	AccNo              string `query:"accNo"`              // 账号
}

func DecodeRevokeNotification

func DecodeRevokeNotification(values url.Values) (*RevokeNotification, error)

type Signer

type Signer interface {
	SignValues(values url.Values, opts ...nsign.SignOption) ([]byte, error)

	SignBytes(data []byte, opts ...nsign.SignOption) ([]byte, error)
}

type Transaction

type Transaction struct {
	Error
	QueryId            string `query:"queryId"`            // 查询流水号
	TraceTime          string `query:"traceTime"`          // 交易传输时间
	TxnType            string `query:"txnType"`            // 交易类型
	TxnSubType         string `query:"txnSubType"`         // 交易子类
	SettleCurrencyCode string `query:"settleCurrencyCode"` // 清算币种
	SettleAmt          string `query:"settleAmt"`          // 清算金额
	SettleDate         string `query:"settleDate"`         // 清算日期
	TraceNo            string `query:"traceNo"`            // 系统跟踪号
	BindId             string `query:"bindId"`             // 绑定标识号
	ExchangeDate       string `query:"exchangeDate"`       // 兑换日期
	IssuerIdentifyMode string `query:"issuerIdentifyMode"` // 发卡机构识别模式
	CurrencyCode       string `query:"currencyCode"`       // 交易币种
	TxnAmt             string `query:"txnAmt"`             // 交易金额
	ExchangeRate       string `query:"exchangeRate"`       // 清算汇率
	CardTransData      string `query:"cardTransData"`      // 有卡交易信息域
	OrigRespCode       string `query:"origRespCode"`       // 原交易应答码
	OrigRespMsg        string `query:"origRespMsg"`        // 原交易应答信息
	AccNo              string `query:"accNo"`              // 账号
	PayType            string `query:"payType"`            // 支付方式
	PayCardNo          string `query:"payCardNo"`          // 支付卡标识
	PayCardType        string `query:"payCardType"`        // 支付卡类型
	PayCardIssueName   string `query:"payCardIssueName"`   // 支付卡名称
	Version            string `query:"version"`            // 版本号
	BizType            string `query:"bizType"`            // 产品类型
	TxnTime            string `query:"txnTime"`            // 订单发送时间
	AccessType         string `query:"accessType"`         // 接入类型
	MerId              string `query:"merId"`              // 商户代码
	OrderId            string `query:"orderId"`            // 商户订单号
	Reserved           string `query:"reserved"`           // 保留域
	ReqReserved        string `query:"reqReserved"`        // 请求方保留域
	AcqInsCode         string `query:"acqInsCode"`         // 收单机构代码
	PreAuthId          string `query:"preAuthId"`          // 预授权号
	InstalTransInfo    string `query:"instalTransInfo"`    // 分期付款信息域
}

type Verifier

type Verifier interface {
	VerifyValues(values url.Values, signature []byte, opts ...nsign.SignOption) error

	VerifyBytes(data []byte, signature []byte, opts ...nsign.SignOption) error
}

type WebPayment

type WebPayment struct {
	Error
	HTML       string // 银联支付表单 HTML 代码,需要在浏览器中执行该代码以打开银联支付
	Version    string // 版本号
	BizType    string // 产品类型
	TxnTime    string // 订单发送时间
	TxnType    string // 交易类型
	TxnSubType string // 交易子类
	AccessType string // 接入类型
	MerId      string // 商户代码
	OrderId    string // 商户订单号
}

Directories

Path Synopsis
examples module

Jump to

Keyboard shortcuts

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