subscriptions

package
v1.0.0-beta.233 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2026 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromAPIBillingSubscriptionCreate

func FromAPIBillingSubscriptionCreate(
	namespace string,
	customerID customer.CustomerID,
	subscriptionName string,
	createSubscriptionRequest api.BillingSubscriptionCreate,
) (subscriptionworkflow.CreateSubscriptionWorkflowInput, error)

FromAPIBillingSubscriptionCreate converts a create subscription request to a create subscription workflow input.

func FromAPIBillingSubscriptionCreateTiming

func FromAPIBillingSubscriptionCreateTiming(t api.BillingSubscriptionCreateTiming) (subscription.Timing, error)

FromAPIBillingSubscriptionCreateTiming maps the create-body timing to the domain timing. Create timing is deliberately narrower than edit timing: only immediate or a custom timestamp — next_billing_cycle is not a create value (a new subscription has no current billing cycle), so it is not part of the type.

func FromAPIBillingSubscriptionCustomPlan

func FromAPIBillingSubscriptionCustomPlan(namespace string, body api.BillingSubscriptionCustomPlan) (plan.CreatePlanInput, error)

FromAPIBillingSubscriptionCustomPlan maps an inline (custom) plan definition from a create or change request into the domain plan create input. It performs pure mapping only: plan validity, currency resolution, and the fiat/custom-currency rules are enforced downstream by the subscription service and spec validation.

func FromAPIBillingSubscriptionEditOperation

func FromAPIBillingSubscriptionEditOperation(op api.BillingSubscriptionEditOperation) (subscription.Patch, error)

FromAPIBillingSubscriptionEditOperation maps a single API edit operation to the domain subscription patch that applies it to the target spec. The mapping mirrors the v1 editSubscription handler; rate cards are converted via the shared plans converter so add-item stays consistent with plan/subscription creation.

func FromAPISubscriptionSortField

func FromAPISubscriptionSortField(ctx context.Context, field string) (subscription.OrderBy, error)

func ToAPIBillingSubscriptionBase

func ToAPIBillingSubscriptionBase(sub subscription.Subscription) api.BillingSubscriptionBase

ToAPIBillingSubscriptionBase maps the subscription's own fields without view data.

func ToAPIBillingSubscriptionWithoutView

func ToAPIBillingSubscriptionWithoutView(sub subscription.Subscription) api.BillingSubscription

ToAPIBillingSubscriptionWithoutView maps a bare subscription — no view — to the API model: base fields only, an empty phase list, and no current period. It serves callers that side-load subscriptions without their specs (e.g. the customer charges subscription expand); the view-derived fields need ToAPIBillingSubscription.

Types

type CancelSubscriptionParams

type CancelSubscriptionParams = string

type CancelSubscriptionRequest

type CancelSubscriptionRequest struct {
	ID     models.NamespacedID
	Timing subscription.Timing
}

type CancelSubscriptionResponse

type CancelSubscriptionResponse = api.BillingSubscription

type ChangeSubscriptionParams

type ChangeSubscriptionParams = string

type ChangeSubscriptionRequest

type ChangeSubscriptionRequest struct {
	ID             models.NamespacedID
	PlanInput      plansubscription.PlanInput
	WorkflowInput  subscriptionworkflow.ChangeSubscriptionWorkflowInput
	StartingPhase  *string
	SettlementMode *productcatalog.SettlementMode
}

type ChangeSubscriptionResponse

type ChangeSubscriptionResponse = api.BillingSubscriptionChangeResponse

type CreateSubscriptionResponse

type CreateSubscriptionResponse = api.BillingSubscription

type EditSubscriptionParams

type EditSubscriptionParams = string

type EditSubscriptionRequest

type EditSubscriptionRequest struct {
	ID             models.NamespacedID
	Customizations []subscription.Patch
	Timing         subscription.Timing
}

type EditSubscriptionResponse

type EditSubscriptionResponse = api.BillingSubscription

type GetSubscriptionParams

type GetSubscriptionParams = string

type GetSubscriptionRequest

type GetSubscriptionRequest = models.NamespacedID

type GetSubscriptionResponse

type GetSubscriptionResponse = api.BillingSubscription

type Handler

type Handler interface {
	ListSubscriptions() ListSubscriptionsHandler
	GetSubscription() GetSubscriptionHandler
	CreateSubscription() CreateSubscriptionHandler
	CancelSubscription() CancelSubscriptionHandler
	UnscheduleCancelation() UnscheduleCancelationHandler
	UnscheduleSubscription() UnscheduleSubscriptionHandler
	RestoreSubscription() RestoreSubscriptionHandler
	ChangeSubscription() ChangeSubscriptionHandler
	MigrateSubscription() MigrateSubscriptionHandler
	EditSubscription() EditSubscriptionHandler
}

func New

func New(
	resolveNamespace func(ctx context.Context) (string, error),
	customerService customer.Service,
	planService plan.Service,
	planSubscriptionService plansubscription.PlanSubscriptionService,
	subscriptionService subscription.Service,
	subscriptionWorkflowService subscriptionworkflow.Service,
	options ...httptransport.HandlerOption,
) Handler

type ListSubscriptionsParams

type ListSubscriptionsParams = api.ListSubscriptionsParams

type ListSubscriptionsRequest

type ListSubscriptionsRequest = subscription.ListSubscriptionsInput

type MigrateSubscriptionParams

type MigrateSubscriptionParams = string

type MigrateSubscriptionResponse

type MigrateSubscriptionResponse = api.BillingSubscriptionMigrateResponse

type RestoreSubscriptionParams

type RestoreSubscriptionParams = string

type RestoreSubscriptionRequest

type RestoreSubscriptionRequest = models.NamespacedID

type RestoreSubscriptionResponse

type RestoreSubscriptionResponse = api.BillingSubscription

type UnscheduleCancelationParams

type UnscheduleCancelationParams = string

type UnscheduleCancelationRequest

type UnscheduleCancelationRequest = models.NamespacedID

type UnscheduleCancelationResponse

type UnscheduleCancelationResponse = api.BillingSubscription

type UnscheduleSubscriptionParams

type UnscheduleSubscriptionParams = string

type UnscheduleSubscriptionRequest

type UnscheduleSubscriptionRequest = models.NamespacedID

type UnscheduleSubscriptionResponse

type UnscheduleSubscriptionResponse = any

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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