testutil

package
v1.0.22 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 29, 2025 License: AGPL-3.0 Imports: 65 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckEnvironmentFilter

func CheckEnvironmentFilter(ctx context.Context, itemEnvID string) bool

CheckEnvironmentFilter is a helper function to check if an item matches the environment filter

func NewInMemoryEntityIntegrationMappingStore added in v1.0.21

func NewInMemoryEntityIntegrationMappingStore() entityintegrationmapping.Repository

NewInMemoryEntityIntegrationMappingStore creates a new in-memory entity integration mapping store

func NewInMemoryEventPublisher

func NewInMemoryEventPublisher(eventStore *InMemoryEventStore) publisher.EventPublisher

NewInMemoryEventPublisher creates a new instance of InMemoryPublisherService

func NewMockPDFGenerator added in v1.0.0

func NewMockPDFGenerator(logger *logger.Logger) pdf.Generator

func NewMockPostgresClient

func NewMockPostgresClient(logger *logger.Logger) postgres.IClient

NewMockPostgresClient creates a new mock postgres client

func SetupContext

func SetupContext() context.Context

Types

type BaseServiceTestSuite

type BaseServiceTestSuite struct {
	suite.Suite
	// contains filtered or unexported fields
}

BaseServiceTestSuite provides common functionality for all service test suites

func (*BaseServiceTestSuite) ClearStores

func (s *BaseServiceTestSuite) ClearStores()

func (*BaseServiceTestSuite) GetConfig

func (s *BaseServiceTestSuite) GetConfig() *config.Configuration

GetConfig returns the test configuration

func (*BaseServiceTestSuite) GetContext

func (s *BaseServiceTestSuite) GetContext() context.Context

GetContext returns the test context

func (*BaseServiceTestSuite) GetDB

GetDB returns the test database client

func (*BaseServiceTestSuite) GetLogger

func (s *BaseServiceTestSuite) GetLogger() *logger.Logger

GetLogger returns the test logger

func (*BaseServiceTestSuite) GetNow

func (s *BaseServiceTestSuite) GetNow() time.Time

GetNow returns the current test time

func (*BaseServiceTestSuite) GetPDFGenerator added in v1.0.0

func (s *BaseServiceTestSuite) GetPDFGenerator() pdf.Generator

GetPDFGenerator returns the test PDF generator

func (*BaseServiceTestSuite) GetPublisher

func (s *BaseServiceTestSuite) GetPublisher() publisher.EventPublisher

GetPublisher returns the test event publisher

func (*BaseServiceTestSuite) GetStores

func (s *BaseServiceTestSuite) GetStores() Stores

GetStores returns all test repositories

func (*BaseServiceTestSuite) GetUUID

func (s *BaseServiceTestSuite) GetUUID() string

GetUUID returns a new UUID string

func (*BaseServiceTestSuite) GetWebhookPublisher

func (s *BaseServiceTestSuite) GetWebhookPublisher() webhookPublisher.WebhookPublisher

GetWebhookPublisher returns the test webhook publisher

func (*BaseServiceTestSuite) SetupSuite

func (s *BaseServiceTestSuite) SetupSuite()

SetupSuite is called once before running the tests in the suite

func (*BaseServiceTestSuite) SetupTest

func (s *BaseServiceTestSuite) SetupTest()

SetupTest is called before each test

func (*BaseServiceTestSuite) TearDownTest

func (s *BaseServiceTestSuite) TearDownTest()

TearDownTest is called after each test

type FilterFunc

type FilterFunc[T any] func(ctx context.Context, item T, filter interface{}) bool

FilterFunc is a generic filter function type

type InMemoryAddonAssociationStore added in v1.0.21

type InMemoryAddonAssociationStore struct {
	*InMemoryStore[*addonassociation.AddonAssociation]
}

InMemoryAddonAssociationStore implements addonassociation.Repository

func NewInMemoryAddonAssociationStore added in v1.0.21

func NewInMemoryAddonAssociationStore() *InMemoryAddonAssociationStore

NewInMemoryAddonAssociationStore creates a new in-memory addon association store

func (*InMemoryAddonAssociationStore) Count added in v1.0.21

func (*InMemoryAddonAssociationStore) Create added in v1.0.21

func (*InMemoryAddonAssociationStore) Delete added in v1.0.21

func (*InMemoryAddonAssociationStore) GetByID added in v1.0.21

func (*InMemoryAddonAssociationStore) List added in v1.0.21

func (*InMemoryAddonAssociationStore) Update added in v1.0.21

type InMemoryAddonStore added in v1.0.21

type InMemoryAddonStore struct {
	*InMemoryStore[*addon.Addon]
}

InMemoryAddonStore implements addon.Repository

func NewInMemoryAddonStore added in v1.0.21

func NewInMemoryAddonStore() *InMemoryAddonStore

NewInMemoryAddonStore creates a new in-memory addon store

func (*InMemoryAddonStore) Count added in v1.0.21

func (s *InMemoryAddonStore) Count(ctx context.Context, filter *types.AddonFilter) (int, error)

func (*InMemoryAddonStore) Create added in v1.0.21

func (s *InMemoryAddonStore) Create(ctx context.Context, a *addon.Addon) error

func (*InMemoryAddonStore) Delete added in v1.0.21

func (s *InMemoryAddonStore) Delete(ctx context.Context, id string) error

func (*InMemoryAddonStore) GetByID added in v1.0.21

func (s *InMemoryAddonStore) GetByID(ctx context.Context, id string) (*addon.Addon, error)

func (*InMemoryAddonStore) GetByLookupKey added in v1.0.21

func (s *InMemoryAddonStore) GetByLookupKey(ctx context.Context, lookupKey string) (*addon.Addon, error)

func (*InMemoryAddonStore) List added in v1.0.21

func (s *InMemoryAddonStore) List(ctx context.Context, filter *types.AddonFilter) ([]*addon.Addon, error)

func (*InMemoryAddonStore) Update added in v1.0.21

func (s *InMemoryAddonStore) Update(ctx context.Context, a *addon.Addon) error

type InMemoryAuthRepository

type InMemoryAuthRepository struct {
	// contains filtered or unexported fields
}

InMemoryAuthRepository is an in-memory implementation of the auth.Repository interface

func NewInMemoryAuthRepository

func NewInMemoryAuthRepository() *InMemoryAuthRepository

NewInMemoryAuthRepository creates a new instance of InMemoryAuthRepository

func (*InMemoryAuthRepository) Clear

func (r *InMemoryAuthRepository) Clear()

Clear clears all auth records from the in-memory store

func (*InMemoryAuthRepository) CreateAuth

func (r *InMemoryAuthRepository) CreateAuth(ctx context.Context, auth *auth.Auth) error

CreateAuth creates a new auth record in the in-memory store

func (*InMemoryAuthRepository) DeleteAuth

func (r *InMemoryAuthRepository) DeleteAuth(ctx context.Context, userID string) error

DeleteAuth deletes an auth record by user ID from the in-memory store

func (*InMemoryAuthRepository) GetAuthByUserID

func (r *InMemoryAuthRepository) GetAuthByUserID(ctx context.Context, userID string) (*auth.Auth, error)

GetAuthByUserID retrieves an auth record by user ID from the in-memory store

func (*InMemoryAuthRepository) UpdateAuth

func (r *InMemoryAuthRepository) UpdateAuth(ctx context.Context, auth *auth.Auth) error

UpdateAuth updates an existing auth record in the in-memory store

type InMemoryConnectionStore added in v1.0.21

type InMemoryConnectionStore struct {
	// contains filtered or unexported fields
}

func NewInMemoryConnectionStore added in v1.0.21

func NewInMemoryConnectionStore() *InMemoryConnectionStore

func (*InMemoryConnectionStore) Clear added in v1.0.21

func (s *InMemoryConnectionStore) Clear()

func (*InMemoryConnectionStore) Count added in v1.0.21

func (*InMemoryConnectionStore) CountByFilter added in v1.0.21

func (s *InMemoryConnectionStore) CountByFilter(ctx context.Context, filter *types.ConnectionFilter) (int, error)

CountByFilter counts connections based on filter

func (*InMemoryConnectionStore) Create added in v1.0.21

func (*InMemoryConnectionStore) Delete added in v1.0.21

func (s *InMemoryConnectionStore) Delete(ctx context.Context, connection *connection.Connection) error

func (*InMemoryConnectionStore) Get added in v1.0.21

func (*InMemoryConnectionStore) GetByProvider added in v1.0.21

func (*InMemoryConnectionStore) List added in v1.0.21

func (*InMemoryConnectionStore) ListAll added in v1.0.21

func (*InMemoryConnectionStore) ListByFilter added in v1.0.21

ListByFilter retrieves connections based on filter

func (*InMemoryConnectionStore) Update added in v1.0.21

type InMemoryCostSheetStore added in v1.0.18

type InMemoryCostSheetStore struct {
	*InMemoryStore[*costsheet.Costsheet]
}

InMemoryCostSheetStore implements costsheet.Repository

func NewInMemoryCostSheetStore added in v1.0.18

func NewInMemoryCostSheetStore() *InMemoryCostSheetStore

NewInMemoryCostSheetStore creates a new in-memory costsheet store

func (*InMemoryCostSheetStore) Count added in v1.0.18

func (s *InMemoryCostSheetStore) Count(ctx context.Context, filter *costsheet.Filter) (int, error)

func (*InMemoryCostSheetStore) Create added in v1.0.18

func (*InMemoryCostSheetStore) Delete added in v1.0.18

func (s *InMemoryCostSheetStore) Delete(ctx context.Context, id string) error

func (*InMemoryCostSheetStore) Get added in v1.0.18

func (*InMemoryCostSheetStore) GetByMeterAndPrice added in v1.0.18

func (s *InMemoryCostSheetStore) GetByMeterAndPrice(ctx context.Context, meterID, priceID string) (*costsheet.Costsheet, error)

func (*InMemoryCostSheetStore) List added in v1.0.18

func (*InMemoryCostSheetStore) Update added in v1.0.18

type InMemoryCouponApplicationStore added in v1.0.21

type InMemoryCouponApplicationStore struct {
	*InMemoryStore[*coupon_application.CouponApplication]
}

InMemoryCouponApplicationStore implements coupon_application.Repository

func NewInMemoryCouponApplicationStore added in v1.0.21

func NewInMemoryCouponApplicationStore() *InMemoryCouponApplicationStore

NewInMemoryCouponApplicationStore creates a new in-memory coupon application store

func (*InMemoryCouponApplicationStore) CountBySubscriptionAndCoupon added in v1.0.21

func (s *InMemoryCouponApplicationStore) CountBySubscriptionAndCoupon(ctx context.Context, subscriptionID string, couponID string) (int, error)

func (*InMemoryCouponApplicationStore) Create added in v1.0.21

func (*InMemoryCouponApplicationStore) Delete added in v1.0.21

func (*InMemoryCouponApplicationStore) Get added in v1.0.21

func (*InMemoryCouponApplicationStore) GetByInvoice added in v1.0.21

func (*InMemoryCouponApplicationStore) GetBySubscription added in v1.0.21

func (s *InMemoryCouponApplicationStore) GetBySubscription(ctx context.Context, subscriptionID string) ([]*coupon_application.CouponApplication, error)

func (*InMemoryCouponApplicationStore) GetBySubscriptionAndCoupon added in v1.0.21

func (s *InMemoryCouponApplicationStore) GetBySubscriptionAndCoupon(ctx context.Context, subscriptionID string, couponID string) ([]*coupon_application.CouponApplication, error)

func (*InMemoryCouponApplicationStore) Update added in v1.0.21

type InMemoryCouponAssociationStore added in v1.0.21

type InMemoryCouponAssociationStore struct {
	*InMemoryStore[*coupon_association.CouponAssociation]
}

InMemoryCouponAssociationStore implements coupon_association.Repository

func NewInMemoryCouponAssociationStore added in v1.0.21

func NewInMemoryCouponAssociationStore() *InMemoryCouponAssociationStore

NewInMemoryCouponAssociationStore creates a new in-memory coupon association store

func (*InMemoryCouponAssociationStore) Create added in v1.0.21

func (*InMemoryCouponAssociationStore) Delete added in v1.0.21

func (*InMemoryCouponAssociationStore) Get added in v1.0.21

func (*InMemoryCouponAssociationStore) GetBySubscription added in v1.0.21

func (s *InMemoryCouponAssociationStore) GetBySubscription(ctx context.Context, subscriptionID string) ([]*coupon_association.CouponAssociation, error)

func (*InMemoryCouponAssociationStore) GetBySubscriptionForLineItems added in v1.0.21

func (s *InMemoryCouponAssociationStore) GetBySubscriptionForLineItems(ctx context.Context, subscriptionID string) ([]*coupon_association.CouponAssociation, error)

GetBySubscriptionForLineItems retrieves coupon associations that target specific subscription line items for a given subscription. It excludes invoice-level associations (those without SubscriptionLineItemID).

func (*InMemoryCouponAssociationStore) Update added in v1.0.21

type InMemoryCouponStore added in v1.0.21

type InMemoryCouponStore struct {
	*InMemoryStore[*coupon.Coupon]
}

InMemoryCouponStore implements coupon.Repository

func NewInMemoryCouponStore added in v1.0.21

func NewInMemoryCouponStore() *InMemoryCouponStore

NewInMemoryCouponStore creates a new in-memory coupon store

func (*InMemoryCouponStore) Count added in v1.0.21

func (s *InMemoryCouponStore) Count(ctx context.Context, filter *types.CouponFilter) (int, error)

func (*InMemoryCouponStore) Create added in v1.0.21

func (*InMemoryCouponStore) Delete added in v1.0.21

func (s *InMemoryCouponStore) Delete(ctx context.Context, id string) error

func (*InMemoryCouponStore) Get added in v1.0.21

func (*InMemoryCouponStore) GetBatch added in v1.0.21

func (s *InMemoryCouponStore) GetBatch(ctx context.Context, ids []string) ([]*coupon.Coupon, error)

func (*InMemoryCouponStore) IncrementRedemptions added in v1.0.21

func (s *InMemoryCouponStore) IncrementRedemptions(ctx context.Context, id string) error

func (*InMemoryCouponStore) List added in v1.0.21

func (*InMemoryCouponStore) Update added in v1.0.21

type InMemoryCreditGrantApplicationStore added in v1.0.18

type InMemoryCreditGrantApplicationStore struct {
	*InMemoryStore[*creditgrantapplication.CreditGrantApplication]
}

InMemoryCreditGrantApplicationStore provides an in-memory implementation of creditgrantapplication.Repository for testing

func NewInMemoryCreditGrantApplicationStore added in v1.0.18

func NewInMemoryCreditGrantApplicationStore() *InMemoryCreditGrantApplicationStore

NewInMemoryCreditGrantApplicationStore creates a new in-memory credit grant application store

func (*InMemoryCreditGrantApplicationStore) Clear added in v1.0.18

Clear removes all credit grant applications from the store

func (*InMemoryCreditGrantApplicationStore) Count added in v1.0.18

Count counts credit grant applications based on filter

func (*InMemoryCreditGrantApplicationStore) Create added in v1.0.18

Create creates a new credit grant application

func (*InMemoryCreditGrantApplicationStore) Delete added in v1.0.18

Delete deletes a credit grant application

func (*InMemoryCreditGrantApplicationStore) FindAllScheduledApplications added in v1.0.18

FindAllScheduledApplications retrieves all scheduled applications

func (*InMemoryCreditGrantApplicationStore) FindByIdempotencyKey added in v1.0.18

FindByIdempotencyKey finds a credit grant application by idempotency key

func (*InMemoryCreditGrantApplicationStore) Get added in v1.0.18

Get retrieves a credit grant application by ID

func (*InMemoryCreditGrantApplicationStore) List added in v1.0.18

List retrieves credit grant applications based on filter

func (*InMemoryCreditGrantApplicationStore) ListAll added in v1.0.18

ListAll retrieves all credit grant applications based on filter without pagination

func (*InMemoryCreditGrantApplicationStore) Update added in v1.0.18

Update updates an existing credit grant application

type InMemoryCreditGrantStore added in v1.0.18

type InMemoryCreditGrantStore struct {
	*InMemoryStore[*creditgrant.CreditGrant]
}

InMemoryCreditGrantStore provides an in-memory implementation of creditgrant.Repository for testing

func NewInMemoryCreditGrantStore added in v1.0.18

func NewInMemoryCreditGrantStore() *InMemoryCreditGrantStore

NewInMemoryCreditGrantStore creates a new in-memory credit grant store

func (*InMemoryCreditGrantStore) Clear added in v1.0.18

func (s *InMemoryCreditGrantStore) Clear()

Clear removes all credit grants from the store

func (*InMemoryCreditGrantStore) Count added in v1.0.18

Count counts credit grants based on filter

func (*InMemoryCreditGrantStore) Create added in v1.0.18

Create creates a new credit grant

func (*InMemoryCreditGrantStore) CreateBulk added in v1.0.18

func (s *InMemoryCreditGrantStore) CreateBulk(ctx context.Context, creditGrants []*creditgrant.CreditGrant) ([]*creditgrant.CreditGrant, error)

CreateBulk creates multiple credit grants

func (*InMemoryCreditGrantStore) Delete added in v1.0.18

Delete deletes a credit grant by ID (soft delete by setting status to archived)

func (*InMemoryCreditGrantStore) DeleteBulk added in v1.0.18

func (s *InMemoryCreditGrantStore) DeleteBulk(ctx context.Context, ids []string) error

DeleteBulk deletes multiple credit grants by IDs (soft delete by setting status to archived)

func (*InMemoryCreditGrantStore) Get added in v1.0.18

Get retrieves a credit grant by ID

func (*InMemoryCreditGrantStore) GetByPlan added in v1.0.18

GetByPlan retrieves credit grants for a specific plan

func (*InMemoryCreditGrantStore) GetBySubscription added in v1.0.18

func (s *InMemoryCreditGrantStore) GetBySubscription(ctx context.Context, subscriptionID string) ([]*creditgrant.CreditGrant, error)

GetBySubscription retrieves credit grants for a specific subscription

func (*InMemoryCreditGrantStore) List added in v1.0.18

List retrieves credit grants based on filter

func (*InMemoryCreditGrantStore) ListAll added in v1.0.18

ListAll retrieves all credit grants based on filter without pagination

func (*InMemoryCreditGrantStore) Update added in v1.0.18

Update updates an existing credit grant

type InMemoryCreditNoteLineItemStore added in v1.0.18

type InMemoryCreditNoteLineItemStore struct {
	*InMemoryStore[*creditnote.CreditNoteLineItem]
}

InMemoryCreditNoteLineItemStore implements the credit note line item repository interface for testing

func NewInMemoryCreditNoteLineItemStore added in v1.0.18

func NewInMemoryCreditNoteLineItemStore() *InMemoryCreditNoteLineItemStore

NewInMemoryCreditNoteLineItemStore creates a new in-memory credit note line item store

func (*InMemoryCreditNoteLineItemStore) Count added in v1.0.18

func (*InMemoryCreditNoteLineItemStore) Create added in v1.0.18

func (*InMemoryCreditNoteLineItemStore) CreateBulk added in v1.0.18

func (*InMemoryCreditNoteLineItemStore) Delete added in v1.0.18

func (*InMemoryCreditNoteLineItemStore) Get added in v1.0.18

func (*InMemoryCreditNoteLineItemStore) List added in v1.0.18

func (*InMemoryCreditNoteLineItemStore) ListByCreditNote added in v1.0.18

func (s *InMemoryCreditNoteLineItemStore) ListByCreditNote(ctx context.Context, creditNoteID string) ([]*creditnote.CreditNoteLineItem, error)

func (*InMemoryCreditNoteLineItemStore) ListByInvoiceLineItem added in v1.0.18

func (s *InMemoryCreditNoteLineItemStore) ListByInvoiceLineItem(ctx context.Context, invoiceLineItemID string) ([]*creditnote.CreditNoteLineItem, error)

func (*InMemoryCreditNoteLineItemStore) Update added in v1.0.18

type InMemoryCreditNoteStore added in v1.0.18

type InMemoryCreditNoteStore struct {
	*InMemoryStore[*creditnote.CreditNote]
	// contains filtered or unexported fields
}

InMemoryCreditNoteStore implements the creditnote.Repository interface for testing

func NewInMemoryCreditNoteStore added in v1.0.18

func NewInMemoryCreditNoteStore() *InMemoryCreditNoteStore

NewInMemoryCreditNoteStore creates a new in-memory credit note store

func (*InMemoryCreditNoteStore) AddLineItems added in v1.0.18

func (s *InMemoryCreditNoteStore) AddLineItems(ctx context.Context, creditNoteID string, items []*creditnote.CreditNoteLineItem) error

AddLineItems adds line items to a credit note

func (*InMemoryCreditNoteStore) Clear added in v1.0.18

func (s *InMemoryCreditNoteStore) Clear()

Clear removes all credit notes from the store

func (*InMemoryCreditNoteStore) Count added in v1.0.18

Count returns the total count of credit notes based on the filter

func (*InMemoryCreditNoteStore) Create added in v1.0.18

Create creates a new credit note

func (*InMemoryCreditNoteStore) CreateWithLineItems added in v1.0.18

func (s *InMemoryCreditNoteStore) CreateWithLineItems(ctx context.Context, cn *creditnote.CreditNote) error

CreateWithLineItems creates a credit note with its line items

func (*InMemoryCreditNoteStore) Delete added in v1.0.18

func (s *InMemoryCreditNoteStore) Delete(ctx context.Context, id string) error

Delete marks a credit note as deleted

func (*InMemoryCreditNoteStore) Get added in v1.0.18

Get retrieves a credit note by ID

func (*InMemoryCreditNoteStore) GetByIdempotencyKey added in v1.0.18

func (s *InMemoryCreditNoteStore) GetByIdempotencyKey(ctx context.Context, key string) (*creditnote.CreditNote, error)

GetByIdempotencyKey retrieves a credit note by idempotency key

func (*InMemoryCreditNoteStore) List added in v1.0.18

List returns a list of credit notes based on the filter

func (*InMemoryCreditNoteStore) RemoveLineItems added in v1.0.18

func (s *InMemoryCreditNoteStore) RemoveLineItems(ctx context.Context, creditNoteID string, itemIDs []string) error

RemoveLineItems removes line items from a credit note

func (*InMemoryCreditNoteStore) Update added in v1.0.18

Update updates a credit note

type InMemoryCustomerStore

type InMemoryCustomerStore struct {
	*InMemoryStore[*customer.Customer]
}

InMemoryCustomerStore implements customer.Repository

func NewInMemoryCustomerStore

func NewInMemoryCustomerStore() *InMemoryCustomerStore

NewInMemoryCustomerStore creates a new in-memory customer store

func (*InMemoryCustomerStore) Count

func (*InMemoryCustomerStore) CountByFilter added in v1.0.17

func (s *InMemoryCustomerStore) CountByFilter(ctx context.Context, filter *types.CustomerFilter) (int, error)

CountByFilter counts customers based on filter

func (*InMemoryCustomerStore) Create

func (*InMemoryCustomerStore) Delete

func (s *InMemoryCustomerStore) Delete(ctx context.Context, customer *customer.Customer) error

func (*InMemoryCustomerStore) Get

func (*InMemoryCustomerStore) GetByLookupKey

func (s *InMemoryCustomerStore) GetByLookupKey(ctx context.Context, lookupKey string) (*customer.Customer, error)

func (*InMemoryCustomerStore) List

func (*InMemoryCustomerStore) ListAll

func (*InMemoryCustomerStore) ListByFilter added in v1.0.17

func (s *InMemoryCustomerStore) ListByFilter(ctx context.Context, filter *types.CustomerFilter) ([]*customer.Customer, error)

ListByFilter retrieves customers based on filter

func (*InMemoryCustomerStore) Update

type InMemoryEntitlementStore

type InMemoryEntitlementStore struct {
	*InMemoryStore[*entitlement.Entitlement]
}

InMemoryEntitlementStore implements entitlement.Repository

func NewInMemoryEntitlementStore

func NewInMemoryEntitlementStore() *InMemoryEntitlementStore

NewInMemoryEntitlementStore creates a new in-memory entitlement store

func (*InMemoryEntitlementStore) Clear

func (s *InMemoryEntitlementStore) Clear()

Clear clears the entitlement store

func (*InMemoryEntitlementStore) Count

func (*InMemoryEntitlementStore) Create

func (*InMemoryEntitlementStore) CreateBulk

func (s *InMemoryEntitlementStore) CreateBulk(ctx context.Context, entitlements []*entitlement.Entitlement) ([]*entitlement.Entitlement, error)

func (*InMemoryEntitlementStore) Delete

func (*InMemoryEntitlementStore) DeleteBulk

func (s *InMemoryEntitlementStore) DeleteBulk(ctx context.Context, ids []string) error

func (*InMemoryEntitlementStore) Get

func (*InMemoryEntitlementStore) List

func (*InMemoryEntitlementStore) ListByAddonIDs added in v1.0.21

func (s *InMemoryEntitlementStore) ListByAddonIDs(ctx context.Context, addonIDs []string) ([]*entitlement.Entitlement, error)

ListByAddonIDs retrieves all entitlements for the given addon IDs

func (*InMemoryEntitlementStore) ListByFeatureIDs added in v1.0.0

func (s *InMemoryEntitlementStore) ListByFeatureIDs(ctx context.Context, featureIDs []string) ([]*entitlement.Entitlement, error)

ListByFeatureIDs retrieves all entitlements for the given feature IDs

func (*InMemoryEntitlementStore) ListByPlanIDs added in v1.0.0

func (s *InMemoryEntitlementStore) ListByPlanIDs(ctx context.Context, planIDs []string) ([]*entitlement.Entitlement, error)

ListByPlanIDs retrieves all entitlements for the given plan IDs

func (*InMemoryEntitlementStore) Update

type InMemoryEntityIntegrationMappingStore added in v1.0.21

type InMemoryEntityIntegrationMappingStore struct {
	*InMemoryStore[*entityintegrationmapping.EntityIntegrationMapping]
}

InMemoryEntityIntegrationMappingStore implements entityintegrationmapping.Repository for testing

func (*InMemoryEntityIntegrationMappingStore) Count added in v1.0.21

Count counts entity integration mappings based on filter

func (*InMemoryEntityIntegrationMappingStore) CountByFilter added in v1.0.21

CountByFilter counts entity integration mappings based on filter

func (*InMemoryEntityIntegrationMappingStore) Create added in v1.0.21

Create adds a new entity integration mapping to the store

func (*InMemoryEntityIntegrationMappingStore) Delete added in v1.0.21

Delete removes an entity integration mapping

func (*InMemoryEntityIntegrationMappingStore) Get added in v1.0.21

Get retrieves an entity integration mapping by ID

func (*InMemoryEntityIntegrationMappingStore) GetByEntityAndProvider added in v1.0.21

GetByEntityAndProvider retrieves an entity integration mapping by entity and provider

func (*InMemoryEntityIntegrationMappingStore) GetByProviderEntity added in v1.0.21

func (s *InMemoryEntityIntegrationMappingStore) GetByProviderEntity(ctx context.Context, providerType, providerEntityID string) (*entityintegrationmapping.EntityIntegrationMapping, error)

GetByProviderEntity retrieves an entity integration mapping by provider entity

func (*InMemoryEntityIntegrationMappingStore) List added in v1.0.21

List retrieves entity integration mappings based on filter

func (*InMemoryEntityIntegrationMappingStore) ListByEntity added in v1.0.21

ListByEntity retrieves entity integration mappings by entity

func (*InMemoryEntityIntegrationMappingStore) ListByFilter added in v1.0.21

ListByFilter retrieves entity integration mappings based on filter

func (*InMemoryEntityIntegrationMappingStore) ListByProvider added in v1.0.21

ListByProvider retrieves entity integration mappings by provider

func (*InMemoryEntityIntegrationMappingStore) Update added in v1.0.21

Update updates an entity integration mapping

type InMemoryEnvironmentStore

type InMemoryEnvironmentStore struct {
	// contains filtered or unexported fields
}

func NewInMemoryEnvironmentStore

func NewInMemoryEnvironmentStore() *InMemoryEnvironmentStore

func (*InMemoryEnvironmentStore) Clear

func (s *InMemoryEnvironmentStore) Clear()

func (*InMemoryEnvironmentStore) Create

func (*InMemoryEnvironmentStore) Get

func (*InMemoryEnvironmentStore) List

func (*InMemoryEnvironmentStore) Update

type InMemoryEventStore

type InMemoryEventStore struct {
	// contains filtered or unexported fields
}

func NewInMemoryEventStore

func NewInMemoryEventStore() *InMemoryEventStore

func (*InMemoryEventStore) BulkInsertEvents added in v1.0.0

func (s *InMemoryEventStore) BulkInsertEvents(ctx context.Context, events []*events.Event) error

func (*InMemoryEventStore) Clear

func (s *InMemoryEventStore) Clear()

func (*InMemoryEventStore) FindUnprocessedEvents added in v1.0.17

func (s *InMemoryEventStore) FindUnprocessedEvents(ctx context.Context, params *events.FindUnprocessedEventsParams) ([]*events.Event, error)

func (*InMemoryEventStore) GetDistinctEventNames added in v1.0.22

func (s *InMemoryEventStore) GetDistinctEventNames(ctx context.Context, externalCustomerID string, startTime, endTime time.Time) ([]string, error)

func (*InMemoryEventStore) GetEvents

func (s *InMemoryEventStore) GetEvents(ctx context.Context, params *events.GetEventsParams) ([]*events.Event, uint64, error)

func (*InMemoryEventStore) GetUsage

func (*InMemoryEventStore) GetUsageWithFilters

func (s *InMemoryEventStore) GetUsageWithFilters(ctx context.Context, params *events.UsageWithFiltersParams) ([]*events.AggregationResult, error)

func (*InMemoryEventStore) HasEvent

func (s *InMemoryEventStore) HasEvent(id string) bool

func (*InMemoryEventStore) InsertEvent

func (s *InMemoryEventStore) InsertEvent(ctx context.Context, event *events.Event) error

type InMemoryFeatureStore

type InMemoryFeatureStore struct {
	*InMemoryStore[*feature.Feature]
}

InMemoryFeatureStore implements feature.Repository

func NewInMemoryFeatureStore

func NewInMemoryFeatureStore() *InMemoryFeatureStore

NewInMemoryFeatureStore creates a new in-memory feature store

func (*InMemoryFeatureStore) Clear

func (s *InMemoryFeatureStore) Clear()

Clear clears the feature store

func (*InMemoryFeatureStore) Count

func (s *InMemoryFeatureStore) Count(ctx context.Context, filter *types.FeatureFilter) (int, error)

func (*InMemoryFeatureStore) Create

func (*InMemoryFeatureStore) CreateBulk

func (s *InMemoryFeatureStore) CreateBulk(ctx context.Context, features []*feature.Feature) ([]*feature.Feature, error)

func (*InMemoryFeatureStore) Delete

func (s *InMemoryFeatureStore) Delete(ctx context.Context, id string) error

func (*InMemoryFeatureStore) DeleteBulk

func (s *InMemoryFeatureStore) DeleteBulk(ctx context.Context, ids []string) error

func (*InMemoryFeatureStore) Get

func (*InMemoryFeatureStore) List

func (*InMemoryFeatureStore) ListAll

ListAll returns all features without pagination

func (*InMemoryFeatureStore) ListByIDs added in v1.0.0

func (s *InMemoryFeatureStore) ListByIDs(ctx context.Context, featureIDs []string) ([]*feature.Feature, error)

ListByIDs retrieves features by their IDs

func (*InMemoryFeatureStore) Update

type InMemoryInvoiceStore

type InMemoryInvoiceStore struct {
	*InMemoryStore[*invoice.Invoice]
}

InMemoryInvoiceStore implements invoice.Repository

func NewInMemoryInvoiceStore

func NewInMemoryInvoiceStore() *InMemoryInvoiceStore

NewInMemoryInvoiceStore creates a new in-memory invoice store

func (*InMemoryInvoiceStore) AddLineItems

func (s *InMemoryInvoiceStore) AddLineItems(ctx context.Context, invoiceID string, items []*invoice.InvoiceLineItem) error

func (*InMemoryInvoiceStore) Count

func (s *InMemoryInvoiceStore) Count(ctx context.Context, filter *types.InvoiceFilter) (int, error)

func (*InMemoryInvoiceStore) Create

func (*InMemoryInvoiceStore) CreateWithLineItems

func (s *InMemoryInvoiceStore) CreateWithLineItems(ctx context.Context, inv *invoice.Invoice) error

func (*InMemoryInvoiceStore) Delete

func (s *InMemoryInvoiceStore) Delete(ctx context.Context, id string) error

func (*InMemoryInvoiceStore) ExistsForPeriod

func (s *InMemoryInvoiceStore) ExistsForPeriod(ctx context.Context, subscriptionID string, periodStart, periodEnd time.Time) (bool, error)

func (*InMemoryInvoiceStore) Get

func (*InMemoryInvoiceStore) GetByIdempotencyKey

func (s *InMemoryInvoiceStore) GetByIdempotencyKey(ctx context.Context, key string) (*invoice.Invoice, error)

func (*InMemoryInvoiceStore) GetNextBillingSequence

func (s *InMemoryInvoiceStore) GetNextBillingSequence(ctx context.Context, subscriptionID string) (int, error)

func (*InMemoryInvoiceStore) GetNextInvoiceNumber

func (s *InMemoryInvoiceStore) GetNextInvoiceNumber(ctx context.Context, invoiceConfig *types.InvoiceConfig) (string, error)

func (*InMemoryInvoiceStore) List

func (*InMemoryInvoiceStore) RemoveLineItems

func (s *InMemoryInvoiceStore) RemoveLineItems(ctx context.Context, invoiceID string, itemIDs []string) error

func (*InMemoryInvoiceStore) Update

type InMemoryKafka

type InMemoryKafka struct {
	// contains filtered or unexported fields
}

func NewInMemoryKafka

func NewInMemoryKafka() *InMemoryKafka

func (*InMemoryKafka) Close

func (b *InMemoryKafka) Close() error

func (*InMemoryKafka) HasMessage

func (b *InMemoryKafka) HasMessage(topic, id string) bool

func (*InMemoryKafka) Publish

func (b *InMemoryKafka) Publish(ctx context.Context, event *events.Event) error

func (*InMemoryKafka) Subscribe

func (b *InMemoryKafka) Subscribe() chan *message.Message

type InMemoryMeterStore

type InMemoryMeterStore struct {
	*InMemoryStore[*meter.Meter]
}

InMemoryMeterStore implements meter.Repository

func NewInMemoryMeterStore

func NewInMemoryMeterStore() *InMemoryMeterStore

NewInMemoryMeterStore creates a new in-memory meter store

func (*InMemoryMeterStore) Count

func (s *InMemoryMeterStore) Count(ctx context.Context, filter *types.MeterFilter) (int, error)

func (*InMemoryMeterStore) CreateMeter

func (s *InMemoryMeterStore) CreateMeter(ctx context.Context, m *meter.Meter) error

func (*InMemoryMeterStore) DisableMeter

func (s *InMemoryMeterStore) DisableMeter(ctx context.Context, id string) error

func (*InMemoryMeterStore) GetMeter

func (s *InMemoryMeterStore) GetMeter(ctx context.Context, id string) (*meter.Meter, error)

func (*InMemoryMeterStore) List

func (s *InMemoryMeterStore) List(ctx context.Context, filter *types.MeterFilter) ([]*meter.Meter, error)

func (*InMemoryMeterStore) ListAll

func (s *InMemoryMeterStore) ListAll(ctx context.Context, filter *types.MeterFilter) ([]*meter.Meter, error)

func (*InMemoryMeterStore) UpdateMeter

func (s *InMemoryMeterStore) UpdateMeter(ctx context.Context, id string, filters []meter.Filter) error

type InMemoryPaymentStore added in v1.0.0

type InMemoryPaymentStore struct {
	*InMemoryStore[*payment.Payment]
	// contains filtered or unexported fields
}

InMemoryPaymentStore implements payment.Repository

func NewInMemoryPaymentStore added in v1.0.0

func NewInMemoryPaymentStore() *InMemoryPaymentStore

NewInMemoryPaymentStore creates a new in-memory payment repository

func (*InMemoryPaymentStore) Clear added in v1.0.0

func (m *InMemoryPaymentStore) Clear()

Clear resets all stored data

func (*InMemoryPaymentStore) Count added in v1.0.0

func (m *InMemoryPaymentStore) Count(ctx context.Context, filter *types.PaymentFilter) (int, error)

Count returns the number of payments matching the filter

func (*InMemoryPaymentStore) Create added in v1.0.0

Create stores a new payment

func (*InMemoryPaymentStore) CreateAttempt added in v1.0.0

func (m *InMemoryPaymentStore) CreateAttempt(ctx context.Context, attempt *payment.PaymentAttempt) error

CreateAttempt creates a new payment attempt

func (*InMemoryPaymentStore) Delete added in v1.0.0

func (m *InMemoryPaymentStore) Delete(ctx context.Context, id string) error

Delete removes a payment

func (*InMemoryPaymentStore) Get added in v1.0.0

Get retrieves a payment by ID

func (*InMemoryPaymentStore) GetAttempt added in v1.0.0

GetAttempt retrieves a payment attempt by ID

func (*InMemoryPaymentStore) GetByIdempotencyKey added in v1.0.0

func (m *InMemoryPaymentStore) GetByIdempotencyKey(ctx context.Context, key string) (*payment.Payment, error)

GetByIdempotencyKey retrieves a payment by idempotency key

func (*InMemoryPaymentStore) GetCreatedPayments added in v1.0.0

func (m *InMemoryPaymentStore) GetCreatedPayments() []*payment.Payment

GetCreatedPayments returns all payments that were created, in order of creation This is a helper method for testing

func (*InMemoryPaymentStore) GetLatestAttempt added in v1.0.0

func (m *InMemoryPaymentStore) GetLatestAttempt(ctx context.Context, paymentID string) (*payment.PaymentAttempt, error)

GetLatestAttempt retrieves the latest attempt for a payment

func (*InMemoryPaymentStore) GetPaymentsForDestination added in v1.0.0

func (m *InMemoryPaymentStore) GetPaymentsForDestination(ctx context.Context, destinationType types.PaymentDestinationType, destinationID string) ([]*payment.Payment, error)

GetPaymentsForDestination returns payments for a specific destination

func (*InMemoryPaymentStore) List added in v1.0.0

List returns a list of payments based on the filter

func (*InMemoryPaymentStore) ListAttempts added in v1.0.0

func (m *InMemoryPaymentStore) ListAttempts(ctx context.Context, paymentID string) ([]*payment.PaymentAttempt, error)

ListAttempts returns a list of payment attempts for a payment

func (*InMemoryPaymentStore) Update added in v1.0.0

Update updates an existing payment

func (*InMemoryPaymentStore) UpdateAttempt added in v1.0.0

func (m *InMemoryPaymentStore) UpdateAttempt(ctx context.Context, attempt *payment.PaymentAttempt) error

UpdateAttempt updates an existing payment attempt

type InMemoryPlanStore

type InMemoryPlanStore struct {
	*InMemoryStore[*plan.Plan]
}

InMemoryPlanStore implements plan.Repository

func NewInMemoryPlanStore

func NewInMemoryPlanStore() *InMemoryPlanStore

NewInMemoryPlanStore creates a new in-memory plan store

func (*InMemoryPlanStore) Clear

func (s *InMemoryPlanStore) Clear()

Clear clears the plan store

func (*InMemoryPlanStore) Count

func (s *InMemoryPlanStore) Count(ctx context.Context, filter *types.PlanFilter) (int, error)

func (*InMemoryPlanStore) Create

func (s *InMemoryPlanStore) Create(ctx context.Context, p *plan.Plan) error

func (*InMemoryPlanStore) Delete

func (s *InMemoryPlanStore) Delete(ctx context.Context, p *plan.Plan) error

func (*InMemoryPlanStore) Get

func (s *InMemoryPlanStore) Get(ctx context.Context, id string) (*plan.Plan, error)

func (*InMemoryPlanStore) GetByLookupKey

func (s *InMemoryPlanStore) GetByLookupKey(ctx context.Context, lookupKey string) (*plan.Plan, error)

GetByLookupKey retrieves a plan by its lookup key

func (*InMemoryPlanStore) List

func (s *InMemoryPlanStore) List(ctx context.Context, filter *types.PlanFilter) ([]*plan.Plan, error)

func (*InMemoryPlanStore) ListAll

func (s *InMemoryPlanStore) ListAll(ctx context.Context, filter *types.PlanFilter) ([]*plan.Plan, error)

ListAll returns all plans without pagination

func (*InMemoryPlanStore) Update

func (s *InMemoryPlanStore) Update(ctx context.Context, p *plan.Plan) error

type InMemoryPriceStore

type InMemoryPriceStore struct {
	*InMemoryStore[*price.Price]
}

InMemoryPriceStore implements price.Repository

func NewInMemoryPriceStore

func NewInMemoryPriceStore() *InMemoryPriceStore

func (*InMemoryPriceStore) Clear

func (s *InMemoryPriceStore) Clear()

Clear clears the price store

func (*InMemoryPriceStore) Count

func (s *InMemoryPriceStore) Count(ctx context.Context, filter *types.PriceFilter) (int, error)

func (*InMemoryPriceStore) Create

func (s *InMemoryPriceStore) Create(ctx context.Context, p *price.Price) error

func (*InMemoryPriceStore) CreateBulk

func (s *InMemoryPriceStore) CreateBulk(ctx context.Context, prices []*price.Price) error

CreateBulk creates multiple prices in bulk

func (*InMemoryPriceStore) Delete

func (s *InMemoryPriceStore) Delete(ctx context.Context, id string) error

func (*InMemoryPriceStore) DeleteBulk

func (s *InMemoryPriceStore) DeleteBulk(ctx context.Context, ids []string) error

DeleteBulk deletes multiple prices in bulk

func (*InMemoryPriceStore) Get

func (*InMemoryPriceStore) List

func (s *InMemoryPriceStore) List(ctx context.Context, filter *types.PriceFilter) ([]*price.Price, error)

func (*InMemoryPriceStore) ListAll

func (s *InMemoryPriceStore) ListAll(ctx context.Context, filter *types.PriceFilter) ([]*price.Price, error)

ListAll returns all prices without pagination

func (*InMemoryPriceStore) Update

func (s *InMemoryPriceStore) Update(ctx context.Context, p *price.Price) error

type InMemoryPriceUnitStore added in v1.0.21

type InMemoryPriceUnitStore struct {
	*InMemoryStore[*priceunit.PriceUnit]
}

InMemoryPriceUnitStore implements priceunit.Repository

func NewInMemoryPriceUnitStore added in v1.0.21

func NewInMemoryPriceUnitStore() *InMemoryPriceUnitStore

func (*InMemoryPriceUnitStore) ConvertToBaseCurrency added in v1.0.21

func (s *InMemoryPriceUnitStore) ConvertToBaseCurrency(ctx context.Context, code, tenantID, environmentID string, priceUnitAmount decimal.Decimal) (decimal.Decimal, error)

func (*InMemoryPriceUnitStore) ConvertToPriceUnit added in v1.0.21

func (s *InMemoryPriceUnitStore) ConvertToPriceUnit(ctx context.Context, code, tenantID, environmentID string, fiatAmount decimal.Decimal) (decimal.Decimal, error)

func (*InMemoryPriceUnitStore) Count added in v1.0.21

func (*InMemoryPriceUnitStore) Create added in v1.0.21

func (*InMemoryPriceUnitStore) Delete added in v1.0.21

func (s *InMemoryPriceUnitStore) Delete(ctx context.Context, id string) error

func (*InMemoryPriceUnitStore) GetByCode added in v1.0.21

func (s *InMemoryPriceUnitStore) GetByCode(ctx context.Context, code, tenantID, environmentID string, status string) (*priceunit.PriceUnit, error)

func (*InMemoryPriceUnitStore) GetByID added in v1.0.21

func (*InMemoryPriceUnitStore) List added in v1.0.21

func (*InMemoryPriceUnitStore) Update added in v1.0.21

type InMemoryPubSub

type InMemoryPubSub struct {
	// contains filtered or unexported fields
}

InMemoryPubSub is an in-memory implementation of pubsub.PubSub interface

func NewInMemoryPubSub

func NewInMemoryPubSub() *InMemoryPubSub

NewInMemoryPubSub creates a new instance of InMemoryPubSub

func (*InMemoryPubSub) ClearMessages

func (ps *InMemoryPubSub) ClearMessages()

ClearMessages clears all stored messages

func (*InMemoryPubSub) Close

func (ps *InMemoryPubSub) Close() error

Close implements pubsub.PubSub interface

func (*InMemoryPubSub) GetMessages

func (ps *InMemoryPubSub) GetMessages(topic string) []*message.Message

GetMessages returns all messages published to a topic

func (*InMemoryPubSub) Publish

func (ps *InMemoryPubSub) Publish(ctx context.Context, topic string, msg *message.Message) error

Publish implements pubsub.Publisher interface

func (*InMemoryPubSub) Subscribe

func (ps *InMemoryPubSub) Subscribe(ctx context.Context, topic string) (<-chan *message.Message, error)

Subscribe implements pubsub.Subscriber interface

type InMemoryPublisherService

type InMemoryPublisherService struct {
	// contains filtered or unexported fields
}

InMemoryPublisherService provides an in-memory implementation of publisher.Service for testing

func (*InMemoryPublisherService) Clear

func (p *InMemoryPublisherService) Clear()

Clear removes all published events and messages

func (*InMemoryPublisherService) GetEvents

func (p *InMemoryPublisherService) GetEvents() []*events.Event

GetEvents returns all published events

func (*InMemoryPublisherService) HasEvent

func (p *InMemoryPublisherService) HasEvent(id string) bool

HasEvent checks if an event with the given ID exists in publisher's memory

func (*InMemoryPublisherService) HasMessage

func (p *InMemoryPublisherService) HasMessage(topic, id string) bool

HasMessage checks if a message with the given ID exists in the given topic

func (*InMemoryPublisherService) Publish

func (p *InMemoryPublisherService) Publish(ctx context.Context, event *events.Event) error

Publish implements publisher.Service interface

func (*InMemoryPublisherService) Subscribe

func (p *InMemoryPublisherService) Subscribe() chan *message.Message

Subscribe returns a channel for receiving messages

type InMemorySecretStore

type InMemorySecretStore struct {
	*InMemoryStore[*secret.Secret]
}

InMemorySecretStore implements secret.Repository

func NewInMemorySecretStore

func NewInMemorySecretStore() *InMemorySecretStore

NewInMemorySecretStore creates a new in-memory secret store

func (*InMemorySecretStore) Clear

func (s *InMemorySecretStore) Clear()

Clear clears the secret store

func (*InMemorySecretStore) Count

func (s *InMemorySecretStore) Count(ctx context.Context, filter *types.SecretFilter) (int, error)

func (*InMemorySecretStore) Create

func (s *InMemorySecretStore) Create(ctx context.Context, secret *secret.Secret) error

func (*InMemorySecretStore) Delete

func (s *InMemorySecretStore) Delete(ctx context.Context, id string) error

func (*InMemorySecretStore) Get

func (*InMemorySecretStore) GetAPIKeyByValue

func (s *InMemorySecretStore) GetAPIKeyByValue(ctx context.Context, value string) (*secret.Secret, error)

func (*InMemorySecretStore) List

func (*InMemorySecretStore) ListAll

func (s *InMemorySecretStore) ListAll(ctx context.Context, filter *types.SecretFilter) ([]*secret.Secret, error)

func (*InMemorySecretStore) UpdateLastUsed

func (s *InMemorySecretStore) UpdateLastUsed(ctx context.Context, id string) error

type InMemorySettingsStore added in v1.0.22

type InMemorySettingsStore struct {
	*InMemoryStore[*domainSettings.Setting]
}

InMemorySettingsStore implements an in-memory settings repository for testing

func NewInMemorySettingsStore added in v1.0.22

func NewInMemorySettingsStore() *InMemorySettingsStore

NewInMemorySettingsStore creates a new in-memory settings store

func (*InMemorySettingsStore) Clear added in v1.0.22

func (s *InMemorySettingsStore) Clear()

Clear removes all settings from the store

func (*InMemorySettingsStore) Create added in v1.0.22

Create creates a new setting

func (*InMemorySettingsStore) DeleteByKey added in v1.0.22

func (s *InMemorySettingsStore) DeleteByKey(ctx context.Context, key string) error

DeleteByKey deletes a setting by key for a specific tenant and environment

func (*InMemorySettingsStore) Get added in v1.0.22

Get retrieves a setting by ID

func (*InMemorySettingsStore) GetByKey added in v1.0.22

GetByKey retrieves a setting by key for a specific tenant and environment

func (*InMemorySettingsStore) Update added in v1.0.22

Update updates an existing setting

type InMemoryStore

type InMemoryStore[T any] struct {
	// contains filtered or unexported fields
}

InMemoryStore implements a generic in-memory store

func NewInMemoryStore

func NewInMemoryStore[T any]() *InMemoryStore[T]

NewInMemoryStore creates a new InMemoryStore

func (*InMemoryStore[T]) Clear

func (s *InMemoryStore[T]) Clear()

Clear removes all items from the store

func (*InMemoryStore[T]) Count

func (s *InMemoryStore[T]) Count(ctx context.Context, filter interface{}, filterFn FilterFunc[T]) (int, error)

Count returns the total number of items matching the filter

func (*InMemoryStore[T]) Create

func (s *InMemoryStore[T]) Create(ctx context.Context, id string, item T) error

Create adds a new item to the store

func (*InMemoryStore[T]) Delete

func (s *InMemoryStore[T]) Delete(ctx context.Context, id string) error

Delete removes an item from the store

func (*InMemoryStore[T]) Get

func (s *InMemoryStore[T]) Get(ctx context.Context, id string) (T, error)

Get retrieves an item by ID

func (*InMemoryStore[T]) List

func (s *InMemoryStore[T]) List(ctx context.Context, filter interface{}, filterFn FilterFunc[T], sortFn SortFunc[T]) ([]T, error)

List retrieves items based on filter

func (*InMemoryStore[T]) Update

func (s *InMemoryStore[T]) Update(ctx context.Context, id string, item T) error

Update updates an existing item

type InMemorySubscriptionLineItemStore added in v1.0.0

type InMemorySubscriptionLineItemStore struct {
	*InMemoryStore[*subscription.SubscriptionLineItem]
}

InMemorySubscriptionLineItemStore implements subscription.LineItemRepository

func NewInMemorySubscriptionLineItemStore added in v1.0.0

func NewInMemorySubscriptionLineItemStore() *InMemorySubscriptionLineItemStore

NewInMemorySubscriptionLineItemStore creates a new in-memory subscription line item store

func (*InMemorySubscriptionLineItemStore) Count added in v1.0.0

Count counts subscription line items based on filter

func (*InMemorySubscriptionLineItemStore) Create added in v1.0.0

Create creates a new subscription line item

func (*InMemorySubscriptionLineItemStore) CreateBulk added in v1.0.0

CreateBulk creates multiple subscription line items in bulk

func (*InMemorySubscriptionLineItemStore) Delete added in v1.0.0

Delete deletes a subscription line item

func (*InMemorySubscriptionLineItemStore) Get added in v1.0.0

Get retrieves a subscription line item by ID

func (*InMemorySubscriptionLineItemStore) GetByPlanID added in v1.0.0

GetByPlanID retrieves all line items for a plan

func (*InMemorySubscriptionLineItemStore) GetByPriceID added in v1.0.0

GetByPriceID retrieves all line items for a price

func (*InMemorySubscriptionLineItemStore) List added in v1.0.0

List retrieves subscription line items based on filter

func (*InMemorySubscriptionLineItemStore) ListByCustomer added in v1.0.0

ListByCustomer retrieves all line items for a customer

func (*InMemorySubscriptionLineItemStore) ListBySubscription added in v1.0.0

func (s *InMemorySubscriptionLineItemStore) ListBySubscription(ctx context.Context, subscriptionID string) ([]*subscription.SubscriptionLineItem, error)

ListBySubscription retrieves all line items for a subscription

func (*InMemorySubscriptionLineItemStore) Update added in v1.0.0

Update updates a subscription line item

type InMemorySubscriptionStore

type InMemorySubscriptionStore struct {
	*InMemoryStore[*subscription.Subscription]
	// contains filtered or unexported fields
}

InMemorySubscriptionStore implements subscription.Repository

func NewInMemorySubscriptionStore

func NewInMemorySubscriptionStore() *InMemorySubscriptionStore

func (*InMemorySubscriptionStore) Count

func (*InMemorySubscriptionStore) Create

func (*InMemorySubscriptionStore) CreatePause

CreatePause creates a new subscription pause

func (*InMemorySubscriptionStore) CreateWithLineItems

CreateWithLineItems creates a subscription with its line items

func (*InMemorySubscriptionStore) Delete

func (*InMemorySubscriptionStore) Get

func (*InMemorySubscriptionStore) GetPause

GetPause gets a subscription pause by ID

func (*InMemorySubscriptionStore) GetWithLineItems

GetWithLineItems gets a subscription with its line items

func (*InMemorySubscriptionStore) GetWithPauses

GetWithPauses gets a subscription with its pauses

func (*InMemorySubscriptionStore) List

func (*InMemorySubscriptionStore) ListAll

ListAll returns all subscriptions without pagination

func (*InMemorySubscriptionStore) ListAllTenant

ListAllTenant returns all subscriptions across all tenants NOTE: This is a potentially expensive operation and to be used only for CRONs

func (*InMemorySubscriptionStore) ListByCustomerID added in v1.0.0

func (s *InMemorySubscriptionStore) ListByCustomerID(ctx context.Context, customerID string) ([]*subscription.Subscription, error)

func (*InMemorySubscriptionStore) ListByIDs added in v1.0.0

func (*InMemorySubscriptionStore) ListPauses

func (s *InMemorySubscriptionStore) ListPauses(ctx context.Context, subscriptionID string) ([]*subscription.SubscriptionPause, error)

ListPauses lists all pauses for a subscription

func (*InMemorySubscriptionStore) Update

func (*InMemorySubscriptionStore) UpdatePause

UpdatePause updates a subscription pause

type InMemoryTaskStore

type InMemoryTaskStore struct {
	*InMemoryStore[*task.Task]
}

InMemoryTaskStore implements task.Repository

func NewInMemoryTaskStore

func NewInMemoryTaskStore() *InMemoryTaskStore

NewInMemoryTaskStore creates a new in-memory task store

func (*InMemoryTaskStore) Count

func (s *InMemoryTaskStore) Count(ctx context.Context, filter *types.TaskFilter) (int, error)

func (*InMemoryTaskStore) Create

func (s *InMemoryTaskStore) Create(ctx context.Context, t *task.Task) error

func (*InMemoryTaskStore) Delete

func (s *InMemoryTaskStore) Delete(ctx context.Context, id string) error

func (*InMemoryTaskStore) Get

func (s *InMemoryTaskStore) Get(ctx context.Context, id string) (*task.Task, error)

func (*InMemoryTaskStore) List

func (s *InMemoryTaskStore) List(ctx context.Context, filter *types.TaskFilter) ([]*task.Task, error)

func (*InMemoryTaskStore) Update

func (s *InMemoryTaskStore) Update(ctx context.Context, t *task.Task) error

type InMemoryTaxAppliedStore added in v1.0.21

type InMemoryTaxAppliedStore struct {
	*InMemoryStore[*taxapplied.TaxApplied]
}

InMemoryTaxAppliedStore implements taxapplied.Repository

func NewInMemoryTaxAppliedStore added in v1.0.21

func NewInMemoryTaxAppliedStore() *InMemoryTaxAppliedStore

func (*InMemoryTaxAppliedStore) Clear added in v1.0.21

func (s *InMemoryTaxAppliedStore) Clear()

Clear clears the tax applied store

func (*InMemoryTaxAppliedStore) Count added in v1.0.21

func (*InMemoryTaxAppliedStore) Create added in v1.0.21

func (*InMemoryTaxAppliedStore) Delete added in v1.0.21

func (s *InMemoryTaxAppliedStore) Delete(ctx context.Context, id string) error

func (*InMemoryTaxAppliedStore) Get added in v1.0.21

func (*InMemoryTaxAppliedStore) GetByIdempotencyKey added in v1.0.21

func (s *InMemoryTaxAppliedStore) GetByIdempotencyKey(ctx context.Context, idempotencyKey string) (*taxapplied.TaxApplied, error)

func (*InMemoryTaxAppliedStore) List added in v1.0.21

func (*InMemoryTaxAppliedStore) Update added in v1.0.21

type InMemoryTaxAssociationStore added in v1.0.21

type InMemoryTaxAssociationStore struct {
	*InMemoryStore[*taxassociation.TaxAssociation]
}

InMemoryTaxAssociationStore implements taxassociation.Repository

func NewInMemoryTaxAssociationStore added in v1.0.21

func NewInMemoryTaxAssociationStore() *InMemoryTaxAssociationStore

func (*InMemoryTaxAssociationStore) Clear added in v1.0.21

func (s *InMemoryTaxAssociationStore) Clear()

Clear clears the tax association store

func (*InMemoryTaxAssociationStore) Count added in v1.0.21

func (*InMemoryTaxAssociationStore) Create added in v1.0.21

func (*InMemoryTaxAssociationStore) Delete added in v1.0.21

func (*InMemoryTaxAssociationStore) Get added in v1.0.21

func (*InMemoryTaxAssociationStore) List added in v1.0.21

func (*InMemoryTaxAssociationStore) Update added in v1.0.21

type InMemoryTaxRateStore added in v1.0.21

type InMemoryTaxRateStore struct {
	*InMemoryStore[*taxrate.TaxRate]
}

InMemoryTaxRateStore implements taxrate.Repository

func NewInMemoryTaxRateStore added in v1.0.21

func NewInMemoryTaxRateStore() *InMemoryTaxRateStore

func (*InMemoryTaxRateStore) Clear added in v1.0.21

func (s *InMemoryTaxRateStore) Clear()

Clear clears the tax rate store

func (*InMemoryTaxRateStore) Count added in v1.0.21

func (s *InMemoryTaxRateStore) Count(ctx context.Context, filter *types.TaxRateFilter) (int, error)

func (*InMemoryTaxRateStore) Create added in v1.0.21

func (*InMemoryTaxRateStore) Delete added in v1.0.21

func (*InMemoryTaxRateStore) Get added in v1.0.21

func (*InMemoryTaxRateStore) GetByCode added in v1.0.21

func (s *InMemoryTaxRateStore) GetByCode(ctx context.Context, code string) (*taxrate.TaxRate, error)

func (*InMemoryTaxRateStore) List added in v1.0.21

func (*InMemoryTaxRateStore) ListAll added in v1.0.21

func (*InMemoryTaxRateStore) Update added in v1.0.21

type InMemoryTenantStore

type InMemoryTenantStore struct {
	// contains filtered or unexported fields
}

func NewInMemoryTenantStore

func NewInMemoryTenantStore() *InMemoryTenantStore

func (*InMemoryTenantStore) Clear

func (s *InMemoryTenantStore) Clear()

func (*InMemoryTenantStore) Create

func (*InMemoryTenantStore) GetByID

func (s *InMemoryTenantStore) GetByID(ctx context.Context, id string) (*tenant.Tenant, error)

func (*InMemoryTenantStore) List

func (*InMemoryTenantStore) Update added in v1.0.0

type InMemoryUserStore

type InMemoryUserStore struct {
	// contains filtered or unexported fields
}

InMemoryUserStore is an in-memory implementation of the User repository

func NewInMemoryUserStore

func NewInMemoryUserStore() *InMemoryUserStore

NewInMemoryUserStore creates a new instance of InMemoryUserStore

func (*InMemoryUserStore) Clear

func (s *InMemoryUserStore) Clear()

func (*InMemoryUserStore) Create

func (r *InMemoryUserStore) Create(ctx context.Context, user *user.User) error

Create creates a new user in the in-memory store

func (*InMemoryUserStore) GetByEmail

func (r *InMemoryUserStore) GetByEmail(ctx context.Context, email string) (*user.User, error)

GetByEmail retrieves a user by email from the in-memory store

func (*InMemoryUserStore) GetByID

func (r *InMemoryUserStore) GetByID(ctx context.Context, userID string) (*user.User, error)

GetByID retrieves a user by ID from the in-memory store

type InMemoryWalletStore

type InMemoryWalletStore struct {
	// contains filtered or unexported fields
}

func NewInMemoryWalletStore

func NewInMemoryWalletStore() *InMemoryWalletStore

func (*InMemoryWalletStore) Clear

func (s *InMemoryWalletStore) Clear()

func (*InMemoryWalletStore) ConsumeCredits

func (s *InMemoryWalletStore) ConsumeCredits(ctx context.Context, credits []*wallet.Transaction, amount decimal.Decimal) error

ConsumeCredits consumes credits from a wallet

func (*InMemoryWalletStore) CountWalletTransactions

func (s *InMemoryWalletStore) CountWalletTransactions(ctx context.Context, f *types.WalletTransactionFilter) (int, error)

func (*InMemoryWalletStore) CreateTransaction

func (s *InMemoryWalletStore) CreateTransaction(ctx context.Context, tx *wallet.Transaction) error

CreateTransaction creates a new wallet transaction record

func (*InMemoryWalletStore) CreateWallet

func (s *InMemoryWalletStore) CreateWallet(ctx context.Context, w *wallet.Wallet) error

func (*InMemoryWalletStore) FindEligibleCredits

func (s *InMemoryWalletStore) FindEligibleCredits(ctx context.Context, walletID string, requiredAmount decimal.Decimal, pageSize int) ([]*wallet.Transaction, error)

FindEligibleCredits finds eligible credits for a wallet

func (*InMemoryWalletStore) GetTransactionByID

func (s *InMemoryWalletStore) GetTransactionByID(ctx context.Context, id string) (*wallet.Transaction, error)

func (*InMemoryWalletStore) GetWalletByID

func (s *InMemoryWalletStore) GetWalletByID(ctx context.Context, id string) (*wallet.Wallet, error)

func (*InMemoryWalletStore) GetWalletsByCustomerID

func (s *InMemoryWalletStore) GetWalletsByCustomerID(ctx context.Context, customerID string) ([]*wallet.Wallet, error)

func (*InMemoryWalletStore) GetWalletsByFilter added in v1.0.21

func (s *InMemoryWalletStore) GetWalletsByFilter(ctx context.Context, filter *types.WalletFilter) ([]*wallet.Wallet, error)

GetWalletsByFilter retrieves wallets based on filter criteria

func (*InMemoryWalletStore) ListAllWalletTransactions

func (s *InMemoryWalletStore) ListAllWalletTransactions(ctx context.Context, f *types.WalletTransactionFilter) ([]*wallet.Transaction, error)

func (*InMemoryWalletStore) ListWalletTransactions

func (s *InMemoryWalletStore) ListWalletTransactions(ctx context.Context, f *types.WalletTransactionFilter) ([]*wallet.Transaction, error)

func (*InMemoryWalletStore) UpdateTransactionStatus

func (s *InMemoryWalletStore) UpdateTransactionStatus(ctx context.Context, id string, status types.TransactionStatus) error

func (*InMemoryWalletStore) UpdateWallet

func (s *InMemoryWalletStore) UpdateWallet(ctx context.Context, id string, w *wallet.Wallet) error

UpdateWallet updates a wallet in the in-memory store

func (*InMemoryWalletStore) UpdateWalletBalance

func (s *InMemoryWalletStore) UpdateWalletBalance(ctx context.Context, walletID string, finalBalance, newCreditBalance decimal.Decimal) error

UpdateWalletBalance updates the wallet's balance and credit balance

func (*InMemoryWalletStore) UpdateWalletStatus

func (s *InMemoryWalletStore) UpdateWalletStatus(ctx context.Context, id string, status types.WalletStatus) error

type MockHTTPClient

type MockHTTPClient struct {
	// contains filtered or unexported fields
}

MockHTTPClient implements a mock HTTP client for testing

func NewMockHTTPClient

func NewMockHTTPClient() *MockHTTPClient

NewMockHTTPClient creates a new mock HTTP client

func (*MockHTTPClient) Clear

func (m *MockHTTPClient) Clear()

Clear removes all registered responses

func (*MockHTTPClient) RegisterCSVResponse

func (m *MockHTTPClient) RegisterCSVResponse(url string, headers []string, records [][]string)

RegisterCSVResponse is a helper to register a CSV response

func (*MockHTTPClient) RegisterResponse

func (m *MockHTTPClient) RegisterResponse(url string, resp MockResponse)

RegisterResponse registers a mock response for a given URL

func (*MockHTTPClient) Send

Send implements the httpclient.Client interface

type MockPDFGenerator added in v1.0.0

type MockPDFGenerator struct {
	mock.Mock
	// contains filtered or unexported fields
}

func (*MockPDFGenerator) RenderInvoicePdf added in v1.0.0

func (m *MockPDFGenerator) RenderInvoicePdf(ctx context.Context, data *domain.InvoiceData) ([]byte, error)

RenderInvoicePdf implements pdf.Generator.

type MockPostgresClient

type MockPostgresClient struct {
	// contains filtered or unexported fields
}

MockPostgresClient is a mock implementation of postgres client for testing

func (*MockPostgresClient) Querier

func (c *MockPostgresClient) Querier(ctx context.Context) *ent.Client

Querier returns the ent client

func (*MockPostgresClient) TxFromContext

func (c *MockPostgresClient) TxFromContext(ctx context.Context) *ent.Tx

TxFromContext returns the transaction from context if it exists

func (*MockPostgresClient) WithTx

func (c *MockPostgresClient) WithTx(ctx context.Context, fn func(context.Context) error) error

WithTx executes the given function within a transaction

type MockResponse

type MockResponse struct {
	StatusCode int
	Body       []byte
	Headers    map[string]string
}

MockResponse represents a mock HTTP response

type SortFunc

type SortFunc[T any] func(i, j T) bool

SortFunc is a generic sort function type

type Stores

type Stores struct {
	CreditGrantRepo              creditgrant.Repository
	CreditGrantApplicationRepo   creditgrantapplication.Repository
	SubscriptionRepo             subscription.Repository
	EventRepo                    events.Repository
	PlanRepo                     plan.Repository
	PriceRepo                    price.Repository
	MeterRepo                    meter.Repository
	CustomerRepo                 customer.Repository
	InvoiceRepo                  invoice.Repository
	WalletRepo                   wallet.Repository
	PaymentRepo                  payment.Repository
	AuthRepo                     auth.Repository
	UserRepo                     user.Repository
	TenantRepo                   tenant.Repository
	EnvironmentRepo              environment.Repository
	EntitlementRepo              entitlement.Repository
	FeatureRepo                  feature.Repository
	TaskRepo                     task.Repository
	SecretRepo                   secret.Repository
	CreditNoteRepo               creditnote.Repository
	CreditNoteLineItemRepo       creditnote.CreditNoteLineItemRepository
	TaxRateRepo                  taxrate.Repository
	TaxAppliedRepo               taxapplied.Repository
	TaxAssociationRepo           taxassociation.Repository
	CouponRepo                   coupon.Repository
	CouponAssociationRepo        coupon_association.Repository
	CouponApplicationRepo        coupon_application.Repository
	ConnectionRepo               connection.Repository
	EntityIntegrationMappingRepo entityintegrationmapping.Repository
	SettingsRepo                 settings.Repository
}

Stores holds all the repository interfaces for testing

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL