/
payment_reporting_test.go
95 lines (79 loc) · 2.64 KB
/
payment_reporting_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
package tests
import (
"context"
"github.com/craftgate/craftgate-go-client/adapter"
craftgate "github.com/craftgate/craftgate-go-client/adapter"
"github.com/davecgh/go-spew/spew"
"testing"
"time"
)
var paymentReportingClient, _ = craftgate.New("api-key", "secret-key", "https://sandbox-api.craftgate.io")
func Test_SearchPayment(t *testing.T) {
request := adapter.SearchPaymentsRequest{
Page: 0, Size: 10,
PaymentType: craftgate.PaymentType_CARD_PAYMENT,
PaymentStatus: craftgate.PaymentStatus_SUCCESS,
Currency: craftgate.Currency_TRY,
MinCreatedDate: time.Now().AddDate(0, 0, -180),
MaxCreatedDate: time.Now(),
}
res, err := paymentReportingClient.PaymentReporting.SearchPayments(context.Background(), request)
_, _ = spew.Printf("%#v\n", res)
if err != nil {
t.Errorf("Error %s", err)
}
}
func Test_SearchPaymentRefunds(t *testing.T) {
request := adapter.SearchPaymentRefundsRequest{
Page: 0, Size: 10,
Currency: craftgate.Currency_TRY,
MinCreatedDate: time.Now().AddDate(0, 0, -180),
MaxCreatedDate: time.Now(),
}
res, err := paymentReportingClient.PaymentReporting.SearchPaymentRefunds(context.Background(), request)
_, _ = spew.Printf("%#v\n", res)
if err != nil {
t.Errorf("Error %s", err)
}
}
func Test_SearchPaymentTransactionRefunds(t *testing.T) {
request := adapter.SearchPaymentTransactionRefundsRequest{
Page: 0, Size: 10,
Currency: craftgate.Currency_TRY,
MinCreatedDate: time.Now().AddDate(0, 0, -180),
MaxCreatedDate: time.Now(),
}
res, err := paymentReportingClient.PaymentReporting.SearchPaymentTransactionRefunds(context.Background(), request)
_, _ = spew.Printf("%#v\n", res)
if err != nil {
t.Errorf("Error %s", err)
}
}
func Test_RetrievePayment(t *testing.T) {
res, err := paymentReportingClient.PaymentReporting.RetrievePayment(context.Background(), 123)
_, _ = spew.Printf("%#v\n", res)
if err != nil {
t.Errorf("Error %s", err)
}
}
func Test_RetrievePaymentTransactions(t *testing.T) {
res, err := paymentReportingClient.PaymentReporting.RetrievePaymentTransactions(context.Background(), 123)
_, _ = spew.Printf("%#v\n", res)
if err != nil {
t.Errorf("Error %s", err)
}
}
func Test_RetrievePaymentRefunds(t *testing.T) {
res, err := paymentReportingClient.PaymentReporting.RetrievePaymentRefunds(context.Background(), 123)
_, _ = spew.Printf("%#v\n", res)
if err != nil {
t.Errorf("Error %s", err)
}
}
func Test_RetrievePaymentTransactionRefunds(t *testing.T) {
res, err := paymentReportingClient.PaymentReporting.RetrievePaymentTransactionRefunds(context.Background(), 123, 789)
_, _ = spew.Printf("%#v\n", res)
if err != nil {
t.Errorf("Error %s", err)
}
}