Documentation
¶
Index ¶
- func Query(db *datastore.Datastore) datastore.Query
- type Phase
- type PhaseItem
- type Status
- type SubscriptionSchedule
- func (s *SubscriptionSchedule) Cancel() error
- func (s *SubscriptionSchedule) Complete()
- func (s *SubscriptionSchedule) Defaults()
- func (s *SubscriptionSchedule) Init(db *datastore.Datastore)
- func (s SubscriptionSchedule) Kind() string
- func (s *SubscriptionSchedule) Load(ps []datastore.Property) (err error)
- func (s *SubscriptionSchedule) Release() error
- func (s *SubscriptionSchedule) Save() (ps []datastore.Property, err error)
- func (s *SubscriptionSchedule) Start(subscriptionId string)
- func (s *SubscriptionSchedule) Validator() *val.Validator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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 SubscriptionSchedule ¶
type SubscriptionSchedule struct {
mixin.BaseModel
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"`
}
SubscriptionSchedule represents a scheduled set of subscription phases.
func New ¶
func New(db *datastore.Datastore) *SubscriptionSchedule
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) Defaults ¶
func (s *SubscriptionSchedule) Defaults()
func (*SubscriptionSchedule) Init ¶
func (s *SubscriptionSchedule) Init(db *datastore.Datastore)
func (SubscriptionSchedule) Kind ¶
func (s SubscriptionSchedule) Kind() string
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
Click to show internal directories.
Click to hide internal directories.