forked from smartwalle/alipay
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtrade.go
88 lines (74 loc) · 3 KB
/
trade.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
package alipay
import (
"net/url"
)
// TradePagePay https://docs.open.alipay.com/270/alipay.trade.page.pay
func (this *Client) TradePagePay(param TradePagePay) (results *url.URL, err error) {
p, err := this.URLValues(param)
if err != nil {
return nil, err
}
results, err = url.Parse(this.apiDomain + "?" + p.Encode())
if err != nil {
return nil, err
}
return results, err
}
// TradeAppPay https://docs.open.alipay.com/api_1/alipay.trade.app.pay
func (this *Client) TradeAppPay(param TradeAppPay) (results string, err error) {
p, err := this.URLValues(param)
if err != nil {
return "", err
}
return p.Encode(), err
}
// TradeFastPayRefundQuery https://docs.open.alipay.com/api_1/alipay.trade.fastpay.refund.query
func (this *Client) TradeFastPayRefundQuery(param TradeFastPayRefundQuery) (results *TradeFastPayRefundQueryRsp, err error) {
err = this.doRequest("POST", param, &results)
return results, err
}
// TradeOrderSettle https://docs.open.alipay.com/api_1/alipay.trade.order.settle
func (this *Client) TradeOrderSettle(param TradeOrderSettle) (results *TradeOrderSettleRsp, err error) {
err = this.doRequest("POST", param, &results)
return results, err
}
// TradeClose https://docs.open.alipay.com/api_1/alipay.trade.close/
func (this *Client) TradeClose(param TradeClose) (results *TradeCloseRsp, err error) {
err = this.doRequest("POST", param, &results)
return results, err
}
// TradeCancel https://docs.open.alipay.com/api_1/alipay.trade.cancel/
func (this *Client) TradeCancel(param TradeCancel) (results *TradeCancelRsp, err error) {
err = this.doRequest("POST", param, &results)
return results, err
}
// TradeRefund https://docs.open.alipay.com/api_1/alipay.trade.refund/
func (this *Client) TradeRefund(param TradeRefund) (results *TradeRefundRsp, err error) {
err = this.doRequest("POST", param, &results)
return results, err
}
// TradePreCreate https://docs.open.alipay.com/api_1/alipay.trade.precreate/
func (this *Client) TradePreCreate(param TradePreCreate) (results *TradePreCreateRsp, err error) {
err = this.doRequest("POST", param, &results)
return results, err
}
// TradeQuery https://docs.open.alipay.com/api_1/alipay.trade.query/
func (this *Client) TradeQuery(param TradeQuery) (results *TradeQueryRsp, err error) {
err = this.doRequest("POST", param, &results)
return results, err
}
// TradeCreate https://docs.open.alipay.com/api_1/alipay.trade.create/
func (this *Client) TradeCreate(param TradeCreate) (results *TradeCreateRsp, err error) {
err = this.doRequest("POST", param, &results)
return results, err
}
// Trade https://docs.open.alipay.com/api_1/alipay.trade.pay/
func (this *Client) TradePay(param TradePay) (results *TradePayRsp, err error) {
err = this.doRequest("POST", param, &results)
return results, err
}
// TradeOrderInfoSync https://docs.open.alipay.com/api_1/alipay.trade.orderinfo.sync/
func (this *Client) TradeOrderInfoSync(param TradeOrderInfoSync) (results *TradeOrderInfoSyncRsp, err error) {
err = this.doRequest("POST", param, &results)
return results, err
}