-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathnotify.go
More file actions
41 lines (37 loc) · 1.01 KB
/
notify.go
File metadata and controls
41 lines (37 loc) · 1.01 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
package epaylinks
import (
"encoding/json"
)
type Notify struct {
CustomerCode string `json:"customerCode"`
OutTradeNo string `json:"outTradeNo"`
TransactionNo string `json:"transactionNo"`
ChannelOrder string `json:"channelOrder"`
Amount int `json:"amount"`
PayState string `json:"payState"`
PayTime int64 `json:"payTime"`
SettCycle string `json:"settCycle"`
SettCycleInterva string `json:"settCycleInterval"`
ProcedureFee int `json:"procedureFee"`
AttachData string `json:"attachData"`
NonceStr string `json:"nonceStr"`
}
type NotifyRsp struct {
ReturnCode string `json:"returnCode"`
ReturnMsg string `json:"returnMsg"`
}
// 异步通知验证
// sign 签名
// body 验签的数据
func (c *Client) Notify(sign, body string) (rsp *Notify, err error) {
rsp = new(Notify)
err = json.Unmarshal([]byte(body), rsp)
if err != nil {
return rsp, err
}
err = c.Verify(sign, body)
if err != nil {
return rsp, err
}
return rsp, nil
}