subscriptionschedule

package
v1.39.1 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Query

Types

type Phase

type Phase struct {
	PlanId            string      `json:"planId"`
	Items             []PhaseItem `json:"items,omitempty"`
	StartDate         time.Time   `json:"startDate"`
	EndDate           time.Time   `json:"endDate"`
	TrialEnd          time.Time   `json:"trialEnd,omitempty"`
	ProrationBehavior string      `json:"prorationBehavior,omitempty"` // "create_prorations" | "none"
}

Phase represents a time-bounded billing phase within the schedule.

type PhaseItem

type PhaseItem struct {
	PriceId  string `json:"priceId"`
	Quantity int64  `json:"quantity"`
}

PhaseItem represents a single item within a schedule phase.

type Status

type Status string

Status represents the schedule lifecycle state.

const (
	NotStarted Status = "not_started"
	Active     Status = "active"
	Completed  Status = "completed"
	Released   Status = "released"
	SSCanceled Status = "canceled"
)

type SubscriptionSchedule

type SubscriptionSchedule struct {
	mixin.Model[SubscriptionSchedule]

	CustomerId     string    `json:"customerId"`
	SubscriptionId string    `json:"subscriptionId,omitempty"`
	Status         Status    `json:"status"`
	StartDate      time.Time `json:"startDate"`
	EndBehavior    string    `json:"endBehavior,omitempty"` // "release" | "cancel"

	Phases  []Phase `json:"phases,omitempty" datastore:"-"`
	Phases_ string  `json:"-" datastore:",noindex"`

	Metadata  Map    `json:"metadata,omitempty" datastore:"-"`
	Metadata_ string `json:"-" datastore:",noindex"`
}

func (*SubscriptionSchedule) Cancel

func (s *SubscriptionSchedule) Cancel() error

Cancel transitions the schedule to canceled.

func (*SubscriptionSchedule) Complete

func (s *SubscriptionSchedule) Complete()

Complete transitions the schedule to completed after all phases finish.

func (*SubscriptionSchedule) Load

func (s *SubscriptionSchedule) Load(ps []datastore.Property) (err error)

func (*SubscriptionSchedule) Release

func (s *SubscriptionSchedule) Release() error

Release transitions the schedule to released, detaching from the subscription.

func (*SubscriptionSchedule) Save

func (s *SubscriptionSchedule) Save() (ps []datastore.Property, err error)

func (*SubscriptionSchedule) Start

func (s *SubscriptionSchedule) Start(subscriptionId string)

Start activates the schedule and links it to a subscription.

func (*SubscriptionSchedule) Validator

func (s *SubscriptionSchedule) Validator() *val.Validator

Jump to

Keyboard shortcuts

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