-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcore_test.go
63 lines (56 loc) · 1.34 KB
/
core_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
package xenditfasthttp
import (
"fmt"
"testing"
"time"
)
func initial() *CoreXendit {
client := NewClient()
client.Host = "https://api.xendit.co"
client.SecretKey = ""
return &CoreXendit{
Client: client,
}
}
func TestOutlet(t *testing.T) {
init := initial()
req := CreateFixedPaymentCodeRequest{
ExternalID: fmt.Sprintf("%v", time.Now().Unix()),
RetailOutletName: OutletIndomaret,
Name: "Joe Doe",
ExpectedAmount: 10000,
ExpirationDate: time.Now().Add(24 * time.Hour).Format(time.RFC3339),
IsSingleUse: true,
}
reqData, err := init.CreateFixedPaymentCode(req)
if err != nil {
t.Fatal(err)
}
reqSimulate := SimulateRequest{
ExternalID: reqData.ExternalID,
RetailOutletName: reqData.RetailOutletName,
PaymentCode: reqData.PaymentCode,
TransferAmount: reqData.ExpectedAmount,
}
simResp, err := init.SimulateFixedPayment(reqSimulate)
if err != nil {
t.Fatal(err)
}
t.Log(simResp)
}
func TestVA(t *testing.T) {
init := initial()
reqData := CreateVARequest{
ExternalID: fmt.Sprintf("%v", time.Now().UnixNano()),
BankCode: VABRI,
Name: "Jihar",
IsSingleUse: true,
SuggestedAmount: 100000,
ExpirationDate: time.Now().Add(24 * time.Hour).Format(time.RFC3339),
}
resp, err := init.CreataVA(reqData)
if err != nil {
t.Fatal(err)
}
t.Log(resp)
}