-
Notifications
You must be signed in to change notification settings - Fork 1
/
vpos_test.go
46 lines (40 loc) · 984 Bytes
/
vpos_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
package vposgo
import (
"testing"
)
var (
posID = int64(0)
token = ""
refundCallbackURL = ""
paymentCallbackURL = ""
supervidorCard = ""
vpos = NewVPOS(
posID,
token,
paymentCallbackURL,
refundCallbackURL,
supervidorCard,
)
)
func TestPaymentTransaction(t *testing.T) {
_, _, _, _, err := vpos.PaymentTransaction("payment", "900111222", "123.45")
if err != nil {
t.Logf("something went wrong: %v", err)
t.Fail()
}
}
func TestFailPaymentTransactionWithInvalidToken(t *testing.T) {
vpos.Token = "vpos-token"
_, _, _, _, err := vpos.PaymentTransaction("payment", "900111222", "123.45")
if err == nil {
t.Log("payment should not be performed with that token, something went wrong!")
t.Fail()
}
}
func TestFailRefundTransaction(t *testing.T) {
_, _, _, _, err := vpos.RefundOrCancelation("refund", "non-existent-transaction-id")
if err != nil {
t.Logf("something went wrong: %v", err)
t.Fail()
}
}