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

API Updates #1579

Merged
merged 2 commits into from
Dec 6, 2022
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
2 changes: 1 addition & 1 deletion OPENAPI_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v211
v212
96 changes: 96 additions & 0 deletions billingportal_session.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,72 @@

package stripe

// The specified type of behavior after the flow is completed.
type BillingPortalSessionFlowAfterCompletionType string

// List of values that BillingPortalSessionFlowAfterCompletionType can take
const (
BillingPortalSessionFlowAfterCompletionTypeHostedConfirmation BillingPortalSessionFlowAfterCompletionType = "hosted_confirmation"
BillingPortalSessionFlowAfterCompletionTypePortalHomepage BillingPortalSessionFlowAfterCompletionType = "portal_homepage"
BillingPortalSessionFlowAfterCompletionTypeRedirect BillingPortalSessionFlowAfterCompletionType = "redirect"
)

// Type of flow that the customer will go through.
type BillingPortalSessionFlowType string

// List of values that BillingPortalSessionFlowType can take
const (
BillingPortalSessionFlowTypePaymentMethodUpdate BillingPortalSessionFlowType = "payment_method_update"
BillingPortalSessionFlowTypeSubscriptionCancel BillingPortalSessionFlowType = "subscription_cancel"
)

// Configuration when `after_completion.type=hosted_confirmation`.
type BillingPortalSessionFlowDataAfterCompletionHostedConfirmationParams struct {
// A custom message to display to the customer after the flow is completed.
CustomMessage *string `form:"custom_message"`
}

// Configuration when `after_completion.type=redirect`.
type BillingPortalSessionFlowDataAfterCompletionRedirectParams struct {
// The URL the customer will be redirected to after the flow is completed.
ReturnURL *string `form:"return_url"`
}

// Behavior after the flow is completed.
type BillingPortalSessionFlowDataAfterCompletionParams struct {
// Configuration when `after_completion.type=hosted_confirmation`.
HostedConfirmation *BillingPortalSessionFlowDataAfterCompletionHostedConfirmationParams `form:"hosted_confirmation"`
// Configuration when `after_completion.type=redirect`.
Redirect *BillingPortalSessionFlowDataAfterCompletionRedirectParams `form:"redirect"`
// The specified behavior after the flow is completed.
Type *string `form:"type"`
}

// Configuration when `flow_data.type=subscription_cancel`.
type BillingPortalSessionFlowDataSubscriptionCancelParams struct {
// The ID of the subscription to be canceled.
Subscription *string `form:"subscription"`
}

// Information about a specific flow for the customer to go through.
type BillingPortalSessionFlowDataParams struct {
// Behavior after the flow is completed.
AfterCompletion *BillingPortalSessionFlowDataAfterCompletionParams `form:"after_completion"`
// Configuration when `flow_data.type=subscription_cancel`.
SubscriptionCancel *BillingPortalSessionFlowDataSubscriptionCancelParams `form:"subscription_cancel"`
// Type of flow that the customer will go through.
Type *string `form:"type"`
}

// Creates a session of the customer portal.
type BillingPortalSessionParams struct {
Params `form:"*"`
// The ID of an existing [configuration](https://stripe.com/docs/api/customer_portal/configuration) to use for this session, describing its functionality and features. If not specified, the session uses the default configuration.
Configuration *string `form:"configuration"`
// The ID of an existing customer.
Customer *string `form:"customer"`
// Information about a specific flow for the customer to go through.
FlowData *BillingPortalSessionFlowDataParams `form:"flow_data"`
// The IETF language tag of the locale Customer Portal is displayed in. If blank or auto, the customer's `preferred_locales` or browser's locale is used.
Locale *string `form:"locale"`
// The `on_behalf_of` account to use for this session. When specified, only subscriptions and invoices with this `on_behalf_of` account appear in the portal. For more information, see the [docs](https://stripe.com/docs/connect/charges-transfers#on-behalf-of). Use the [Accounts API](https://stripe.com/docs/api/accounts/object#account_object-settings-branding) to modify the `on_behalf_of` account's branding settings, which the portal displays.
Expand All @@ -21,6 +80,41 @@ type BillingPortalSessionParams struct {
ReturnURL *string `form:"return_url"`
}

// Configuration when `after_completion.type=hosted_confirmation`.
type BillingPortalSessionFlowAfterCompletionHostedConfirmation struct {
// A custom message to display to the customer after the flow is completed.
CustomMessage string `json:"custom_message"`
}

// Configuration when `after_completion.type=redirect`.
type BillingPortalSessionFlowAfterCompletionRedirect struct {
// The URL the customer will be redirected to after the flow is completed.
ReturnURL string `json:"return_url"`
}
type BillingPortalSessionFlowAfterCompletion struct {
// Configuration when `after_completion.type=hosted_confirmation`.
HostedConfirmation *BillingPortalSessionFlowAfterCompletionHostedConfirmation `json:"hosted_confirmation"`
// Configuration when `after_completion.type=redirect`.
Redirect *BillingPortalSessionFlowAfterCompletionRedirect `json:"redirect"`
// The specified type of behavior after the flow is completed.
Type BillingPortalSessionFlowAfterCompletionType `json:"type"`
}

// Configuration when `flow.type=subscription_cancel`.
type BillingPortalSessionFlowSubscriptionCancel struct {
// The ID of the subscription to be canceled.
Subscription string `json:"subscription"`
}

// Information about a specific flow for the customer to go through.
type BillingPortalSessionFlow struct {
AfterCompletion *BillingPortalSessionFlowAfterCompletion `json:"after_completion"`
// Configuration when `flow.type=subscription_cancel`.
SubscriptionCancel *BillingPortalSessionFlowSubscriptionCancel `json:"subscription_cancel"`
// Type of flow that the customer will go through.
Type BillingPortalSessionFlowType `json:"type"`
}

// The Billing customer portal is a Stripe-hosted UI for subscription and
// billing management.
//
Expand All @@ -43,6 +137,8 @@ type BillingPortalSession struct {
Created int64 `json:"created"`
// The ID of the customer for this session.
Customer string `json:"customer"`
// Information about a specific flow for the customer to go through.
Flow *BillingPortalSessionFlow `json:"flow"`
// Unique identifier for the object.
ID string `json:"id"`
// Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
Expand Down
2 changes: 1 addition & 1 deletion example/generated_examples_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2306,7 +2306,7 @@ func TestTransferReversalCreate(t *testing.T) {

func TestTransferReversalUpdate(t *testing.T) {
params := &stripe.TransferReversalParams{
ID: stripe.String("tr_xxxxxxxxxxxxx"),
Transfer: stripe.String("tr_xxxxxxxxxxxxx"),
}
params.AddMetadata("order_id", "6735")
result, _ := transferreversal.Update("trr_xxxxxxxxxxxxx", params)
Expand Down