-
Notifications
You must be signed in to change notification settings - Fork 14
/
checkout.go
54 lines (41 loc) · 2.08 KB
/
checkout.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
package mocks
import (
"github.com/checkout/checkout-sdk-go/instruments"
"github.com/checkout/checkout-sdk-go/payments"
"github.com/checkout/checkout-sdk-go/tokens"
"github.com/stretchr/testify/mock"
"github.com/coretrix/hitrix/service/component/checkout"
)
type FakeCheckoutClient struct {
mock.Mock
}
func (c *FakeCheckoutClient) CheckWebhookKey(keyCode, key string) bool {
return c.Called(keyCode, key).Get(0).(bool)
}
func (c *FakeCheckoutClient) RequestPayment(request *payments.Request) *payments.Response {
return c.Called(request).Get(0).(*payments.Response)
}
func (c *FakeCheckoutClient) RequestRefunds(amount uint64, paymentID, reference string, metadata map[string]string) *payments.RefundsResponse {
return c.Called(amount, paymentID, reference, metadata).Get(0).(*payments.RefundsResponse)
}
func (c *FakeCheckoutClient) DeleteCustomerInstrument(instrumentID string) bool {
return c.Called(instrumentID).Get(0).(bool)
}
func (c *FakeCheckoutClient) GetCustomer(idOrEmail string) (bool, *checkout.CustomerResponse) {
return c.Called(idOrEmail).Get(0).(bool), c.Called(idOrEmail).Get(1).(*checkout.CustomerResponse)
}
func (c *FakeCheckoutClient) SaveGetClient(customerData *checkout.SaveCustomerRequest) (created bool, customer *checkout.CustomerResponse) {
return c.Called(customerData).Get(0).(bool), c.Called(customerData).Get(1).(*checkout.CustomerResponse)
}
func (c *FakeCheckoutClient) CreateToken(request *tokens.Request) (string, error) {
return c.Called(request).Get(0).(string), c.Called(request).Error(1)
}
func (c *FakeCheckoutClient) CreateInstrument(request *instruments.Request) (*instruments.Response, error) {
return c.Called(request).Get(0).(*instruments.Response), c.Called(request).Error(1)
}
func (c *FakeCheckoutClient) GetInstrument(sourceID string) (*instruments.Response, error) {
return c.Called(sourceID).Get(0).(*instruments.Response), c.Called(sourceID).Error(1)
}
func (c *FakeCheckoutClient) GetPaymentDetail(paymentID string) (*payments.PaymentResponse, error) {
return c.Called(paymentID).Get(0).(*payments.PaymentResponse), c.Called(paymentID).Error(1)
}