service

package
v1.0.0-beta.229 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2026 License: Apache-2.0 Imports: 36 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(config Config) (usagebased.Service, error)

Types

type Config

type Config struct {
	Adapter                 usagebased.Adapter
	Handler                 usagebased.Handler
	Lineage                 lineage.Service
	Locker                  *lockr.Locker
	MetaAdapter             meta.Adapter
	CustomerOverrideService billing.CustomerOverrideService
	FeatureService          feature.FeatureConnector
	RatingService           rating.Service

	StreamingConnector streaming.Connector
}

func (Config) Validate

func (c Config) Validate() error

type CreditThenInvoiceStateMachine

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

func NewCreditThenInvoiceStateMachine

func NewCreditThenInvoiceStateMachine(config StateMachineConfig) (*CreditThenInvoiceStateMachine, error)

func (CreditThenInvoiceStateMachine) AdvanceAfterCollectionPeriodEnd

func (s CreditThenInvoiceStateMachine) AdvanceAfterCollectionPeriodEnd(ctx context.Context) error

func (CreditThenInvoiceStateMachine) AdvanceAfterServicePeriodFrom

func (s CreditThenInvoiceStateMachine) AdvanceAfterServicePeriodFrom(ctx context.Context) error

func (CreditThenInvoiceStateMachine) AdvanceAfterServicePeriodTo

func (s CreditThenInvoiceStateMachine) AdvanceAfterServicePeriodTo(ctx context.Context) error

func (*CreditThenInvoiceStateMachine) AreAllInvoicedRunsSettled

func (s *CreditThenInvoiceStateMachine) AreAllInvoicedRunsSettled() bool

func (*CreditThenInvoiceStateMachine) DeleteCharge

func (*CreditThenInvoiceStateMachine) ExtendCharge

func (s *CreditThenInvoiceStateMachine) ExtendCharge(ctx context.Context, patch meta.PatchExtend) error

func (*CreditThenInvoiceStateMachine) FinalizeInvoiceRun

func (CreditThenInvoiceStateMachine) IsAfterCollectionPeriod

func (s CreditThenInvoiceStateMachine) IsAfterCollectionPeriod(ctx context.Context, _ ...any) bool

func (CreditThenInvoiceStateMachine) IsAfterServicePeriod

func (s CreditThenInvoiceStateMachine) IsAfterServicePeriod() bool

func (CreditThenInvoiceStateMachine) IsInsideServicePeriod

func (s CreditThenInvoiceStateMachine) IsInsideServicePeriod() bool

func (*CreditThenInvoiceStateMachine) ShrinkCharge

func (*CreditThenInvoiceStateMachine) SnapshotInvoiceUsage

func (s *CreditThenInvoiceStateMachine) SnapshotInvoiceUsage(ctx context.Context) error

func (*CreditThenInvoiceStateMachine) StartFinalInvoiceRun

func (s *CreditThenInvoiceStateMachine) StartFinalInvoiceRun(ctx context.Context, input invoiceCreatedInput) error

func (*CreditThenInvoiceStateMachine) StartPartialInvoiceRun

func (s *CreditThenInvoiceStateMachine) StartPartialInvoiceRun(ctx context.Context, input invoiceCreatedInput) error

func (CreditThenInvoiceStateMachine) SyncFeatureIDFromFeatureMeter

func (s CreditThenInvoiceStateMachine) SyncFeatureIDFromFeatureMeter(ctx context.Context) error

func (*CreditThenInvoiceStateMachine) UnsupportedExtendOperation

func (s *CreditThenInvoiceStateMachine) UnsupportedExtendOperation(_ context.Context, _ meta.PatchExtend) error

func (*CreditThenInvoiceStateMachine) UnsupportedShrinkOperation

func (s *CreditThenInvoiceStateMachine) UnsupportedShrinkOperation(_ context.Context, _ meta.PatchShrink) error

type CreditsOnlyStateMachine

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

func NewCreditsOnlyStateMachine

func NewCreditsOnlyStateMachine(config StateMachineConfig) (*CreditsOnlyStateMachine, error)

func (CreditsOnlyStateMachine) AdvanceAfterCollectionPeriodEnd

func (s CreditsOnlyStateMachine) AdvanceAfterCollectionPeriodEnd(ctx context.Context) error

func (CreditsOnlyStateMachine) AdvanceAfterServicePeriodFrom

func (s CreditsOnlyStateMachine) AdvanceAfterServicePeriodFrom(ctx context.Context) error

func (CreditsOnlyStateMachine) AdvanceAfterServicePeriodTo

func (s CreditsOnlyStateMachine) AdvanceAfterServicePeriodTo(ctx context.Context) error

func (*CreditsOnlyStateMachine) ClearAdvanceAfter

func (s *CreditsOnlyStateMachine) ClearAdvanceAfter(ctx context.Context) error

func (*CreditsOnlyStateMachine) DeleteCharge

func (s *CreditsOnlyStateMachine) DeleteCharge(ctx context.Context, policy meta.PatchDeletePolicy) error

func (*CreditsOnlyStateMachine) FinalizeRealizationRun

func (s *CreditsOnlyStateMachine) FinalizeRealizationRun(ctx context.Context) error

func (CreditsOnlyStateMachine) IsAfterCollectionPeriod

func (s CreditsOnlyStateMachine) IsAfterCollectionPeriod(ctx context.Context, _ ...any) bool

func (CreditsOnlyStateMachine) IsAfterServicePeriod

func (s CreditsOnlyStateMachine) IsAfterServicePeriod() bool

func (CreditsOnlyStateMachine) IsInsideServicePeriod

func (s CreditsOnlyStateMachine) IsInsideServicePeriod() bool

func (*CreditsOnlyStateMachine) StartFinalRealizationRun

func (s *CreditsOnlyStateMachine) StartFinalRealizationRun(ctx context.Context) error

func (CreditsOnlyStateMachine) SyncFeatureIDFromFeatureMeter

func (s CreditsOnlyStateMachine) SyncFeatureIDFromFeatureMeter(ctx context.Context) error

type LineEngine

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

func (*LineEngine) BuildStandardInvoiceLines

func (e *LineEngine) BuildStandardInvoiceLines(ctx context.Context, input billing.BuildStandardInvoiceLinesInput) (billing.StandardLines, error)

func (*LineEngine) BuildStandardLinesForGatheringPreview

func (e *LineEngine) BuildStandardLinesForGatheringPreview(ctx context.Context, input billing.BuildStandardInvoiceLinesInput) (billing.StandardLines, error)

func (*LineEngine) GetLineEngineType

func (e *LineEngine) GetLineEngineType() billing.LineEngineType

func (*LineEngine) IsLineBillableAsOf

func (e *LineEngine) IsLineBillableAsOf(_ context.Context, input billing.IsLineBillableAsOfInput) (bool, error)

func (*LineEngine) OnCollectionCompleted

func (e *LineEngine) OnCollectionCompleted(ctx context.Context, input billing.OnCollectionCompletedInput) (billing.StandardLines, error)

func (*LineEngine) OnInvoiceIssued

func (e *LineEngine) OnInvoiceIssued(ctx context.Context, input billing.OnInvoiceIssuedInput) error

func (*LineEngine) OnMutableStandardLinesDeleted

func (e *LineEngine) OnMutableStandardLinesDeleted(ctx context.Context, input billing.OnMutableStandardLinesDeletedInput) error

func (*LineEngine) OnPaymentAuthorized

func (e *LineEngine) OnPaymentAuthorized(ctx context.Context, input billing.OnPaymentAuthorizedInput) error

func (*LineEngine) OnPaymentSettled

func (e *LineEngine) OnPaymentSettled(ctx context.Context, input billing.OnPaymentSettledInput) error

func (*LineEngine) OnStandardInvoiceCreated

func (e *LineEngine) OnStandardInvoiceCreated(ctx context.Context, input billing.OnStandardInvoiceCreatedInput) (billing.StandardLines, error)

func (*LineEngine) OnUnsupportedCreditNote

func (e *LineEngine) OnUnsupportedCreditNote(ctx context.Context, input billing.OnUnsupportedCreditNoteInput) error

type StateMachineConfig

type StateMachineConfig struct {
	Charge             usagebased.Charge
	Adapter            usagebased.Adapter
	Rater              usagebasedrating.Service
	Runs               *usagebasedrun.Service
	Logger             *slog.Logger
	CustomerOverride   billing.CustomerOverrideWithDetails
	FeatureMeter       feature.FeatureMeter
	CurrencyCalculator currencyx.Calculator
}

func (StateMachineConfig) Validate

func (c StateMachineConfig) Validate() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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