Skip to content

Commit

Permalink
Merge pull request #987 from stripe/cjavilla/add-sub-schedule-default…
Browse files Browse the repository at this point in the history
…-settings

Add DefaultSettings to Subscription Schedules
  • Loading branch information
remi-stripe authored Nov 6, 2019
2 parents a41a5db + 729cf6e commit 7a47683
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ cache:
env:
global:
# If changing this number, please also change it in `testing/testing.go`.
- STRIPE_MOCK_VERSION=0.69.0
- STRIPE_MOCK_VERSION=0.71.0

go:
- "1.9.x"
Expand Down
2 changes: 1 addition & 1 deletion stripe.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (

const (
// APIVersion is the currently supported API version
APIVersion string = "2019-10-17"
APIVersion string = "2019-11-05"

// APIBackend is a constant representing the API service backend.
APIBackend SupportedBackend = "api"
Expand Down
45 changes: 28 additions & 17 deletions subschedule.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,16 @@ type SubscriptionScheduleInvoiceSettingsParams struct {
DaysUntilDue *int64 `form:"days_until_due"`
}

// SubscriptionScheduleDefaultSettingsParams is the set of parameters
// representing the subscription schedule’s default settings.
type SubscriptionScheduleDefaultSettingsParams struct {
Params `form:"*"`
BillingThresholds *SubscriptionBillingThresholdsParams `form:"billing_thresholds"`
CollectionMethod *string `form:"collection_method"`
DefaultPaymentMethod *string `form:"default_payment_method"`
InvoiceSettings *SubscriptionScheduleInvoiceSettingsParams `form:"invoice_settings"`
}

// SubscriptionSchedulePhaseItemParams is a structure representing the parameters allowed to control
// a specic plan on a phase on a subscription schedule.
type SubscriptionSchedulePhaseItemParams struct {
Expand Down Expand Up @@ -64,18 +74,14 @@ type SubscriptionSchedulePhaseParams struct {
// SubscriptionScheduleParams is the set of parameters that can be used when creating or updating a
// subscription schedule.
type SubscriptionScheduleParams struct {
Params `form:"*"`
BillingThresholds *SubscriptionBillingThresholdsParams `form:"billing_thresholds"`
CollectionMethod *string `form:"collection_method"`
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"`
Prorate *bool `form:"prorate"`
StartDate *int64 `form:"start_date"`
Params `form:"*"`
Customer *string `form:"customer"`
DefaultSettings *SubscriptionScheduleDefaultSettingsParams `form:"default_settings"`
EndBehavior *string `form:"end_behavior"`
FromSubscription *string `form:"from_subscription"`
Phases []*SubscriptionSchedulePhaseParams `form:"phases"`
Prorate *bool `form:"prorate"`
StartDate *int64 `form:"start_date"`
}

// SubscriptionScheduleCancelParams is the set of parameters that can be used when canceling a
Expand Down Expand Up @@ -121,6 +127,15 @@ type SubscriptionScheduleInvoiceSettings struct {
DaysUntilDue int64 `json:"days_until_due"`
}

// SubscriptionScheduleDefaultSettings is a structure representing the
// subscription schedule’s default settings.
type SubscriptionScheduleDefaultSettings struct {
BillingThresholds *SubscriptionBillingThresholds `json:"billing_thresholds"`
CollectionMethod SubscriptionCollectionMethod `json:"collection_method"`
DefaultPaymentMethod *PaymentMethod `json:"default_payment_method"`
InvoiceSettings *SubscriptionScheduleInvoiceSettings `json:"invoice_settings"`
}

// SubscriptionSchedulePhaseItem represents plan details for a given phase
type SubscriptionSchedulePhaseItem struct {
BillingThresholds *SubscriptionItemBillingThresholds `json:"billing_thresholds"`
Expand Down Expand Up @@ -155,18 +170,14 @@ type SubscriptionScheduleRenewalInterval struct {

// SubscriptionSchedule is the resource representing a Stripe subscription schedule.
type SubscriptionSchedule struct {
BillingThresholds *SubscriptionBillingThresholds `json:"billing_thresholds"`
CanceledAt int64 `json:"canceled_at"`
CollectionMethod SubscriptionCollectionMethod `json:"collection_method"`
CompletedAt int64 `json:"completed_at"`
Created int64 `json:"created"`
CurrentPhase *SubscriptionScheduleCurrentPhase `json:"current_phase"`
Customer *Customer `json:"customer"`
DefaultPaymentMethod *PaymentMethod `json:"default_payment_method"`
DefaultSource *PaymentSource `json:"default_source"`
DefaultSettings *SubscriptionScheduleDefaultSettings `json:"default_settings"`
EndBehavior SubscriptionScheduleEndBehavior `json:"end_behavior"`
ID string `json:"id"`
InvoiceSettings *SubscriptionScheduleInvoiceSettings `json:"invoice_settings"`
Livemode bool `json:"livemode"`
Metadata map[string]string `json:"metadata"`
Object string `json:"object"`
Expand Down
2 changes: 1 addition & 1 deletion testing/testing.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const (
// added in a more recent version of stripe-mock, we can show people a
// better error message instead of the test suite crashing with a bunch of
// confusing 404 errors or the like.
MockMinimumVersion = "0.69.0"
MockMinimumVersion = "0.71.0"

// TestMerchantID is a token that can be used to represent a merchant ID in
// simple tests.
Expand Down

0 comments on commit 7a47683

Please sign in to comment.