Documentation
¶
Overview ¶
Package subscription registers the `safedep subscription` domain: the tenant's plan and access lifecycle - status, free trial, paid subscription, on-demand (overage) billing, and the billing portal. It is named for the user's intent (plan/access), not the billing mechanism; low-level billing detail (invoices, payment methods) is delegated to the provider portal.
Index ¶
- func Register(root *cobra.Command, a *app.App)
- type AccountStatus
- type CheckoutInput
- type CheckoutResult
- type Customer
- type CustomerCreator
- type CustomerGetter
- type CustomerInput
- type FeatureOverage
- type FeatureUsage
- type OnDemandDisabler
- type OnDemandEnabler
- type OnDemandState
- type OnDemandStateGetter
- type PortalOpener
- type ProviderError
- type Service
- func (s *Service) ActivateTrial(ctx context.Context) error
- func (s *Service) Checkout(ctx context.Context, in CheckoutInput) (*CheckoutResult, error)
- func (s *Service) CreateCustomer(ctx context.Context, in CustomerInput) (*Customer, []ProviderError, error)
- func (s *Service) DisableOnDemand(ctx context.Context) (*OnDemandState, error)
- func (s *Service) EnableOnDemand(ctx context.Context, terms string) (*OnDemandState, error)
- func (s *Service) GetCustomer(ctx context.Context) (*Customer, bool, error)
- func (s *Service) OnDemandState(ctx context.Context) (*OnDemandState, error)
- func (s *Service) Portal(ctx context.Context, returnURL string) (string, error)
- func (s *Service) Status(ctx context.Context) (*AccountStatus, error)
- type StatusGetter
- type Subscriber
- type TrialActivator
- type TrialInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AccountStatus ¶
type AccountStatus struct {
Status string
Tier string
Trial *TrialInfo // set only when in an active trial
Entitlements []string
OnDemand *OnDemandState // best-effort; nil if unavailable
}
type CheckoutInput ¶
type CheckoutResult ¶
type CustomerCreator ¶
type CustomerCreator interface {
CreateCustomer(ctx context.Context, in CustomerInput) (*Customer, []ProviderError, error)
}
type CustomerGetter ¶
type CustomerInput ¶
type FeatureOverage ¶ added in v0.4.0
type FeatureUsage ¶ added in v0.4.0
type FeatureUsage struct {
FeatureKey string
DisplayName string
UnitLabel string
IncludedLimit int64 // -1 unlimited, 0 not-available, >0 finite
Consumed int64
Seats int64
Tier string
PeriodEnd time.Time
Provisional bool // enforcement == PROVISIONAL
Overage *FeatureOverage
OverageUsed int64
OverageUsedMinor int64
SettlementPending bool // settlement_status == PENDING
}
FeatureUsage is the CLI-side view of one metered feature's usage. Numbers are copied from the API as-is; the CLI performs no billing math.
type OnDemandDisabler ¶
type OnDemandDisabler interface {
DisableOnDemand(ctx context.Context) (*OnDemandState, error)
}
type OnDemandEnabler ¶
type OnDemandEnabler interface {
EnableOnDemand(ctx context.Context, terms string) (*OnDemandState, error)
}
type OnDemandState ¶
type OnDemandState struct {
Enabled bool
PaymentMethodOnFile bool
Posture string
Usage []FeatureUsage
}
type OnDemandStateGetter ¶
type OnDemandStateGetter interface {
OnDemandState(ctx context.Context) (*OnDemandState, error)
}
type PortalOpener ¶
type ProviderError ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func NewService(conn *grpc.ClientConn) *Service
func (*Service) Checkout ¶
func (s *Service) Checkout(ctx context.Context, in CheckoutInput) (*CheckoutResult, error)
func (*Service) CreateCustomer ¶
func (s *Service) CreateCustomer(ctx context.Context, in CustomerInput) (*Customer, []ProviderError, error)
func (*Service) DisableOnDemand ¶
func (s *Service) DisableOnDemand(ctx context.Context) (*OnDemandState, error)
func (*Service) EnableOnDemand ¶
func (*Service) GetCustomer ¶
func (*Service) OnDemandState ¶
func (s *Service) OnDemandState(ctx context.Context) (*OnDemandState, error)
type StatusGetter ¶
type StatusGetter interface {
Status(ctx context.Context) (*AccountStatus, error)
}
type Subscriber ¶
type Subscriber interface {
Checkout(ctx context.Context, in CheckoutInput) (*CheckoutResult, error)
}
type TrialActivator ¶
Click to show internal directories.
Click to hide internal directories.