forked from smartwalle/alipay
-
Notifications
You must be signed in to change notification settings - Fork 0
/
trade.go
82 lines (69 loc) · 2.88 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
package alipay
import (
"net/url"
)
// TradePagePay https://docs.open.alipay.com/270/alipay.trade.page.pay
func (this *AliPay) TradePagePay(param AliPayTradePagePay) (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 *AliPay) TradeAppPay(param AliPayTradeAppPay) (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 *AliPay) TradeFastpayRefundQuery(param AliPayFastpayTradeRefundQuery) (results *AliPayFastpayTradeRefundQueryResponse, 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 *AliPay) TradeOrderSettle(param AliPayTradeOrderSettle) (results interface{}, err error) {
err = this.doRequest("POST", param, &results)
return results, err
}
// TradeClose https://docs.open.alipay.com/api_1/alipay.trade.close/
func (this *AliPay) TradeClose(param AliPayTradeClose) (results *AliPayTradeCloseResponse, err error) {
err = this.doRequest("POST", param, &results)
return results, err
}
// TradeCancel https://docs.open.alipay.com/api_1/alipay.trade.cancel/
func (this *AliPay) TradeCancel(param AliPayTradeCancel) (results *AliPayTradeCancelResponse, err error) {
err = this.doRequest("POST", param, &results)
return results, err
}
// TradeRefund https://docs.open.alipay.com/api_1/alipay.trade.refund/
func (this *AliPay) TradeRefund(param AliPayTradeRefund) (results *AliPayTradeRefundResponse, err error) {
err = this.doRequest("POST", param, &results)
return results, err
}
// TradePreCreate https://docs.open.alipay.com/api_1/alipay.trade.precreate/
func (this *AliPay) TradePreCreate(param AliPayTradePreCreate) (results *AliPayTradePreCreateResponse, err error) {
err = this.doRequest("POST", param, &results)
return results, err
}
// TradeQuery https://docs.open.alipay.com/api_1/alipay.trade.query/
func (this *AliPay) TradeQuery(param AliPayTradeQuery) (results *AliPayTradeQueryResponse, err error) {
err = this.doRequest("POST", param, &results)
return results, err
}
// TradeCreate https://docs.open.alipay.com/api_1/alipay.trade.create/
func (this *AliPay) TradeCreate(param AliPayTradeCreate) (results *AliPayTradeCreateResponse, err error) {
err = this.doRequest("POST", param, &results)
return results, err
}
// TradePay https://docs.open.alipay.com/api_1/alipay.trade.pay/
func (this *AliPay) TradePay(param AliPayTradePay) (results *AliPayTradePayResponse, err error) {
err = this.doRequest("POST", param, &results)
return results, err
}