billingservice

package
v1.0.0-beta.217 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2025 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExecuteTriggerWithAllowInStates

func ExecuteTriggerWithAllowInStates(states ...billing.InvoiceStatus) executeTriggerApplyOptionFunc

func ExecuteTriggerWithEditCallback

func ExecuteTriggerWithEditCallback(cb editCallbackFunc) executeTriggerApplyOptionFunc

func ExecuteTriggerWithIncludeDeletedLines

func ExecuteTriggerWithIncludeDeletedLines(includeDeletedLines bool) executeTriggerApplyOptionFunc

Types

type Config

type Config struct {
	Adapter                      billing.Adapter
	CustomerService              customer.Service
	AppService                   app.Service
	Logger                       *slog.Logger
	FeatureService               feature.FeatureConnector
	MeterService                 meter.Service
	StreamingConnector           streaming.Connector
	Publisher                    eventbus.Publisher
	AdvancementStrategy          billing.AdvancementStrategy
	FSNamespaceLockdown          []string
	MaxParallelQuantitySnapshots int
}

func (Config) Validate

func (c Config) Validate() error

type InvoiceStateMachine

type InvoiceStateMachine struct {
	Invoice             billing.Invoice
	Calculator          invoicecalc.Calculator
	StateMachine        *stateless.StateMachine
	Logger              *slog.Logger
	Publisher           eventbus.Publisher
	Service             *Service
	FSNamespaceLockdown []string
}

func (*InvoiceStateMachine) AdvanceUntilStateStable

func (m *InvoiceStateMachine) AdvanceUntilStateStable(ctx context.Context) error

func (*InvoiceStateMachine) CanFire

func (m *InvoiceStateMachine) CanFire(ctx context.Context, trigger billing.InvoiceTrigger) (bool, error)

func (*InvoiceStateMachine) FireAndActivate

func (m *InvoiceStateMachine) FireAndActivate(ctx context.Context, trigger billing.InvoiceTrigger) error

FireAndActivate fires the trigger and activates the new state, if activation fails it automatically transitions to the failed state and activates that. In addition to the activation a calculation is always performed to ensure that the invoice is up to date.

func (*InvoiceStateMachine) HandleInvoiceTrigger

func (m *InvoiceStateMachine) HandleInvoiceTrigger(ctx context.Context, trigger billing.InvoiceTriggerInput) error

func (*InvoiceStateMachine) StatusDetails

func (*InvoiceStateMachine) TriggerFailed

func (m *InvoiceStateMachine) TriggerFailed(ctx context.Context) error

type InvoiceStateMachineCallback

type InvoiceStateMachineCallback func(context.Context, *InvoiceStateMachine) error

type Service

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

func New

func New(config Config) (*Service, error)

func (*Service) AdvanceInvoice

func (s *Service) AdvanceInvoice(ctx context.Context, input billing.AdvanceInvoiceInput) (billing.Invoice, error)

func (*Service) ApproveInvoice

func (s *Service) ApproveInvoice(ctx context.Context, input billing.ApproveInvoiceInput) (billing.Invoice, error)

func (*Service) CreateProfile

func (s *Service) CreateProfile(ctx context.Context, input billing.CreateProfileInput) (*billing.Profile, error)

func (*Service) DeleteCustomerOverride

func (s *Service) DeleteCustomerOverride(ctx context.Context, input billing.DeleteCustomerOverrideInput) error

func (*Service) DeleteInvoice

func (s *Service) DeleteInvoice(ctx context.Context, input billing.DeleteInvoiceInput) error

func (*Service) DeleteProfile

func (s *Service) DeleteProfile(ctx context.Context, input billing.DeleteProfileInput) error

func (*Service) DeleteSplitLineGroup

func (s *Service) DeleteSplitLineGroup(ctx context.Context, input billing.DeleteSplitLineGroupInput) error

func (*Service) GenerateInvoiceSequenceNumber

func (s *Service) GenerateInvoiceSequenceNumber(ctx context.Context, in billing.SequenceGenerationInput, def billing.SequenceDefinition) (string, error)

func (Service) GetAdvancementStrategy

func (s Service) GetAdvancementStrategy() billing.AdvancementStrategy

func (*Service) GetDefaultProfile

func (s *Service) GetDefaultProfile(ctx context.Context, input billing.GetDefaultProfileInput) (*billing.Profile, error)

func (*Service) GetInvoiceByID

func (s *Service) GetInvoiceByID(ctx context.Context, input billing.GetInvoiceByIdInput) (billing.Invoice, error)

func (*Service) GetLinesForSubscription

func (s *Service) GetLinesForSubscription(ctx context.Context, input billing.GetLinesForSubscriptionInput) ([]billing.LineOrHierarchy, error)

func (*Service) GetProfile

func (s *Service) GetProfile(ctx context.Context, input billing.GetProfileInput) (*billing.Profile, error)

func (*Service) GetSplitLineGroup

func (Service) InvoiceCalculator

func (s Service) InvoiceCalculator() invoicecalc.Calculator

func (*Service) InvoicePendingLines

func (s *Service) InvoicePendingLines(ctx context.Context, input billing.InvoicePendingLinesInput) ([]billing.Invoice, error)

func (*Service) IsAppUsed

func (s *Service) IsAppUsed(ctx context.Context, appID app.AppID) error

func (*Service) ListInvoices

func (*Service) ListProfiles

func (*Service) ProvisionDefaultBillingProfile

func (s *Service) ProvisionDefaultBillingProfile(ctx context.Context, namespace string) error

func (*Service) RecalculateGatheringInvoices

func (s *Service) RecalculateGatheringInvoices(ctx context.Context, input billing.RecalculateGatheringInvoicesInput) error

func (*Service) RetryInvoice

func (s *Service) RetryInvoice(ctx context.Context, input billing.RetryInvoiceInput) (billing.Invoice, error)

func (Service) SimulateInvoice

func (s Service) SimulateInvoice(ctx context.Context, input billing.SimulateInvoiceInput) (billing.Invoice, error)

func (*Service) SnapshotLineQuantity

func (s *Service) SnapshotLineQuantity(ctx context.Context, input billing.SnapshotLineQuantityInput) (*billing.Line, error)

func (*Service) SnapshotQuantities

func (s *Service) SnapshotQuantities(ctx context.Context, input billing.SnapshotQuantitiesInput) (billing.Invoice, error)

func (*Service) SyncDraftInvoice

func (s *Service) SyncDraftInvoice(ctx context.Context, input billing.SyncDraftInvoiceInput) (billing.Invoice, error)

func (*Service) SyncIssuingInvoice

func (s *Service) SyncIssuingInvoice(ctx context.Context, input billing.SyncIssuingInvoiceInput) (billing.Invoice, error)

func (*Service) TriggerInvoice

func (s *Service) TriggerInvoice(ctx context.Context, input billing.InvoiceTriggerServiceInput) error

func (*Service) UpdateInvoice

func (s *Service) UpdateInvoice(ctx context.Context, input billing.UpdateInvoiceInput) (billing.Invoice, error)

func (*Service) UpdateInvoiceFields

func (s *Service) UpdateInvoiceFields(ctx context.Context, input billing.UpdateInvoiceFieldsInput) error

func (*Service) UpdateProfile

func (s *Service) UpdateProfile(ctx context.Context, input billing.UpdateProfileInput) (*billing.Profile, error)

func (*Service) UpdateSplitLineGroup

func (s *Service) UpdateSplitLineGroup(ctx context.Context, input billing.UpdateSplitLineGroupInput) (billing.SplitLineGroup, error)

func (*Service) UpsertValidationIssues

func (s *Service) UpsertValidationIssues(ctx context.Context, input billing.UpsertValidationIssuesInput) error

func (Service) WithAdvancementStrategy

func (s Service) WithAdvancementStrategy(strategy billing.AdvancementStrategy) billing.Service

func (Service) WithInvoiceCalculator

func (s Service) WithInvoiceCalculator(calc invoicecalc.Calculator) *Service

func (*Service) WithInvoiceStateMachine

func (s *Service) WithInvoiceStateMachine(ctx context.Context, invoice billing.Invoice, cb InvoiceStateMachineCallback) (billing.Invoice, error)

func (*Service) WithLock

func (s *Service) WithLock(ctx context.Context, customerID customer.CustomerID, fn func(ctx context.Context) error) error

func (*Service) WithLockedNamespaces

func (s *Service) WithLockedNamespaces(namespaces []string) billing.Service

Directories

Path Synopsis
lineservice package contains the implementation of the LineAdapter interface which acts as a adapter between the specific line types and the billing service.
lineservice package contains the implementation of the LineAdapter interface which acts as a adapter between the specific line types and the billing service.

Jump to

Keyboard shortcuts

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