-
Notifications
You must be signed in to change notification settings - Fork 14
/
stripe.go
121 lines (85 loc) · 4.42 KB
/
stripe.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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
package mocks
import (
"github.com/stretchr/testify/mock"
"github.com/stripe/stripe-go/v72"
)
type FakeStripeClient struct {
mock.Mock
}
func (t *FakeStripeClient) CreateAccount(accountParams *stripe.AccountParams) (*stripe.Account, error) {
args := t.Called(accountParams)
return args.Get(0).(*stripe.Account), args.Error(1)
}
func (t *FakeStripeClient) UpdateAccount(accountID string, accountParams *stripe.AccountParams) (*stripe.Account, error) {
args := t.Called(accountID, accountParams)
return args.Get(0).(*stripe.Account), args.Error(1)
}
func (t *FakeStripeClient) GetAccount(accountID string, accountParams *stripe.AccountParams) (*stripe.Account, error) {
args := t.Called(accountID, accountParams)
return args.Get(0).(*stripe.Account), args.Error(1)
}
func (t *FakeStripeClient) CreateCustomer(customerParams *stripe.CustomerParams) (*stripe.Customer, error) {
args := t.Called(customerParams)
return args.Get(0).(*stripe.Customer), args.Error(1)
}
func (t *FakeStripeClient) UpdateCustomer(customerID string, customerParams *stripe.CustomerParams) (*stripe.Customer, error) {
args := t.Called(customerID, customerParams)
return args.Get(0).(*stripe.Customer), args.Error(1)
}
func (t *FakeStripeClient) CreateCheckoutSession(checkoutSessionParams *stripe.CheckoutSessionParams) (*stripe.CheckoutSession, error) {
args := t.Called(checkoutSessionParams)
return args.Get(0).(*stripe.CheckoutSession), args.Error(1)
}
func (t *FakeStripeClient) GetSubscription(subscriptionID string, params *stripe.SubscriptionParams) (*stripe.Subscription, error) {
args := t.Called(subscriptionID, params)
return args.Get(0).(*stripe.Subscription), args.Error(1)
}
func (t *FakeStripeClient) CreateSubscription(subscriptionParams *stripe.SubscriptionParams) (*stripe.Subscription, error) {
args := t.Called(subscriptionParams)
return args.Get(0).(*stripe.Subscription), args.Error(1)
}
func (t *FakeStripeClient) UpdateSubscription(subscriptionID string, subscriptionParams *stripe.SubscriptionParams) (*stripe.Subscription, error) {
args := t.Called(subscriptionID, subscriptionParams)
return args.Get(0).(*stripe.Subscription), args.Error(1)
}
func (t *FakeStripeClient) CancelSubscription(subscriptionID string, cancelParams *stripe.SubscriptionCancelParams) (*stripe.Subscription, error) {
args := t.Called(subscriptionID, cancelParams)
return args.Get(0).(*stripe.Subscription), args.Error(1)
}
func (t *FakeStripeClient) CreateSetupIntent(setupIntentParams *stripe.SetupIntentParams) (*stripe.SetupIntent, error) {
args := t.Called(setupIntentParams)
return args.Get(0).(*stripe.SetupIntent), args.Error(1)
}
func (t *FakeStripeClient) CreateBillingPortalSession(billingPortalSParams *stripe.BillingPortalSessionParams) (*stripe.BillingPortalSession, error) {
args := t.Called(billingPortalSParams)
return args.Get(0).(*stripe.BillingPortalSession), args.Error(1)
}
func (t *FakeStripeClient) CreateAccountLink(accountLinkParams *stripe.AccountLinkParams) (*stripe.AccountLink, error) {
args := t.Called(accountLinkParams)
return args.Get(0).(*stripe.AccountLink), args.Error(1)
}
func (t *FakeStripeClient) GetPaymentIntent(paymentIntentID string, paymentIntentParams *stripe.PaymentIntentParams) (*stripe.PaymentIntent, error) {
args := t.Called(paymentIntentID, paymentIntentParams)
return args.Get(0).(*stripe.PaymentIntent), args.Error(1)
}
func (t *FakeStripeClient) CreatePaymentIntentMultiparty(
paymentIntentParams *stripe.PaymentIntentParams,
linkedAccountID string,
) (*stripe.PaymentIntent, error) {
args := t.Called(paymentIntentParams, linkedAccountID)
return args.Get(0).(*stripe.PaymentIntent), args.Error(1)
}
func (t *FakeStripeClient) CreateRefundMultiparty(refundParams *stripe.RefundParams, linkedAccountID string) (*stripe.Refund, error) {
args := t.Called(refundParams, linkedAccountID)
return args.Get(0).(*stripe.Refund), args.Error(1)
}
func (t *FakeStripeClient) ConstructWebhookEvent(reqBody []byte, signature string, webhookKey string) (stripe.Event, error) {
return t.Called(reqBody, signature, webhookKey).Get(0).(stripe.Event), t.Called(reqBody, signature, webhookKey).Error(1)
}
func (t *FakeStripeClient) NewCheckoutSession(
paymentMethods []string,
mode, successURL, CancelURL string,
lineItems []*stripe.CheckoutSessionLineItemParams,
_ []*stripe.CheckoutSessionDiscountParams) *stripe.CheckoutSession {
return t.Called(paymentMethods, mode, successURL, CancelURL, lineItems).Get(0).(*stripe.CheckoutSession)
}