persistedstate

package
v1.0.0-beta.228 Latest Latest
Warning

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

Go to latest
Published: May 19, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ItemAsFlatFeeCharge

func ItemAsFlatFeeCharge(in Item) (flatfee.Charge, error)

ItemAsFlatFeeCharge returns the wrapped flat-fee charge when the persisted item is flat-fee-backed.

func ItemAsLine

func ItemAsLine(in Item) (billing.GenericInvoiceLine, error)

ItemAsLine returns the wrapped line when the persisted item is line-backed.

func ItemAsSplitLineHierarchy

func ItemAsSplitLineHierarchy(in Item) (*billing.SplitLineHierarchy, error)

ItemAsSplitLineHierarchy returns the wrapped hierarchy when the persisted item is hierarchy-backed.

func ItemAsUsageBasedCharge

func ItemAsUsageBasedCharge(in Item) (usagebased.Charge, error)

ItemAsUsageBasedCharge returns the wrapped usage-based charge when the persisted item is usage-based.

Types

type FlatFeeChargeGetter

type FlatFeeChargeGetter interface {
	GetFlatFeeCharge() flatfee.Charge
}

type Invoices

type Invoices map[string]billing.Invoice

func (Invoices) IsGatheringInvoice

func (i Invoices) IsGatheringInvoice(invoiceID string) (bool, error)

type Item

type Item interface {
	ID() models.NamespacedID
	Type() ItemType
	ChildUniqueReferenceID() *string
	ServicePeriod() timeutil.ClosedPeriod
	IsSubscriptionManaged() bool
	HasLastLineAnnotation(annotation string) bool
}

func NewChargeItemFromChargeType

func NewChargeItemFromChargeType(chargeType meta.ChargeType, usageBasedCharge *usagebased.Charge, flatFeeCharge *flatfee.Charge) (Item, error)

func NewItemFromLineOrHierarchy

func NewItemFromLineOrHierarchy(lineOrHierarchy billing.LineOrHierarchy) (Item, error)

type ItemType

type ItemType string
const (
	ItemTypeInvoiceLine           ItemType = "invoice.line"
	ItemTypeInvoiceSplitLineGroup ItemType = "invoice.splitLineGroup"
	ItemTypeChargeFlatFee         ItemType = "charge.flatFee"
	ItemTypeChargeUsageBased      ItemType = "charge.usageBased"
)

type LineGetter

type LineGetter interface {
	GetLine() billing.GenericInvoiceLine
}

type Loader

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

func NewLoader

func NewLoader(billingService billingService, chargeService chargeService) Loader

func (Loader) LoadForSubscription

func (l Loader) LoadForSubscription(ctx context.Context, subs subscription.Subscription) (State, error)

type SplitLineHierarchyGetter

type SplitLineHierarchyGetter interface {
	GetSplitLineHierarchy() *billing.SplitLineHierarchy
}

type State

type State struct {
	ByUniqueID map[string]Item
	Invoices   Invoices
}

func (State) Validate

func (s State) Validate() error

type UsageBasedChargeGetter

type UsageBasedChargeGetter interface {
	GetUsageBasedCharge() usagebased.Charge
}

Jump to

Keyboard shortcuts

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