Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for EndBehavior on SubscriptionSchedule #937

Merged
merged 1 commit into from
Aug 29, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions subschedule.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@ import (
"encoding/json"
)

// SubscriptionScheduleEndBehavior describe what happens to a schedule when it ends.
type SubscriptionScheduleEndBehavior string

// List of values that SubscriptionScheduleEndBehavior can take.
const (
SubscriptionScheduleEndBehaviorCancel SubscriptionScheduleEndBehavior = "cancel"
SubscriptionScheduleEndBehaviorNone SubscriptionScheduleEndBehavior = "none"
SubscriptionScheduleEndBehaviorRenew SubscriptionScheduleEndBehavior = "release"
SubscriptionScheduleEndBehaviorRelease SubscriptionScheduleEndBehavior = "renew"
)

// SubscriptionScheduleStatus is the list of allowed values for the schedule's status.
type SubscriptionScheduleStatus string

Expand All @@ -21,6 +32,7 @@ type SubscriptionScheduleRenewalBehavior string

// List of values that SubscriptionScheduleRenewalBehavior can take.
const (
SubscriptionScheduleRenewalBehaviorCancel SubscriptionScheduleRenewalBehavior = "cancel"
SubscriptionScheduleRenewalBehaviorNone SubscriptionScheduleRenewalBehavior = "none"
SubscriptionScheduleRenewalBehaviorRenew SubscriptionScheduleRenewalBehavior = "release"
SubscriptionScheduleRenewalBehaviorRelease SubscriptionScheduleRenewalBehavior = "renew"
Expand Down Expand Up @@ -78,6 +90,7 @@ type SubscriptionScheduleParams struct {
Customer *string `form:"customer"`
DefaultPaymentMethod *string `form:"default_payment_method"`
DefaultSource *string `form:"default_source"`
EndBehavior *string `form:"end_behavior"`
FromSubscription *string `form:"from_subscription"`
InvoiceSettings *SubscriptionScheduleInvoiceSettingsParams `form:"invoice_settings"`
Phases []*SubscriptionSchedulePhaseParams `form:"phases"`
Expand Down Expand Up @@ -176,6 +189,7 @@ type SubscriptionSchedule struct {
Customer *Customer `json:"customer"`
DefaultPaymentMethod *PaymentMethod `json:"default_payment_method"`
DefaultSource *PaymentSource `json:"default_source"`
EndBehavior SubscriptionScheduleEndBehavior `json:"end_behavior"`
ID string `json:"id"`
InvoiceSettings *SubscriptionScheduleInvoiceSettings `json:"invoice_settings"`
Livemode bool `json:"livemode"`
Expand Down