forked from smartwalle/alipay
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fund_test.go
105 lines (96 loc) · 2.52 KB
/
fund_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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
package alipay_test
import (
"testing"
alipay "github.com/smartwalle/alipay/v3"
)
func TestClient_FundTransToAccountTransfer(t *testing.T) {
t.Log("========== FundTransToAccountTransfer ==========")
var p = alipay.FundTransToAccountTransfer{}
p.OutBizNo = "xxxx"
p.PayeeType = "ALIPAY_LOGONID"
p.PayeeAccount = "xwmkjn7612@sandbox.com"
p.Amount = "100"
rsp, err := client.FundTransToAccountTransfer(p)
if err != nil {
t.Fatal(err)
}
if rsp.Content.Code != alipay.CodeSuccess {
t.Fatal(rsp.Content.Msg, rsp.Content.SubMsg)
}
t.Log(rsp.Content.Msg)
}
func TestClient_FundAuthOrderVoucherCreate(t *testing.T) {
t.Log("========== FundAuthOrderVoucherCreate ==========")
var p = alipay.FundAuthOrderVoucherCreate{}
p.OutOrderNo = "1111"
p.OutRequestNo = "222"
p.OrderTitle = "eee"
p.Amount = "1001"
rsp, err := client.FundAuthOrderVoucherCreate(p)
if err != nil {
t.Fatal(err)
}
if rsp.Content.Code != alipay.CodeSuccess {
t.Fatal(rsp.Content.Msg, rsp.Content.SubMsg)
}
t.Log(rsp.Content.Msg)
}
func TestClient_FundAuthOrderAppFreeze(t *testing.T) {
t.Log("========== FundAuthOrderAppFreeze ==========")
var p = alipay.FundAuthOrderAppFreeze{}
p.OutOrderNo = "111"
p.OutRequestNo = "xxxxx"
p.OrderTitle = "test"
p.Amount = "100"
p.ProductCode = "PRE_AUTH_ONLINE"
rsp, err := client.FundAuthOrderAppFreeze(p)
if err != nil {
t.Fatal(err)
}
t.Log(rsp)
}
func TestClient_FundTransUniTransfer(t *testing.T) {
t.Log("========== FundTransUniTransfer ==========")
var param = alipay.FundTransUniTransfer{
OutBizNo: "1111",
TransAmount: "10.00",
ProductCode: "TRANS_ACCOUNT_NO_PWD",
BizScene: "DIRECT_TRANSFER",
OrderTitle: "remark",
PayeeInfo: &alipay.PayeeInfo{
Identity: "xwmkjn7612@sandbox.com",
IdentityType: "ALIPAY_LOGON_ID",
Name: "沙箱环境",
},
Remark: "remark",
}
rsp, err := client.FundTransUniTransfer(param)
if err != nil {
t.Fatal(err)
}
t.Log(rsp)
}
func TestClient_FundTransCommonQuery(t *testing.T) {
t.Log("========== FundTransCommonQuery ==========")
var param = alipay.FundTransCommonQuery{
ProductCode: "TRANS_ACCOUNT_NO_PWD",
BizScene: "DIRECT_TRANSFER",
OutBizNo: "1111",
}
rsp, err := client.FundTransCommonQuery(param)
if err != nil {
t.Fatal(err)
}
t.Log(rsp)
}
func TestClient_FundAccountQuery(t *testing.T) {
t.Log("========== FundAccountQuery ==========")
var param = alipay.FundAccountQuery{
AliPayUserId: "2088102169227503",
}
rsp, err := client.FundAccountQuery(param)
if err != nil {
t.Fatal(err)
}
t.Log(rsp)
}