Skip to content

Commit

Permalink
Codegen for openapi v157 (#1477)
Browse files Browse the repository at this point in the history
  • Loading branch information
kamil-stripe authored Jun 17, 2022
1 parent 1b75612 commit 72586c5
Show file tree
Hide file tree
Showing 18 changed files with 130 additions and 13 deletions.
2 changes: 1 addition & 1 deletion OPENAPI_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v154
v157
12 changes: 12 additions & 0 deletions account.go
Original file line number Diff line number Diff line change
Expand Up @@ -749,6 +749,10 @@ type AccountSettingsCardPaymentsParams struct {
DeclineOn *AccountDeclineSettingsParams `form:"decline_on"`
// The default text that appears on credit card statements when a charge is made. This field prefixes any dynamic `statement_descriptor` specified on the charge. `statement_descriptor_prefix` is useful for maximizing descriptor space for the dynamic portion.
StatementDescriptorPrefix *string `form:"statement_descriptor_prefix"`
// The Kana variation of the default text that appears on credit card statements when a charge is made (Japan only). This field prefixes any dynamic `statement_descriptor_suffix_kana` specified on the charge. `statement_descriptor_prefix_kana` is useful for maximizing descriptor space for the dynamic portion.
StatementDescriptorPrefixKana *string `form:"statement_descriptor_prefix_kana"`
// The Kanji variation of the default text that appears on credit card statements when a charge is made (Japan only). This field prefixes any dynamic `statement_descriptor_suffix_kanji` specified on the charge. `statement_descriptor_prefix_kanji` is useful for maximizing descriptor space for the dynamic portion.
StatementDescriptorPrefixKanji *string `form:"statement_descriptor_prefix_kanji"`
}

// AccountSettingsDashboardParams represent allowed parameters to configure settings for the
Expand Down Expand Up @@ -1150,6 +1154,10 @@ type AccountSettingsCardPayments struct {
DeclineOn *AccountDeclineOn `json:"decline_on"`
// The default text that appears on credit card statements when a charge is made. This field prefixes any dynamic `statement_descriptor` specified on the charge. `statement_descriptor_prefix` is useful for maximizing descriptor space for the dynamic portion.
StatementDescriptorPrefix string `json:"statement_descriptor_prefix"`
// The Kana variation of the default text that appears on credit card statements when a charge is made (Japan only). This field prefixes any dynamic `statement_descriptor_suffix_kana` specified on the charge. `statement_descriptor_prefix_kana` is useful for maximizing descriptor space for the dynamic portion.
StatementDescriptorPrefixKana string `json:"statement_descriptor_prefix_kana"`
// The Kanji variation of the default text that appears on credit card statements when a charge is made (Japan only). This field prefixes any dynamic `statement_descriptor_suffix_kanji` specified on the charge. `statement_descriptor_prefix_kanji` is useful for maximizing descriptor space for the dynamic portion.
StatementDescriptorPrefixKanji string `json:"statement_descriptor_prefix_kanji"`
}
type AccountSettingsDashboard struct {
// The display name for this account. This is used on the Stripe Dashboard to differentiate between accounts.
Expand All @@ -1164,6 +1172,10 @@ type AccountSettingsPayments struct {
StatementDescriptorKana string `json:"statement_descriptor_kana"`
// The Kanji variation of the default text that appears on credit card statements when a charge is made (Japan only)
StatementDescriptorKanji string `json:"statement_descriptor_kanji"`
// The Kana variation of the default text that appears on credit card statements when a charge is made (Japan only). This field prefixes any dynamic `statement_descriptor_suffix_kana` specified on the charge. `statement_descriptor_prefix_kana` is useful for maximizing descriptor space for the dynamic portion.
StatementDescriptorPrefixKana string `json:"statement_descriptor_prefix_kana"`
// The Kanji variation of the default text that appears on credit card statements when a charge is made (Japan only). This field prefixes any dynamic `statement_descriptor_suffix_kanji` specified on the charge. `statement_descriptor_prefix_kanji` is useful for maximizing descriptor space for the dynamic portion.
StatementDescriptorPrefixKanji string `json:"statement_descriptor_prefix_kanji"`
}
type AccountPayoutSchedule struct {
// The number of days charges for the account will be held before being paid out.
Expand Down
8 changes: 8 additions & 0 deletions checkout_session.go
Original file line number Diff line number Diff line change
Expand Up @@ -821,6 +821,10 @@ type CheckoutSessionPaymentMethodOptionsCardParams struct {
//
// When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication).
SetupFutureUsage *string `form:"setup_future_usage"`
// Provides information about a card payment that customers see on their statements. Concatenated with the Kana prefix (shortened Kana descriptor) or Kana statement descriptor that's set on the account to form the complete statement descriptor. Maximum 22 characters. On card statements, the *concatenation* of both prefix and suffix (including separators) will appear truncated to 22 characters.
StatementDescriptorSuffixKana *string `form:"statement_descriptor_suffix_kana"`
// Provides information about a card payment that customers see on their statements. Concatenated with the Kanji prefix (shortened Kanji descriptor) or Kanji statement descriptor that's set on the account to form the complete statement descriptor. Maximum 17 characters. On card statements, the *concatenation* of both prefix and suffix (including separators) will appear truncated to 17 characters.
StatementDescriptorSuffixKanji *string `form:"statement_descriptor_suffix_kanji"`
}

// contains details about the EPS payment method options.
Expand Down Expand Up @@ -1449,6 +1453,10 @@ type CheckoutSessionPaymentMethodOptionsCard struct {
//
// When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication).
SetupFutureUsage CheckoutSessionPaymentMethodOptionsCardSetupFutureUsage `json:"setup_future_usage"`
// Provides information about a card payment that customers see on their statements. Concatenated with the Kana prefix (shortened Kana descriptor) or Kana statement descriptor that's set on the account to form the complete statement descriptor. Maximum 22 characters. On card statements, the *concatenation* of both prefix and suffix (including separators) will appear truncated to 22 characters.
StatementDescriptorSuffixKana string `json:"statement_descriptor_suffix_kana"`
// Provides information about a card payment that customers see on their statements. Concatenated with the Kanji prefix (shortened Kanji descriptor) or Kanji statement descriptor that's set on the account to form the complete statement descriptor. Maximum 17 characters. On card statements, the *concatenation* of both prefix and suffix (including separators) will appear truncated to 17 characters.
StatementDescriptorSuffixKanji string `json:"statement_descriptor_suffix_kanji"`
}
type CheckoutSessionPaymentMethodOptionsEPS struct {
// Indicates that you intend to make future payments with this PaymentIntent's payment method.
Expand Down
4 changes: 4 additions & 0 deletions client/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ import (
terminalconnectiontoken "github.com/stripe/stripe-go/v72/terminal/connectiontoken"
terminallocation "github.com/stripe/stripe-go/v72/terminal/location"
terminalreader "github.com/stripe/stripe-go/v72/terminal/reader"
testhelperscustomer "github.com/stripe/stripe-go/v72/testhelpers/customer"
testhelpersrefund "github.com/stripe/stripe-go/v72/testhelpers/refund"
testhelpersterminalreader "github.com/stripe/stripe-go/v72/testhelpers/terminal/reader"
testhelperstestclock "github.com/stripe/stripe-go/v72/testhelpers/testclock"
Expand Down Expand Up @@ -274,6 +275,8 @@ type API struct {
TerminalLocations *terminallocation.Client
// TerminalReaders is the client used to invoke /terminal/readers APIs.
TerminalReaders *terminalreader.Client
// TestHelpersCustomers is the client used to invoke /customers APIs.
TestHelpersCustomers *testhelperscustomer.Client
// TestHelpersRefunds is the client used to invoke /refunds APIs.
TestHelpersRefunds *testhelpersrefund.Client
// TestHelpersTerminalReaders is the client used to invoke /terminal/readers APIs.
Expand Down Expand Up @@ -413,6 +416,7 @@ func (a *API) Init(key string, backends *stripe.Backends) {
a.TerminalConnectionTokens = &terminalconnectiontoken.Client{B: backends.API, Key: key}
a.TerminalLocations = &terminallocation.Client{B: backends.API, Key: key}
a.TerminalReaders = &terminalreader.Client{B: backends.API, Key: key}
a.TestHelpersCustomers = &testhelperscustomer.Client{B: backends.API, Key: key}
a.TestHelpersRefunds = &testhelpersrefund.Client{B: backends.API, Key: key}
a.TestHelpersTerminalReaders = &testhelpersterminalreader.Client{B: backends.API, Key: key}
a.TestHelpersTestClocks = &testhelperstestclock.Client{B: backends.API, Key: key}
Expand Down
4 changes: 3 additions & 1 deletion creditnote.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,12 +223,14 @@ type CreditNote struct {
Refund *Refund `json:"refund"`
// Status of this credit note, one of `issued` or `void`. Learn more about [voiding credit notes](https://stripe.com/docs/billing/invoices/credit-notes#voiding).
Status CreditNoteStatus `json:"status"`
// The integer amount in %s representing the amount of the credit note, excluding tax and invoice level discounts.
// The integer amount in %s representing the amount of the credit note, excluding exclusive tax and invoice level discounts.
Subtotal int64 `json:"subtotal"`
// The aggregate amounts calculated per tax rate for all line items.
TaxAmounts []*CreditNoteTaxAmount `json:"tax_amounts"`
// The integer amount in %s representing the total amount of the credit note, including tax and all discount.
Total int64 `json:"total"`
// The integer amount in %s representing the total amount of the credit note, excluding tax, but including discounts.
TotalExcludingTax int64 `json:"total_excluding_tax"`
// Type of this credit note, one of `pre_payment` or `post_payment`. A `pre_payment` credit note means it was issued when the invoice was open. A `post_payment` credit note means it was issued when the invoice was paid.
Type CreditNoteType `json:"type"`
// The time that the credit note was voided.
Expand Down
10 changes: 9 additions & 1 deletion customer.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ type CustomerInvoiceCustomFieldParams struct {

// Default options for invoice PDF rendering for this customer.
type CustomerInvoiceSettingsRenderingOptionsParams struct {
// How line-item prices and amounts will be displayed with respect to tax on invoice PDFs.
// How line-item prices and amounts will be displayed with respect to tax on invoice PDFs. One of `exclude_tax` or `include_inclusive_tax`. `include_inclusive_tax` will include inclusive tax (and exclude exclusive tax) in invoice PDF amounts. `exclude_tax` will exclude all tax (inclusive and exclusive alike) from invoice PDF amounts.
AmountTaxDisplay *string `form:"amount_tax_display"`
}

Expand Down Expand Up @@ -239,13 +239,21 @@ type CustomerInvoiceCustomField struct {
Name *string `form:"name"`
Value *string `form:"value"`
}

// Default options for invoice PDF rendering for this customer.
type CustomerInvoiceSettingsRenderingOptions struct {
// How line-item prices and amounts will be displayed with respect to tax on invoice PDFs.
AmountTaxDisplay string `json:"amount_tax_display"`
}
type CustomerInvoiceSettings struct {
// Default custom fields to be displayed on invoices for this customer.
CustomFields []*CustomerInvoiceCustomField `json:"custom_fields"`
// ID of a payment method that's attached to the customer, to be used as the customer's default payment method for subscriptions and invoices.
DefaultPaymentMethod *PaymentMethod `json:"default_payment_method"`
// Default footer to be displayed on invoices for this customer.
Footer string `json:"footer"`
// Default options for invoice PDF rendering for this customer.
RenderingOptions *CustomerInvoiceSettingsRenderingOptions `json:"rendering_options"`
}

// Mailing and shipping address for the customer. Appears on invoices emailed to this customer.
Expand Down
10 changes: 10 additions & 0 deletions example/generated_examples_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ import (
terminal_connectiontoken "github.com/stripe/stripe-go/v72/terminal/connectiontoken"
terminal_location "github.com/stripe/stripe-go/v72/terminal/location"
terminal_reader "github.com/stripe/stripe-go/v72/terminal/reader"
testhelpers_customer "github.com/stripe/stripe-go/v72/testhelpers/customer"
testhelpers_refund "github.com/stripe/stripe-go/v72/testhelpers/refund"
testhelpers_testclock "github.com/stripe/stripe-go/v72/testhelpers/testclock"
testhelpers_treasury_inboundtransfer "github.com/stripe/stripe-go/v72/testhelpers/treasury/inboundtransfer"
Expand Down Expand Up @@ -445,6 +446,15 @@ func TestCashBalanceUpdate(t *testing.T) {
assert.NotNil(t, result)
}

func TestTestHelpersCustomerFundCashBalance(t *testing.T) {
params := &stripe.TestHelpersCustomerFundCashBalanceParams{
Amount: stripe.Int64(30),
Currency: stripe.String(string(stripe.CurrencyEUR)),
}
result, _ := testhelpers_customer.FundCashBalance("cus_123", params)
assert.NotNil(t, result)
}

func TestCustomerList(t *testing.T) {
params := &stripe.CustomerListParams{}
params.Limit = stripe.Int64(3)
Expand Down
10 changes: 9 additions & 1 deletion invoice.go
Original file line number Diff line number Diff line change
Expand Up @@ -615,6 +615,12 @@ type InvoicePaymentSettings struct {
// The list of payment method types (e.g. card) to provide to the invoice's PaymentIntent. If not set, Stripe attempts to automatically determine the types to use by looking at the invoice's default payment method, the subscription's default payment method, the customer's default payment method, and your [invoice template settings](https://dashboard.stripe.com/settings/billing/invoice).
PaymentMethodTypes []InvoicePaymentSettingsPaymentMethodType `json:"payment_method_types"`
}

// Options for invoice PDF rendering.
type InvoiceRenderingOptions struct {
// How line-item prices and amounts will be displayed with respect to tax on invoice PDFs.
AmountTaxDisplay string `json:"amount_tax_display"`
}
type InvoiceStatusTransitions struct {
// The time that the invoice draft was finalized.
FinalizedAt int64 `json:"finalized_at"`
Expand Down Expand Up @@ -811,6 +817,8 @@ type Invoice struct {
Quote *Quote `json:"quote"`
// This is the transaction number that appears on email receipts sent for this invoice.
ReceiptNumber string `json:"receipt_number"`
// Options for invoice PDF rendering.
RenderingOptions *InvoiceRenderingOptions `json:"rendering_options"`
// Starting customer balance before the invoice is finalized. If the invoice has not been finalized yet, this will be the current customer balance.
StartingBalance int64 `json:"starting_balance"`
// Extra information about an invoice for the customer's credit card statement.
Expand All @@ -822,7 +830,7 @@ type Invoice struct {
Subscription *Subscription `json:"subscription"`
// Only set for upcoming invoices that preview prorations. The time used to calculate prorations.
SubscriptionProrationDate int64 `json:"subscription_proration_date"`
// Total of all subscriptions, invoice items, and prorations on the invoice before any invoice level discount or tax is applied. Item discounts are already incorporated
// Total of all subscriptions, invoice items, and prorations on the invoice before any invoice level discount or exclusive tax is applied. Item discounts are already incorporated
Subtotal int64 `json:"subtotal"`
// The amount of tax on this invoice. This is the sum of all the tax amounts on this invoice.
Tax int64 `json:"tax"`
Expand Down
8 changes: 8 additions & 0 deletions paymentintent.go
Original file line number Diff line number Diff line change
Expand Up @@ -999,6 +999,10 @@ type PaymentIntentPaymentMethodOptionsCardParams struct {
//
// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`.
SetupFutureUsage *string `form:"setup_future_usage"`
// Provides information about a card payment that customers see on their statements. Concatenated with the Kana prefix (shortened Kana descriptor) or Kana statement descriptor that's set on the account to form the complete statement descriptor. Maximum 22 characters. On card statements, the *concatenation* of both prefix and suffix (including separators) will appear truncated to 22 characters.
StatementDescriptorSuffixKana *string `form:"statement_descriptor_suffix_kana"`
// Provides information about a card payment that customers see on their statements. Concatenated with the Kanji prefix (shortened Kanji descriptor) or Kanji statement descriptor that's set on the account to form the complete statement descriptor. Maximum 17 characters. On card statements, the *concatenation* of both prefix and suffix (including separators) will appear truncated to 17 characters.
StatementDescriptorSuffixKanji *string `form:"statement_descriptor_suffix_kanji"`
}

// If this is a `card_present` PaymentMethod, this sub-hash contains details about the Card Present payment method options.
Expand Down Expand Up @@ -2028,6 +2032,10 @@ type PaymentIntentPaymentMethodOptionsCard struct {
//
// When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication).
SetupFutureUsage PaymentIntentPaymentMethodOptionsCardSetupFutureUsage `json:"setup_future_usage"`
// Provides information about a card payment that customers see on their statements. Concatenated with the Kana prefix (shortened Kana descriptor) or Kana statement descriptor that's set on the account to form the complete statement descriptor. Maximum 22 characters. On card statements, the *concatenation* of both prefix and suffix (including separators) will appear truncated to 22 characters.
StatementDescriptorSuffixKana string `json:"statement_descriptor_suffix_kana"`
// Provides information about a card payment that customers see on their statements. Concatenated with the Kanji prefix (shortened Kanji descriptor) or Kanji statement descriptor that's set on the account to form the complete statement descriptor. Maximum 17 characters. On card statements, the *concatenation* of both prefix and suffix (including separators) will appear truncated to 17 characters.
StatementDescriptorSuffixKanji string `json:"statement_descriptor_suffix_kanji"`
}

// PaymentIntentPaymentMethodOptionsCardPresent is the set of Card Present-specific options associated
Expand Down
40 changes: 40 additions & 0 deletions testhelpers/customer/client.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
//
//
// File generated from our OpenAPI spec
//
//

// Package customer provides the /customers APIs
package customer

import (
"net/http"

stripe "github.com/stripe/stripe-go/v72"
)

// Client is used to invoke /customers APIs.
type Client struct {
B stripe.Backend
Key string
}

// FundCashBalance is the method for the `POST /v1/test_helpers/customers/{customer}/fund_cash_balance` API.
func FundCashBalance(id string, params *stripe.TestHelpersCustomerFundCashBalanceParams) (*stripe.Customer, error) {
return getC().FundCashBalance(id, params)
}

// FundCashBalance is the method for the `POST /v1/test_helpers/customers/{customer}/fund_cash_balance` API.
func (c Client) FundCashBalance(id string, params *stripe.TestHelpersCustomerFundCashBalanceParams) (*stripe.Customer, error) {
path := stripe.FormatURLPath(
"/v1/test_helpers/customers/%s/fund_cash_balance",
id,
)
customer := &stripe.Customer{}
err := c.B.Call(http.MethodPost, path, c.Key, params, customer)
return customer, err
}

func getC() Client {
return Client{stripe.GetBackend(stripe.APIBackend), stripe.Key}
}
17 changes: 17 additions & 0 deletions testhelpers_customer.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//
//
// File generated from our OpenAPI spec
//
//

package stripe

// Create an incoming testmode bank transfer
type TestHelpersCustomerFundCashBalanceParams struct {
Params `form:"*"`
// Amount intended to be collected by this PaymentIntent. A positive integer representing how much to charge in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal) (e.g., 100 cents to charge $1.00 or 100 to charge ¥100, a zero-decimal currency). The minimum amount is $0.50 US or [equivalent in charge currency](https://stripe.com/docs/currencies#minimum-and-maximum-charge-amounts). The amount value supports up to eight digits (e.g., a value of 99999999 for a USD charge of $999,999.99).
Amount *int64 `form:"amount"`
// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
Currency *string `form:"currency"`
Reference *string `form:"reference"`
}
Loading

0 comments on commit 72586c5

Please sign in to comment.