forked from smartwalle/alipay
-
Notifications
You must be signed in to change notification settings - Fork 0
/
trade_test.go
78 lines (74 loc) · 1.94 KB
/
trade_test.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
package alipay
import (
"fmt"
"testing"
)
//func TestAliPay_TradeQuery(t *testing.T) {
// fmt.Println("========== TradeQuery ==========")
// type arg struct {
// outTradeNo string
// wanted error
// name string
// }
//
// testCaes := []arg{
// {"trade_no_20170623022111", nil, "query success"},
// //TODO:add more test case
// }
//
// for _, tc := range testCaes {
// req := AliPayTradeQuery{
// OutTradeNo: tc.outTradeNo,
// }
// resp, err := client.TradeQuery(req)
// if err != tc.wanted {
// t.Errorf("%s input:%s wanted:%v get:%v", tc.name, tc.outTradeNo, tc.wanted, err)
// } else {
// t.Log(resp)
// }
// }
//}
//
//func TestAliPay_TradeAppPay(t *testing.T) {
// fmt.Println("========== TradeAppPay ==========")
// var p = AliPayTradeAppPay{}
// p.NotifyURL = "http://203.86.24.181:3000/alipay"
// p.Body = "body"
// p.Subject = "商品标题"
// p.OutTradeNo = "01010101"
// p.TotalAmount = "100.00"
// p.ProductCode = "p_1010101"
// fmt.Println(client.TradeAppPay(p))
//}
//
func TestAliPay_TradePagePay(t *testing.T) {
fmt.Println("========== TradePagePay ==========")
var p = AliPayTradePagePay{}
p.NotifyURL = "http://220.112.233.229:3000/alipay"
p.ReturnURL = "http://220.112.233.229:3000"
p.Subject = "修正了中文的 Bug"
p.OutTradeNo = "trade_no_20170623011112"
p.TotalAmount = "10.00"
p.ProductCode = "FAST_INSTANT_TRADE_PAY"
fmt.Println(client.TradePagePay(p))
}
//func TestAliPay_TradePreCreate(t *testing.T) {
// fmt.Println("========== TradePreCreate ==========")
// var p = AliPayTradePreCreate{}
// p.OutTradeNo = "no_0001"
// p.Subject = "测试订单"
// p.TotalAmount = "10.10"
//
// fmt.Println(client.TradePreCreate(p))
//}
//func TestAliPay_TradePay(t *testing.T) {
// fmt.Println("========== TradePay ==========")
// var p = AliPayTradePay{}
// p.OutTradeNo = "no_000111"
// p.Subject = "测试订单"
// p.TotalAmount = "10.10"
// p.Scene = "bar_code"
// p.AuthCode = "xxx"
//
// fmt.Println(client.TradePay(p))
//}