Documentation
¶
Index ¶
- Constants
- type Config
- type FeatureFlags
- type Handler
- func (h *Handler) HandleCancelledEvent(ctx context.Context, event *subscription.CancelledEvent) error
- func (h *Handler) HandleInvoiceCreation(ctx context.Context, invoice billing.EventInvoice) error
- func (h *Handler) SyncronizeSubscription(ctx context.Context, subs subscription.SubscriptionView, asOf time.Time) error
- type PhaseIterator
- func (it *PhaseIterator) Generate(iterationEnd time.Time) ([]subscriptionItemWithPeriod, error)
- func (it *PhaseIterator) GetMinimumBillableTime() time.Time
- func (it *PhaseIterator) HasInvoicableItems() bool
- func (it *PhaseIterator) PhaseEnd() *time.Time
- func (it *PhaseIterator) PhaseStart() time.Time
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
}
type FeatureFlags ¶
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
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 ¶
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
Click to show internal directories.
Click to hide internal directories.