-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathasync_response.go
91 lines (84 loc) · 2.92 KB
/
async_response.go
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
package alipay
import (
"errors"
"net/url"
)
// ErrAsyncVerify ...
var (
ErrAsyncVerify = errors.New("支付宝异步验签失败")
)
// ParseAsyncResponse ...
func (alipay *Alipay) ParseAsyncResponse(values url.Values) (*AsyncResponse, error) {
if err := alipay.asyncVerifyRequest(values); err != nil {
return nil, ErrAsyncVerify
}
asyncResponse := new(AsyncResponse)
asyncResponse.NotifyTime = values.Get("notify_time")
asyncResponse.NotifyType = values.Get("notify_type")
asyncResponse.NotifyID = values.Get("notify_id")
asyncResponse.AppID = values.Get("app_id")
asyncResponse.Charset = values.Get("charset")
asyncResponse.Version = values.Get("version")
asyncResponse.SignType = values.Get("sign_type")
asyncResponse.Sign = values.Get("sign")
asyncResponse.AuthAppID = values.Get("auth_app_id")
asyncResponse.TradeNo = values.Get("trade_no")
asyncResponse.OutTradeNo = values.Get("out_trade_no")
asyncResponse.OutBizNo = values.Get("out_biz_no")
asyncResponse.BuyerID = values.Get("buyer_id")
asyncResponse.BuyerLogonID = values.Get("buyer_logon_id")
asyncResponse.SellerID = values.Get("seller_id")
asyncResponse.SellerEmail = values.Get("seller_email")
asyncResponse.TradeStatus = values.Get("trade_status")
asyncResponse.TotalAmount = values.Get("total_amount")
asyncResponse.ReceiptAmount = values.Get("receipt_amount")
asyncResponse.InvoiceAmount = values.Get("invoice_amount")
asyncResponse.BuyerPayAmount = values.Get("buyer_pay_amount")
asyncResponse.PointAmount = values.Get("point_amount")
asyncResponse.RefundFee = values.Get("refund_fee")
asyncResponse.Subject = values.Get("subject")
asyncResponse.Body = values.Get("body")
asyncResponse.GmtCreate = values.Get("gmt_create")
asyncResponse.GmtPayment = values.Get("gmt_payment")
asyncResponse.GmtRefund = values.Get("gmt_refund")
asyncResponse.GmtClose = values.Get("gmt_close")
asyncResponse.FundBillList = values.Get("fund_bill_list")
asyncResponse.PassbackParams = values.Get("passback_params")
asyncResponse.VoucherDetailList = values.Get("voucher_detail_list")
return asyncResponse, nil
}
// AsyncResponse ...
type AsyncResponse struct {
NotifyTime string
NotifyType string
NotifyID string
AppID string
Charset string
Version string
SignType string
Sign string
AuthAppID string
TradeNo string
OutTradeNo string
OutBizNo string
BuyerID string
BuyerLogonID string
SellerID string
SellerEmail string
TradeStatus string
TotalAmount string
ReceiptAmount string
InvoiceAmount string
BuyerPayAmount string
PointAmount string
RefundFee string
Subject string
Body string
GmtCreate string
GmtPayment string
GmtRefund string
GmtClose string
FundBillList string
PassbackParams string
VoucherDetailList string
}