This repository has been archived by the owner on Mar 1, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
checkout_test.go
75 lines (60 loc) · 1.65 KB
/
checkout_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
package axcessms
import (
"context"
"testing"
)
func TestCreateCheckout(t *testing.T) {
client := getTestClient(t)
req := &CreateCheckoutRequest{
EntityID: "8ac7a4c8710d265c01710d30b6e60023",
Currency: "USD",
Amount: 6969,
PaymentType: PaymentTypeDebit,
TransactionCategory: TransactionCategoryECommerce,
}
res, err := client.CreateCheckout(context.TODO(), req)
if err != nil {
t.Errorf("Expected not to get an error but got '%s' instead", err)
}
t.Logf("Response: %#+v", res)
}
func TestGetCheckout(t *testing.T) {
client := getTestClient(t)
// Create a checkout to test with
req := &CreateCheckoutRequest{
EntityID: "8ac7a4c8710d265c01710d30b6e60023",
Currency: "USD",
Amount: 6969,
PaymentType: PaymentTypeDebit,
TransactionCategory: TransactionCategoryECommerce,
CustomParameters: &CustomParameters{
"customFieldName": "customFieldValue",
},
Customer: &Customer{
ID: "TEST",
FirstName: "John",
MiddleNames: "James",
LastName: "Smith",
Browser: &UserAgent{
IsJavaEnabled: false,
ScreenWidth: 640,
ScreenHeight: 480,
Accept: "application/json",
UserAgent: "go/1.14 +testUA",
Language: "en-US",
UTCOffset: 1440,
},
},
}
cko, err := client.CreateCheckout(context.TODO(), req)
if err != nil {
t.Errorf("Failed to create a checkout to test against: %s", err)
return
}
resp, err := client.GetCheckout(context.TODO(), *cko)
if err != nil {
t.Errorf("Expected not to get an error but insted got: %s", err)
return
}
t.Logf("Checkout: %#+v\n", resp)
}