subscriptionschedule

package
v1.44.0 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2026 License: MIT Imports: 8 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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