-
Notifications
You must be signed in to change notification settings - Fork 45
/
redemptions.go
52 lines (39 loc) · 1.67 KB
/
redemptions.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
package mock
import (
"context"
"github.com/blacklightcms/recurly"
)
var _ recurly.RedemptionsService = &RedemptionsService{}
// RedemptionsService manages the interactions for redemptions.
type RedemptionsService struct {
OnListAccount func(accountCode string, opts *recurly.PagerOptions) recurly.Pager
ListAccountInvoked bool
OnListInvoice func(invoiceNumber int, opts *recurly.PagerOptions) recurly.Pager
ListInvoiceInvoked bool
OnListSubscription func(uuid string, opts *recurly.PagerOptions) recurly.Pager
ListSubscriptionInvoked bool
OnRedeem func(ctx context.Context, code string, r recurly.CouponRedemption) (*recurly.Redemption, error)
RedeemInvoked bool
OnDelete func(ctx context.Context, accountCode, couponCode string) error
DeleteInvoked bool
}
func (m *RedemptionsService) ListAccount(accountCode string, opts *recurly.PagerOptions) recurly.Pager {
m.ListAccountInvoked = true
return m.OnListAccount(accountCode, opts)
}
func (m *RedemptionsService) ListInvoice(invoiceNumber int, opts *recurly.PagerOptions) recurly.Pager {
m.ListInvoiceInvoked = true
return m.OnListInvoice(invoiceNumber, opts)
}
func (m *RedemptionsService) ListSubscription(uuid string, opts *recurly.PagerOptions) recurly.Pager {
m.ListSubscriptionInvoked = true
return m.OnListSubscription(uuid, opts)
}
func (m *RedemptionsService) Redeem(ctx context.Context, code string, r recurly.CouponRedemption) (*recurly.Redemption, error) {
m.RedeemInvoked = true
return m.OnRedeem(ctx, code, r)
}
func (m *RedemptionsService) Delete(ctx context.Context, accountCode, couponCode string) error {
m.DeleteInvoked = true
return m.OnDelete(ctx, accountCode, couponCode)
}