diff --git a/core/deleter/mocks/credit_service.go b/core/deleter/mocks/credit_service.go index bef1a735b7..e34cdb5799 100644 --- a/core/deleter/mocks/credit_service.go +++ b/core/deleter/mocks/credit_service.go @@ -68,6 +68,63 @@ func (_c *CreditService_DeleteByAccountID_Call) RunAndReturn(run func(context.Co return _c } +// GetBalance provides a mock function with given fields: ctx, accountID +func (_m *CreditService) GetBalance(ctx context.Context, accountID string) (int64, error) { + ret := _m.Called(ctx, accountID) + + if len(ret) == 0 { + panic("no return value specified for GetBalance") + } + + var r0 int64 + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, string) (int64, error)); ok { + return rf(ctx, accountID) + } + if rf, ok := ret.Get(0).(func(context.Context, string) int64); ok { + r0 = rf(ctx, accountID) + } else { + r0 = ret.Get(0).(int64) + } + + if rf, ok := ret.Get(1).(func(context.Context, string) error); ok { + r1 = rf(ctx, accountID) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// CreditService_GetBalance_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetBalance' +type CreditService_GetBalance_Call struct { + *mock.Call +} + +// GetBalance is a helper method to define mock.On call +// - ctx context.Context +// - accountID string +func (_e *CreditService_Expecter) GetBalance(ctx interface{}, accountID interface{}) *CreditService_GetBalance_Call { + return &CreditService_GetBalance_Call{Call: _e.mock.On("GetBalance", ctx, accountID)} +} + +func (_c *CreditService_GetBalance_Call) Run(run func(ctx context.Context, accountID string)) *CreditService_GetBalance_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string)) + }) + return _c +} + +func (_c *CreditService_GetBalance_Call) Return(_a0 int64, _a1 error) *CreditService_GetBalance_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *CreditService_GetBalance_Call) RunAndReturn(run func(context.Context, string) (int64, error)) *CreditService_GetBalance_Call { + _c.Call.Return(run) + return _c +} + // NewCreditService creates a new instance of CreditService. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. // The first argument is typically a *testing.T value. func NewCreditService(t interface { diff --git a/core/deleter/mocks/invoice_service.go b/core/deleter/mocks/invoice_service.go index c48580e932..c8e3d25797 100644 --- a/core/deleter/mocks/invoice_service.go +++ b/core/deleter/mocks/invoice_service.go @@ -8,7 +8,6 @@ import ( customer "github.com/raystack/frontier/billing/customer" invoice "github.com/raystack/frontier/billing/invoice" - mock "github.com/stretchr/testify/mock" ) @@ -131,6 +130,53 @@ func (_c *InvoiceService_List_Call) RunAndReturn(run func(context.Context, invoi return _c } +// SyncWithProvider provides a mock function with given fields: ctx, customr +func (_m *InvoiceService) SyncWithProvider(ctx context.Context, customr customer.Customer) error { + ret := _m.Called(ctx, customr) + + if len(ret) == 0 { + panic("no return value specified for SyncWithProvider") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, customer.Customer) error); ok { + r0 = rf(ctx, customr) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// InvoiceService_SyncWithProvider_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SyncWithProvider' +type InvoiceService_SyncWithProvider_Call struct { + *mock.Call +} + +// SyncWithProvider is a helper method to define mock.On call +// - ctx context.Context +// - customr customer.Customer +func (_e *InvoiceService_Expecter) SyncWithProvider(ctx interface{}, customr interface{}) *InvoiceService_SyncWithProvider_Call { + return &InvoiceService_SyncWithProvider_Call{Call: _e.mock.On("SyncWithProvider", ctx, customr)} +} + +func (_c *InvoiceService_SyncWithProvider_Call) Run(run func(ctx context.Context, customr customer.Customer)) *InvoiceService_SyncWithProvider_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(customer.Customer)) + }) + return _c +} + +func (_c *InvoiceService_SyncWithProvider_Call) Return(_a0 error) *InvoiceService_SyncWithProvider_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *InvoiceService_SyncWithProvider_Call) RunAndReturn(run func(context.Context, customer.Customer) error) *InvoiceService_SyncWithProvider_Call { + _c.Call.Return(run) + return _c +} + // NewInvoiceService creates a new instance of InvoiceService. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. // The first argument is typically a *testing.T value. func NewInvoiceService(t interface { diff --git a/core/deleter/mocks/plan_service.go b/core/deleter/mocks/plan_service.go new file mode 100644 index 0000000000..9137c52e36 --- /dev/null +++ b/core/deleter/mocks/plan_service.go @@ -0,0 +1,94 @@ +// Code generated by mockery v2.53.5. DO NOT EDIT. + +package mocks + +import ( + context "context" + + plan "github.com/raystack/frontier/billing/plan" + mock "github.com/stretchr/testify/mock" +) + +// PlanService is an autogenerated mock type for the PlanService type +type PlanService struct { + mock.Mock +} + +type PlanService_Expecter struct { + mock *mock.Mock +} + +func (_m *PlanService) EXPECT() *PlanService_Expecter { + return &PlanService_Expecter{mock: &_m.Mock} +} + +// GetByID provides a mock function with given fields: ctx, id +func (_m *PlanService) GetByID(ctx context.Context, id string) (plan.Plan, error) { + ret := _m.Called(ctx, id) + + if len(ret) == 0 { + panic("no return value specified for GetByID") + } + + var r0 plan.Plan + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, string) (plan.Plan, error)); ok { + return rf(ctx, id) + } + if rf, ok := ret.Get(0).(func(context.Context, string) plan.Plan); ok { + r0 = rf(ctx, id) + } else { + r0 = ret.Get(0).(plan.Plan) + } + + if rf, ok := ret.Get(1).(func(context.Context, string) error); ok { + r1 = rf(ctx, id) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// PlanService_GetByID_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetByID' +type PlanService_GetByID_Call struct { + *mock.Call +} + +// GetByID is a helper method to define mock.On call +// - ctx context.Context +// - id string +func (_e *PlanService_Expecter) GetByID(ctx interface{}, id interface{}) *PlanService_GetByID_Call { + return &PlanService_GetByID_Call{Call: _e.mock.On("GetByID", ctx, id)} +} + +func (_c *PlanService_GetByID_Call) Run(run func(ctx context.Context, id string)) *PlanService_GetByID_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string)) + }) + return _c +} + +func (_c *PlanService_GetByID_Call) Return(_a0 plan.Plan, _a1 error) *PlanService_GetByID_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *PlanService_GetByID_Call) RunAndReturn(run func(context.Context, string) (plan.Plan, error)) *PlanService_GetByID_Call { + _c.Call.Return(run) + return _c +} + +// NewPlanService creates a new instance of PlanService. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewPlanService(t interface { + mock.TestingT + Cleanup(func()) +}) *PlanService { + mock := &PlanService{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/core/deleter/mocks/subscription_service.go b/core/deleter/mocks/subscription_service.go index 874edb3252..8fbb5ea3dc 100644 --- a/core/deleter/mocks/subscription_service.go +++ b/core/deleter/mocks/subscription_service.go @@ -7,6 +7,7 @@ import ( customer "github.com/raystack/frontier/billing/customer" + subscription "github.com/raystack/frontier/billing/subscription" mock "github.com/stretchr/testify/mock" ) @@ -23,6 +24,64 @@ func (_m *SubscriptionService) EXPECT() *SubscriptionService_Expecter { return &SubscriptionService_Expecter{mock: &_m.Mock} } +// Cancel provides a mock function with given fields: ctx, id, immediate +func (_m *SubscriptionService) Cancel(ctx context.Context, id string, immediate bool) (subscription.Subscription, error) { + ret := _m.Called(ctx, id, immediate) + + if len(ret) == 0 { + panic("no return value specified for Cancel") + } + + var r0 subscription.Subscription + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, string, bool) (subscription.Subscription, error)); ok { + return rf(ctx, id, immediate) + } + if rf, ok := ret.Get(0).(func(context.Context, string, bool) subscription.Subscription); ok { + r0 = rf(ctx, id, immediate) + } else { + r0 = ret.Get(0).(subscription.Subscription) + } + + if rf, ok := ret.Get(1).(func(context.Context, string, bool) error); ok { + r1 = rf(ctx, id, immediate) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// SubscriptionService_Cancel_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Cancel' +type SubscriptionService_Cancel_Call struct { + *mock.Call +} + +// Cancel is a helper method to define mock.On call +// - ctx context.Context +// - id string +// - immediate bool +func (_e *SubscriptionService_Expecter) Cancel(ctx interface{}, id interface{}, immediate interface{}) *SubscriptionService_Cancel_Call { + return &SubscriptionService_Cancel_Call{Call: _e.mock.On("Cancel", ctx, id, immediate)} +} + +func (_c *SubscriptionService_Cancel_Call) Run(run func(ctx context.Context, id string, immediate bool)) *SubscriptionService_Cancel_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string), args[2].(bool)) + }) + return _c +} + +func (_c *SubscriptionService_Cancel_Call) Return(_a0 subscription.Subscription, _a1 error) *SubscriptionService_Cancel_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *SubscriptionService_Cancel_Call) RunAndReturn(run func(context.Context, string, bool) (subscription.Subscription, error)) *SubscriptionService_Cancel_Call { + _c.Call.Return(run) + return _c +} + // DeleteByCustomer provides a mock function with given fields: ctx, customr func (_m *SubscriptionService) DeleteByCustomer(ctx context.Context, customr customer.Customer) error { ret := _m.Called(ctx, customr) @@ -70,6 +129,65 @@ func (_c *SubscriptionService_DeleteByCustomer_Call) RunAndReturn(run func(conte return _c } +// List provides a mock function with given fields: ctx, filter +func (_m *SubscriptionService) List(ctx context.Context, filter subscription.Filter) ([]subscription.Subscription, error) { + ret := _m.Called(ctx, filter) + + if len(ret) == 0 { + panic("no return value specified for List") + } + + var r0 []subscription.Subscription + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, subscription.Filter) ([]subscription.Subscription, error)); ok { + return rf(ctx, filter) + } + if rf, ok := ret.Get(0).(func(context.Context, subscription.Filter) []subscription.Subscription); ok { + r0 = rf(ctx, filter) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]subscription.Subscription) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, subscription.Filter) error); ok { + r1 = rf(ctx, filter) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// SubscriptionService_List_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'List' +type SubscriptionService_List_Call struct { + *mock.Call +} + +// List is a helper method to define mock.On call +// - ctx context.Context +// - filter subscription.Filter +func (_e *SubscriptionService_Expecter) List(ctx interface{}, filter interface{}) *SubscriptionService_List_Call { + return &SubscriptionService_List_Call{Call: _e.mock.On("List", ctx, filter)} +} + +func (_c *SubscriptionService_List_Call) Run(run func(ctx context.Context, filter subscription.Filter)) *SubscriptionService_List_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(subscription.Filter)) + }) + return _c +} + +func (_c *SubscriptionService_List_Call) Return(_a0 []subscription.Subscription, _a1 error) *SubscriptionService_List_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *SubscriptionService_List_Call) RunAndReturn(run func(context.Context, subscription.Filter) ([]subscription.Subscription, error)) *SubscriptionService_List_Call { + _c.Call.Return(run) + return _c +} + // NewSubscriptionService creates a new instance of SubscriptionService. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. // The first argument is typically a *testing.T value. func NewSubscriptionService(t interface {