billingworkersubscription

package
v1.0.0-beta.199 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2025 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SubscriptionSyncComponentName billing.ComponentName = "subscription-sync"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	BillingService      billing.Service
	SubscriptionService subscription.Service
	TxCreator           transaction.Creator
	Logger              *slog.Logger
	FeatureFlags        FeatureFlags
}

func (Config) Validate

func (c Config) Validate() error

type FeatureFlags

type FeatureFlags struct {
	EnableFlatFeeInAdvanceProrating bool
	EnableFlatFeeInArrearsProrating bool
}

type Handler

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

func New

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

func (*Handler) HandleCancelledEvent

func (h *Handler) HandleCancelledEvent(ctx context.Context, event *subscription.CancelledEvent) error

HandleCancelledEvent is a handler for the subscription cancel event, it will make sure that we syncronize the

func (*Handler) HandleInvoiceCreation

func (h *Handler) HandleInvoiceCreation(ctx context.Context, invoice billing.EventInvoice) error

HandleInvoiceCreation is a handler for the invoice creation event, it will make sure that we are backfilling the items consumed by invoice creation into the gathering invoice.

func (*Handler) SyncronizeSubscription

func (h *Handler) SyncronizeSubscription(ctx context.Context, subs subscription.SubscriptionView, asOf time.Time) error

type PhaseIterator

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

func NewPhaseIterator

func NewPhaseIterator(subs subscription.SubscriptionView, phaseKey string) (*PhaseIterator, error)

func (*PhaseIterator) Generate

func (it *PhaseIterator) Generate(iterationEnd time.Time) ([]subscriptionItemWithPeriod, error)

func (*PhaseIterator) GetMinimumBillableTime

func (it *PhaseIterator) GetMinimumBillableTime() time.Time

GetMinimumBillableTime returns the minimum time that we can bill for the phase (e.g. the first time we would be yielding a line item)

func (*PhaseIterator) HasInvoicableItems

func (it *PhaseIterator) HasInvoicableItems() bool

func (*PhaseIterator) PhaseEnd

func (it *PhaseIterator) PhaseEnd() *time.Time

func (*PhaseIterator) PhaseStart

func (it *PhaseIterator) PhaseStart() time.Time

Jump to

Keyboard shortcuts

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