-
Notifications
You must be signed in to change notification settings - Fork 5
/
payment_test.go
88 lines (85 loc) · 2.09 KB
/
payment_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
package ravepay
import (
"reflect"
"testing"
)
func TestNewTxnVerificationChecklist(t *testing.T) {
type args struct {
amount int
flwRef string
currency string
secKey string
}
tests := []struct {
name string
args args
want *TxnVerificationChecklist
}{
{
name: "returns a new txn verification checklist",
args: args{
amount: 1000,
flwRef: "some-flw-ref",
currency: "NGN",
secKey: "some-sec-key",
},
want: &TxnVerificationChecklist{
Amount: 1000,
FlwRef: "some-flw-ref",
TransactionCurrency: "NGN",
SECKEY: "some-sec-key",
VerificationURL: baseURL + txnVerificationURL,
},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
SecretKey = tt.args.secKey
if got := NewTxnVerificationChecklist(tt.args.amount, tt.args.flwRef, tt.args.currency); !reflect.DeepEqual(got, tt.want) {
t.Errorf("NewTxnVerificationChecklist() = %v, want %v", got, tt.want)
}
})
}
}
func TestNewXRQTxnVerificationChecklist(t *testing.T) {
type args struct {
amount int
flwRef string
txRef string
currency string
secKey string
}
tests := []struct {
name string
args args
want *TxnVerificationChecklist
}{
{
name: "returns a new txn verification checklist",
args: args{
amount: 1000,
flwRef: "some-flw-ref",
currency: "NGN",
secKey: "some-sec-key",
},
want: &TxnVerificationChecklist{
Amount: 1000,
Flwref: "some-flw-ref",
FlwRef: "some-flw-ref",
TransactionCurrency: "NGN",
LastAttempt: "1",
OnlySuccessful: "1",
SECKEY: "some-sec-key",
VerificationURL: baseURL + txnVerificationRequeryURL,
},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
SecretKey = tt.args.secKey
if got := NewXRQTxnVerificationChecklist(tt.args.amount, tt.args.flwRef, tt.args.txRef, tt.args.currency); !reflect.DeepEqual(got, tt.want) {
t.Errorf("NewXRQTxnVerificationChecklist() = %+v, want %+v", got, tt.want)
}
})
}
}