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: 27 Imported by: 0

Documentation

Index

Constants

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

Variables

Functions

This section is empty.

Types

type Config

type Config struct {
	BillingService billing.Service
	// ChargesService is required for credit-only sync and charge-based provisioning.
	ChargesService          charges.Service
	SubscriptionService     subscription.Service
	SubscriptionSyncAdapter subscriptionsync.Adapter
	FeatureFlags            FeatureFlags
	Logger                  *slog.Logger
	Tracer                  trace.Tracer
	FeatureGate             featuregate.Gate
}

func (Config) Validate

func (c Config) Validate() error

type FeatureFlags

type FeatureFlags struct {
	EnableFlatFeeInAdvanceProrating bool
	EnableFlatFeeInArrearsProrating bool
	EnableCreditThenInvoice         bool

	CreditsFlag string
}

type Service

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

func New

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

func (*Service) GetSyncStates

func (*Service) HandleCancelledEvent

func (s *Service) HandleCancelledEvent(ctx context.Context, event *subscription.CancelledEvent) error

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

func (*Service) HandleDeletedEvent

func (s *Service) HandleDeletedEvent(ctx context.Context, event *subscription.DeletedEvent) error

HandleDeletedEvent is a handler for the subscription deleted event, it will make sure that we synchronize the subscription and invoice customer.

func (*Service) HandleInvoiceCreation

func (s *Service) HandleInvoiceCreation(ctx context.Context, event *billing.StandardInvoiceCreatedEvent) 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 (*Service) HandleSubscriptionSyncEvent

func (s *Service) HandleSubscriptionSyncEvent(ctx context.Context, event *subscription.SubscriptionSyncEvent) error

func (*Service) SyncByID

func (s *Service) SyncByID(ctx context.Context, subscriptionID models.NamespacedID, asOf time.Time, opts ...subscriptionsync.SynchronizeSubscriptionOption) error

func (*Service) SyncByIDAndInvoiceCustomer

func (s *Service) SyncByIDAndInvoiceCustomer(ctx context.Context, subscriptionID models.NamespacedID, asOf time.Time) error

func (*Service) SyncByViewAndInvoiceCustomer

func (s *Service) SyncByViewAndInvoiceCustomer(ctx context.Context, view subscription.SubscriptionView, asOf time.Time) error

type SubscriptionReferenceType

type SubscriptionReferenceType string
const (
	SubscriptionReferenceTypeID   SubscriptionReferenceType = "id"
	SubscriptionReferenceTypeView SubscriptionReferenceType = "view"
)

func (SubscriptionReferenceType) Validate

func (t SubscriptionReferenceType) Validate() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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