Skip to content

Commit

Permalink
Codegen for openapi v152 (#1472)
Browse files Browse the repository at this point in the history
  • Loading branch information
pakrym-stripe authored Jun 8, 2022
1 parent d65aab1 commit ffcbbc3
Show file tree
Hide file tree
Showing 10 changed files with 737 additions and 39 deletions.
2 changes: 1 addition & 1 deletion OPENAPI_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v150
v152
704 changes: 691 additions & 13 deletions checkout_session.go

Large diffs are not rendered by default.

10 changes: 3 additions & 7 deletions invoice.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ type InvoicePaymentSettingsPaymentMethodOptionsKonbiniParams struct{}

// Additional fields for Financial Connections Session creation
type InvoicePaymentSettingsPaymentMethodOptionsUSBankAccountFinancialConnectionsParams struct {
// The list of permissions to request. If this parameter is passed, the `payment_method` permission must be included. Valid permissions include: `balances`, `payment_method`, and `transactions`.
// The list of permissions to request. If this parameter is passed, the `payment_method` permission must be included. Valid permissions include: `balances`, `ownership`, `payment_method`, and `transactions`.
Permissions []*string `form:"permissions"`
}

Expand Down Expand Up @@ -351,11 +351,7 @@ type InvoiceParams struct {
// A list of up to 20 subscription items, each with an attached price.
SubscriptionItems []*SubscriptionItemsParams `form:"subscription_items"`
SubscriptionPlan *string `form:"subscription_plan"`
// Determines how to handle [prorations](https://stripe.com/docs/subscriptions/billing-cycle#prorations) when the billing cycle changes (e.g., when switching plans, resetting `billing_cycle_anchor=now`, or starting a trial), or if an item's `quantity` changes. Valid values are `create_prorations`, `none`, or `always_invoice`.
//
// Passing `create_prorations` will cause proration invoice items to be created when applicable. These proration items will only be invoiced immediately under [certain conditions](https://stripe.com/docs/subscriptions/upgrading-downgrading#immediate-payment). In order to always invoice immediately for prorations, pass `always_invoice`.
//
// Prorations can be disabled by passing `none`.
// Determines how to handle [prorations](https://stripe.com/docs/subscriptions/billing-cycle#prorations) when the billing cycle changes (e.g., when switching plans, resetting `billing_cycle_anchor=now`, or starting a trial), or if an item's `quantity` changes.
SubscriptionProrationBehavior *string `form:"subscription_proration_behavior"`
// If previewing an update to a subscription, and doing proration, `subscription_proration_date` forces the proration to be calculated as though the update was done at the specified time. The time given must be within the current subscription period, and cannot be before the subscription was on its current plan. If set, `subscription`, and one of `subscription_items`, or `subscription_trial_end` are required. Also, `subscription_proration_behavior` cannot be set to 'none'.
SubscriptionProrationDate *int64 `form:"subscription_proration_date"`
Expand Down Expand Up @@ -701,7 +697,7 @@ type Invoice struct {
AmountDue int64 `json:"amount_due"`
// The amount, in %s, that was paid.
AmountPaid int64 `json:"amount_paid"`
// The amount remaining, in %s, that is due.
// The difference between amount_due and amount_paid, in %s.
AmountRemaining int64 `json:"amount_remaining"`
// ID of the Connect Application that created the invoice.
Application *Application `json:"application"`
Expand Down
2 changes: 1 addition & 1 deletion paymentintent.go
Original file line number Diff line number Diff line change
Expand Up @@ -1216,7 +1216,7 @@ type PaymentIntentPaymentMethodOptionsSofortParams struct {

// Additional fields for Financial Connections Session creation
type PaymentIntentPaymentMethodOptionsUSBankAccountFinancialConnectionsParams struct {
// The list of permissions to request. If this parameter is passed, the `payment_method` permission must be included. Valid permissions include: `balances`, `payment_method`, and `transactions`.
// The list of permissions to request. If this parameter is passed, the `payment_method` permission must be included. Valid permissions include: `balances`, `ownership`, `payment_method`, and `transactions`.
Permissions []*string `form:"permissions"`
// For webview integrations only. Upon completing OAuth login in the native browser, the user will be redirected to this URL to return to your app.
ReturnURL *string `form:"return_url"`
Expand Down
19 changes: 19 additions & 0 deletions setupattempt.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,17 @@ package stripe

import "encoding/json"

// Indicates the directions of money movement for which this payment method is intended to be used.
//
// Include `inbound` if you intend to use the payment method as the origin to pull funds from. Include `outbound` if you intend to use the payment method as the destination to send funds to. You can include both if you intend to use the payment method for both purposes.
type SetupAttemptFlowDirection string

// List of values that SetupAttemptFlowDirection can take
const (
SetupAttemptFlowDirectionInbound SetupAttemptFlowDirection = "inbound"
SetupAttemptFlowDirectionOutbound SetupAttemptFlowDirection = "outbound"
)

// For authenticated transactions: how the customer was authenticated by
// the issuing bank.
type SetupAttemptPaymentMethodDetailsCardThreeDSecureAuthenticationFlow string
Expand Down Expand Up @@ -199,10 +210,18 @@ type SetupAttempt struct {
APIResource
// The value of [application](https://stripe.com/docs/api/setup_intents/object#setup_intent_object-application) on the SetupIntent at the time of this confirmation.
Application *Application `json:"application"`
// If present, the SetupIntent's payment method will be attached to the in-context Stripe Account.
//
// It can only be used for this Stripe Account's own money movement flows like InboundTransfer and OutboundTransfers. It cannot be set to true when setting up a PaymentMethod for a Customer, and defaults to false when attaching a PaymentMethod to a Customer.
AttachToSelf bool `json:"attach_to_self"`
// Time at which the object was created. Measured in seconds since the Unix epoch.
Created int64 `json:"created"`
// The value of [customer](https://stripe.com/docs/api/setup_intents/object#setup_intent_object-customer) on the SetupIntent at the time of this confirmation.
Customer *Customer `json:"customer"`
// Indicates the directions of money movement for which this payment method is intended to be used.
//
// Include `inbound` if you intend to use the payment method as the origin to pull funds from. Include `outbound` if you intend to use the payment method as the destination to send funds to. You can include both if you intend to use the payment method for both purposes.
FlowDirections []SetupAttemptFlowDirection `json:"flow_directions"`
// 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
14 changes: 13 additions & 1 deletion setupintent.go
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ type SetupIntentPaymentMethodOptionsSepaDebitParams struct {

// Additional fields for Financial Connections Session creation
type SetupIntentPaymentMethodOptionsUSBankAccountFinancialConnectionsParams struct {
// The list of permissions to request. If this parameter is passed, the `payment_method` permission must be included. Valid permissions include: `balances`, `payment_method`, and `transactions`.
// The list of permissions to request. If this parameter is passed, the `payment_method` permission must be included. Valid permissions include: `balances`, `ownership`, `payment_method`, and `transactions`.
Permissions []*string `form:"permissions"`
// For webview integrations only. Upon completing OAuth login in the native browser, the user will be redirected to this URL to return to your app.
ReturnURL *string `form:"return_url"`
Expand Down Expand Up @@ -574,6 +574,10 @@ type SetupIntentSingleUseParams struct {
// to collect any required permissions to charge the payment method later.
type SetupIntentParams struct {
Params `form:"*"`
// If present, the SetupIntent's payment method will be attached to the in-context Stripe Account.
//
// It can only be used for this Stripe Account's own money movement flows like InboundTransfer and OutboundTransfers. It cannot be set to true when setting up a PaymentMethod for a Customer, and defaults to false when attaching a PaymentMethod to a Customer.
AttachToSelf *bool `form:"attach_to_self"`
// The client secret of the SetupIntent. Required if a publishable key is used to retrieve the SetupIntent.
ClientSecret *string `form:"client_secret"`
// Set to `true` to attempt to confirm this SetupIntent immediately. This parameter defaults to `false`. If the payment method attached is a card, a return_url may be provided in case additional authentication is required.
Expand All @@ -584,6 +588,10 @@ type SetupIntentParams struct {
Customer *string `form:"customer"`
// An arbitrary string attached to the object. Often useful for displaying to users.
Description *string `form:"description"`
// Indicates the directions of money movement for which this payment method is intended to be used.
//
// Include `inbound` if you intend to use the payment method as the origin to pull funds from. Include `outbound` if you intend to use the payment method as the destination to send funds to. You can include both if you intend to use the payment method for both purposes.
FlowDirections []*string `form:"flow_directions"`
// This hash contains details about the Mandate to create. This parameter can only be used with [`confirm=true`](https://stripe.com/docs/api/setup_intents/create#create_setup_intent-confirm).
MandateData *SetupIntentMandateDataParams `form:"mandate_data"`
// The Stripe account ID for which this SetupIntent is created.
Expand All @@ -608,6 +616,10 @@ type SetupIntentParams struct {
// Returns a list of SetupIntents.
type SetupIntentListParams struct {
ListParams `form:"*"`
// If present, the SetupIntent's payment method will be attached to the in-context Stripe Account.
//
// It can only be used for this Stripe Account's own money movement flows like InboundTransfer and OutboundTransfers. It cannot be set to true when setting up a PaymentMethod for a Customer, and defaults to false when attaching a PaymentMethod to a Customer.
AttachToSelf *bool `form:"attach_to_self"`
// A filter on the list, based on the object `created` field. The value can be a string with an integer Unix timestamp, or it can be a dictionary with a number of different query options.
Created *int64 `form:"created"`
// A filter on the list, based on the object `created` field. The value can be a string with an integer Unix timestamp, or it can be a dictionary with a number of different query options.
Expand Down
3 changes: 2 additions & 1 deletion shippingrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@ type ShippingRateFixedAmount struct {
}

// Shipping rates describe the price of shipping presented to your customers and can be
// applied to [Checkout Sessions](https://stripe.com/docs/payments/checkout/shipping) to collect shipping costs.
// applied to [Checkout Sessions](https://stripe.com/docs/payments/checkout/shipping)
// and [Orders](https://stripe.com/docs/orders/shipping) to collect shipping costs.
type ShippingRate struct {
APIResource
// Whether the shipping rate can be used for new purchases. Defaults to `true`.
Expand Down
14 changes: 5 additions & 9 deletions sub.go
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ type SubscriptionPaymentSettingsPaymentMethodOptionsKonbiniParams struct{}

// Additional fields for Financial Connections Session creation
type SubscriptionPaymentSettingsPaymentMethodOptionsUSBankAccountFinancialConnectionsParams struct {
// The list of permissions to request. If this parameter is passed, the `payment_method` permission must be included. Valid permissions include: `balances`, `payment_method`, and `transactions`.
// The list of permissions to request. If this parameter is passed, the `payment_method` permission must be included. Valid permissions include: `balances`, `ownership`, `payment_method`, and `transactions`.
Permissions []*string `form:"permissions"`
}

Expand Down Expand Up @@ -399,7 +399,7 @@ type SubscriptionParams struct {
AutomaticTax *SubscriptionAutomaticTaxParams `form:"automatic_tax"`
// For new subscriptions, a past timestamp to backdate the subscription's start date to. If set, the first invoice will contain a proration for the timespan between the start date and the current time. Can be combined with trials and the billing cycle anchor.
BackdateStartDate *int64 `form:"backdate_start_date"`
// Either `now` or `unchanged`. Setting the value to `now` resets the subscription's billing cycle anchor to the current time. For more information, see the billing cycle [documentation](https://stripe.com/docs/billing/subscriptions/billing-cycle).
// Either `now` or `unchanged`. Setting the value to `now` resets the subscription's billing cycle anchor to the current time (in UTC). For more information, see the billing cycle [documentation](https://stripe.com/docs/billing/subscriptions/billing-cycle).
BillingCycleAnchor *int64 `form:"billing_cycle_anchor"`
BillingCycleAnchorNow *bool `form:"-"` // See custom AppendTo
BillingCycleAnchorUnchanged *bool `form:"-"` // See custom AppendTo
Expand Down Expand Up @@ -448,11 +448,7 @@ type SubscriptionParams struct {
Plan *string `form:"plan"`
// The promotion code to apply to this subscription. A promotion code applied to a subscription will only affect invoices created for that particular subscription.
PromotionCode *string `form:"promotion_code"`
// Determines how to handle [prorations](https://stripe.com/docs/subscriptions/billing-cycle#prorations) when the billing cycle changes (e.g., when switching plans, resetting `billing_cycle_anchor=now`, or starting a trial), or if an item's `quantity` changes. Valid values are `create_prorations`, `none`, or `always_invoice`.
//
// Passing `create_prorations` will cause proration invoice items to be created when applicable. These proration items will only be invoiced immediately under [certain conditions](https://stripe.com/docs/subscriptions/upgrading-downgrading#immediate-payment). In order to always invoice immediately for prorations, pass `always_invoice`.
//
// Prorations can be disabled by passing `none`.
// Determines how to handle [prorations](https://stripe.com/docs/subscriptions/billing-cycle#prorations) when the billing cycle changes (e.g., when switching plans, resetting `billing_cycle_anchor=now`, or starting a trial), or if an item's `quantity` changes.
ProrationBehavior *string `form:"proration_behavior"`
// If set, the proration will be calculated as though the subscription was updated at the given time. This can be used to apply exactly the same proration that was previewed with [upcoming invoice](https://stripe.com/docs/api#retrieve_customer_invoice) endpoint. It can also be used to implement custom proration logic, such as prorating by day instead of by second, by providing the time that you wish to use for proration calculations.
ProrationDate *int64 `form:"proration_date"`
Expand Down Expand Up @@ -615,7 +611,7 @@ type SubscriptionPendingInvoiceItemInterval struct {

// If specified, [pending updates](https://stripe.com/docs/billing/subscriptions/pending-updates) that will be applied to the subscription once the `latest_invoice` has been paid.
type SubscriptionPendingUpdate struct {
// If the update is applied, determines the date of the first full invoice, and, for plans with `month` or `year` intervals, the day of the month for subsequent invoices.
// If the update is applied, determines the date of the first full invoice, and, for plans with `month` or `year` intervals, the day of the month for subsequent invoices. The timestamp is in UTC format.
BillingCycleAnchor int64 `json:"billing_cycle_anchor"`
// The point after which the changes reflected by this update will be discarded and no longer applied.
ExpiresAt int64 `json:"expires_at"`
Expand Down Expand Up @@ -645,7 +641,7 @@ type Subscription struct {
// A non-negative decimal between 0 and 100, with at most two decimal places. This represents the percentage of the subscription invoice subtotal that will be transferred to the application owner's Stripe account.
ApplicationFeePercent float64 `json:"application_fee_percent"`
AutomaticTax *SubscriptionAutomaticTax `json:"automatic_tax"`
// Determines the date of the first full invoice, and, for plans with `month` or `year` intervals, the day of the month for subsequent invoices.
// Determines the date of the first full invoice, and, for plans with `month` or `year` intervals, the day of the month for subsequent invoices. The timestamp is in UTC format.
BillingCycleAnchor int64 `json:"billing_cycle_anchor"`
// Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period
BillingThresholds *SubscriptionBillingThresholds `json:"billing_thresholds"`
Expand Down
6 changes: 1 addition & 5 deletions subitem.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,7 @@ type SubscriptionItemParams struct {
Price *string `form:"price"`
// Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline.
PriceData *SubscriptionItemPriceDataParams `form:"price_data"`
// Determines how to handle [prorations](https://stripe.com/docs/subscriptions/billing-cycle#prorations) when the billing cycle changes (e.g., when switching plans, resetting `billing_cycle_anchor=now`, or starting a trial), or if an item's `quantity` changes. Valid values are `create_prorations`, `none`, or `always_invoice`.
//
// Passing `create_prorations` will cause proration invoice items to be created when applicable. These proration items will only be invoiced immediately under [certain conditions](https://stripe.com/docs/subscriptions/upgrading-downgrading#immediate-payment). In order to always invoice immediately for prorations, pass `always_invoice`.
//
// Prorations can be disabled by passing `none`.
// Determines how to handle [prorations](https://stripe.com/docs/subscriptions/billing-cycle#prorations) when the billing cycle changes (e.g., when switching plans, resetting `billing_cycle_anchor=now`, or starting a trial), or if an item's `quantity` changes.
ProrationBehavior *string `form:"proration_behavior"`
// If set, the proration will be calculated as though the subscription was updated at the given time. This can be used to apply the same proration that was previewed with the [upcoming invoice](https://stripe.com/docs/api#retrieve_customer_invoice) endpoint.
ProrationDate *int64 `form:"proration_date"`
Expand Down
2 changes: 1 addition & 1 deletion treasury_receiveddebit.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ type TreasuryReceivedDebitInitiatingPaymentMethodDetails struct {
type TreasuryReceivedDebitLinkedFlows struct {
// Set if the ReceivedDebit is associated with an InboundTransfer's return of funds.
InboundTransfer string `json:"inbound_transfer"`
// Set if the ReceivedCredit was created due to an [Issuing Authorization](https://stripe.com/docs/api#issuing_authorizations) object.
// Set if the ReceivedDebit was created due to an [Issuing Authorization](https://stripe.com/docs/api#issuing_authorizations) object.
IssuingAuthorization string `json:"issuing_authorization"`
// Set if the ReceivedDebit is also viewable as an [Issuing Dispute](https://stripe.com/docs/api#issuing_disputes) object.
IssuingTransaction string `json:"issuing_transaction"`
Expand Down

0 comments on commit ffcbbc3

Please sign in to comment.