-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathget_transactions_test.go
69 lines (61 loc) · 1.37 KB
/
get_transactions_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
package cloudbeds_test
import (
"encoding/json"
"log"
"testing"
_ "github.com/joho/godotenv/autoload"
"github.com/omniboost/go-cloudbeds"
)
func TestGetTransactions(t *testing.T) {
client := client()
req := client.NewGetTransactionsRequest()
req.SetRequestBody(cloudbeds.GetTransactionsRequestBody{
Filters: cloudbeds.Filters{
And: []cloudbeds.And{
{
Operator: "greater_than_or_equal",
Value: "2024-10-01T03:00:00",
Field: "TRANSACTION_DATETIME",
},
{
Operator: "less_than_or_equal",
Value: "2024-12-12T03:00:00",
Field: "TRANSACTION_DATETIME",
},
},
},
})
resp, err := req.Do()
if err != nil {
t.Error(err)
}
b, _ := json.MarshalIndent(resp, "", " ")
log.Println(string(b))
}
func TestGetTransactionsAll(t *testing.T) {
client := client()
req := client.NewGetTransactionsRequest()
req.SetRequestBody(cloudbeds.GetTransactionsRequestBody{
Filters: cloudbeds.Filters{
And: []cloudbeds.And{
{
Operator: "greater_than_or_equal",
Value: "2024-10-01T03:00:00",
Field: "TRANSACTION_DATETIME",
},
{
Operator: "less_than_or_equal",
Value: "2024-12-12T03:00:00",
Field: "TRANSACTION_DATETIME",
},
},
},
Limit: 10,
})
resp, err := req.All()
if err != nil {
t.Error(err)
}
b, _ := json.MarshalIndent(resp, "", " ")
log.Println(string(b))
}