-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathprotocol_pay_confirm.go
More file actions
67 lines (61 loc) · 2.22 KB
/
protocol_pay_confirm.go
File metadata and controls
67 lines (61 loc) · 2.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
package epaylinks
import (
"errors"
)
type ProtocolPayConfirm struct {
Token string `json:"token"` // 绑卡流水号
CustomerCode string `json:"customerCode"` // 商户号
MemberId string `json:"memberId"` // 会员编号
Protocol string `json:"protocol"` // 协议号
NonceStr string `json:"nonceStr"` // 随机字符串
SmsCode string `json:"smsCode"` // 短息验证码
}
type ProtocolPayConfirmRsp struct {
ReturnCode string `json:"returnCode"` // 返回状态码
ReturnMsg string `json:"returnMsg"` // 返回信息
CustomerCode string `json:"customerCode"` // 商户号
MemberId string `json:"memberId"` // 会员编号
NonceStr string `json:"nonceStr"` // 随机字符串
transactionNo string `json:"transactionNo"` // 易票联订单号
channelOrder string `json:"channelOrder"` // 上游订单号
Amount int64 `json:"amount"` // 支付金额
ProcedureFee int64 `json:"procedureFee"` // 手续费
PayState string `json:"payState"` // 支付结果
PayTime string `json:"payTime"` // 支付完成时间
SettCycle string `json:"settCycle"` // 该支付交易所属的清算周期
settCycleInterval int `json:"settCycleInterval"` // 清算周期长度
}
// 协议支付确认交易
func (c *Client) ProtocolPayConfirm(ppc *ProtocolPayConfirm) (rsp *ProtocolPayConfirmRsp, err error) {
rsp = new(ProtocolPayConfirmRsp)
err = ppc.checkParms()
if err != nil {
return rsp, err
}
err = c.doPostReq(protocolPayConfirm, ppc, rsp)
if err != nil {
return rsp, err
}
return rsp, err
}
func (ppc *ProtocolPayConfirm) checkParms() error {
if ppc.Token == "" {
return errors.New("绑卡流水号不能为空")
}
if ppc.CustomerCode == "" {
return errors.New("商户号不能为空")
}
if ppc.MemberId == "" {
return errors.New("会员编号不能为空")
}
if ppc.Protocol == "" {
return errors.New("协议号不能为空")
}
if ppc.NonceStr == "" {
return errors.New("随机字符串不能为空")
}
if ppc.SmsCode == "" {
return errors.New("短息验证码不能为空")
}
return nil
}