-
Notifications
You must be signed in to change notification settings - Fork 45
/
coupons.go
68 lines (51 loc) · 1.92 KB
/
coupons.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
package mock
import (
"context"
"github.com/blacklightcms/recurly"
)
var _ recurly.CouponsService = &CouponsService{}
// CouponsService manages the interactions for coupons.
type CouponsService struct {
OnList func(opts *recurly.PagerOptions) recurly.Pager
ListInvoked bool
OnGet func(ctx context.Context, code string) (*recurly.Coupon, error)
GetInvoked bool
OnCreate func(ctx context.Context, c recurly.Coupon) (*recurly.Coupon, error)
CreateInvoked bool
OnUpdate func(ctx context.Context, code string, c recurly.Coupon) (*recurly.Coupon, error)
UpdateInvoked bool
OnRestore func(ctx context.Context, code string, c recurly.Coupon) (*recurly.Coupon, error)
RestoreInvoked bool
OnDelete func(ctx context.Context, code string) error
DeleteInvoked bool
OnGenerate func(ctx context.Context, code string, n int) (recurly.Pager, error)
GenerateInvoked bool
}
func (m *CouponsService) List(opts *recurly.PagerOptions) recurly.Pager {
m.ListInvoked = true
return m.OnList(opts)
}
func (m *CouponsService) Get(ctx context.Context, code string) (*recurly.Coupon, error) {
m.GetInvoked = true
return m.OnGet(ctx, code)
}
func (m *CouponsService) Create(ctx context.Context, c recurly.Coupon) (*recurly.Coupon, error) {
m.CreateInvoked = true
return m.OnCreate(ctx, c)
}
func (m *CouponsService) Update(ctx context.Context, code string, c recurly.Coupon) (*recurly.Coupon, error) {
m.UpdateInvoked = true
return m.OnUpdate(ctx, code, c)
}
func (m *CouponsService) Restore(ctx context.Context, code string, c recurly.Coupon) (*recurly.Coupon, error) {
m.RestoreInvoked = true
return m.OnRestore(ctx, code, c)
}
func (m *CouponsService) Delete(ctx context.Context, code string) error {
m.DeleteInvoked = true
return m.OnDelete(ctx, code)
}
func (m *CouponsService) Generate(ctx context.Context, code string, n int) (recurly.Pager, error) {
m.GenerateInvoked = true
return m.OnGenerate(ctx, code, n)
}