forked from Invoiced/invoiced-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrefund_test.go
39 lines (30 loc) · 876 Bytes
/
refund_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
package invdapi
import (
"testing"
"time"
"github.com/gabrielsoaressantos/invoiced-go/invdendpoint"
"github.com/gabrielsoaressantos/invoiced-go/invdmockserver"
)
func TestCreateRefund(t *testing.T) {
key := "test api key"
mockPaymentResponseID := int64(1523)
mockPaymentResponse := new(invdendpoint.Refund)
mockPaymentResponse.Id = mockPaymentResponseID
mockPaymentResponse.Charge = 234112
mockPaymentResponse.GatewayId = "234"
mockPaymentResponse.CreatedAt = time.Now().UnixNano()
server, err := invdmockserver.New(200, mockPaymentResponse, "json", true)
if err != nil {
t.Fatal(err)
}
defer server.Close()
conn := mockConnection(key, server)
refund := conn.NewRefund()
err = refund.Create(234112, 123.00)
if err != nil {
t.Fatal("Error Creating refund", err)
}
if refund.Id != int64(1523) {
t.Fatal("Error Messages Do Not Match Up")
}
}