forked from smartwalle/alipay
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bill_test.go
43 lines (40 loc) · 802 Bytes
/
bill_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
package alipay
import (
"testing"
"time"
"fmt"
)
func TestAliPay_BillDownloadURLQuery(t *testing.T) {
fmt.Println("========== BillDownloadURLQuery ==========")
type arg struct {
param BillDownloadURLQuery
wanted string
}
testCases := []arg{
{
param: BillDownloadURLQuery{
BillType: "trade",
BillDate: "2017-02-24",
},
wanted: "10000",
},
{
param: BillDownloadURLQuery{
BillType: "trade",
BillDate: time.Now().Format("2006-01-02"),
},
wanted: "40004",
},
}
client := New(appID, "", publicKey, privateKey, false)
for _, tc := range testCases {
r, err := client.BillDownloadURLQuery(tc.param)
t.Log(r, err)
if err != nil {
t.FailNow()
}
if r.AliPayDataServiceBillDownloadURLQueryResponse.Code != tc.wanted {
t.FailNow()
}
}
}