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

Adds PendingUpdate to Subscription #1012

Merged
merged 2 commits into from
Jan 15, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 1 addition & 0 deletions invoice.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ type InvoiceParams struct {
SubscriptionItems []*SubscriptionItemsParams `form:"subscription_items"`
SubscriptionPlan *string `form:"subscription_plan"`
SubscriptionProrate *bool `form:"subscription_prorate"`
SubscriptionProrationBehavior *string `form:"subscription_proration_behavior"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're missing a list of constants for all those values. In go, we define them even if it's just used as a parameter and we pass *string

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I couldn't remember that rule.

SubscriptionProrationDate *int64 `form:"subscription_proration_date"`
SubscriptionQuantity *int64 `form:"subscription_quantity"`
SubscriptionTrialEnd *int64 `form:"subscription_trial_end"`
Expand Down
11 changes: 11 additions & 0 deletions sub.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ type SubscriptionParams struct {
PendingInvoiceItemInterval *SubscriptionPendingInvoiceItemIntervalParams `form:"pending_invoice_item_interval"`
Plan *string `form:"plan"`
Prorate *bool `form:"prorate"`
ProrationBehavior *string `form:"proration_behavior"`
ProrationDate *int64 `form:"proration_date"`
Quantity *int64 `form:"quantity"`
TrialEnd *int64 `form:"trial_end"`
Expand Down Expand Up @@ -171,6 +172,15 @@ type SubscriptionPendingInvoiceItemInterval struct {
IntervalCount int64 `json:"interval_count"`
}

// SubscriptionPendingUpdate represents deferred changes that will be applied when latest invoice is paid.
type SubscriptionPendingUpdate struct {
BillingCycleAnchor int64 `json:"billing_cycle_anchor"`
ExpiresAt int64 `json:"expires_at"`
SubscriptionItems []*SubscriptionItem `json:"subscription_items"`
TrialEnd int64 `json:"trial_end"`
TrialFromPlan bool `json:"trial_from_plan"`
}

// SubscriptionTransferData represents the information for the transfer_data associated with a subscription.
type SubscriptionTransferData struct {
Destination *Account `json:"destination"`
Expand Down Expand Up @@ -206,6 +216,7 @@ type Subscription struct {
OnBehalfOf *Account `json:"on_behalf_of"`
PendingInvoiceItemInterval SubscriptionPendingInvoiceItemInterval `json:"pending_invoice_item_interval"`
PendingSetupIntent *SetupIntent `json:"pending_setup_intent"`
PendingUpdate *SubscriptionPendingUpdate `json:"pending_update"`
Plan *Plan `json:"plan"`
Quantity int64 `json:"quantity"`
Schedule *SubscriptionSchedule `json:"schedule"`
Expand Down
1 change: 1 addition & 0 deletions subitem.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ type SubscriptionItemParams struct {
Plan *string `form:"plan"`
Prorate *bool `form:"prorate"`
ProrationDate *int64 `form:"proration_date"`
ProrationBehavior *string `form:"proration_behavior"`
Quantity *int64 `form:"quantity"`
Subscription *string `form:"subscription"`
TaxRates []*string `form:"tax_rates"`
Expand Down