From 1b756124afb71e19dfb9a50403e57ebdc292506c Mon Sep 17 00:00:00 2001 From: pakrym-stripe <99349468+pakrym-stripe@users.noreply.github.com> Date: Wed, 15 Jun 2022 14:33:16 -0700 Subject: [PATCH 01/17] Fix test assert to allow beta versions (#1478) --- stripe_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stripe_test.go b/stripe_test.go index 6710e96fa9..ce5345452d 100644 --- a/stripe_test.go +++ b/stripe_test.go @@ -1022,7 +1022,7 @@ func TestUserAgent(t *testing.T) { // We keep out version constant private to the package, so use a regexp // match instead. - expectedPattern := regexp.MustCompile(`^Stripe/v1 GoBindings/[1-9][0-9.]+[0-9]$`) + expectedPattern := regexp.MustCompile(`^Stripe/v1 GoBindings/[.\-\w\d]+$`) match := expectedPattern.MatchString(req.Header.Get("User-Agent")) assert.True(t, match) @@ -1049,7 +1049,7 @@ func TestUserAgentWithAppInfo(t *testing.T) { // We keep out version constant private to the package, so use a regexp // match instead. - expectedPattern := regexp.MustCompile(`^Stripe/v1 GoBindings/[1-9][0-9.]+[0-9] MyAwesomePlugin/1.2.34 \(https://myawesomeplugin.info\)$`) + expectedPattern := regexp.MustCompile(`^Stripe/v1 GoBindings/[.\-\w\d]+ MyAwesomePlugin/1.2.34 \(https://myawesomeplugin.info\)$`) match := expectedPattern.MatchString(req.Header.Get("User-Agent")) assert.True(t, match) From 72586c56ab04ea991ce1e34251e3c691672c7f08 Mon Sep 17 00:00:00 2001 From: Kamil Pajdzik <99290280+kamil-stripe@users.noreply.github.com> Date: Fri, 17 Jun 2022 12:05:41 -0700 Subject: [PATCH 02/17] Codegen for openapi v157 (#1477) --- OPENAPI_VERSION | 2 +- account.go | 12 +++++++++ checkout_session.go | 8 ++++++ client/api.go | 4 +++ creditnote.go | 4 ++- customer.go | 10 +++++++- example/generated_examples_test.go | 10 ++++++++ invoice.go | 10 +++++++- paymentintent.go | 8 ++++++ testhelpers/customer/client.go | 40 ++++++++++++++++++++++++++++++ testhelpers_customer.go | 17 +++++++++++++ treasury_creditreversal.go | 2 +- treasury_debitreversal.go | 2 +- treasury_inboundtransfer.go | 4 +-- treasury_outboundpayment.go | 4 +-- treasury_outboundtransfer.go | 2 +- treasury_transaction.go | 2 +- treasury_transactionentry.go | 2 +- 18 files changed, 130 insertions(+), 13 deletions(-) create mode 100644 testhelpers/customer/client.go create mode 100644 testhelpers_customer.go diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index d377f60ad0..2b4f3461d7 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v154 \ No newline at end of file +v157 \ No newline at end of file diff --git a/account.go b/account.go index 96ce5e146b..025970987a 100644 --- a/account.go +++ b/account.go @@ -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 @@ -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. @@ -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. diff --git a/checkout_session.go b/checkout_session.go index 9c7094102f..36d54bddd6 100644 --- a/checkout_session.go +++ b/checkout_session.go @@ -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. @@ -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. diff --git a/client/api.go b/client/api.go index e4fdf9d57c..30022197b0 100644 --- a/client/api.go +++ b/client/api.go @@ -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" @@ -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. @@ -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} diff --git a/creditnote.go b/creditnote.go index bcfdd31408..c9b163d699 100644 --- a/creditnote.go +++ b/creditnote.go @@ -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. diff --git a/customer.go b/customer.go index 8005a30462..9e79296119 100644 --- a/customer.go +++ b/customer.go @@ -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"` } @@ -239,6 +239,12 @@ 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"` @@ -246,6 +252,8 @@ type CustomerInvoiceSettings struct { 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. diff --git a/example/generated_examples_test.go b/example/generated_examples_test.go index 7c4182a819..a938b63fed 100644 --- a/example/generated_examples_test.go +++ b/example/generated_examples_test.go @@ -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" @@ -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) diff --git a/invoice.go b/invoice.go index bdfd414566..440dce1b33 100644 --- a/invoice.go +++ b/invoice.go @@ -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"` @@ -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. @@ -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"` diff --git a/paymentintent.go b/paymentintent.go index 84393ef708..4f8129445c 100644 --- a/paymentintent.go +++ b/paymentintent.go @@ -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. @@ -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 diff --git a/testhelpers/customer/client.go b/testhelpers/customer/client.go new file mode 100644 index 0000000000..dde5f3b619 --- /dev/null +++ b/testhelpers/customer/client.go @@ -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} +} diff --git a/testhelpers_customer.go b/testhelpers_customer.go new file mode 100644 index 0000000000..a1cc2582b9 --- /dev/null +++ b/testhelpers_customer.go @@ -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"` +} diff --git a/treasury_creditreversal.go b/treasury_creditreversal.go index 4293204147..edd265b365 100644 --- a/treasury_creditreversal.go +++ b/treasury_creditreversal.go @@ -56,7 +56,7 @@ type TreasuryCreditReversal struct { Currency Currency `json:"currency"` // The FinancialAccount to reverse funds from. FinancialAccount string `json:"financial_account"` - // A hosted transaction receipt URL that is provided when money movement is considered regulated under Stripe's money transmission licenses. + // A [hosted transaction receipt](https://stripe.com/docs/treasury/moving-money/regulatory-receipts) URL that is provided when money movement is considered regulated under Stripe's money transmission licenses. HostedRegulatoryReceiptURL string `json:"hosted_regulatory_receipt_url"` // Unique identifier for the object. ID string `json:"id"` diff --git a/treasury_debitreversal.go b/treasury_debitreversal.go index 5f7dd2415d..359299c989 100644 --- a/treasury_debitreversal.go +++ b/treasury_debitreversal.go @@ -64,7 +64,7 @@ type TreasuryDebitReversal struct { Currency Currency `json:"currency"` // The FinancialAccount to reverse funds from. FinancialAccount string `json:"financial_account"` - // A hosted transaction receipt URL that is provided when money movement is considered regulated under Stripe's money transmission licenses. + // A [hosted transaction receipt](https://stripe.com/docs/treasury/moving-money/regulatory-receipts) URL that is provided when money movement is considered regulated under Stripe's money transmission licenses. HostedRegulatoryReceiptURL string `json:"hosted_regulatory_receipt_url"` // Unique identifier for the object. ID string `json:"id"` diff --git a/treasury_inboundtransfer.go b/treasury_inboundtransfer.go index 52676f28e5..3647e22399 100644 --- a/treasury_inboundtransfer.go +++ b/treasury_inboundtransfer.go @@ -151,7 +151,7 @@ type TreasuryInboundTransferStatusTransitions struct { SucceededAt int64 `json:"succeeded_at"` } -// Use InboundTransfers to add funds to your [FinancialAccount](https://stripe.com/docs/api#financial_accounts) via a PaymentMethod that is owned by you. The funds will be transferred via an ACH debit. +// Use [InboundTransfers](https://stripe.com/docs/treasury/moving-money/financial-accounts/into/inbound-transfers) to add funds to your [FinancialAccount](https://stripe.com/docs/api#financial_accounts) via a PaymentMethod that is owned by you. The funds will be transferred via an ACH debit. type TreasuryInboundTransfer struct { APIResource // Amount (in cents) transferred. @@ -168,7 +168,7 @@ type TreasuryInboundTransfer struct { FailureDetails *TreasuryInboundTransferFailureDetails `json:"failure_details"` // The FinancialAccount that received the funds. FinancialAccount string `json:"financial_account"` - // A hosted transaction receipt URL that is provided when money movement is considered regulated under Stripe's money transmission licenses. + // A [hosted transaction receipt](https://stripe.com/docs/treasury/moving-money/regulatory-receipts) URL that is provided when money movement is considered regulated under Stripe's money transmission licenses. HostedRegulatoryReceiptURL string `json:"hosted_regulatory_receipt_url"` // Unique identifier for the object. ID string `json:"id"` diff --git a/treasury_outboundpayment.go b/treasury_outboundpayment.go index 867ad8fae7..116618c99b 100644 --- a/treasury_outboundpayment.go +++ b/treasury_outboundpayment.go @@ -257,7 +257,7 @@ type TreasuryOutboundPayment struct { Created int64 `json:"created"` // 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 Currency `json:"currency"` - // ID of the customer to whom an OutboundPayment is sent. + // ID of the [customer](https://stripe.com/docs/api/customers) to whom an OutboundPayment is sent. Customer string `json:"customer"` // An arbitrary string attached to the object. Often useful for displaying to users. Description string `json:"description"` @@ -271,7 +271,7 @@ type TreasuryOutboundPayment struct { ExpectedArrivalDate int64 `json:"expected_arrival_date"` // The FinancialAccount that funds were pulled from. FinancialAccount string `json:"financial_account"` - // A hosted transaction receipt URL that is provided when money movement is considered regulated under Stripe's money transmission licenses. + // A [hosted transaction receipt](https://stripe.com/docs/treasury/moving-money/regulatory-receipts) URL that is provided when money movement is considered regulated under Stripe's money transmission licenses. HostedRegulatoryReceiptURL string `json:"hosted_regulatory_receipt_url"` // Unique identifier for the object. ID string `json:"id"` diff --git a/treasury_outboundtransfer.go b/treasury_outboundtransfer.go index 44a9c8a990..e1bed168a8 100644 --- a/treasury_outboundtransfer.go +++ b/treasury_outboundtransfer.go @@ -184,7 +184,7 @@ type TreasuryOutboundTransfer struct { ExpectedArrivalDate int64 `json:"expected_arrival_date"` // The FinancialAccount that funds were pulled from. FinancialAccount string `json:"financial_account"` - // A hosted transaction receipt URL that is provided when money movement is considered regulated under Stripe's money transmission licenses. + // A [hosted transaction receipt](https://stripe.com/docs/treasury/moving-money/regulatory-receipts) URL that is provided when money movement is considered regulated under Stripe's money transmission licenses. HostedRegulatoryReceiptURL string `json:"hosted_regulatory_receipt_url"` // Unique identifier for the object. ID string `json:"id"` diff --git a/treasury_transaction.go b/treasury_transaction.go index 4569120c0f..2b218b129c 100644 --- a/treasury_transaction.go +++ b/treasury_transaction.go @@ -94,7 +94,7 @@ type TreasuryTransactionFlowDetails struct { CreditReversal *TreasuryCreditReversal `json:"credit_reversal"` // You can reverse some [ReceivedDebits](https://stripe.com/docs/api#received_debits) depending on their network and source flow. Reversing a ReceivedDebit leads to the creation of a new object known as a DebitReversal. DebitReversal *TreasuryDebitReversal `json:"debit_reversal"` - // Use InboundTransfers to add funds to your [FinancialAccount](https://stripe.com/docs/api#financial_accounts) via a PaymentMethod that is owned by you. The funds will be transferred via an ACH debit. + // Use [InboundTransfers](https://stripe.com/docs/treasury/moving-money/financial-accounts/into/inbound-transfers) to add funds to your [FinancialAccount](https://stripe.com/docs/api#financial_accounts) via a PaymentMethod that is owned by you. The funds will be transferred via an ACH debit. InboundTransfer *TreasuryInboundTransfer `json:"inbound_transfer"` // When an [issued card](https://stripe.com/docs/issuing) is used to make a purchase, an Issuing `Authorization` // object is created. [Authorizations](https://stripe.com/docs/issuing/purchases/authorizations) must be approved for the diff --git a/treasury_transactionentry.go b/treasury_transactionentry.go index 5b8805e020..b671979852 100644 --- a/treasury_transactionentry.go +++ b/treasury_transactionentry.go @@ -101,7 +101,7 @@ type TreasuryTransactionEntryFlowDetails struct { CreditReversal *TreasuryCreditReversal `json:"credit_reversal"` // You can reverse some [ReceivedDebits](https://stripe.com/docs/api#received_debits) depending on their network and source flow. Reversing a ReceivedDebit leads to the creation of a new object known as a DebitReversal. DebitReversal *TreasuryDebitReversal `json:"debit_reversal"` - // Use InboundTransfers to add funds to your [FinancialAccount](https://stripe.com/docs/api#financial_accounts) via a PaymentMethod that is owned by you. The funds will be transferred via an ACH debit. + // Use [InboundTransfers](https://stripe.com/docs/treasury/moving-money/financial-accounts/into/inbound-transfers) to add funds to your [FinancialAccount](https://stripe.com/docs/api#financial_accounts) via a PaymentMethod that is owned by you. The funds will be transferred via an ACH debit. InboundTransfer *TreasuryInboundTransfer `json:"inbound_transfer"` // When an [issued card](https://stripe.com/docs/issuing) is used to make a purchase, an Issuing `Authorization` // object is created. [Authorizations](https://stripe.com/docs/issuing/purchases/authorizations) must be approved for the From 6d096af83d20c621c7b3c1a24c9acc83d7513ed2 Mon Sep 17 00:00:00 2001 From: Kamil Pajdzik Date: Fri, 17 Jun 2022 12:23:50 -0700 Subject: [PATCH 03/17] Bump version to 72.115.0 --- CHANGELOG.md | 11 +++++++++++ VERSION | 2 +- stripe.go | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7037498b94..2fe2d17781 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,16 @@ # Changelog +## 72.115.0 - 2022-06-17 +* [#1477](https://github.com/stripe/stripe-go/pull/1477) API Updates + * Add support for `FundCashBalance` test helper method on resource `Customer` + * Add support for `StatementDescriptorPrefixKana` and `StatementDescriptorPrefixKanji` on `AccountSettingsCardPaymentsParams`, `AccountSettingsCardPayments`, and `AccountSettingsPayments` + * Add support for `StatementDescriptorSuffixKana` and `StatementDescriptorSuffixKanji` on `CheckoutSessionPaymentMethodOptionsCardParams`, `CheckoutSessionPaymentMethodOptionsCard`, `PaymentIntentConfirmPaymentMethodOptionsCardParams`, `PaymentIntentPaymentMethodOptionsCardParams`, and `PaymentIntentPaymentMethodOptionsCard` + * Add support for `TotalExcludingTax` on `CreditNote` + * Change type of `CustomerInvoiceSettingsRenderingOptionsParams` from `rendering_options_param` to `emptyStringable(rendering_options_param)` + * Add support for `RenderingOptions` on `CustomerInvoiceSettings` and `Invoice` +* [#1478](https://github.com/stripe/stripe-go/pull/1478) Fix test assert to allow beta versions +* [#1475](https://github.com/stripe/stripe-go/pull/1475) Trigger workflows on beta branches + ## 72.114.0 - 2022-06-09 * [#1473](https://github.com/stripe/stripe-go/pull/1473) API Updates * Add support for `Treasury` on `AccountSettingsParams` and `AccountSettings` diff --git a/VERSION b/VERSION index 29b995fbeb..e74ce3594d 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -72.114.0 +72.115.0 diff --git a/stripe.go b/stripe.go index 593906f7c0..8b17692ff2 100644 --- a/stripe.go +++ b/stripe.go @@ -1203,7 +1203,7 @@ func StringSlice(v []string) []*string { // // clientversion is the binding version -const clientversion = "72.114.0" +const clientversion = "72.115.0" // defaultHTTPTimeout is the default timeout on the http.Client used by the library. // This is chosen to be consistent with the other Stripe language libraries and From 501fa39687acdd37b4eab110ed4be3dba7ade1e7 Mon Sep 17 00:00:00 2001 From: pakrym-stripe <99349468+pakrym-stripe@users.noreply.github.com> Date: Wed, 22 Jun 2022 14:25:42 -0700 Subject: [PATCH 04/17] Use the generated API version (#1482) * Use the generated API version 2 * remove comment --- api_version.go | 11 +++++++++++ stripe.go | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 api_version.go diff --git a/api_version.go b/api_version.go new file mode 100644 index 0000000000..63ecf7fccd --- /dev/null +++ b/api_version.go @@ -0,0 +1,11 @@ +// +// +// File generated from our OpenAPI spec +// +// + +package stripe + +const ( + apiVersion string = "2020-08-27" +) diff --git a/stripe.go b/stripe.go index 8b17692ff2..decec37623 100644 --- a/stripe.go +++ b/stripe.go @@ -31,7 +31,7 @@ import ( const ( // APIVersion is the currently supported API version - APIVersion string = "2020-08-27" + APIVersion string = apiVersion // APIBackend is a constant representing the API service backend. APIBackend SupportedBackend = "api" From e8c8afcd6cac49fd3335c44cd4eef10f12366582 Mon Sep 17 00:00:00 2001 From: yejia-stripe <90646909+yejia-stripe@users.noreply.github.com> Date: Thu, 23 Jun 2022 12:15:35 -0400 Subject: [PATCH 05/17] API Updates (#1481) --- OPENAPI_VERSION | 2 +- account.go | 20 ++++++++++++ charge.go | 5 +++ creditnote.go | 2 ++ creditnotelineitem.go | 4 +++ example/generated_examples_test.go | 1 + invoice.go | 13 ++++++++ invoicelineitem.go | 4 +++ paymentintent.go | 51 ++++++++++++++++++++++++++++++ paymentlink.go | 2 +- paymentmethod.go | 16 +++++++--- setupintent.go | 10 ++++++ sub.go | 1 + treasury_receivedcredit.go | 22 +++++++++++++ treasury_receiveddebit.go | 24 ++++++++++++++ 15 files changed, 171 insertions(+), 6 deletions(-) diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index 2b4f3461d7..e575469dcb 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v157 \ No newline at end of file +v159 \ No newline at end of file diff --git a/account.go b/account.go index 025970987a..cfcff79e3b 100644 --- a/account.go +++ b/account.go @@ -110,6 +110,16 @@ const ( AccountCapabilitiesPayNowPaymentsPending AccountCapabilitiesPayNowPayments = "pending" ) +// The status of the promptpay payments capability of the account, or whether the account can directly process promptpay charges. +type AccountCapabilitiesPromptPayPayments string + +// List of values that AccountCapabilitiesPromptPayPayments can take +const ( + AccountCapabilitiesPromptPayPaymentsActive AccountCapabilitiesPromptPayPayments = "active" + AccountCapabilitiesPromptPayPaymentsInactive AccountCapabilitiesPromptPayPayments = "inactive" + AccountCapabilitiesPromptPayPaymentsPending AccountCapabilitiesPromptPayPayments = "pending" +) + // The status of the banking capability, or whether the account can have bank accounts. type AccountCapabilitiesTreasury string @@ -447,6 +457,12 @@ type AccountCapabilitiesPayNowPaymentsParams struct { Requested *bool `form:"requested"` } +// The promptpay_payments capability. +type AccountCapabilitiesPromptPayPaymentsParams struct { + // Passing true requests the capability for the account, if it is not already requested. A requested capability may not immediately become active. Any requirements to activate the capability are returned in the `requirements` arrays. + Requested *bool `form:"requested"` +} + // The sepa_debit_payments capability. type AccountCapabilitiesSEPADebitPaymentsParams struct { // Passing true requests the capability for the account, if it is not already requested. A requested capability may not immediately become active. Any requirements to activate the capability are returned in the `requirements` arrays. @@ -539,6 +555,8 @@ type AccountCapabilitiesParams struct { P24Payments *AccountCapabilitiesP24PaymentsParams `form:"p24_payments"` // The paynow_payments capability. PayNowPayments *AccountCapabilitiesPayNowPaymentsParams `form:"paynow_payments"` + // The promptpay_payments capability. + PromptPayPayments *AccountCapabilitiesPromptPayPaymentsParams `form:"promptpay_payments"` // The sepa_debit_payments capability. SEPADebitPayments *AccountCapabilitiesSEPADebitPaymentsParams `form:"sepa_debit_payments"` // The sofort_payments capability. @@ -945,6 +963,8 @@ type AccountCapabilities struct { P24Payments AccountCapabilityStatus `json:"p24_payments"` // The status of the paynow payments capability of the account, or whether the account can directly process paynow charges. PayNowPayments AccountCapabilitiesPayNowPayments `json:"paynow_payments"` + // The status of the promptpay payments capability of the account, or whether the account can directly process promptpay charges. + PromptPayPayments AccountCapabilitiesPromptPayPayments `json:"promptpay_payments"` // The status of the SEPA Direct Debits payments capability of the account, or whether the account can directly process SEPA Direct Debits charges. SEPADebitPayments AccountCapabilityStatus `json:"sepa_debit_payments"` // The status of the Sofort payments capability of the account, or whether the account can directly process Sofort charges. diff --git a/charge.go b/charge.go index f50928121e..6975b30b38 100644 --- a/charge.go +++ b/charge.go @@ -782,6 +782,10 @@ type ChargePaymentMethodDetailsPayNow struct { // Reference number associated with this PayNow payment Reference string `json:"reference"` } +type ChargePaymentMethodDetailsPromptPay struct { + // Bill reference generated by PromptPay + Reference string `json:"reference"` +} type ChargePaymentMethodDetailsSepaCreditTransfer struct { // Name of the bank associated with the bank account. BankName string `json:"bank_name"` @@ -877,6 +881,7 @@ type ChargePaymentMethodDetails struct { OXXO *ChargePaymentMethodDetailsOXXO `json:"oxxo"` P24 *ChargePaymentMethodDetailsP24 `json:"p24"` PayNow *ChargePaymentMethodDetailsPayNow `json:"paynow"` + PromptPay *ChargePaymentMethodDetailsPromptPay `json:"promptpay"` SepaCreditTransfer *ChargePaymentMethodDetailsSepaCreditTransfer `json:"sepa_credit_transfer"` SepaDebit *ChargePaymentMethodDetailsSepaDebit `json:"sepa_debit"` Sofort *ChargePaymentMethodDetailsSofort `json:"sofort"` diff --git a/creditnote.go b/creditnote.go index c9b163d699..44d79fa493 100644 --- a/creditnote.go +++ b/creditnote.go @@ -225,6 +225,8 @@ type CreditNote struct { Status CreditNoteStatus `json:"status"` // The integer amount in %s representing the amount of the credit note, excluding exclusive tax and invoice level discounts. Subtotal int64 `json:"subtotal"` + // The integer amount in %s representing the amount of the credit note, excluding all tax and invoice level discounts. + SubtotalExcludingTax int64 `json:"subtotal_excluding_tax"` // 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. diff --git a/creditnotelineitem.go b/creditnotelineitem.go index 408dec3edc..1fe93f8d68 100644 --- a/creditnotelineitem.go +++ b/creditnotelineitem.go @@ -28,6 +28,8 @@ type CreditNoteLineItemDiscountAmount struct { type CreditNoteLineItem struct { // The integer amount in %s representing the gross amount being credited for this line item, excluding (exclusive) tax and discounts. Amount int64 `json:"amount"` + // The integer amount in %s representing the amount being credited for this line item, excluding all tax and discounts. + AmountExcludingTax int64 `json:"amount_excluding_tax"` // Description of the item being credited. Description string `json:"description"` // The integer amount in %s representing the discount being credited for this line item. @@ -54,6 +56,8 @@ type CreditNoteLineItem struct { UnitAmount int64 `json:"unit_amount"` // Same as `unit_amount`, but contains a decimal value with at most 12 decimal places. UnitAmountDecimal float64 `json:"unit_amount_decimal,string"` + // The amount in %s representing the unit amount being credited for this line item, excluding all tax and discounts. + UnitAmountExcludingTax float64 `json:"unit_amount_excluding_tax,string"` } // CreditNoteLineItemList is a list of CreditNoteLineItems as retrieved from a list endpoint. diff --git a/example/generated_examples_test.go b/example/generated_examples_test.go index a938b63fed..a7e6aa15d1 100644 --- a/example/generated_examples_test.go +++ b/example/generated_examples_test.go @@ -1,3 +1,4 @@ +// File generated from our OpenAPI spec package example import ( diff --git a/invoice.go b/invoice.go index 440dce1b33..99e12e0e87 100644 --- a/invoice.go +++ b/invoice.go @@ -123,6 +123,7 @@ const ( InvoicePaymentSettingsPaymentMethodTypeKonbini InvoicePaymentSettingsPaymentMethodType = "konbini" InvoicePaymentSettingsPaymentMethodTypeLink InvoicePaymentSettingsPaymentMethodType = "link" InvoicePaymentSettingsPaymentMethodTypePayNow InvoicePaymentSettingsPaymentMethodType = "paynow" + InvoicePaymentSettingsPaymentMethodTypePromptPay InvoicePaymentSettingsPaymentMethodType = "promptpay" InvoicePaymentSettingsPaymentMethodTypeSepaCreditTransfer InvoicePaymentSettingsPaymentMethodType = "sepa_credit_transfer" InvoicePaymentSettingsPaymentMethodTypeSepaDebit InvoicePaymentSettingsPaymentMethodType = "sepa_debit" InvoicePaymentSettingsPaymentMethodTypeSofort InvoicePaymentSettingsPaymentMethodType = "sofort" @@ -281,6 +282,12 @@ type InvoicePaymentSettingsParams struct { PaymentMethodTypes []*string `form:"payment_method_types"` } +// Options for invoice PDF rendering. +type InvoiceRenderingOptionsParams struct { + // 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"` +} + // If specified, the funds from the invoice will be transferred to the destination and the ID of the resulting transfer will be found on the invoice's charge. type InvoiceTransferDataParams struct { // The amount that will be transferred automatically when the invoice is paid. If no amount is set, the full amount is transferred. @@ -329,6 +336,8 @@ type InvoiceParams struct { PaymentSettings *InvoicePaymentSettingsParams `form:"payment_settings"` // How to handle pending invoice items on invoice creation. One of `include`, `exclude`, or `include_and_require`. `include` will include any pending invoice items, and will create an empty draft invoice if no pending invoice items exist. `include_and_require` will include any pending invoice items, if no pending invoice items exist then the request will fail. `exclude` will always create an empty invoice draft regardless if there are pending invoice items or not. Defaults to `include_and_require` if the parameter is omitted. PendingInvoiceItemsBehavior *string `form:"pending_invoice_items_behavior"` + // Options for invoice PDF rendering. + RenderingOptions *InvoiceRenderingOptionsParams `form:"rendering_options"` // The identifier of the unstarted schedule whose upcoming invoice you'd like to retrieve. Cannot be used with subscription or subscription fields. Schedule *string `form:"schedule"` // Extra information about a charge for the customer's credit card statement. It must contain at least one letter. If not specified and this invoice is part of a subscription, the default `statement_descriptor` will be set to the first subscription item's product's `statement_descriptor`. @@ -832,6 +841,8 @@ type Invoice struct { SubscriptionProrationDate int64 `json:"subscription_proration_date"` // 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 integer amount in %s representing the subtotal of the invoice before any invoice level discount or tax is applied. Item discounts are already incorporated + SubtotalExcludingTax int64 `json:"subtotal_excluding_tax"` // The amount of tax on this invoice. This is the sum of all the tax amounts on this invoice. Tax int64 `json:"tax"` // ID of the test clock this invoice belongs to. @@ -841,6 +852,8 @@ type Invoice struct { Total int64 `json:"total"` // The aggregate amounts calculated per discount across all line items. TotalDiscountAmounts []*InvoiceDiscountAmount `json:"total_discount_amounts"` + // The integer amount in %s representing the total amount of the invoice including all discounts but excluding all tax. + TotalExcludingTax int64 `json:"total_excluding_tax"` // The aggregate amounts calculated per tax rate for all line items. TotalTaxAmounts []*InvoiceTaxAmount `json:"total_tax_amounts"` // The account (if any) the payment will be attributed to for tax reporting, and where funds from the payment will be transferred to for the invoice. diff --git a/invoicelineitem.go b/invoicelineitem.go index da69d2dc7d..82e51d3a2c 100644 --- a/invoicelineitem.go +++ b/invoicelineitem.go @@ -39,6 +39,8 @@ type InvoiceLineProrationDetails struct { type InvoiceLine struct { // The amount, in %s. Amount int64 `json:"amount"` + // The integer amount in %s representing the amount for this line item, excluding all tax and discounts. + AmountExcludingTax int64 `json:"amount_excluding_tax"` // 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 Currency `json:"currency"` // An arbitrary string attached to the object. Often useful for displaying to users. @@ -81,6 +83,8 @@ type InvoiceLine struct { // A string identifying the type of the source of this line item, either an `invoiceitem` or a `subscription`. Type InvoiceLineType `json:"type"` UnifiedProration bool `json:"unified_proration"` + // The amount in %s representing the unit amount for this line item, excluding all tax and discounts. + UnitAmountExcludingTax float64 `json:"unit_amount_excluding_tax,string"` } // Period is a structure representing a start and end dates. diff --git a/paymentintent.go b/paymentintent.go index 4f8129445c..69d5edfda3 100644 --- a/paymentintent.go +++ b/paymentintent.go @@ -525,6 +525,18 @@ const ( PaymentIntentPaymentMethodOptionsPayNowSetupFutureUsageNone PaymentIntentPaymentMethodOptionsPayNowSetupFutureUsage = "none" ) +// Indicates that you intend to make future payments with this PaymentIntent's payment method. +// +// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. If no Customer was provided, the payment method can still be [attached](https://stripe.com/docs/api/payment_methods/attach) to a Customer after the transaction completes. +// +// 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). +type PaymentIntentPaymentMethodOptionsPromptPaySetupFutureUsage string + +// List of values that PaymentIntentPaymentMethodOptionsPromptPaySetupFutureUsage can take +const ( + PaymentIntentPaymentMethodOptionsPromptPaySetupFutureUsageNone PaymentIntentPaymentMethodOptionsPromptPaySetupFutureUsage = "none" +) + // Indicates that you intend to make future payments with this PaymentIntent's payment method. // // Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. If no Customer was provided, the payment method can still be [attached](https://stripe.com/docs/api/payment_methods/attach) to a Customer after the transaction completes. @@ -702,6 +714,9 @@ type PaymentIntentPaymentMethodDataLinkParams struct{} // If this is a `paynow` PaymentMethod, this hash contains details about the PayNow payment method. type PaymentIntentPaymentMethodDataPayNowParams struct{} +// If this is a `promptpay` PaymentMethod, this hash contains details about the PromptPay payment method. +type PaymentIntentPaymentMethodDataPromptPayParams struct{} + // Options to configure Radar. See [Radar Session](https://stripe.com/docs/radar/radar-session) for more information. type PaymentIntentPaymentMethodDataRadarOptionsParams struct { // A [Radar Session](https://stripe.com/docs/radar/radar-session) is a snapshot of the browser metadata and device details that help Radar make more accurate predictions on your payments. @@ -773,6 +788,8 @@ type PaymentIntentPaymentMethodDataParams struct { P24 *PaymentMethodP24Params `form:"p24"` // If this is a `paynow` PaymentMethod, this hash contains details about the PayNow payment method. PayNow *PaymentIntentPaymentMethodDataPayNowParams `form:"paynow"` + // If this is a `promptpay` PaymentMethod, this hash contains details about the PromptPay payment method. + PromptPay *PaymentIntentPaymentMethodDataPromptPayParams `form:"promptpay"` // Options to configure Radar. See [Radar Session](https://stripe.com/docs/radar/radar-session) for more information. RadarOptions *PaymentIntentPaymentMethodDataRadarOptionsParams `form:"radar_options"` // If this is a `sepa_debit` PaymentMethod, this hash contains details about the SEPA debit bank account. @@ -1207,6 +1224,18 @@ type PaymentIntentPaymentMethodOptionsPayNowParams struct { SetupFutureUsage *string `form:"setup_future_usage"` } +// If this is a `promptpay` PaymentMethod, this sub-hash contains details about the PromptPay payment method options. +type PaymentIntentPaymentMethodOptionsPromptPayParams struct { + // Indicates that you intend to make future payments with this PaymentIntent's payment method. + // + // Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. If no Customer was provided, the payment method can still be [attached](https://stripe.com/docs/api/payment_methods/attach) to a Customer after the transaction completes. + // + // 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). + // + // 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"` +} + // Additional fields for Mandate creation type PaymentIntentPaymentMethodOptionsSepaDebitMandateOptionsParams struct{} @@ -1334,6 +1363,8 @@ type PaymentIntentPaymentMethodOptionsParams struct { P24 *PaymentIntentPaymentMethodOptionsP24Params `form:"p24"` // If this is a `paynow` PaymentMethod, this sub-hash contains details about the PayNow payment method options. PayNow *PaymentIntentPaymentMethodOptionsPayNowParams `form:"paynow"` + // If this is a `promptpay` PaymentMethod, this sub-hash contains details about the PromptPay payment method options. + PromptPay *PaymentIntentPaymentMethodOptionsPromptPayParams `form:"promptpay"` // If this is a `sepa_debit` PaymentIntent, this sub-hash contains details about the SEPA Debit payment method options. SepaDebit *PaymentIntentPaymentMethodOptionsSepaDebitParams `form:"sepa_debit"` // If this is a `sofort` PaymentMethod, this sub-hash contains details about the SOFORT payment method options. @@ -1813,6 +1844,16 @@ type PaymentIntentNextActionPayNowDisplayQRCode struct { // The image_url_svg string used to render QR code ImageURLSVG string `json:"image_url_svg"` } +type PaymentIntentNextActionPromptPayDisplayQRCode struct { + // The raw data string used to generate QR code, it should be used together with QR code library. + Data string `json:"data"` + // The URL to the hosted PromptPay instructions page, which allows customers to view the PromptPay QR code. + HostedInstructionsURL string `json:"hosted_instructions_url"` + // The image_url_png string used to render QR code, can be used as + ImageURLPNG string `json:"image_url_png"` + // The image_url_svg string used to render QR code, can be used as + ImageURLSVG string `json:"image_url_svg"` +} type PaymentIntentNextActionRedirectToURL struct { // If the customer does not exit their browser while authenticating, they will be redirected to this specified URL after completion. ReturnURL string `json:"return_url"` @@ -1870,6 +1911,7 @@ type PaymentIntentNextAction struct { KonbiniDisplayDetails *PaymentIntentNextActionKonbiniDisplayDetails `json:"konbini_display_details"` OXXODisplayDetails *PaymentIntentNextActionOXXODisplayDetails `json:"oxxo_display_details"` PayNowDisplayQRCode *PaymentIntentNextActionPayNowDisplayQRCode `json:"paynow_display_qr_code"` + PromptPayDisplayQRCode *PaymentIntentNextActionPromptPayDisplayQRCode `json:"promptpay_display_qr_code"` RedirectToURL *PaymentIntentNextActionRedirectToURL `json:"redirect_to_url"` // Type of the next action to perform, one of `redirect_to_url`, `use_stripe_sdk`, `alipay_handle_redirect`, `oxxo_display_details`, or `verify_with_microdeposits`. Type PaymentIntentNextActionType `json:"type"` @@ -2186,6 +2228,14 @@ type PaymentIntentPaymentMethodOptionsPayNow 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 PaymentIntentPaymentMethodOptionsPayNowSetupFutureUsage `json:"setup_future_usage"` } +type PaymentIntentPaymentMethodOptionsPromptPay struct { + // Indicates that you intend to make future payments with this PaymentIntent's payment method. + // + // Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. If no Customer was provided, the payment method can still be [attached](https://stripe.com/docs/api/payment_methods/attach) to a Customer after the transaction completes. + // + // 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 PaymentIntentPaymentMethodOptionsPromptPaySetupFutureUsage `json:"setup_future_usage"` +} type PaymentIntentPaymentMethodOptionsSepaDebitMandateOptions struct{} // PaymentIntentPaymentMethodOptionsSepaDebit is the set of SEPA Debit-specific options associated @@ -2264,6 +2314,7 @@ type PaymentIntentPaymentMethodOptions struct { OXXO *PaymentIntentPaymentMethodOptionsOXXO `json:"oxxo"` P24 *PaymentIntentPaymentMethodOptionsP24 `json:"p24"` PayNow *PaymentIntentPaymentMethodOptionsPayNow `json:"paynow"` + PromptPay *PaymentIntentPaymentMethodOptionsPromptPay `json:"promptpay"` SepaDebit *PaymentIntentPaymentMethodOptionsSepaDebit `json:"sepa_debit"` Sofort *PaymentIntentPaymentMethodOptionsSofort `json:"sofort"` USBankAccount *PaymentIntentPaymentMethodOptionsUSBankAccount `json:"us_bank_account"` diff --git a/paymentlink.go b/paymentlink.go index fb3f6dd155..40eabe2b74 100644 --- a/paymentlink.go +++ b/paymentlink.go @@ -234,7 +234,7 @@ type PaymentLinkParams struct { OnBehalfOf *string `form:"on_behalf_of"` // A subset of parameters to be passed to PaymentIntent creation for Checkout Sessions in `payment` mode. PaymentIntentData *PaymentLinkPaymentIntentDataParams `form:"payment_intent_data"` - // The list of payment method types that customers can use. Only `card` is supported. Pass an empty string to enable automatic payment methods that use your [payment method settings](https://dashboard.stripe.com/settings/payment_methods). + // The list of payment method types that customers can use. Pass an empty string to enable automatic payment methods that use your [payment method settings](https://dashboard.stripe.com/settings/payment_methods). PaymentMethodTypes []*string `form:"payment_method_types"` // Controls phone number collection settings during checkout. // diff --git a/paymentmethod.go b/paymentmethod.go index 412e551b7d..c3e80a0417 100644 --- a/paymentmethod.go +++ b/paymentmethod.go @@ -89,6 +89,7 @@ const ( PaymentMethodTypeOXXO PaymentMethodType = "oxxo" PaymentMethodTypeP24 PaymentMethodType = "p24" PaymentMethodTypePayNow PaymentMethodType = "paynow" + PaymentMethodTypePromptPay PaymentMethodType = "promptpay" PaymentMethodTypeSepaDebit PaymentMethodType = "sepa_debit" PaymentMethodTypeSofort PaymentMethodType = "sofort" PaymentMethodTypeUSBankAccount PaymentMethodType = "us_bank_account" @@ -258,6 +259,9 @@ type PaymentMethodP24Params struct { // If this is a `paynow` PaymentMethod, this hash contains details about the PayNow payment method. type PaymentMethodPayNowParams struct{} +// If this is a `promptpay` PaymentMethod, this hash contains details about the PromptPay payment method. +type PaymentMethodPromptPayParams struct{} + // Options to configure Radar. See [Radar Session](https://stripe.com/docs/radar/radar-session) for more information. type PaymentMethodRadarOptionsParams struct { // A [Radar Session](https://stripe.com/docs/radar/radar-session) is a snapshot of the browser metadata and device details that help Radar make more accurate predictions on your payments. @@ -344,6 +348,8 @@ type PaymentMethodParams struct { P24 *PaymentMethodP24Params `form:"p24"` // If this is a `paynow` PaymentMethod, this hash contains details about the PayNow payment method. PayNow *PaymentMethodPayNowParams `form:"paynow"` + // If this is a `promptpay` PaymentMethod, this hash contains details about the PromptPay payment method. + PromptPay *PaymentMethodPromptPayParams `form:"promptpay"` // Options to configure Radar. See [Radar Session](https://stripe.com/docs/radar/radar-session) for more information. RadarOptions *PaymentMethodRadarOptionsParams `form:"radar_options"` // This is a legacy parameter that will be removed in the future. It is a hash that does not accept any keys. @@ -584,6 +590,7 @@ type PaymentMethodP24 struct { Bank string `json:"bank"` } type PaymentMethodPayNow struct{} +type PaymentMethodPromptPay struct{} // Options to configure Radar. See [Radar Session](https://stripe.com/docs/radar/radar-session) for more information. type PaymentMethodRadarOptions struct { @@ -683,10 +690,11 @@ type PaymentMethod struct { // Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Metadata map[string]string `json:"metadata"` // String representing the object's type. Objects of the same type share the same value. - Object string `json:"object"` - OXXO *PaymentMethodOXXO `json:"oxxo"` - P24 *PaymentMethodP24 `json:"p24"` - PayNow *PaymentMethodPayNow `json:"paynow"` + Object string `json:"object"` + OXXO *PaymentMethodOXXO `json:"oxxo"` + P24 *PaymentMethodP24 `json:"p24"` + PayNow *PaymentMethodPayNow `json:"paynow"` + PromptPay *PaymentMethodPromptPay `json:"promptpay"` // Options to configure Radar. See [Radar Session](https://stripe.com/docs/radar/radar-session) for more information. RadarOptions *PaymentMethodRadarOptions `json:"radar_options"` SepaDebit *PaymentMethodSepaDebit `json:"sepa_debit"` diff --git a/setupintent.go b/setupintent.go index 45911ce9aa..9c38fb00b0 100644 --- a/setupintent.go +++ b/setupintent.go @@ -347,6 +347,9 @@ type SetupIntentPaymentMethodDataP24Params struct { // If this is a `paynow` PaymentMethod, this hash contains details about the PayNow payment method. type SetupIntentPaymentMethodDataPayNowParams struct{} +// If this is a `promptpay` PaymentMethod, this hash contains details about the PromptPay payment method. +type SetupIntentPaymentMethodDataPromptPayParams struct{} + // Options to configure Radar. See [Radar Session](https://stripe.com/docs/radar/radar-session) for more information. type SetupIntentPaymentMethodDataRadarOptionsParams struct { // A [Radar Session](https://stripe.com/docs/radar/radar-session) is a snapshot of the browser metadata and device details that help Radar make more accurate predictions on your payments. @@ -431,6 +434,8 @@ type SetupIntentPaymentMethodDataParams struct { P24 *SetupIntentPaymentMethodDataP24Params `form:"p24"` // If this is a `paynow` PaymentMethod, this hash contains details about the PayNow payment method. PayNow *SetupIntentPaymentMethodDataPayNowParams `form:"paynow"` + // If this is a `promptpay` PaymentMethod, this hash contains details about the PromptPay payment method. + PromptPay *SetupIntentPaymentMethodDataPromptPayParams `form:"promptpay"` // Options to configure Radar. See [Radar Session](https://stripe.com/docs/radar/radar-session) for more information. RadarOptions *SetupIntentPaymentMethodDataRadarOptionsParams `form:"radar_options"` // If this is a `sepa_debit` PaymentMethod, this hash contains details about the SEPA debit bank account. @@ -752,6 +757,9 @@ type SetupIntentConfirmPaymentMethodDataP24Params struct { // If this is a `paynow` PaymentMethod, this hash contains details about the PayNow payment method. type SetupIntentConfirmPaymentMethodDataPayNowParams struct{} +// If this is a `promptpay` PaymentMethod, this hash contains details about the PromptPay payment method. +type SetupIntentConfirmPaymentMethodDataPromptPayParams struct{} + // Options to configure Radar. See [Radar Session](https://stripe.com/docs/radar/radar-session) for more information. type SetupIntentConfirmPaymentMethodDataRadarOptionsParams struct { // A [Radar Session](https://stripe.com/docs/radar/radar-session) is a snapshot of the browser metadata and device details that help Radar make more accurate predictions on your payments. @@ -836,6 +844,8 @@ type SetupIntentConfirmPaymentMethodDataParams struct { P24 *SetupIntentConfirmPaymentMethodDataP24Params `form:"p24"` // If this is a `paynow` PaymentMethod, this hash contains details about the PayNow payment method. PayNow *SetupIntentConfirmPaymentMethodDataPayNowParams `form:"paynow"` + // If this is a `promptpay` PaymentMethod, this hash contains details about the PromptPay payment method. + PromptPay *SetupIntentConfirmPaymentMethodDataPromptPayParams `form:"promptpay"` // Options to configure Radar. See [Radar Session](https://stripe.com/docs/radar/radar-session) for more information. RadarOptions *SetupIntentConfirmPaymentMethodDataRadarOptionsParams `form:"radar_options"` // If this is a `sepa_debit` PaymentMethod, this hash contains details about the SEPA debit bank account. diff --git a/sub.go b/sub.go index 8ac1d53ce1..993f35081a 100644 --- a/sub.go +++ b/sub.go @@ -116,6 +116,7 @@ const ( SubscriptionPaymentSettingsPaymentMethodTypeKonbini SubscriptionPaymentSettingsPaymentMethodType = "konbini" SubscriptionPaymentSettingsPaymentMethodTypeLink SubscriptionPaymentSettingsPaymentMethodType = "link" SubscriptionPaymentSettingsPaymentMethodTypePayNow SubscriptionPaymentSettingsPaymentMethodType = "paynow" + SubscriptionPaymentSettingsPaymentMethodTypePromptPay SubscriptionPaymentSettingsPaymentMethodType = "promptpay" SubscriptionPaymentSettingsPaymentMethodTypeSepaCreditTransfer SubscriptionPaymentSettingsPaymentMethodType = "sepa_credit_transfer" SubscriptionPaymentSettingsPaymentMethodTypeSepaDebit SubscriptionPaymentSettingsPaymentMethodType = "sepa_debit" SubscriptionPaymentSettingsPaymentMethodTypeSofort SubscriptionPaymentSettingsPaymentMethodType = "sofort" diff --git a/treasury_receivedcredit.go b/treasury_receivedcredit.go index 2fa10c0bc6..e39702bed0 100644 --- a/treasury_receivedcredit.go +++ b/treasury_receivedcredit.go @@ -66,6 +66,18 @@ const ( TreasuryReceivedCreditNetworkUSDomesticWire TreasuryReceivedCreditNetwork = "us_domestic_wire" ) +// Set if a ReceivedCredit cannot be reversed. +type TreasuryReceivedCreditReversalDetailsRestrictedReason string + +// List of values that TreasuryReceivedCreditReversalDetailsRestrictedReason can take +const ( + TreasuryReceivedCreditReversalDetailsRestrictedReasonAlreadyReversed TreasuryReceivedCreditReversalDetailsRestrictedReason = "already_reversed" + TreasuryReceivedCreditReversalDetailsRestrictedReasonDeadlinePassed TreasuryReceivedCreditReversalDetailsRestrictedReason = "deadline_passed" + TreasuryReceivedCreditReversalDetailsRestrictedReasonNetworkRestricted TreasuryReceivedCreditReversalDetailsRestrictedReason = "network_restricted" + TreasuryReceivedCreditReversalDetailsRestrictedReasonOther TreasuryReceivedCreditReversalDetailsRestrictedReason = "other" + TreasuryReceivedCreditReversalDetailsRestrictedReasonSourceFlowRestricted TreasuryReceivedCreditReversalDetailsRestrictedReason = "source_flow_restricted" +) + // Status of the ReceivedCredit. ReceivedCredits are created either `succeeded` (approved) or `failed` (declined). If a ReceivedCredit is declined, the failure reason can be found in the `failure_code` field. type TreasuryReceivedCreditStatus string @@ -164,6 +176,14 @@ type TreasuryReceivedCreditLinkedFlows struct { SourceFlowType string `json:"source_flow_type"` } +// Details describing when a ReceivedCredit may be reversed. +type TreasuryReceivedCreditReversalDetails struct { + // Time before which a ReceivedCredit can be reversed. + Deadline int64 `json:"deadline"` + // Set if a ReceivedCredit cannot be reversed. + RestrictedReason TreasuryReceivedCreditReversalDetailsRestrictedReason `json:"restricted_reason"` +} + // ReceivedCredits represent funds sent to a [FinancialAccount](https://stripe.com/docs/api#financial_accounts) (for example, via ACH or wire). These money movements are not initiated from the FinancialAccount. type TreasuryReceivedCredit struct { APIResource @@ -189,6 +209,8 @@ type TreasuryReceivedCredit struct { Network TreasuryReceivedCreditNetwork `json:"network"` // String representing the object's type. Objects of the same type share the same value. Object string `json:"object"` + // Details describing when a ReceivedCredit may be reversed. + ReversalDetails *TreasuryReceivedCreditReversalDetails `json:"reversal_details"` // Status of the ReceivedCredit. ReceivedCredits are created either `succeeded` (approved) or `failed` (declined). If a ReceivedCredit is declined, the failure reason can be found in the `failure_code` field. Status TreasuryReceivedCreditStatus `json:"status"` // The Transaction associated with this object. diff --git a/treasury_receiveddebit.go b/treasury_receiveddebit.go index 351b006020..23632dd3e0 100644 --- a/treasury_receiveddebit.go +++ b/treasury_receiveddebit.go @@ -55,6 +55,18 @@ const ( TreasuryReceivedDebitNetworkStripe TreasuryReceivedDebitNetwork = "stripe" ) +// Set if a ReceivedDebit can't be reversed. +type TreasuryReceivedDebitReversalDetailsRestrictedReason string + +// List of values that TreasuryReceivedDebitReversalDetailsRestrictedReason can take +const ( + TreasuryReceivedDebitReversalDetailsRestrictedReasonAlreadyReversed TreasuryReceivedDebitReversalDetailsRestrictedReason = "already_reversed" + TreasuryReceivedDebitReversalDetailsRestrictedReasonDeadlinePassed TreasuryReceivedDebitReversalDetailsRestrictedReason = "deadline_passed" + TreasuryReceivedDebitReversalDetailsRestrictedReasonNetworkRestricted TreasuryReceivedDebitReversalDetailsRestrictedReason = "network_restricted" + TreasuryReceivedDebitReversalDetailsRestrictedReasonOther TreasuryReceivedDebitReversalDetailsRestrictedReason = "other" + TreasuryReceivedDebitReversalDetailsRestrictedReasonSourceFlowRestricted TreasuryReceivedDebitReversalDetailsRestrictedReason = "source_flow_restricted" +) + // Status of the ReceivedDebit. ReceivedDebits are created with a status of either `succeeded` (approved) or `failed` (declined). The failure reason can be found under the `failure_code`. type TreasuryReceivedDebitStatus string @@ -110,6 +122,8 @@ type TreasuryReceivedDebitInitiatingPaymentMethodDetails struct { USBankAccount *TreasuryReceivedDebitInitiatingPaymentMethodDetailsUSBankAccount `json:"us_bank_account"` } type TreasuryReceivedDebitLinkedFlows struct { + // The DebitReversal created as a result of this ReceivedDebit being reversed. + DebitReversal string `json:"debit_reversal"` // Set if the ReceivedDebit is associated with an InboundTransfer's return of funds. InboundTransfer string `json:"inbound_transfer"` // Set if the ReceivedDebit was created due to an [Issuing Authorization](https://stripe.com/docs/api#issuing_authorizations) object. @@ -118,6 +132,14 @@ type TreasuryReceivedDebitLinkedFlows struct { IssuingTransaction string `json:"issuing_transaction"` } +// Details describing when a ReceivedDebit might be reversed. +type TreasuryReceivedDebitReversalDetails struct { + // Time before which a ReceivedDebit can be reversed. + Deadline int64 `json:"deadline"` + // Set if a ReceivedDebit can't be reversed. + RestrictedReason TreasuryReceivedDebitReversalDetailsRestrictedReason `json:"restricted_reason"` +} + // ReceivedDebits represent funds pulled from a [FinancialAccount](https://stripe.com/docs/api#financial_accounts). These are not initiated from the FinancialAccount. type TreasuryReceivedDebit struct { APIResource @@ -143,6 +165,8 @@ type TreasuryReceivedDebit struct { Network TreasuryReceivedDebitNetwork `json:"network"` // String representing the object's type. Objects of the same type share the same value. Object string `json:"object"` + // Details describing when a ReceivedDebit might be reversed. + ReversalDetails *TreasuryReceivedDebitReversalDetails `json:"reversal_details"` // Status of the ReceivedDebit. ReceivedDebits are created with a status of either `succeeded` (approved) or `failed` (declined). The failure reason can be found under the `failure_code`. Status TreasuryReceivedDebitStatus `json:"status"` // The Transaction associated with this object. From af8d3f6d04f1b38cc8c74ada13579153d117ed17 Mon Sep 17 00:00:00 2001 From: Dominic Charley-Roy <78050200+dcr-stripe@users.noreply.github.com> Date: Thu, 23 Jun 2022 12:37:20 -0400 Subject: [PATCH 06/17] API Updates (#1484) --- OPENAPI_VERSION | 2 +- paymentintent.go | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index e575469dcb..08f46537f5 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v159 \ No newline at end of file +v160 \ No newline at end of file diff --git a/paymentintent.go b/paymentintent.go index 69d5edfda3..f962e6a61c 100644 --- a/paymentintent.go +++ b/paymentintent.go @@ -1521,6 +1521,8 @@ type PaymentIntentConfirmRadarOptionsParams struct { // to learn more about manual confirmation. type PaymentIntentConfirmParams struct { Params `form:"*"` + // Controls when the funds will be captured from the customer's account. + CaptureMethod *string `form:"capture_method"` // Set to `true` to fail the payment attempt if the PaymentIntent transitions into `requires_action`. This parameter is intended for simpler integrations that do not handle customer actions, like [saving cards without authentication](https://stripe.com/docs/payments/save-card-without-authentication). ErrorOnRequiresAction *bool `form:"error_on_requires_action"` // ID of the mandate to be used for this payment. From 522b51fcb699b74c7683ea030bcc0b4ac7b6b9ad Mon Sep 17 00:00:00 2001 From: Dominic Charley-Roy Date: Thu, 23 Jun 2022 13:19:47 -0400 Subject: [PATCH 07/17] Bump version to 72.116.0 --- CHANGELOG.md | 17 +++++++++++++++++ VERSION | 2 +- stripe.go | 2 +- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2fe2d17781..96b488e4cc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,22 @@ # Changelog +## 72.116.0 - 2022-06-23 +* [#1484](https://github.com/stripe/stripe-go/pull/1484) API Updates + * Add support for `CaptureMethod` on `PaymentIntentConfirmParams` and `PaymentIntentParams` +* [#1481](https://github.com/stripe/stripe-go/pull/1481) API Updates + * Add support for `PromptPayPayments` on `AccountCapabilitiesParams` and `AccountCapabilities` + * Add support for `PromptPay` on `ChargePaymentMethodDetails`, `PaymentIntentConfirmPaymentMethodDataParams`, `PaymentIntentConfirmPaymentMethodOptionsParams`, `PaymentIntentPaymentMethodDataParams`, `PaymentIntentPaymentMethodOptionsParams`, `PaymentIntentPaymentMethodOptions`, `PaymentMethodParams`, `PaymentMethod`, `SetupIntentConfirmPaymentMethodDataParams`, and `SetupIntentPaymentMethodDataParams` + * Add support for `SubtotalExcludingTax` on `CreditNote` and `Invoice` + * Add support for `AmountExcludingTax` and `UnitAmountExcludingTax` on `CreditNoteLineItem` and `InvoiceLineItem` + * Add support for `RenderingOptions` on `InvoiceParams` + * Add support for `TotalExcludingTax` on `Invoice` + * Add support for new value `promptpay` on enums `InvoicePaymentSettingsPaymentMethodTypes` and `SubscriptionPaymentSettingsPaymentMethodTypes` + * Add support for `AutomaticPaymentMethods` on `OrderPaymentSettings` + * Add support for `PromptPayDisplayQRCode` on `PaymentIntentNextAction` + * Add support for new value `promptpay` on enum `PaymentMethodType` + +* [#1482](https://github.com/stripe/stripe-go/pull/1482) Use the generated API version + ## 72.115.0 - 2022-06-17 * [#1477](https://github.com/stripe/stripe-go/pull/1477) API Updates * Add support for `FundCashBalance` test helper method on resource `Customer` diff --git a/VERSION b/VERSION index e74ce3594d..13bcfd1cb2 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -72.115.0 +72.116.0 diff --git a/stripe.go b/stripe.go index decec37623..75bceea7d9 100644 --- a/stripe.go +++ b/stripe.go @@ -1203,7 +1203,7 @@ func StringSlice(v []string) []*string { // // clientversion is the binding version -const clientversion = "72.115.0" +const clientversion = "72.116.0" // defaultHTTPTimeout is the default timeout on the http.Client used by the library. // This is chosen to be consistent with the other Stripe language libraries and From 53a10eb652ea4949e2cecd6260312d4ae861f4d0 Mon Sep 17 00:00:00 2001 From: rmanzer-stripe <93411628+rmanzer-stripe@users.noreply.github.com> Date: Mon, 27 Jun 2022 14:17:57 -0700 Subject: [PATCH 08/17] Document use of undocumented parameters/properties (#1483) * Document use of undocumented parameters/properties * Correcting function call Copied over the dotnet function (i think). Resolving that error. * Update README.md Co-authored-by: Dominic Charley-Roy <78050200+dcr-stripe@users.noreply.github.com> * Update README.md Co-authored-by: Dominic Charley-Roy <78050200+dcr-stripe@users.noreply.github.com> Co-authored-by: Dominic Charley-Roy <78050200+dcr-stripe@users.noreply.github.com> --- README.md | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/README.md b/README.md index f89c3cf487..da7251a9e0 100644 --- a/README.md +++ b/README.md @@ -370,7 +370,47 @@ c, _ := charge.Retrieve("ch_123", p) c.Customer.ID // ID is still available c.Customer.Name // Name is now also available (if it had a value) ``` +### How to use undocumented parameters and properties +stripe-go is a typed library and it supports all public properties or parameters. + +Stripe sometimes launches private beta features which introduce new properties or parameters that are not immediately public. These will not have typed accessors in the stripe-go library but can still be used. + +#### Parameters + +To pass undocumented parameters to Stripe using stripe-go you need to use the `AddExtra()` method, as shown below: + +```go + + params := &stripe.CustomerParams{ + Email: stripe.String("jenny.rosen@example.com") + } + + params.AddExtra("secret_feature_enabled", "true") + params.AddExtra("secret_parameter[primary]","primary value") + params.AddExtra("secret_parameter[secondary]","secondary value") + + customer, err := customer.Create(params) +``` + +#### Properties + +You can access undocumented properties returned by Stripe by querying the raw response JSON object. An example of this is shown below: + +```go +customer, _ = customer.Get("cus_1234", nil); + +var rawData map[string]interface{} +_ = json.Unmarshal(customer.LastResponse.RawJSON, &rawData) + +secret_feature_enabled, _ := string(rawData["secret_feature_enabled"].(bool)) + +secret_parameter, ok := rawData["secret_parameter"].(map[string]interface{}) +if ok { + primary := secret_parameter["primary"].(string) + seconardy := secret_parameter["secondary"].(string) +} +``` ### Writing a Plugin If you're writing a plugin that uses the library, we'd appreciate it if you From dcb4734d6a4fd10f9415d3d447445a39eebed26a Mon Sep 17 00:00:00 2001 From: Kamil Pajdzik <99290280+kamil-stripe@users.noreply.github.com> Date: Tue, 28 Jun 2022 15:08:57 -0700 Subject: [PATCH 09/17] Add feature/** and release/** to PR CI triggers (#1486) * Add feature/** and release/** to PR CI triggers * Remove extra stuff * Rename release to sdk-release in CI triggers --- .github/workflows/ci.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b82082a9b8..16df63fef6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,10 +5,14 @@ on: branches: - master - beta + - sdk-release/** + - feature/** pull_request: branches: - master - beta + - sdk-release/** + - feature/** jobs: lint: From 36a12a045843624d13bae3d6d92cb77c9d49255b Mon Sep 17 00:00:00 2001 From: Dominic Charley-Roy <78050200+dcr-stripe@users.noreply.github.com> Date: Wed, 29 Jun 2022 17:30:42 -0400 Subject: [PATCH 10/17] API Updates (#1487) --- checkout_session.go | 4 +- client/api.go | 4 + example/generated_examples_test.go | 2755 ++++++++++++++-------------- invoice.go | 4 +- paymentlink.go | 24 +- testhelpers/issuing/card/client.go | 88 + testhelpersissuing_card.go | 27 + treasury_receivedcredit.go | 4 +- treasury_receiveddebit.go | 2 + 9 files changed, 1550 insertions(+), 1362 deletions(-) create mode 100644 testhelpers/issuing/card/client.go create mode 100644 testhelpersissuing_card.go diff --git a/checkout_session.go b/checkout_session.go index 36d54bddd6..99bebb4b42 100644 --- a/checkout_session.go +++ b/checkout_session.go @@ -1348,7 +1348,7 @@ type CheckoutSessionCustomerDetailsTaxIDs struct { Value string `json:"value"` } -// The customer details including the customer's tax exempt status and the customer's tax IDs. Only present on Sessions in `payment` or `subscription` mode. +// The customer details including the customer's tax exempt status and the customer's tax IDs. Only the customer's email is present on Sessions in `setup` mode. type CheckoutSessionCustomerDetails struct { // The customer's address at the time of checkout. Note: This property is populated only for sessions on or after March 30, 2022. Address *Address `json:"address"` @@ -1711,7 +1711,7 @@ type CheckoutSession struct { Customer *Customer `json:"customer"` // Configure whether a Checkout Session creates a Customer when the Checkout Session completes. CustomerCreation CheckoutSessionCustomerCreation `json:"customer_creation"` - // The customer details including the customer's tax exempt status and the customer's tax IDs. Only present on Sessions in `payment` or `subscription` mode. + // The customer details including the customer's tax exempt status and the customer's tax IDs. Only the customer's email is present on Sessions in `setup` mode. CustomerDetails *CheckoutSessionCustomerDetails `json:"customer_details"` // If provided, this value will be used when the Customer object is created. // If not provided, customers will be asked to enter their email address. diff --git a/client/api.go b/client/api.go index 30022197b0..7a4628708a 100644 --- a/client/api.go +++ b/client/api.go @@ -89,6 +89,7 @@ import ( 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" + testhelpersissuingcard "github.com/stripe/stripe-go/v72/testhelpers/issuing/card" 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" @@ -277,6 +278,8 @@ type API struct { TerminalReaders *terminalreader.Client // TestHelpersCustomers is the client used to invoke /customers APIs. TestHelpersCustomers *testhelperscustomer.Client + // TestHelpersIssuingCards is the client used to invoke /issuing/cards APIs. + TestHelpersIssuingCards *testhelpersissuingcard.Client // TestHelpersRefunds is the client used to invoke /refunds APIs. TestHelpersRefunds *testhelpersrefund.Client // TestHelpersTerminalReaders is the client used to invoke /terminal/readers APIs. @@ -417,6 +420,7 @@ func (a *API) Init(key string, backends *stripe.Backends) { 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.TestHelpersIssuingCards = &testhelpersissuingcard.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} diff --git a/example/generated_examples_test.go b/example/generated_examples_test.go index a7e6aa15d1..b13b62fa9f 100644 --- a/example/generated_examples_test.go +++ b/example/generated_examples_test.go @@ -9,6 +9,7 @@ import ( account "github.com/stripe/stripe-go/v72/account" accountlink "github.com/stripe/stripe-go/v72/accountlink" apps_secret "github.com/stripe/stripe-go/v72/apps/secret" + balancetransaction "github.com/stripe/stripe-go/v72/balancetransaction" billingportal_configuration "github.com/stripe/stripe-go/v72/billingportal/configuration" billingportal_session "github.com/stripe/stripe-go/v72/billingportal/session" capability "github.com/stripe/stripe-go/v72/capability" @@ -61,6 +62,7 @@ import ( 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_issuing_card "github.com/stripe/stripe-go/v72/testhelpers/issuing/card" 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" @@ -85,6 +87,88 @@ import ( webhookendpoint "github.com/stripe/stripe-go/v72/webhookendpoint" ) +func TestAppsSecretList(t *testing.T) { + params := &stripe.AppsSecretListParams{ + Scope: &stripe.AppsSecretListScopeParams{ + Type: stripe.String(string(stripe.AppsSecretScopeTypeAccount)), + }, + } + params.Limit = stripe.Int64(2) + result := apps_secret.List(params) + assert.NotNil(t, result) + assert.Nil(t, result.Err()) +} + +func TestAppsSecretCreate(t *testing.T) { + params := &stripe.AppsSecretParams{ + Name: stripe.String("sec_123"), + Payload: stripe.String("very secret string"), + Scope: &stripe.AppsSecretScopeParams{ + Type: stripe.String(string(stripe.AppsSecretScopeTypeAccount)), + }, + } + result, _ := apps_secret.New(params) + assert.NotNil(t, result) +} + +func TestAppsSecretDeleteWhere(t *testing.T) { + params := &stripe.AppsSecretDeleteWhereParams{ + Name: stripe.String("my-api-key"), + Scope: &stripe.AppsSecretDeleteWhereScopeParams{ + Type: stripe.String(string(stripe.AppsSecretScopeTypeAccount)), + }, + } + result, _ := apps_secret.DeleteWhere(params) + assert.NotNil(t, result) +} + +func TestAppsSecretFind(t *testing.T) { + params := &stripe.AppsSecretFindParams{ + Name: stripe.String("sec_123"), + Scope: &stripe.AppsSecretFindScopeParams{ + Type: stripe.String(string(stripe.AppsSecretScopeTypeAccount)), + }, + } + result, _ := apps_secret.Find(params) + assert.NotNil(t, result) +} + +func TestCheckoutSessionExpire(t *testing.T) { + params := &stripe.CheckoutSessionExpireParams{} + result, _ := checkout_session.Expire("sess_xyz", params) + assert.NotNil(t, result) +} + +func TestCashBalanceRetrieve(t *testing.T) { + params := &stripe.CashBalanceParams{Customer: stripe.String("cus_123")} + result, _ := cashbalance.Get(params) + assert.NotNil(t, result) +} + +func TestCashBalanceUpdate(t *testing.T) { + params := &stripe.CashBalanceParams{ + Settings: &stripe.CashBalanceSettingsParams{ + ReconciliationMode: stripe.String(string(stripe.CashBalanceSettingsReconciliationModeManual)), + }, + Customer: stripe.String("cus_123"), + } + result, _ := cashbalance.Update(params) + assert.NotNil(t, result) +} + +func TestCustomerCreateFundingInstructions(t *testing.T) { + params := &stripe.CustomerCreateFundingInstructionsParams{ + BankTransfer: &stripe.CustomerCreateFundingInstructionsBankTransferParams{ + RequestedAddressTypes: []*string{stripe.String("zengin")}, + Type: stripe.String("jp_bank_transfer"), + }, + Currency: stripe.String(string(stripe.CurrencyUSD)), + FundingType: stripe.String("bank_transfer"), + } + result, _ := customer.CreateFundingInstructions("cus_123", params) + assert.NotNil(t, result) +} + func TestCustomerListPaymentMethods(t *testing.T) { params := &stripe.CustomerListPaymentMethodsParams{ Type: stripe.String("card"), @@ -95,30 +179,61 @@ func TestCustomerListPaymentMethods(t *testing.T) { assert.Nil(t, result.Err()) } -func TestCheckoutSessionExpire(t *testing.T) { - params := &stripe.CheckoutSessionExpireParams{} - result, _ := checkout_session.Expire("sess_xyz", params) +func TestFinancialConnectionsAccountList(t *testing.T) { + params := &stripe.FinancialConnectionsAccountListParams{} + result := financialconnections_account.List(params) assert.NotNil(t, result) + assert.Nil(t, result.Err()) } -func TestShippingRateCreate(t *testing.T) { - params := &stripe.ShippingRateParams{ - DisplayName: stripe.String("Sample Shipper"), - FixedAmount: &stripe.ShippingRateFixedAmountParams{ - Currency: stripe.String(string(stripe.CurrencyUSD)), - Amount: stripe.Int64(400), +func TestFinancialConnectionsAccountRetrieve(t *testing.T) { + params := &stripe.FinancialConnectionsAccountParams{} + result, _ := financialconnections_account.GetByID("fca_xyz", params) + assert.NotNil(t, result) +} + +func TestFinancialConnectionsAccountDisconnect(t *testing.T) { + params := &stripe.FinancialConnectionsAccountDisconnectParams{} + result, _ := financialconnections_account.Disconnect("fca_xyz", params) + assert.NotNil(t, result) +} + +func TestFinancialConnectionsAccountListOwners(t *testing.T) { + params := &stripe.FinancialConnectionsAccountListOwnersParams{ + Ownership: stripe.String("fcaowns_xyz"), + Account: stripe.String("fca_xyz"), + } + result := financialconnections_account.ListOwners(params) + assert.NotNil(t, result) + assert.Nil(t, result.Err()) +} + +func TestFinancialConnectionsAccountRefresh(t *testing.T) { + params := &stripe.FinancialConnectionsAccountRefreshParams{ + Features: []*string{stripe.String("balance")}, + } + result, _ := financialconnections_account.Refresh("fca_xyz", params) + assert.NotNil(t, result) +} + +func TestFinancialConnectionsSessionCreate(t *testing.T) { + params := &stripe.FinancialConnectionsSessionParams{ + AccountHolder: &stripe.FinancialConnectionsSessionAccountHolderParams{ + Type: stripe.String(string(stripe.FinancialConnectionsSessionAccountHolderTypeCustomer)), + Customer: stripe.String("cus_123"), + }, + Permissions: []*string{ + stripe.String(string(stripe.FinancialConnectionsSessionPermissionBalances)), }, - Type: stripe.String("fixed_amount"), } - result, _ := shippingrate.New(params) + result, _ := financialconnections_session.New(params) assert.NotNil(t, result) } -func TestShippingRateList(t *testing.T) { - params := &stripe.ShippingRateListParams{} - result := shippingrate.List(params) +func TestFinancialConnectionsSessionRetrieve(t *testing.T) { + params := &stripe.FinancialConnectionsSessionParams{} + result, _ := financialconnections_session.Get("fcsess_xyz", params) assert.NotNil(t, result) - assert.Nil(t, result.Err()) } func TestPaymentIntentCreate(t *testing.T) { @@ -133,6 +248,12 @@ func TestPaymentIntentCreate(t *testing.T) { assert.NotNil(t, result) } +func TestPaymentIntentVerifyMicrodeposits(t *testing.T) { + params := &stripe.PaymentIntentVerifyMicrodepositsParams{} + result, _ := paymentintent.VerifyMicrodeposits("pi_xxxxxxxxxxxxx", params) + assert.NotNil(t, result) +} + func TestPaymentLinkCreate(t *testing.T) { params := &stripe.PaymentLinkParams{ LineItems: []*stripe.PaymentLinkLineItemParams{ @@ -146,25 +267,19 @@ func TestPaymentLinkCreate(t *testing.T) { assert.NotNil(t, result) } -func TestPaymentLinkListLineItems(t *testing.T) { - params := &stripe.PaymentLinkListLineItemsParams{ - PaymentLink: stripe.String("pl_xyz"), - } - result := paymentlink.ListLineItems(params) - assert.NotNil(t, result) - assert.Nil(t, result.Err()) -} - func TestPaymentLinkRetrieve(t *testing.T) { params := &stripe.PaymentLinkParams{} result, _ := paymentlink.Get("pl_xyz", params) assert.NotNil(t, result) } -func TestPaymentIntentVerifyMicrodeposits(t *testing.T) { - params := &stripe.PaymentIntentVerifyMicrodepositsParams{} - result, _ := paymentintent.VerifyMicrodeposits("pi_xxxxxxxxxxxxx", params) +func TestPaymentLinkListLineItems(t *testing.T) { + params := &stripe.PaymentLinkListLineItemsParams{ + PaymentLink: stripe.String("pl_xyz"), + } + result := paymentlink.ListLineItems(params) assert.NotNil(t, result) + assert.Nil(t, result.Err()) } func TestSetupIntentVerifyMicrodeposits(t *testing.T) { @@ -173,52 +288,23 @@ func TestSetupIntentVerifyMicrodeposits(t *testing.T) { assert.NotNil(t, result) } -func TestTestHelpersTestClockCreate(t *testing.T) { - params := &stripe.TestHelpersTestClockParams{ - FrozenTime: stripe.Int64(123), - Name: stripe.String("cogsworth"), - } - result, _ := testhelpers_testclock.New(params) - assert.NotNil(t, result) -} - -func TestTestHelpersTestClockRetrieve(t *testing.T) { - params := &stripe.TestHelpersTestClockParams{} - result, _ := testhelpers_testclock.Get("clock_xyz", params) - assert.NotNil(t, result) -} - -func TestTestHelpersTestClockList(t *testing.T) { - params := &stripe.TestHelpersTestClockListParams{} - result := testhelpers_testclock.List(params) +func TestShippingRateList(t *testing.T) { + params := &stripe.ShippingRateListParams{} + result := shippingrate.List(params) assert.NotNil(t, result) assert.Nil(t, result.Err()) } -func TestTestHelpersTestClockDelete(t *testing.T) { - params := &stripe.TestHelpersTestClockParams{} - result, _ := testhelpers_testclock.Del("clock_xyz", params) - assert.NotNil(t, result) -} - -func TestTestHelpersTestClockAdvance(t *testing.T) { - params := &stripe.TestHelpersTestClockAdvanceParams{ - FrozenTime: stripe.Int64(142), - } - result, _ := testhelpers_testclock.Advance("clock_xyz", params) - assert.NotNil(t, result) -} - -func TestCustomerCreateFundingInstructions(t *testing.T) { - params := &stripe.CustomerCreateFundingInstructionsParams{ - BankTransfer: &stripe.CustomerCreateFundingInstructionsBankTransferParams{ - RequestedAddressTypes: []*string{stripe.String("zengin")}, - Type: stripe.String("jp_bank_transfer"), +func TestShippingRateCreate(t *testing.T) { + params := &stripe.ShippingRateParams{ + DisplayName: stripe.String("Sample Shipper"), + FixedAmount: &stripe.ShippingRateFixedAmountParams{ + Currency: stripe.String(string(stripe.CurrencyUSD)), + Amount: stripe.Int64(400), }, - Currency: stripe.String(string(stripe.CurrencyUSD)), - FundingType: stripe.String("bank_transfer"), + Type: stripe.String("fixed_amount"), } - result, _ := customer.CreateFundingInstructions("cus_123", params) + result, _ := shippingrate.New(params) assert.NotNil(t, result) } @@ -229,15 +315,21 @@ func TestTerminalConfigurationList(t *testing.T) { assert.Nil(t, result.Err()) } -func TestTerminalConfigurationRetrieve(t *testing.T) { +func TestTerminalConfigurationCreate(t *testing.T) { params := &stripe.TerminalConfigurationParams{} - result, _ := terminal_configuration.Get("uc_123", params) + result, _ := terminal_configuration.New(params) assert.NotNil(t, result) } -func TestTerminalConfigurationCreate(t *testing.T) { +func TestTerminalConfigurationDelete(t *testing.T) { params := &stripe.TerminalConfigurationParams{} - result, _ := terminal_configuration.New(params) + result, _ := terminal_configuration.Del("uc_123", params) + assert.NotNil(t, result) +} + +func TestTerminalConfigurationRetrieve(t *testing.T) { + params := &stripe.TerminalConfigurationParams{} + result, _ := terminal_configuration.Get("uc_123", params) assert.NotNil(t, result) } @@ -253,9 +345,12 @@ func TestTerminalConfigurationUpdate(t *testing.T) { assert.NotNil(t, result) } -func TestTerminalConfigurationDelete(t *testing.T) { - params := &stripe.TerminalConfigurationParams{} - result, _ := terminal_configuration.Del("uc_123", params) +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) } @@ -265,61 +360,40 @@ func TestTestHelpersRefundExpire(t *testing.T) { assert.NotNil(t, result) } -func TestFinancialConnectionsAccountRetrieve(t *testing.T) { - params := &stripe.FinancialConnectionsAccountParams{} - result, _ := financialconnections_account.GetByID("fca_xyz", params) +func TestTestHelpersTestClockList(t *testing.T) { + params := &stripe.TestHelpersTestClockListParams{} + result := testhelpers_testclock.List(params) assert.NotNil(t, result) + assert.Nil(t, result.Err()) } -func TestFinancialConnectionsAccountRefresh(t *testing.T) { - params := &stripe.FinancialConnectionsAccountRefreshParams{ - Features: []*string{stripe.String("balance")}, +func TestTestHelpersTestClockCreate(t *testing.T) { + params := &stripe.TestHelpersTestClockParams{ + FrozenTime: stripe.Int64(123), + Name: stripe.String("cogsworth"), } - result, _ := financialconnections_account.Refresh("fca_xyz", params) + result, _ := testhelpers_testclock.New(params) assert.NotNil(t, result) } -func TestFinancialConnectionsAccountDisconnect(t *testing.T) { - params := &stripe.FinancialConnectionsAccountDisconnectParams{} - result, _ := financialconnections_account.Disconnect("fca_xyz", params) - assert.NotNil(t, result) -} - -func TestFinancialConnectionsSessionCreate(t *testing.T) { - params := &stripe.FinancialConnectionsSessionParams{ - AccountHolder: &stripe.FinancialConnectionsSessionAccountHolderParams{ - Type: stripe.String(string(stripe.FinancialConnectionsSessionAccountHolderTypeCustomer)), - Customer: stripe.String("cus_123"), - }, - Permissions: []*string{ - stripe.String(string(stripe.FinancialConnectionsSessionPermissionBalances)), - }, - } - result, _ := financialconnections_session.New(params) - assert.NotNil(t, result) -} - -func TestFinancialConnectionsSessionRetrieve(t *testing.T) { - params := &stripe.FinancialConnectionsSessionParams{} - result, _ := financialconnections_session.Get("fcsess_xyz", params) +func TestTestHelpersTestClockDelete(t *testing.T) { + params := &stripe.TestHelpersTestClockParams{} + result, _ := testhelpers_testclock.Del("clock_xyz", params) assert.NotNil(t, result) } -func TestFinancialConnectionsAccountList(t *testing.T) { - params := &stripe.FinancialConnectionsAccountListParams{} - result := financialconnections_account.List(params) +func TestTestHelpersTestClockRetrieve(t *testing.T) { + params := &stripe.TestHelpersTestClockParams{} + result, _ := testhelpers_testclock.Get("clock_xyz", params) assert.NotNil(t, result) - assert.Nil(t, result.Err()) } -func TestFinancialConnectionsAccountListOwners(t *testing.T) { - params := &stripe.FinancialConnectionsAccountListOwnersParams{ - Ownership: stripe.String("fcaowns_xyz"), - Account: stripe.String("fca_xyz"), +func TestTestHelpersTestClockAdvance(t *testing.T) { + params := &stripe.TestHelpersTestClockAdvanceParams{ + FrozenTime: stripe.Int64(142), } - result := financialconnections_account.ListOwners(params) + result, _ := testhelpers_testclock.Advance("clock_xyz", params) assert.NotNil(t, result) - assert.Nil(t, result.Err()) } func TestTestHelpersTreasuryInboundTransferFail(t *testing.T) { @@ -347,18 +421,18 @@ func TestTestHelpersTreasuryInboundTransferSucceed(t *testing.T) { assert.NotNil(t, result) } -func TestTestHelpersTreasuryOutboundTransferPost(t *testing.T) { - params := &stripe.TestHelpersTreasuryOutboundTransferPostParams{} - result, _ := testhelpers_treasury_outboundtransfer.Post("obt_123", params) - assert.NotNil(t, result) -} - func TestTestHelpersTreasuryOutboundTransferFail(t *testing.T) { params := &stripe.TestHelpersTreasuryOutboundTransferFailParams{} result, _ := testhelpers_treasury_outboundtransfer.Fail("obt_123", params) assert.NotNil(t, result) } +func TestTestHelpersTreasuryOutboundTransferPost(t *testing.T) { + params := &stripe.TestHelpersTreasuryOutboundTransferPostParams{} + result, _ := testhelpers_treasury_outboundtransfer.Post("obt_123", params) + assert.NotNil(t, result) +} + func TestTestHelpersTreasuryOutboundTransferReturnOutboundTransfer( t *testing.T, ) { @@ -396,452 +470,434 @@ func TestTestHelpersTreasuryReceivedDebitCreate(t *testing.T) { assert.NotNil(t, result) } -func TestAppsSecretCreate(t *testing.T) { - params := &stripe.AppsSecretParams{ - Name: stripe.String("sec_123"), - Payload: stripe.String("very secret string"), - Scope: &stripe.AppsSecretScopeParams{ - Type: stripe.String(string(stripe.AppsSecretScopeTypeAccount)), - }, +func TestSetupAttemptList(t *testing.T) { + params := &stripe.SetupAttemptListParams{ + SetupIntent: stripe.String("si_xyz"), } - result, _ := apps_secret.New(params) + params.Limit = stripe.Int64(3) + result := setupattempt.List(params) assert.NotNil(t, result) + assert.Nil(t, result.Err()) } -func TestAppsSecretFind(t *testing.T) { - params := &stripe.AppsSecretFindParams{ - Name: stripe.String("sec_123"), - Scope: &stripe.AppsSecretFindScopeParams{ - Type: stripe.String(string(stripe.AppsSecretScopeTypeAccount)), - }, - } - result, _ := apps_secret.Find(params) +func TestTestHelpersIssuingCardDeliverCard(t *testing.T) { + params := &stripe.TestHelpersIssuingCardDeliverCardParams{} + result, _ := testhelpers_issuing_card.DeliverCard("card_123", params) assert.NotNil(t, result) } -func TestAppsSecretDeleteWhere(t *testing.T) { - params := &stripe.AppsSecretDeleteWhereParams{ - Name: stripe.String("sec_123"), - Scope: &stripe.AppsSecretDeleteWhereScopeParams{ - Type: stripe.String(string(stripe.AppsSecretScopeTypeAccount)), - }, - } - result, _ := apps_secret.DeleteWhere(params) +func TestTestHelpersIssuingCardFailCard(t *testing.T) { + params := &stripe.TestHelpersIssuingCardFailCardParams{} + result, _ := testhelpers_issuing_card.FailCard("card_123", params) assert.NotNil(t, result) } -func TestCashBalanceRetrieve(t *testing.T) { - params := &stripe.CashBalanceParams{Customer: stripe.String("cus_123")} - result, _ := cashbalance.Get(params) +func TestTestHelpersIssuingCardReturnCard(t *testing.T) { + params := &stripe.TestHelpersIssuingCardReturnCardParams{} + result, _ := testhelpers_issuing_card.ReturnCard("card_123", params) assert.NotNil(t, result) } -func TestCashBalanceUpdate(t *testing.T) { - params := &stripe.CashBalanceParams{ - Settings: &stripe.CashBalanceSettingsParams{ - ReconciliationMode: stripe.String(string(stripe.CashBalanceSettingsReconciliationModeManual)), - }, - Customer: stripe.String("cus_123"), - } - result, _ := cashbalance.Update(params) +func TestTestHelpersIssuingCardShipCard(t *testing.T) { + params := &stripe.TestHelpersIssuingCardShipCardParams{} + result, _ := testhelpers_issuing_card.ShipCard("card_123", params) assert.NotNil(t, result) } -func TestTestHelpersCustomerFundCashBalance(t *testing.T) { - params := &stripe.TestHelpersCustomerFundCashBalanceParams{ - Amount: stripe.Int64(30), - Currency: stripe.String(string(stripe.CurrencyEUR)), +func TestAccountLinkCreate(t *testing.T) { + params := &stripe.AccountLinkParams{ + Account: stripe.String("acct_xxxxxxxxxxxxx"), + RefreshURL: stripe.String("https://example.com/reauth"), + ReturnURL: stripe.String("https://example.com/return"), + Type: stripe.String("account_onboarding"), } - result, _ := testhelpers_customer.FundCashBalance("cus_123", params) + result, _ := accountlink.New(params) assert.NotNil(t, result) } -func TestCustomerList(t *testing.T) { - params := &stripe.CustomerListParams{} +func TestAccountList(t *testing.T) { + params := &stripe.AccountListParams{} params.Limit = stripe.Int64(3) - result := customer.List(params) + result := account.List(params) assert.NotNil(t, result) assert.Nil(t, result.Err()) } -func TestCustomerSearch(t *testing.T) { - params := &stripe.CustomerSearchParams{ - SearchParams: stripe.SearchParams{ - Query: "name:'fakename' AND metadata['foo']:'bar'", +func TestAccountCreate(t *testing.T) { + params := &stripe.AccountParams{ + Type: stripe.String(string(stripe.AccountTypeCustom)), + Country: stripe.String("US"), + Email: stripe.String("jenny.rosen@example.com"), + Capabilities: &stripe.AccountCapabilitiesParams{ + CardPayments: &stripe.AccountCapabilitiesCardPaymentsParams{ + Requested: stripe.Bool(true), + }, + Transfers: &stripe.AccountCapabilitiesTransfersParams{ + Requested: stripe.Bool(true), + }, }, } - result := customer.Search(params) + result, _ := account.New(params) assert.NotNil(t, result) - assert.Nil(t, result.Err()) } -func TestChargeCreate(t *testing.T) { - params := &stripe.ChargeParams{ - Amount: stripe.Int64(2000), - Currency: stripe.String(string(stripe.CurrencyUSD)), - Source: &stripe.SourceParams{Token: stripe.String("tok_xxxx")}, - Description: stripe.String("My First Test Charge (created for API docs)"), - } - result, _ := charge.New(params) +func TestAccountDelete(t *testing.T) { + params := &stripe.AccountParams{} + result, _ := account.Del("acct_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestChargeRetrieve(t *testing.T) { - params := &stripe.ChargeParams{} - result, _ := charge.Get("ch_xxxxxxxxxxxxx", params) +func TestAccountRetrieve(t *testing.T) { + params := &stripe.AccountParams{} + result, _ := account.GetByID("acct_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestChargeUpdate(t *testing.T) { - params := &stripe.ChargeParams{} +func TestAccountUpdate(t *testing.T) { + params := &stripe.AccountParams{} params.AddMetadata("order_id", "6735") - result, _ := charge.Update("ch_xxxxxxxxxxxxx", params) - assert.NotNil(t, result) -} - -func TestChargeCapture(t *testing.T) { - params := &stripe.CaptureParams{} - result, _ := charge.Capture("ch_xxxxxxxxxxxxx", params) + result, _ := account.Update("acct_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestChargeList(t *testing.T) { - params := &stripe.ChargeListParams{} - params.Limit = stripe.Int64(3) - result := charge.List(params) +func TestAccountReject(t *testing.T) { + params := &stripe.AccountRejectParams{Reason: stripe.String("fraud")} + result, _ := account.Reject("acct_xxxxxxxxxxxxx", params) assert.NotNil(t, result) - assert.Nil(t, result.Err()) } -func TestChargeSearch(t *testing.T) { - params := &stripe.ChargeSearchParams{ - SearchParams: stripe.SearchParams{ - Query: "amount>999 AND metadata['order_id']:'6735'", - }, +func TestCapabilityList(t *testing.T) { + params := &stripe.CapabilityListParams{ + Account: stripe.String("acct_xxxxxxxxxxxxx"), } - result := charge.Search(params) + result := capability.List(params) assert.NotNil(t, result) assert.Nil(t, result.Err()) } -func TestCustomerCreate(t *testing.T) { - params := &stripe.CustomerParams{ - Description: stripe.String("My First Test Customer (created for API docs)"), +func TestCapabilityRetrieve(t *testing.T) { + params := &stripe.CapabilityParams{ + Account: stripe.String("acct_xxxxxxxxxxxxx"), } - result, _ := customer.New(params) - assert.NotNil(t, result) -} - -func TestCustomerRetrieve(t *testing.T) { - params := &stripe.CustomerParams{} - result, _ := customer.Get("cus_xxxxxxxxxxxxx", params) - assert.NotNil(t, result) -} - -func TestCustomerUpdate(t *testing.T) { - params := &stripe.CustomerParams{} - params.AddMetadata("order_id", "6735") - result, _ := customer.Update("cus_xxxxxxxxxxxxx", params) + result, _ := capability.Get("card_payments", params) assert.NotNil(t, result) } -func TestCustomerDelete(t *testing.T) { - params := &stripe.CustomerParams{} - result, _ := customer.Del("cus_xxxxxxxxxxxxx", params) +func TestCapabilityUpdate(t *testing.T) { + params := &stripe.CapabilityParams{ + Requested: stripe.Bool(true), + Account: stripe.String("acct_xxxxxxxxxxxxx"), + } + result, _ := capability.Update("card_payments", params) assert.NotNil(t, result) } -func TestCustomerList2(t *testing.T) { - params := &stripe.CustomerListParams{} +func TestPersonList(t *testing.T) { + params := &stripe.PersonListParams{ + Account: stripe.String("acct_xxxxxxxxxxxxx"), + } params.Limit = stripe.Int64(3) - result := customer.List(params) + result := person.List(params) assert.NotNil(t, result) assert.Nil(t, result.Err()) } -func TestCustomerSearch2(t *testing.T) { - params := &stripe.CustomerSearchParams{ - SearchParams: stripe.SearchParams{ - Query: "name:'fakename' AND metadata['foo']:'bar'", - }, +func TestPersonCreate(t *testing.T) { + params := &stripe.PersonParams{ + FirstName: stripe.String("Jane"), + LastName: stripe.String("Diaz"), } - result := customer.Search(params) - assert.NotNil(t, result) - assert.Nil(t, result.Err()) -} - -func TestDisputeRetrieve(t *testing.T) { - params := &stripe.DisputeParams{} - result, _ := dispute.Get("dp_xxxxxxxxxxxxx", params) + result, _ := person.New(params) assert.NotNil(t, result) } -func TestDisputeUpdate(t *testing.T) { - params := &stripe.DisputeParams{} +func TestPersonUpdate(t *testing.T) { + params := &stripe.PersonParams{Account: stripe.String("acct_xxxxxxxxxxxxx")} params.AddMetadata("order_id", "6735") - result, _ := dispute.Update("dp_xxxxxxxxxxxxx", params) + result, _ := person.Update("person_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestDisputeClose(t *testing.T) { - params := &stripe.DisputeParams{} - result, _ := dispute.Close("dp_xxxxxxxxxxxxx", params) +func TestAppsSecretCreate2(t *testing.T) { + params := &stripe.AppsSecretParams{ + Name: stripe.String("my-api-key"), + Payload: stripe.String("secret_key_xxxxxx"), + Scope: &stripe.AppsSecretScopeParams{ + Type: stripe.String(string(stripe.AppsSecretScopeTypeAccount)), + }, + } + result, _ := apps_secret.New(params) assert.NotNil(t, result) } -func TestDisputeList(t *testing.T) { - params := &stripe.DisputeListParams{} +func TestBalanceTransactionList(t *testing.T) { + params := &stripe.BalanceTransactionListParams{} params.Limit = stripe.Int64(3) - result := dispute.List(params) + result := balancetransaction.List(params) assert.NotNil(t, result) assert.Nil(t, result.Err()) } -func TestEventRetrieve(t *testing.T) { - params := &stripe.EventParams{} - result, _ := event.Get("evt_xxxxxxxxxxxxx", params) +func TestBalanceTransactionRetrieve(t *testing.T) { + params := &stripe.BalanceTransactionParams{} + result, _ := balancetransaction.Get("txn_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestEventList(t *testing.T) { - params := &stripe.EventListParams{} +func TestBillingPortalConfigurationList(t *testing.T) { + params := &stripe.BillingPortalConfigurationListParams{} params.Limit = stripe.Int64(3) - result := event.List(params) + result := billingportal_configuration.List(params) assert.NotNil(t, result) assert.Nil(t, result.Err()) } -func TestMandateRetrieve(t *testing.T) { - params := &stripe.MandateParams{} - result, _ := mandate.Get("mandate_xxxxxxxxxxxxx", params) +func TestBillingPortalConfigurationCreate(t *testing.T) { + params := &stripe.BillingPortalConfigurationParams{ + Features: &stripe.BillingPortalConfigurationFeaturesParams{ + CustomerUpdate: &stripe.BillingPortalConfigurationFeaturesCustomerUpdateParams{ + AllowedUpdates: []*string{ + stripe.String(string(stripe.BillingPortalConfigurationFeaturesCustomerUpdateAllowedUpdateEmail)), + stripe.String(string(stripe.BillingPortalConfigurationFeaturesCustomerUpdateAllowedUpdateTaxID)), + }, + Enabled: stripe.Bool(true), + }, + InvoiceHistory: &stripe.BillingPortalConfigurationFeaturesInvoiceHistoryParams{ + Enabled: stripe.Bool(true), + }, + }, + BusinessProfile: &stripe.BillingPortalConfigurationBusinessProfileParams{ + PrivacyPolicyURL: stripe.String("https://example.com/privacy"), + TermsOfServiceURL: stripe.String("https://example.com/terms"), + }, + } + result, _ := billingportal_configuration.New(params) assert.NotNil(t, result) } -func TestPaymentIntentCreate2(t *testing.T) { - params := &stripe.PaymentIntentParams{ - Amount: stripe.Int64(2000), - Currency: stripe.String(string(stripe.CurrencyUSD)), - PaymentMethodTypes: []*string{stripe.String("card")}, - } - result, _ := paymentintent.New(params) +func TestBillingPortalConfigurationRetrieve(t *testing.T) { + params := &stripe.BillingPortalConfigurationParams{} + result, _ := billingportal_configuration.Get("bpc_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestPaymentIntentRetrieve(t *testing.T) { - params := &stripe.PaymentIntentParams{} - result, _ := paymentintent.Get("pi_xxxxxxxxxxxxx", params) +func TestBillingPortalConfigurationUpdate(t *testing.T) { + params := &stripe.BillingPortalConfigurationParams{ + BusinessProfile: &stripe.BillingPortalConfigurationBusinessProfileParams{ + PrivacyPolicyURL: stripe.String("https://example.com/privacy"), + TermsOfServiceURL: stripe.String("https://example.com/terms"), + }, + } + result, _ := billingportal_configuration.Update("bpc_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestPaymentIntentUpdate(t *testing.T) { - params := &stripe.PaymentIntentParams{} - params.AddMetadata("order_id", "6735") - result, _ := paymentintent.Update("pi_xxxxxxxxxxxxx", params) +func TestBillingPortalSessionCreate(t *testing.T) { + params := &stripe.BillingPortalSessionParams{ + Customer: stripe.String("cus_xxxxxxxxxxxxx"), + ReturnURL: stripe.String("https://example.com/account"), + } + result, _ := billingportal_session.New(params) assert.NotNil(t, result) } -func TestPaymentIntentConfirm(t *testing.T) { - params := &stripe.PaymentIntentConfirmParams{ - PaymentMethod: stripe.String("pm_card_visa"), - } - result, _ := paymentintent.Confirm("pi_xxxxxxxxxxxxx", params) +func TestChargeList(t *testing.T) { + params := &stripe.ChargeListParams{} + params.Limit = stripe.Int64(3) + result := charge.List(params) assert.NotNil(t, result) + assert.Nil(t, result.Err()) } -func TestPaymentIntentCapture(t *testing.T) { - params := &stripe.PaymentIntentCaptureParams{} - result, _ := paymentintent.Capture("pi_xxxxxxxxxxxxx", params) +func TestChargeCreate(t *testing.T) { + params := &stripe.ChargeParams{ + Amount: stripe.Int64(2000), + Currency: stripe.String(string(stripe.CurrencyUSD)), + Source: &stripe.SourceParams{Token: stripe.String("tok_xxxx")}, + Description: stripe.String("My First Test Charge (created for API docs)"), + } + result, _ := charge.New(params) assert.NotNil(t, result) } -func TestPaymentIntentCancel(t *testing.T) { - params := &stripe.PaymentIntentCancelParams{} - result, _ := paymentintent.Cancel("pi_xxxxxxxxxxxxx", params) +func TestChargeRetrieve(t *testing.T) { + params := &stripe.ChargeParams{} + result, _ := charge.Get("ch_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestPaymentIntentList(t *testing.T) { - params := &stripe.PaymentIntentListParams{} - params.Limit = stripe.Int64(3) - result := paymentintent.List(params) +func TestChargeUpdate(t *testing.T) { + params := &stripe.ChargeParams{} + params.AddMetadata("order_id", "6735") + result, _ := charge.Update("ch_xxxxxxxxxxxxx", params) assert.NotNil(t, result) - assert.Nil(t, result.Err()) } -func TestPaymentIntentIncrementAuthorization(t *testing.T) { - params := &stripe.PaymentIntentIncrementAuthorizationParams{ - Amount: stripe.Int64(2099), - } - result, _ := paymentintent.IncrementAuthorization("pi_xxxxxxxxxxxxx", params) +func TestChargeCapture(t *testing.T) { + params := &stripe.CaptureParams{} + result, _ := charge.Capture("ch_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestPaymentIntentSearch(t *testing.T) { - params := &stripe.PaymentIntentSearchParams{ +func TestChargeSearch(t *testing.T) { + params := &stripe.ChargeSearchParams{ SearchParams: stripe.SearchParams{ - Query: "status:'succeeded' AND metadata['order_id']:'6735'", + Query: "amount>999 AND metadata['order_id']:'6735'", }, } - result := paymentintent.Search(params) + result := charge.Search(params) assert.NotNil(t, result) assert.Nil(t, result.Err()) } -func TestPaymentIntentApplyCustomerBalance(t *testing.T) { - params := &stripe.PaymentIntentApplyCustomerBalanceParams{} - result, _ := paymentintent.ApplyCustomerBalance("pi_xxxxxxxxxxxxx", params) - assert.NotNil(t, result) -} - -func TestSetupIntentCreate(t *testing.T) { - params := &stripe.SetupIntentParams{ - PaymentMethodTypes: []*string{stripe.String("card")}, - } - result, _ := setupintent.New(params) +func TestCheckoutSessionList(t *testing.T) { + params := &stripe.CheckoutSessionListParams{} + params.Limit = stripe.Int64(3) + result := checkout_session.List(params) assert.NotNil(t, result) + assert.Nil(t, result.Err()) } -func TestSetupIntentRetrieve(t *testing.T) { - params := &stripe.SetupIntentParams{} - result, _ := setupintent.Get("seti_xxxxxxxxxxxxx", params) +func TestCheckoutSessionRetrieve(t *testing.T) { + params := &stripe.CheckoutSessionParams{} + result, _ := checkout_session.Get("cs_test_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestSetupIntentUpdate(t *testing.T) { - params := &stripe.SetupIntentParams{} - params.AddMetadata("user_id", "3435453") - result, _ := setupintent.Update("seti_xxxxxxxxxxxxx", params) +func TestCheckoutSessionExpire2(t *testing.T) { + params := &stripe.CheckoutSessionExpireParams{} + result, _ := checkout_session.Expire("cs_test_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestSetupIntentConfirm(t *testing.T) { - params := &stripe.SetupIntentConfirmParams{ - PaymentMethod: stripe.String("pm_card_visa"), - } - result, _ := setupintent.Confirm("seti_xxxxxxxxxxxxx", params) +func TestCountrySpecList(t *testing.T) { + params := &stripe.CountrySpecListParams{} + params.Limit = stripe.Int64(3) + result := countryspec.List(params) assert.NotNil(t, result) + assert.Nil(t, result.Err()) } -func TestSetupIntentCancel(t *testing.T) { - params := &stripe.SetupIntentCancelParams{} - result, _ := setupintent.Cancel("seti_xxxxxxxxxxxxx", params) +func TestCountrySpecRetrieve(t *testing.T) { + params := &stripe.CountrySpecParams{} + result, _ := countryspec.Get("US", params) assert.NotNil(t, result) } -func TestSetupIntentList(t *testing.T) { - params := &stripe.SetupIntentListParams{} +func TestCouponList(t *testing.T) { + params := &stripe.CouponListParams{} params.Limit = stripe.Int64(3) - result := setupintent.List(params) + result := coupon.List(params) assert.NotNil(t, result) assert.Nil(t, result.Err()) } -func TestSetupAttemptList(t *testing.T) { - params := &stripe.SetupAttemptListParams{ - SetupIntent: stripe.String("si_xyz"), +func TestCouponCreate(t *testing.T) { + params := &stripe.CouponParams{ + PercentOff: stripe.Float64(25.5), + Duration: stripe.String(string(stripe.CouponDurationRepeating)), + DurationInMonths: stripe.Int64(3), } - params.Limit = stripe.Int64(3) - result := setupattempt.List(params) + result, _ := coupon.New(params) assert.NotNil(t, result) - assert.Nil(t, result.Err()) } -func TestPayoutCreate(t *testing.T) { - params := &stripe.PayoutParams{ - Amount: stripe.Int64(1100), - Currency: stripe.String(string(stripe.CurrencyUSD)), - } - result, _ := payout.New(params) +func TestCouponDelete(t *testing.T) { + params := &stripe.CouponParams{} + result, _ := coupon.Del("Z4OV52SU", params) assert.NotNil(t, result) } -func TestPayoutRetrieve(t *testing.T) { - params := &stripe.PayoutParams{} - result, _ := payout.Get("po_xxxxxxxxxxxxx", params) +func TestCouponRetrieve(t *testing.T) { + params := &stripe.CouponParams{} + result, _ := coupon.Get("Z4OV52SU", params) assert.NotNil(t, result) } -func TestPayoutUpdate(t *testing.T) { - params := &stripe.PayoutParams{} +func TestCouponUpdate(t *testing.T) { + params := &stripe.CouponParams{} params.AddMetadata("order_id", "6735") - result, _ := payout.Update("po_xxxxxxxxxxxxx", params) + result, _ := coupon.Update("Z4OV52SU", params) assert.NotNil(t, result) } -func TestPayoutList(t *testing.T) { - params := &stripe.PayoutListParams{} +func TestCustomerList(t *testing.T) { + params := &stripe.CustomerListParams{} params.Limit = stripe.Int64(3) - result := payout.List(params) + result := customer.List(params) assert.NotNil(t, result) assert.Nil(t, result.Err()) } -func TestPayoutCancel(t *testing.T) { - params := &stripe.PayoutParams{} - result, _ := payout.Cancel("po_xxxxxxxxxxxxx", params) +func TestCustomerList2(t *testing.T) { + params := &stripe.CustomerListParams{} + params.Limit = stripe.Int64(3) + result := customer.List(params) assert.NotNil(t, result) + assert.Nil(t, result.Err()) } -func TestPayoutReverse(t *testing.T) { - params := &stripe.PayoutReverseParams{} - result, _ := payout.Reverse("po_xxxxxxxxxxxxx", params) +func TestCustomerCreate(t *testing.T) { + params := &stripe.CustomerParams{ + Description: stripe.String("My First Test Customer (created for API docs)"), + } + result, _ := customer.New(params) assert.NotNil(t, result) } -func TestRefundCreate(t *testing.T) { - params := &stripe.RefundParams{Charge: stripe.String("ch_xxxxxxxxxxxxx")} - result, _ := refund.New(params) +func TestCustomerDelete(t *testing.T) { + params := &stripe.CustomerParams{} + result, _ := customer.Del("cus_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestRefundRetrieve(t *testing.T) { - params := &stripe.RefundParams{} - result, _ := refund.Get("re_xxxxxxxxxxxxx", params) +func TestCustomerRetrieve(t *testing.T) { + params := &stripe.CustomerParams{} + result, _ := customer.Get("cus_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestRefundUpdate(t *testing.T) { - params := &stripe.RefundParams{} +func TestCustomerUpdate(t *testing.T) { + params := &stripe.CustomerParams{} params.AddMetadata("order_id", "6735") - result, _ := refund.Update("re_xxxxxxxxxxxxx", params) - assert.NotNil(t, result) -} - -func TestRefundCancel(t *testing.T) { - params := &stripe.RefundCancelParams{} - result, _ := refund.Cancel("re_xxxxxxxxxxxxx", params) + result, _ := customer.Update("cus_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestRefundList(t *testing.T) { - params := &stripe.RefundListParams{} +func TestCustomerBalanceTransactionList(t *testing.T) { + params := &stripe.CustomerBalanceTransactionListParams{ + Customer: stripe.String("cus_xxxxxxxxxxxxx"), + } params.Limit = stripe.Int64(3) - result := refund.List(params) + result := customerbalancetransaction.List(params) assert.NotNil(t, result) assert.Nil(t, result.Err()) } -func TestPaymentMethodRetrieve(t *testing.T) { - params := &stripe.PaymentMethodParams{} - result, _ := paymentmethod.Get("pm_xxxxxxxxxxxxx", params) +func TestCustomerBalanceTransactionCreate(t *testing.T) { + params := &stripe.CustomerBalanceTransactionParams{ + Amount: stripe.Int64(-500), + Currency: stripe.String(string(stripe.CurrencyUSD)), + } + result, _ := customerbalancetransaction.New(params) assert.NotNil(t, result) } -func TestPaymentMethodUpdate(t *testing.T) { - params := &stripe.PaymentMethodParams{} - params.AddMetadata("order_id", "6735") - result, _ := paymentmethod.Update("pm_xxxxxxxxxxxxx", params) +func TestCustomerBalanceTransactionRetrieve(t *testing.T) { + params := &stripe.CustomerBalanceTransactionParams{ + Customer: stripe.String("cus_xxxxxxxxxxxxx"), + } + result, _ := customerbalancetransaction.Get("cbtxn_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestPaymentMethodList(t *testing.T) { - params := &stripe.PaymentMethodListParams{ +func TestCustomerBalanceTransactionUpdate(t *testing.T) { + params := &stripe.CustomerBalanceTransactionParams{ Customer: stripe.String("cus_xxxxxxxxxxxxx"), - Type: stripe.String(string(stripe.PaymentMethodTypeCard)), } - result := paymentmethod.List(params) + params.AddMetadata("order_id", "6735") + result, _ := customerbalancetransaction.Update("cbtxn_xxxxxxxxxxxxx", params) assert.NotNil(t, result) - assert.Nil(t, result.Err()) } func TestCustomerListPaymentMethods2(t *testing.T) { @@ -854,916 +910,886 @@ func TestCustomerListPaymentMethods2(t *testing.T) { assert.Nil(t, result.Err()) } -func TestPaymentMethodAttach(t *testing.T) { - params := &stripe.PaymentMethodAttachParams{ +func TestTaxIDList(t *testing.T) { + params := &stripe.TaxIDListParams{ Customer: stripe.String("cus_xxxxxxxxxxxxx"), } - result, _ := paymentmethod.Attach("pm_xxxxxxxxxxxxx", params) - assert.NotNil(t, result) -} - -func TestPaymentMethodDetach(t *testing.T) { - params := &stripe.PaymentMethodDetachParams{} - result, _ := paymentmethod.Detach("pm_xxxxxxxxxxxxx", params) + params.Limit = stripe.Int64(3) + result := taxid.List(params) assert.NotNil(t, result) + assert.Nil(t, result.Err()) } -func TestSourceRetrieve(t *testing.T) { - params := &stripe.SourceObjectParams{} - result, _ := source.Get("src_xxxxxxxxxxxxx", params) +func TestTaxIDCreate(t *testing.T) { + params := &stripe.TaxIDParams{ + Type: stripe.String(string(stripe.TaxIDTypeEUVAT)), + Value: stripe.String("DE123456789"), + } + result, _ := taxid.New(params) assert.NotNil(t, result) } -func TestSourceUpdate(t *testing.T) { - params := &stripe.SourceObjectParams{} - params.AddMetadata("order_id", "6735") - result, _ := source.Update("src_xxxxxxxxxxxxx", params) +func TestTaxIDDelete(t *testing.T) { + params := &stripe.TaxIDParams{Customer: stripe.String("cus_xxxxxxxxxxxxx")} + result, _ := taxid.Del("txi_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestProductCreate(t *testing.T) { - params := &stripe.ProductParams{Name: stripe.String("Gold Special")} - result, _ := product.New(params) +func TestTaxIDRetrieve(t *testing.T) { + params := &stripe.TaxIDParams{Customer: stripe.String("cus_xxxxxxxxxxxxx")} + result, _ := taxid.Get("txi_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestProductRetrieve(t *testing.T) { - params := &stripe.ProductParams{} - result, _ := product.Get("prod_xxxxxxxxxxxxx", params) +func TestCustomerSearch(t *testing.T) { + params := &stripe.CustomerSearchParams{ + SearchParams: stripe.SearchParams{ + Query: "name:'fakename' AND metadata['foo']:'bar'", + }, + } + result := customer.Search(params) assert.NotNil(t, result) + assert.Nil(t, result.Err()) } -func TestProductUpdate(t *testing.T) { - params := &stripe.ProductParams{} - params.AddMetadata("order_id", "6735") - result, _ := product.Update("prod_xxxxxxxxxxxxx", params) +func TestCustomerSearch2(t *testing.T) { + params := &stripe.CustomerSearchParams{ + SearchParams: stripe.SearchParams{ + Query: "name:'fakename' AND metadata['foo']:'bar'", + }, + } + result := customer.Search(params) assert.NotNil(t, result) + assert.Nil(t, result.Err()) } -func TestProductList(t *testing.T) { - params := &stripe.ProductListParams{} +func TestDisputeList(t *testing.T) { + params := &stripe.DisputeListParams{} params.Limit = stripe.Int64(3) - result := product.List(params) + result := dispute.List(params) assert.NotNil(t, result) assert.Nil(t, result.Err()) } -func TestProductDelete(t *testing.T) { - params := &stripe.ProductParams{} - result, _ := product.Del("prod_xxxxxxxxxxxxx", params) +func TestDisputeRetrieve(t *testing.T) { + params := &stripe.DisputeParams{} + result, _ := dispute.Get("dp_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestProductSearch(t *testing.T) { - params := &stripe.ProductSearchParams{ - SearchParams: stripe.SearchParams{ - Query: "active:'true' AND metadata['order_id']:'6735'", - }, - } - result := product.Search(params) +func TestDisputeUpdate(t *testing.T) { + params := &stripe.DisputeParams{} + params.AddMetadata("order_id", "6735") + result, _ := dispute.Update("dp_xxxxxxxxxxxxx", params) assert.NotNil(t, result) - assert.Nil(t, result.Err()) } -func TestPriceCreate(t *testing.T) { - params := &stripe.PriceParams{ - UnitAmount: stripe.Int64(2000), - Currency: stripe.String(string(stripe.CurrencyUSD)), - Recurring: &stripe.PriceRecurringParams{ - Interval: stripe.String(string(stripe.PriceRecurringIntervalMonth)), - }, - Product: stripe.String("prod_xxxxxxxxxxxxx"), - } - result, _ := price.New(params) +func TestDisputeClose(t *testing.T) { + params := &stripe.DisputeParams{} + result, _ := dispute.Close("dp_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestPriceRetrieve(t *testing.T) { - params := &stripe.PriceParams{} - result, _ := price.Get("price_xxxxxxxxxxxxx", params) +func TestEventList(t *testing.T) { + params := &stripe.EventListParams{} + params.Limit = stripe.Int64(3) + result := event.List(params) assert.NotNil(t, result) + assert.Nil(t, result.Err()) } -func TestPriceUpdate(t *testing.T) { - params := &stripe.PriceParams{} - params.AddMetadata("order_id", "6735") - result, _ := price.Update("price_xxxxxxxxxxxxx", params) +func TestEventRetrieve(t *testing.T) { + params := &stripe.EventParams{} + result, _ := event.Get("evt_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestPriceList(t *testing.T) { - params := &stripe.PriceListParams{} - params.Limit = stripe.Int64(3) - result := price.List(params) +func TestFinancialConnectionsAccountList2(t *testing.T) { + params := &stripe.FinancialConnectionsAccountListParams{ + AccountHolder: &stripe.FinancialConnectionsAccountListAccountHolderParams{ + Customer: stripe.String("cus_xxxxxxxxxxxxx"), + }, + } + result := financialconnections_account.List(params) assert.NotNil(t, result) assert.Nil(t, result.Err()) } -func TestPriceSearch(t *testing.T) { - params := &stripe.PriceSearchParams{ - SearchParams: stripe.SearchParams{ - Query: "active:'true' AND metadata['order_id']:'6735'", - }, +func TestFinancialConnectionsAccountRetrieve2(t *testing.T) { + params := &stripe.FinancialConnectionsAccountParams{} + result, _ := financialconnections_account.GetByID( + "fca_xxxxxxxxxxxxx", + params, + ) + assert.NotNil(t, result) +} + +func TestFinancialConnectionsAccountListOwners2(t *testing.T) { + params := &stripe.FinancialConnectionsAccountListOwnersParams{ + Ownership: stripe.String("fcaowns_xxxxxxxxxxxxx"), + Account: stripe.String("fca_xxxxxxxxxxxxx"), } - result := price.Search(params) + params.Limit = stripe.Int64(3) + result := financialconnections_account.ListOwners(params) assert.NotNil(t, result) assert.Nil(t, result.Err()) } -func TestCouponCreate(t *testing.T) { - params := &stripe.CouponParams{ - PercentOff: stripe.Float64(25.5), - Duration: stripe.String(string(stripe.CouponDurationRepeating)), - DurationInMonths: stripe.Int64(3), +func TestFinancialConnectionsSessionCreate2(t *testing.T) { + params := &stripe.FinancialConnectionsSessionParams{ + AccountHolder: &stripe.FinancialConnectionsSessionAccountHolderParams{ + Type: stripe.String(string(stripe.FinancialConnectionsSessionAccountHolderTypeCustomer)), + Customer: stripe.String("cus_xxxxxxxxxxxxx"), + }, + Permissions: []*string{ + stripe.String(string(stripe.FinancialConnectionsSessionPermissionPaymentMethod)), + stripe.String(string(stripe.FinancialConnectionsSessionPermissionBalances)), + }, + Filters: &stripe.FinancialConnectionsSessionFiltersParams{ + Countries: []*string{stripe.String("US")}, + }, } - result, _ := coupon.New(params) + result, _ := financialconnections_session.New(params) assert.NotNil(t, result) } -func TestCouponRetrieve(t *testing.T) { - params := &stripe.CouponParams{} - result, _ := coupon.Get("Z4OV52SU", params) +func TestFinancialConnectionsSessionRetrieve2(t *testing.T) { + params := &stripe.FinancialConnectionsSessionParams{} + result, _ := financialconnections_session.Get("fcsess_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestCouponUpdate(t *testing.T) { - params := &stripe.CouponParams{} - params.AddMetadata("order_id", "6735") - result, _ := coupon.Update("Z4OV52SU", params) +func TestIdentityVerificationReportList(t *testing.T) { + params := &stripe.IdentityVerificationReportListParams{} + params.Limit = stripe.Int64(3) + result := identity_verificationreport.List(params) assert.NotNil(t, result) + assert.Nil(t, result.Err()) } -func TestCouponDelete(t *testing.T) { - params := &stripe.CouponParams{} - result, _ := coupon.Del("Z4OV52SU", params) +func TestIdentityVerificationReportRetrieve(t *testing.T) { + params := &stripe.IdentityVerificationReportParams{} + result, _ := identity_verificationreport.Get("vr_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestCouponList(t *testing.T) { - params := &stripe.CouponListParams{} +func TestIdentityVerificationSessionList(t *testing.T) { + params := &stripe.IdentityVerificationSessionListParams{} params.Limit = stripe.Int64(3) - result := coupon.List(params) + result := identity_verificationsession.List(params) assert.NotNil(t, result) assert.Nil(t, result.Err()) } -func TestPromotionCodeCreate(t *testing.T) { - params := &stripe.PromotionCodeParams{Coupon: stripe.String("Z4OV52SU")} - result, _ := promotioncode.New(params) +func TestIdentityVerificationSessionCreate(t *testing.T) { + params := &stripe.IdentityVerificationSessionParams{ + Type: stripe.String(string(stripe.IdentityVerificationSessionTypeDocument)), + } + result, _ := identity_verificationsession.New(params) assert.NotNil(t, result) } -func TestPromotionCodeUpdate(t *testing.T) { - params := &stripe.PromotionCodeParams{} - params.AddMetadata("order_id", "6735") - result, _ := promotioncode.Update("promo_xxxxxxxxxxxxx", params) +func TestIdentityVerificationSessionRetrieve(t *testing.T) { + params := &stripe.IdentityVerificationSessionParams{} + result, _ := identity_verificationsession.Get("vs_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestPromotionCodeRetrieve(t *testing.T) { - params := &stripe.PromotionCodeParams{} - result, _ := promotioncode.Get("promo_xxxxxxxxxxxxx", params) +func TestIdentityVerificationSessionUpdate(t *testing.T) { + params := &stripe.IdentityVerificationSessionParams{ + Type: stripe.String(string(stripe.IdentityVerificationSessionTypeIDNumber)), + } + result, _ := identity_verificationsession.Update("vs_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestPromotionCodeList(t *testing.T) { - params := &stripe.PromotionCodeListParams{} - params.Limit = stripe.Int64(3) - result := promotioncode.List(params) +func TestIdentityVerificationSessionCancel(t *testing.T) { + params := &stripe.IdentityVerificationSessionCancelParams{} + result, _ := identity_verificationsession.Cancel("vs_xxxxxxxxxxxxx", params) assert.NotNil(t, result) - assert.Nil(t, result.Err()) } -func TestTaxCodeList(t *testing.T) { - params := &stripe.TaxCodeListParams{} - params.Limit = stripe.Int64(3) - result := taxcode.List(params) +func TestIdentityVerificationSessionRedact(t *testing.T) { + params := &stripe.IdentityVerificationSessionRedactParams{} + result, _ := identity_verificationsession.Redact("vs_xxxxxxxxxxxxx", params) assert.NotNil(t, result) - assert.Nil(t, result.Err()) } -func TestTaxCodeRetrieve(t *testing.T) { - params := &stripe.TaxCodeParams{} - result, _ := taxcode.Get("txcd_xxxxxxxxxxxxx", params) +func TestInvoiceItemList(t *testing.T) { + params := &stripe.InvoiceItemListParams{} + params.Limit = stripe.Int64(3) + result := invoiceitem.List(params) assert.NotNil(t, result) + assert.Nil(t, result.Err()) } -func TestTaxRateCreate(t *testing.T) { - params := &stripe.TaxRateParams{ - DisplayName: stripe.String("VAT"), - Description: stripe.String("VAT Germany"), - Jurisdiction: stripe.String("DE"), - Percentage: stripe.Float64(16), - Inclusive: stripe.Bool(false), +func TestInvoiceItemCreate(t *testing.T) { + params := &stripe.InvoiceItemParams{ + Customer: stripe.String("cus_xxxxxxxxxxxxx"), + Price: stripe.String("price_xxxxxxxxxxxxx"), } - result, _ := taxrate.New(params) + result, _ := invoiceitem.New(params) assert.NotNil(t, result) } -func TestTaxRateRetrieve(t *testing.T) { - params := &stripe.TaxRateParams{} - result, _ := taxrate.Get("txr_xxxxxxxxxxxxx", params) +func TestInvoiceItemDelete(t *testing.T) { + params := &stripe.InvoiceItemParams{} + result, _ := invoiceitem.Del("ii_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestTaxRateUpdate(t *testing.T) { - params := &stripe.TaxRateParams{Active: stripe.Bool(false)} - result, _ := taxrate.Update("txr_xxxxxxxxxxxxx", params) +func TestInvoiceItemRetrieve(t *testing.T) { + params := &stripe.InvoiceItemParams{} + result, _ := invoiceitem.Get("ii_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestTaxRateList(t *testing.T) { - params := &stripe.TaxRateListParams{} +func TestInvoiceItemUpdate(t *testing.T) { + params := &stripe.InvoiceItemParams{} + params.AddMetadata("order_id", "6735") + result, _ := invoiceitem.Update("ii_xxxxxxxxxxxxx", params) + assert.NotNil(t, result) +} + +func TestInvoiceList(t *testing.T) { + params := &stripe.InvoiceListParams{} params.Limit = stripe.Int64(3) - result := taxrate.List(params) + result := invoice.List(params) assert.NotNil(t, result) assert.Nil(t, result.Err()) } -func TestShippingRateCreate2(t *testing.T) { - params := &stripe.ShippingRateParams{ - DisplayName: stripe.String("Ground shipping"), - Type: stripe.String("fixed_amount"), - FixedAmount: &stripe.ShippingRateFixedAmountParams{ - Amount: stripe.Int64(500), - Currency: stripe.String(string(stripe.CurrencyUSD)), - }, - } - result, _ := shippingrate.New(params) +func TestInvoiceCreate(t *testing.T) { + params := &stripe.InvoiceParams{Customer: stripe.String("cus_xxxxxxxxxxxxx")} + result, _ := invoice.New(params) assert.NotNil(t, result) } -func TestShippingRateRetrieve(t *testing.T) { - params := &stripe.ShippingRateParams{} - result, _ := shippingrate.Get("shr_xxxxxxxxxxxxx", params) +func TestInvoiceDelete(t *testing.T) { + params := &stripe.InvoiceParams{} + result, _ := invoice.Del("in_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestShippingRateUpdate(t *testing.T) { - params := &stripe.ShippingRateParams{} - params.AddMetadata("order_id", "6735") - result, _ := shippingrate.Update("shr_xxxxxxxxxxxxx", params) +func TestInvoiceRetrieve(t *testing.T) { + params := &stripe.InvoiceParams{} + result, _ := invoice.Get("in_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestShippingRateList2(t *testing.T) { - params := &stripe.ShippingRateListParams{} - params.Limit = stripe.Int64(3) - result := shippingrate.List(params) +func TestInvoiceUpdate(t *testing.T) { + params := &stripe.InvoiceParams{} + params.AddMetadata("order_id", "6735") + result, _ := invoice.Update("in_xxxxxxxxxxxxx", params) assert.NotNil(t, result) - assert.Nil(t, result.Err()) } -func TestCheckoutSessionExpire2(t *testing.T) { - params := &stripe.CheckoutSessionExpireParams{} - result, _ := checkout_session.Expire("cs_test_xxxxxxxxxxxxx", params) +func TestInvoiceFinalizeInvoice(t *testing.T) { + params := &stripe.InvoiceFinalizeParams{} + result, _ := invoice.FinalizeInvoice("in_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestCheckoutSessionRetrieve(t *testing.T) { - params := &stripe.CheckoutSessionParams{} - result, _ := checkout_session.Get("cs_test_xxxxxxxxxxxxx", params) +func TestInvoiceMarkUncollectible(t *testing.T) { + params := &stripe.InvoiceMarkUncollectibleParams{} + result, _ := invoice.MarkUncollectible("in_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestCheckoutSessionList(t *testing.T) { - params := &stripe.CheckoutSessionListParams{} - params.Limit = stripe.Int64(3) - result := checkout_session.List(params) +func TestInvoicePay(t *testing.T) { + params := &stripe.InvoicePayParams{} + result, _ := invoice.Pay("in_xxxxxxxxxxxxx", params) assert.NotNil(t, result) - assert.Nil(t, result.Err()) } -func TestPaymentLinkCreate2(t *testing.T) { - params := &stripe.PaymentLinkParams{ - LineItems: []*stripe.PaymentLinkLineItemParams{ - &stripe.PaymentLinkLineItemParams{ - Price: stripe.String("price_xxxxxxxxxxxxx"), - Quantity: stripe.Int64(1), - }, - }, - } - result, _ := paymentlink.New(params) +func TestInvoiceSendInvoice(t *testing.T) { + params := &stripe.InvoiceSendParams{} + result, _ := invoice.SendInvoice("in_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestPaymentLinkRetrieve2(t *testing.T) { - params := &stripe.PaymentLinkParams{} - result, _ := paymentlink.Get("plink_xxxxxxxxxxxxx", params) +func TestInvoiceVoidInvoice(t *testing.T) { + params := &stripe.InvoiceVoidParams{} + result, _ := invoice.VoidInvoice("in_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestPaymentLinkUpdate(t *testing.T) { - params := &stripe.PaymentLinkParams{Active: stripe.Bool(false)} - result, _ := paymentlink.Update("plink_xxxxxxxxxxxxx", params) +func TestInvoiceSearch(t *testing.T) { + params := &stripe.InvoiceSearchParams{ + SearchParams: stripe.SearchParams{ + Query: "total>999 AND metadata['order_id']:'6735'", + }, + } + result := invoice.Search(params) assert.NotNil(t, result) + assert.Nil(t, result.Err()) } -func TestPaymentLinkList(t *testing.T) { - params := &stripe.PaymentLinkListParams{} +func TestIssuingAuthorizationList(t *testing.T) { + params := &stripe.IssuingAuthorizationListParams{} params.Limit = stripe.Int64(3) - result := paymentlink.List(params) + result := issuing_authorization.List(params) assert.NotNil(t, result) assert.Nil(t, result.Err()) } -func TestCustomerBalanceTransactionCreate(t *testing.T) { - params := &stripe.CustomerBalanceTransactionParams{ - Amount: stripe.Int64(-500), - Currency: stripe.String(string(stripe.CurrencyUSD)), - } - result, _ := customerbalancetransaction.New(params) +func TestIssuingAuthorizationRetrieve(t *testing.T) { + params := &stripe.IssuingAuthorizationParams{} + result, _ := issuing_authorization.Get("iauth_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestCustomerBalanceTransactionRetrieve(t *testing.T) { - params := &stripe.CustomerBalanceTransactionParams{ - Customer: stripe.String("cus_xxxxxxxxxxxxx"), - } - result, _ := customerbalancetransaction.Get("cbtxn_xxxxxxxxxxxxx", params) +func TestIssuingAuthorizationUpdate(t *testing.T) { + params := &stripe.IssuingAuthorizationParams{} + params.AddMetadata("order_id", "6735") + result, _ := issuing_authorization.Update("iauth_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestCustomerBalanceTransactionUpdate(t *testing.T) { - params := &stripe.CustomerBalanceTransactionParams{ - Customer: stripe.String("cus_xxxxxxxxxxxxx"), - } - params.AddMetadata("order_id", "6735") - result, _ := customerbalancetransaction.Update("cbtxn_xxxxxxxxxxxxx", params) +func TestIssuingAuthorizationApprove(t *testing.T) { + params := &stripe.IssuingAuthorizationApproveParams{} + result, _ := issuing_authorization.Approve("iauth_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestCustomerBalanceTransactionList(t *testing.T) { - params := &stripe.CustomerBalanceTransactionListParams{ - Customer: stripe.String("cus_xxxxxxxxxxxxx"), - } - params.Limit = stripe.Int64(3) - result := customerbalancetransaction.List(params) +func TestIssuingAuthorizationDecline(t *testing.T) { + params := &stripe.IssuingAuthorizationDeclineParams{} + result, _ := issuing_authorization.Decline("iauth_xxxxxxxxxxxxx", params) assert.NotNil(t, result) - assert.Nil(t, result.Err()) } -func TestBillingPortalSessionCreate(t *testing.T) { - params := &stripe.BillingPortalSessionParams{ - Customer: stripe.String("cus_xxxxxxxxxxxxx"), - ReturnURL: stripe.String("https://example.com/account"), - } - result, _ := billingportal_session.New(params) +func TestIssuingCardholderList(t *testing.T) { + params := &stripe.IssuingCardholderListParams{} + params.Limit = stripe.Int64(3) + result := issuing_cardholder.List(params) assert.NotNil(t, result) + assert.Nil(t, result.Err()) } -func TestBillingPortalConfigurationCreate(t *testing.T) { - params := &stripe.BillingPortalConfigurationParams{ - Features: &stripe.BillingPortalConfigurationFeaturesParams{ - CustomerUpdate: &stripe.BillingPortalConfigurationFeaturesCustomerUpdateParams{ - AllowedUpdates: []*string{ - stripe.String(string(stripe.BillingPortalConfigurationFeaturesCustomerUpdateAllowedUpdateEmail)), - stripe.String(string(stripe.BillingPortalConfigurationFeaturesCustomerUpdateAllowedUpdateTaxID)), - }, - Enabled: stripe.Bool(true), - }, - InvoiceHistory: &stripe.BillingPortalConfigurationFeaturesInvoiceHistoryParams{ - Enabled: stripe.Bool(true), +func TestIssuingCardholderCreate(t *testing.T) { + params := &stripe.IssuingCardholderParams{ + Type: stripe.String(string(stripe.IssuingCardholderTypeIndividual)), + Name: stripe.String("Jenny Rosen"), + Email: stripe.String("jenny.rosen@example.com"), + PhoneNumber: stripe.String("+18888675309"), + Billing: &stripe.IssuingCardholderBillingParams{ + Address: &stripe.AddressParams{ + Line1: stripe.String("1234 Main Street"), + City: stripe.String("San Francisco"), + State: stripe.String("CA"), + Country: stripe.String("US"), + PostalCode: stripe.String("94111"), }, }, - BusinessProfile: &stripe.BillingPortalConfigurationBusinessProfileParams{ - PrivacyPolicyURL: stripe.String("https://example.com/privacy"), - TermsOfServiceURL: stripe.String("https://example.com/terms"), - }, } - result, _ := billingportal_configuration.New(params) + result, _ := issuing_cardholder.New(params) assert.NotNil(t, result) } -func TestBillingPortalConfigurationUpdate(t *testing.T) { - params := &stripe.BillingPortalConfigurationParams{ - BusinessProfile: &stripe.BillingPortalConfigurationBusinessProfileParams{ - PrivacyPolicyURL: stripe.String("https://example.com/privacy"), - TermsOfServiceURL: stripe.String("https://example.com/terms"), - }, - } - result, _ := billingportal_configuration.Update("bpc_xxxxxxxxxxxxx", params) +func TestIssuingCardholderRetrieve(t *testing.T) { + params := &stripe.IssuingCardholderParams{} + result, _ := issuing_cardholder.Get("ich_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestBillingPortalConfigurationRetrieve(t *testing.T) { - params := &stripe.BillingPortalConfigurationParams{} - result, _ := billingportal_configuration.Get("bpc_xxxxxxxxxxxxx", params) +func TestIssuingCardholderUpdate(t *testing.T) { + params := &stripe.IssuingCardholderParams{} + params.AddMetadata("order_id", "6735") + result, _ := issuing_cardholder.Update("ich_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestBillingPortalConfigurationList(t *testing.T) { - params := &stripe.BillingPortalConfigurationListParams{} +func TestIssuingCardList(t *testing.T) { + params := &stripe.IssuingCardListParams{} params.Limit = stripe.Int64(3) - result := billingportal_configuration.List(params) + result := issuing_card.List(params) assert.NotNil(t, result) assert.Nil(t, result.Err()) } -func TestTaxIDCreate(t *testing.T) { - params := &stripe.TaxIDParams{ - Type: stripe.String(string(stripe.TaxIDTypeEUVAT)), - Value: stripe.String("DE123456789"), +func TestIssuingCardCreate(t *testing.T) { + params := &stripe.IssuingCardParams{ + Cardholder: stripe.String("ich_xxxxxxxxxxxxx"), + Currency: stripe.String(string(stripe.CurrencyUSD)), + Type: stripe.String(string(stripe.IssuingCardTypeVirtual)), } - result, _ := taxid.New(params) + result, _ := issuing_card.New(params) assert.NotNil(t, result) } -func TestTaxIDRetrieve(t *testing.T) { - params := &stripe.TaxIDParams{Customer: stripe.String("cus_xxxxxxxxxxxxx")} - result, _ := taxid.Get("txi_xxxxxxxxxxxxx", params) +func TestIssuingCardRetrieve(t *testing.T) { + params := &stripe.IssuingCardParams{} + result, _ := issuing_card.Get("ic_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestTaxIDDelete(t *testing.T) { - params := &stripe.TaxIDParams{Customer: stripe.String("cus_xxxxxxxxxxxxx")} - result, _ := taxid.Del("txi_xxxxxxxxxxxxx", params) +func TestIssuingCardUpdate(t *testing.T) { + params := &stripe.IssuingCardParams{} + params.AddMetadata("order_id", "6735") + result, _ := issuing_card.Update("ic_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestTaxIDList(t *testing.T) { - params := &stripe.TaxIDListParams{ - Customer: stripe.String("cus_xxxxxxxxxxxxx"), - } +func TestIssuingDisputeList(t *testing.T) { + params := &stripe.IssuingDisputeListParams{} params.Limit = stripe.Int64(3) - result := taxid.List(params) + result := issuing_dispute.List(params) assert.NotNil(t, result) assert.Nil(t, result.Err()) } -func TestInvoiceCreate(t *testing.T) { - params := &stripe.InvoiceParams{Customer: stripe.String("cus_xxxxxxxxxxxxx")} - result, _ := invoice.New(params) +func TestIssuingDisputeCreate(t *testing.T) { + params := &stripe.IssuingDisputeParams{ + Transaction: stripe.String("ipi_xxxxxxxxxxxxx"), + Evidence: &stripe.IssuingDisputeEvidenceParams{ + Reason: stripe.String(string(stripe.IssuingDisputeEvidenceReasonFraudulent)), + Fraudulent: &stripe.IssuingDisputeEvidenceFraudulentParams{ + Explanation: stripe.String("Purchase was unrecognized."), + }, + }, + } + result, _ := issuing_dispute.New(params) assert.NotNil(t, result) } -func TestInvoiceRetrieve(t *testing.T) { - params := &stripe.InvoiceParams{} - result, _ := invoice.Get("in_xxxxxxxxxxxxx", params) +func TestIssuingDisputeRetrieve(t *testing.T) { + params := &stripe.IssuingDisputeParams{} + result, _ := issuing_dispute.Get("idp_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestInvoiceUpdate(t *testing.T) { - params := &stripe.InvoiceParams{} - params.AddMetadata("order_id", "6735") - result, _ := invoice.Update("in_xxxxxxxxxxxxx", params) +func TestIssuingDisputeSubmit(t *testing.T) { + params := &stripe.IssuingDisputeSubmitParams{} + result, _ := issuing_dispute.Submit("idp_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestInvoiceDelete(t *testing.T) { - params := &stripe.InvoiceParams{} - result, _ := invoice.Del("in_xxxxxxxxxxxxx", params) +func TestIssuingTransactionList(t *testing.T) { + params := &stripe.IssuingTransactionListParams{} + params.Limit = stripe.Int64(3) + result := issuing_transaction.List(params) assert.NotNil(t, result) + assert.Nil(t, result.Err()) } -func TestInvoiceFinalizeInvoice(t *testing.T) { - params := &stripe.InvoiceFinalizeParams{} - result, _ := invoice.FinalizeInvoice("in_xxxxxxxxxxxxx", params) +func TestIssuingTransactionRetrieve(t *testing.T) { + params := &stripe.IssuingTransactionParams{} + result, _ := issuing_transaction.Get("ipi_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestInvoicePay(t *testing.T) { - params := &stripe.InvoicePayParams{} - result, _ := invoice.Pay("in_xxxxxxxxxxxxx", params) +func TestIssuingTransactionUpdate(t *testing.T) { + params := &stripe.IssuingTransactionParams{} + params.AddMetadata("order_id", "6735") + result, _ := issuing_transaction.Update("ipi_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestInvoiceSendInvoice(t *testing.T) { - params := &stripe.InvoiceSendParams{} - result, _ := invoice.SendInvoice("in_xxxxxxxxxxxxx", params) +func TestMandateRetrieve(t *testing.T) { + params := &stripe.MandateParams{} + result, _ := mandate.Get("mandate_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestInvoiceVoidInvoice(t *testing.T) { - params := &stripe.InvoiceVoidParams{} - result, _ := invoice.VoidInvoice("in_xxxxxxxxxxxxx", params) +func TestPaymentIntentList(t *testing.T) { + params := &stripe.PaymentIntentListParams{} + params.Limit = stripe.Int64(3) + result := paymentintent.List(params) assert.NotNil(t, result) + assert.Nil(t, result.Err()) } -func TestInvoiceMarkUncollectible(t *testing.T) { - params := &stripe.InvoiceMarkUncollectibleParams{} - result, _ := invoice.MarkUncollectible("in_xxxxxxxxxxxxx", params) +func TestPaymentIntentCreate2(t *testing.T) { + params := &stripe.PaymentIntentParams{ + Amount: stripe.Int64(2000), + Currency: stripe.String(string(stripe.CurrencyUSD)), + PaymentMethodTypes: []*string{stripe.String("card")}, + } + result, _ := paymentintent.New(params) assert.NotNil(t, result) } -func TestInvoiceList(t *testing.T) { - params := &stripe.InvoiceListParams{} - params.Limit = stripe.Int64(3) - result := invoice.List(params) +func TestPaymentIntentRetrieve(t *testing.T) { + params := &stripe.PaymentIntentParams{} + result, _ := paymentintent.Get("pi_xxxxxxxxxxxxx", params) assert.NotNil(t, result) - assert.Nil(t, result.Err()) } -func TestInvoiceSearch(t *testing.T) { - params := &stripe.InvoiceSearchParams{ - SearchParams: stripe.SearchParams{ - Query: "total>999 AND metadata['order_id']:'6735'", - }, - } - result := invoice.Search(params) +func TestPaymentIntentUpdate(t *testing.T) { + params := &stripe.PaymentIntentParams{} + params.AddMetadata("order_id", "6735") + result, _ := paymentintent.Update("pi_xxxxxxxxxxxxx", params) assert.NotNil(t, result) - assert.Nil(t, result.Err()) } -func TestInvoiceItemCreate(t *testing.T) { - params := &stripe.InvoiceItemParams{ - Customer: stripe.String("cus_xxxxxxxxxxxxx"), - Price: stripe.String("price_xxxxxxxxxxxxx"), - } - result, _ := invoiceitem.New(params) +func TestPaymentIntentApplyCustomerBalance(t *testing.T) { + params := &stripe.PaymentIntentApplyCustomerBalanceParams{} + result, _ := paymentintent.ApplyCustomerBalance("pi_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestInvoiceItemRetrieve(t *testing.T) { - params := &stripe.InvoiceItemParams{} - result, _ := invoiceitem.Get("ii_xxxxxxxxxxxxx", params) +func TestPaymentIntentCancel(t *testing.T) { + params := &stripe.PaymentIntentCancelParams{} + result, _ := paymentintent.Cancel("pi_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestInvoiceItemUpdate(t *testing.T) { - params := &stripe.InvoiceItemParams{} - params.AddMetadata("order_id", "6735") - result, _ := invoiceitem.Update("ii_xxxxxxxxxxxxx", params) +func TestPaymentIntentCapture(t *testing.T) { + params := &stripe.PaymentIntentCaptureParams{} + result, _ := paymentintent.Capture("pi_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestInvoiceItemDelete(t *testing.T) { - params := &stripe.InvoiceItemParams{} - result, _ := invoiceitem.Del("ii_xxxxxxxxxxxxx", params) +func TestPaymentIntentConfirm(t *testing.T) { + params := &stripe.PaymentIntentConfirmParams{ + PaymentMethod: stripe.String("pm_card_visa"), + } + result, _ := paymentintent.Confirm("pi_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestInvoiceItemList(t *testing.T) { - params := &stripe.InvoiceItemListParams{} - params.Limit = stripe.Int64(3) - result := invoiceitem.List(params) +func TestPaymentIntentIncrementAuthorization(t *testing.T) { + params := &stripe.PaymentIntentIncrementAuthorizationParams{ + Amount: stripe.Int64(2099), + } + result, _ := paymentintent.IncrementAuthorization("pi_xxxxxxxxxxxxx", params) assert.NotNil(t, result) - assert.Nil(t, result.Err()) } -func TestPlanCreate(t *testing.T) { - params := &stripe.PlanParams{ - Amount: stripe.Int64(2000), - Currency: stripe.String(string(stripe.CurrencyUSD)), - Interval: stripe.String(string(stripe.PlanIntervalMonth)), - Product: &stripe.PlanProductParams{ID: stripe.String("prod_xxxxxxxxxxxxx")}, +func TestPaymentIntentSearch(t *testing.T) { + params := &stripe.PaymentIntentSearchParams{ + SearchParams: stripe.SearchParams{ + Query: "status:'succeeded' AND metadata['order_id']:'6735'", + }, } - result, _ := plan.New(params) + result := paymentintent.Search(params) assert.NotNil(t, result) + assert.Nil(t, result.Err()) } -func TestPlanRetrieve(t *testing.T) { - params := &stripe.PlanParams{} - result, _ := plan.Get("price_xxxxxxxxxxxxx", params) +func TestPaymentLinkList(t *testing.T) { + params := &stripe.PaymentLinkListParams{} + params.Limit = stripe.Int64(3) + result := paymentlink.List(params) assert.NotNil(t, result) + assert.Nil(t, result.Err()) } -func TestPlanUpdate(t *testing.T) { - params := &stripe.PlanParams{} - params.AddMetadata("order_id", "6735") - result, _ := plan.Update("price_xxxxxxxxxxxxx", params) +func TestPaymentLinkCreate2(t *testing.T) { + params := &stripe.PaymentLinkParams{ + LineItems: []*stripe.PaymentLinkLineItemParams{ + &stripe.PaymentLinkLineItemParams{ + Price: stripe.String("price_xxxxxxxxxxxxx"), + Quantity: stripe.Int64(1), + }, + }, + } + result, _ := paymentlink.New(params) assert.NotNil(t, result) } -func TestPlanDelete(t *testing.T) { - params := &stripe.PlanParams{} - result, _ := plan.Del("price_xxxxxxxxxxxxx", params) +func TestPaymentLinkRetrieve2(t *testing.T) { + params := &stripe.PaymentLinkParams{} + result, _ := paymentlink.Get("plink_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestPlanList(t *testing.T) { - params := &stripe.PlanListParams{} - params.Limit = stripe.Int64(3) - result := plan.List(params) +func TestPaymentLinkUpdate(t *testing.T) { + params := &stripe.PaymentLinkParams{Active: stripe.Bool(false)} + result, _ := paymentlink.Update("plink_xxxxxxxxxxxxx", params) assert.NotNil(t, result) - assert.Nil(t, result.Err()) } -func TestQuoteCreate(t *testing.T) { - params := &stripe.QuoteParams{ +func TestPaymentMethodList(t *testing.T) { + params := &stripe.PaymentMethodListParams{ Customer: stripe.String("cus_xxxxxxxxxxxxx"), - LineItems: []*stripe.QuoteLineItemParams{ - &stripe.QuoteLineItemParams{ - Price: stripe.String("price_xxxxxxxxxxxxx"), - Quantity: stripe.Int64(2), - }, - }, + Type: stripe.String(string(stripe.PaymentMethodTypeCard)), } - result, _ := quote.New(params) + result := paymentmethod.List(params) assert.NotNil(t, result) + assert.Nil(t, result.Err()) } -func TestQuoteRetrieve(t *testing.T) { - params := &stripe.QuoteParams{} - result, _ := quote.Get("qt_xxxxxxxxxxxxx", params) +func TestPaymentMethodRetrieve(t *testing.T) { + params := &stripe.PaymentMethodParams{} + result, _ := paymentmethod.Get("pm_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestQuoteUpdate(t *testing.T) { - params := &stripe.QuoteParams{} +func TestPaymentMethodUpdate(t *testing.T) { + params := &stripe.PaymentMethodParams{} params.AddMetadata("order_id", "6735") - result, _ := quote.Update("qt_xxxxxxxxxxxxx", params) - assert.NotNil(t, result) -} - -func TestQuoteFinalizeQuote(t *testing.T) { - params := &stripe.QuoteFinalizeQuoteParams{} - result, _ := quote.FinalizeQuote("qt_xxxxxxxxxxxxx", params) + result, _ := paymentmethod.Update("pm_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestQuoteAccept(t *testing.T) { - params := &stripe.QuoteAcceptParams{} - result, _ := quote.Accept("qt_xxxxxxxxxxxxx", params) +func TestPaymentMethodAttach(t *testing.T) { + params := &stripe.PaymentMethodAttachParams{ + Customer: stripe.String("cus_xxxxxxxxxxxxx"), + } + result, _ := paymentmethod.Attach("pm_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestQuoteCancel(t *testing.T) { - params := &stripe.QuoteCancelParams{} - result, _ := quote.Cancel("qt_xxxxxxxxxxxxx", params) +func TestPaymentMethodDetach(t *testing.T) { + params := &stripe.PaymentMethodDetachParams{} + result, _ := paymentmethod.Detach("pm_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestQuoteList(t *testing.T) { - params := &stripe.QuoteListParams{} +func TestPayoutList(t *testing.T) { + params := &stripe.PayoutListParams{} params.Limit = stripe.Int64(3) - result := quote.List(params) + result := payout.List(params) assert.NotNil(t, result) assert.Nil(t, result.Err()) } -func TestTestHelpersTestClockCreate2(t *testing.T) { - params := &stripe.TestHelpersTestClockParams{ - FrozenTime: stripe.Int64(1577836800), +func TestPayoutCreate(t *testing.T) { + params := &stripe.PayoutParams{ + Amount: stripe.Int64(1100), + Currency: stripe.String(string(stripe.CurrencyUSD)), } - result, _ := testhelpers_testclock.New(params) - assert.NotNil(t, result) -} - -func TestTestHelpersTestClockRetrieve2(t *testing.T) { - params := &stripe.TestHelpersTestClockParams{} - result, _ := testhelpers_testclock.Get("clock_xxxxxxxxxxxxx", params) + result, _ := payout.New(params) assert.NotNil(t, result) } -func TestTestHelpersTestClockDelete2(t *testing.T) { - params := &stripe.TestHelpersTestClockParams{} - result, _ := testhelpers_testclock.Del("clock_xxxxxxxxxxxxx", params) +func TestPayoutRetrieve(t *testing.T) { + params := &stripe.PayoutParams{} + result, _ := payout.Get("po_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestTestHelpersTestClockAdvance2(t *testing.T) { - params := &stripe.TestHelpersTestClockAdvanceParams{ - FrozenTime: stripe.Int64(1652390605), - } - result, _ := testhelpers_testclock.Advance("clock_xxxxxxxxxxxxx", params) +func TestPayoutUpdate(t *testing.T) { + params := &stripe.PayoutParams{} + params.AddMetadata("order_id", "6735") + result, _ := payout.Update("po_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestTestHelpersTestClockList2(t *testing.T) { - params := &stripe.TestHelpersTestClockListParams{} - params.Limit = stripe.Int64(3) - result := testhelpers_testclock.List(params) +func TestPayoutCancel(t *testing.T) { + params := &stripe.PayoutParams{} + result, _ := payout.Cancel("po_xxxxxxxxxxxxx", params) assert.NotNil(t, result) - assert.Nil(t, result.Err()) } -func TestUsageRecordCreate(t *testing.T) { - params := &stripe.UsageRecordParams{ - Quantity: stripe.Int64(100), - Timestamp: stripe.Int64(1571252444), - } - result, _ := usagerecord.New(params) +func TestPayoutReverse(t *testing.T) { + params := &stripe.PayoutReverseParams{} + result, _ := payout.Reverse("po_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestUsageRecordSummaryList(t *testing.T) { - params := &stripe.UsageRecordSummaryListParams{ - SubscriptionItem: stripe.String("si_xxxxxxxxxxxxx"), - } +func TestPlanList(t *testing.T) { + params := &stripe.PlanListParams{} params.Limit = stripe.Int64(3) - result := usagerecordsummary.List(params) + result := plan.List(params) assert.NotNil(t, result) assert.Nil(t, result.Err()) } -func TestAccountCreate(t *testing.T) { - params := &stripe.AccountParams{ - Type: stripe.String(string(stripe.AccountTypeCustom)), - Country: stripe.String("US"), - Email: stripe.String("jenny.rosen@example.com"), - Capabilities: &stripe.AccountCapabilitiesParams{ - CardPayments: &stripe.AccountCapabilitiesCardPaymentsParams{ - Requested: stripe.Bool(true), - }, - Transfers: &stripe.AccountCapabilitiesTransfersParams{ - Requested: stripe.Bool(true), - }, - }, +func TestPlanCreate(t *testing.T) { + params := &stripe.PlanParams{ + Amount: stripe.Int64(2000), + Currency: stripe.String(string(stripe.CurrencyUSD)), + Interval: stripe.String(string(stripe.PlanIntervalMonth)), + Product: &stripe.PlanProductParams{ID: stripe.String("prod_xxxxxxxxxxxxx")}, } - result, _ := account.New(params) - assert.NotNil(t, result) -} - -func TestAccountRetrieve(t *testing.T) { - params := &stripe.AccountParams{} - result, _ := account.GetByID("acct_xxxxxxxxxxxxx", params) + result, _ := plan.New(params) assert.NotNil(t, result) } -func TestAccountUpdate(t *testing.T) { - params := &stripe.AccountParams{} - params.AddMetadata("order_id", "6735") - result, _ := account.Update("acct_xxxxxxxxxxxxx", params) +func TestPlanDelete(t *testing.T) { + params := &stripe.PlanParams{} + result, _ := plan.Del("price_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestAccountDelete(t *testing.T) { - params := &stripe.AccountParams{} - result, _ := account.Del("acct_xxxxxxxxxxxxx", params) +func TestPlanRetrieve(t *testing.T) { + params := &stripe.PlanParams{} + result, _ := plan.Get("price_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestAccountReject(t *testing.T) { - params := &stripe.AccountRejectParams{Reason: stripe.String("fraud")} - result, _ := account.Reject("acct_xxxxxxxxxxxxx", params) +func TestPlanUpdate(t *testing.T) { + params := &stripe.PlanParams{} + params.AddMetadata("order_id", "6735") + result, _ := plan.Update("price_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestAccountList(t *testing.T) { - params := &stripe.AccountListParams{} +func TestPriceList(t *testing.T) { + params := &stripe.PriceListParams{} params.Limit = stripe.Int64(3) - result := account.List(params) + result := price.List(params) assert.NotNil(t, result) assert.Nil(t, result.Err()) } -func TestAccountLinkCreate(t *testing.T) { - params := &stripe.AccountLinkParams{ - Account: stripe.String("acct_xxxxxxxxxxxxx"), - RefreshURL: stripe.String("https://example.com/reauth"), - ReturnURL: stripe.String("https://example.com/return"), - Type: stripe.String("account_onboarding"), +func TestPriceCreate(t *testing.T) { + params := &stripe.PriceParams{ + UnitAmount: stripe.Int64(2000), + Currency: stripe.String(string(stripe.CurrencyUSD)), + Recurring: &stripe.PriceRecurringParams{ + Interval: stripe.String(string(stripe.PriceRecurringIntervalMonth)), + }, + Product: stripe.String("prod_xxxxxxxxxxxxx"), } - result, _ := accountlink.New(params) + result, _ := price.New(params) assert.NotNil(t, result) } -func TestCapabilityRetrieve(t *testing.T) { - params := &stripe.CapabilityParams{ - Account: stripe.String("acct_xxxxxxxxxxxxx"), - } - result, _ := capability.Get("card_payments", params) +func TestPriceRetrieve(t *testing.T) { + params := &stripe.PriceParams{} + result, _ := price.Get("price_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestCapabilityUpdate(t *testing.T) { - params := &stripe.CapabilityParams{ - Requested: stripe.Bool(true), - Account: stripe.String("acct_xxxxxxxxxxxxx"), - } - result, _ := capability.Update("card_payments", params) +func TestPriceUpdate(t *testing.T) { + params := &stripe.PriceParams{} + params.AddMetadata("order_id", "6735") + result, _ := price.Update("price_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestCapabilityList(t *testing.T) { - params := &stripe.CapabilityListParams{ - Account: stripe.String("acct_xxxxxxxxxxxxx"), +func TestPriceSearch(t *testing.T) { + params := &stripe.PriceSearchParams{ + SearchParams: stripe.SearchParams{ + Query: "active:'true' AND metadata['order_id']:'6735'", + }, } - result := capability.List(params) + result := price.Search(params) assert.NotNil(t, result) assert.Nil(t, result.Err()) } -func TestCountrySpecList(t *testing.T) { - params := &stripe.CountrySpecListParams{} +func TestProductList(t *testing.T) { + params := &stripe.ProductListParams{} params.Limit = stripe.Int64(3) - result := countryspec.List(params) + result := product.List(params) + assert.NotNil(t, result) + assert.Nil(t, result.Err()) +} + +func TestProductCreate(t *testing.T) { + params := &stripe.ProductParams{Name: stripe.String("Gold Special")} + result, _ := product.New(params) assert.NotNil(t, result) - assert.Nil(t, result.Err()) } -func TestCountrySpecRetrieve(t *testing.T) { - params := &stripe.CountrySpecParams{} - result, _ := countryspec.Get("US", params) +func TestProductDelete(t *testing.T) { + params := &stripe.ProductParams{} + result, _ := product.Del("prod_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestPersonCreate(t *testing.T) { - params := &stripe.PersonParams{ - FirstName: stripe.String("Jane"), - LastName: stripe.String("Diaz"), - } - result, _ := person.New(params) +func TestProductRetrieve(t *testing.T) { + params := &stripe.ProductParams{} + result, _ := product.Get("prod_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestPersonUpdate(t *testing.T) { - params := &stripe.PersonParams{Account: stripe.String("acct_xxxxxxxxxxxxx")} +func TestProductUpdate(t *testing.T) { + params := &stripe.ProductParams{} params.AddMetadata("order_id", "6735") - result, _ := person.Update("person_xxxxxxxxxxxxx", params) + result, _ := product.Update("prod_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestPersonList(t *testing.T) { - params := &stripe.PersonListParams{ - Account: stripe.String("acct_xxxxxxxxxxxxx"), +func TestProductSearch(t *testing.T) { + params := &stripe.ProductSearchParams{ + SearchParams: stripe.SearchParams{ + Query: "active:'true' AND metadata['order_id']:'6735'", + }, } + result := product.Search(params) + assert.NotNil(t, result) + assert.Nil(t, result.Err()) +} + +func TestPromotionCodeList(t *testing.T) { + params := &stripe.PromotionCodeListParams{} params.Limit = stripe.Int64(3) - result := person.List(params) + result := promotioncode.List(params) assert.NotNil(t, result) assert.Nil(t, result.Err()) } -func TestTopupCreate(t *testing.T) { - params := &stripe.TopupParams{ - Amount: stripe.Int64(2000), - Currency: stripe.String(string(stripe.CurrencyUSD)), - Description: stripe.String("Top-up for Jenny Rosen"), - StatementDescriptor: stripe.String("Top-up"), - } - result, _ := topup.New(params) +func TestPromotionCodeCreate(t *testing.T) { + params := &stripe.PromotionCodeParams{Coupon: stripe.String("Z4OV52SU")} + result, _ := promotioncode.New(params) assert.NotNil(t, result) } -func TestTopupRetrieve(t *testing.T) { - params := &stripe.TopupParams{} - result, _ := topup.Get("tu_xxxxxxxxxxxxx", params) +func TestPromotionCodeRetrieve(t *testing.T) { + params := &stripe.PromotionCodeParams{} + result, _ := promotioncode.Get("promo_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestTopupUpdate(t *testing.T) { - params := &stripe.TopupParams{} +func TestPromotionCodeUpdate(t *testing.T) { + params := &stripe.PromotionCodeParams{} params.AddMetadata("order_id", "6735") - result, _ := topup.Update("tu_xxxxxxxxxxxxx", params) + result, _ := promotioncode.Update("promo_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestTopupList(t *testing.T) { - params := &stripe.TopupListParams{} +func TestQuoteList(t *testing.T) { + params := &stripe.QuoteListParams{} params.Limit = stripe.Int64(3) - result := topup.List(params) + result := quote.List(params) assert.NotNil(t, result) assert.Nil(t, result.Err()) } -func TestTransferCreate(t *testing.T) { - params := &stripe.TransferParams{ - Amount: stripe.Int64(400), - Currency: stripe.String(string(stripe.CurrencyUSD)), - Destination: stripe.String("acct_xxxxxxxxxxxxx"), - TransferGroup: stripe.String("ORDER_95"), +func TestQuoteCreate(t *testing.T) { + params := &stripe.QuoteParams{ + Customer: stripe.String("cus_xxxxxxxxxxxxx"), + LineItems: []*stripe.QuoteLineItemParams{ + &stripe.QuoteLineItemParams{ + Price: stripe.String("price_xxxxxxxxxxxxx"), + Quantity: stripe.Int64(2), + }, + }, } - result, _ := transfer.New(params) + result, _ := quote.New(params) assert.NotNil(t, result) } -func TestTransferRetrieve(t *testing.T) { - params := &stripe.TransferParams{} - result, _ := transfer.Get("tr_xxxxxxxxxxxxx", params) +func TestQuoteRetrieve(t *testing.T) { + params := &stripe.QuoteParams{} + result, _ := quote.Get("qt_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestTransferUpdate(t *testing.T) { - params := &stripe.TransferParams{} +func TestQuoteUpdate(t *testing.T) { + params := &stripe.QuoteParams{} params.AddMetadata("order_id", "6735") - result, _ := transfer.Update("tr_xxxxxxxxxxxxx", params) - assert.NotNil(t, result) -} - -func TestTransferList(t *testing.T) { - params := &stripe.TransferListParams{} - params.Limit = stripe.Int64(3) - result := transfer.List(params) + result, _ := quote.Update("qt_xxxxxxxxxxxxx", params) assert.NotNil(t, result) - assert.Nil(t, result.Err()) } -func TestReversalCreate(t *testing.T) { - params := &stripe.ReversalParams{Amount: stripe.Int64(100)} - result, _ := reversal.New(params) +func TestQuoteAccept(t *testing.T) { + params := &stripe.QuoteAcceptParams{} + result, _ := quote.Accept("qt_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestReversalRetrieve(t *testing.T) { - params := &stripe.ReversalParams{Transfer: stripe.String("tr_xxxxxxxxxxxxx")} - result, _ := reversal.Get("trr_xxxxxxxxxxxxx", params) +func TestQuoteCancel(t *testing.T) { + params := &stripe.QuoteCancelParams{} + result, _ := quote.Cancel("qt_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestReversalUpdate(t *testing.T) { - params := &stripe.ReversalParams{Transfer: stripe.String("tr_xxxxxxxxxxxxx")} - params.AddMetadata("order_id", "6735") - result, _ := reversal.Update("trr_xxxxxxxxxxxxx", params) +func TestQuoteFinalizeQuote(t *testing.T) { + params := &stripe.QuoteFinalizeQuoteParams{} + result, _ := quote.FinalizeQuote("qt_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestReversalList(t *testing.T) { - params := &stripe.ReversalListParams{ - Transfer: stripe.String("tr_xxxxxxxxxxxxx"), - } +func TestRadarEarlyFraudWarningList(t *testing.T) { + params := &stripe.RadarEarlyFraudWarningListParams{} params.Limit = stripe.Int64(3) - result := reversal.List(params) + result := radar_earlyfraudwarning.List(params) assert.NotNil(t, result) assert.Nil(t, result.Err()) } @@ -1774,312 +1800,282 @@ func TestRadarEarlyFraudWarningRetrieve(t *testing.T) { assert.NotNil(t, result) } -func TestRadarEarlyFraudWarningList(t *testing.T) { - params := &stripe.RadarEarlyFraudWarningListParams{} +func TestRefundList(t *testing.T) { + params := &stripe.RefundListParams{} params.Limit = stripe.Int64(3) - result := radar_earlyfraudwarning.List(params) + result := refund.List(params) assert.NotNil(t, result) assert.Nil(t, result.Err()) } -func TestReviewApprove(t *testing.T) { - params := &stripe.ReviewApproveParams{} - result, _ := review.Approve("prv_xxxxxxxxxxxxx", params) +func TestRefundCreate(t *testing.T) { + params := &stripe.RefundParams{Charge: stripe.String("ch_xxxxxxxxxxxxx")} + result, _ := refund.New(params) assert.NotNil(t, result) } -func TestReviewRetrieve(t *testing.T) { - params := &stripe.ReviewParams{} - result, _ := review.Get("prv_xxxxxxxxxxxxx", params) +func TestRefundRetrieve(t *testing.T) { + params := &stripe.RefundParams{} + result, _ := refund.Get("re_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestReviewList(t *testing.T) { - params := &stripe.ReviewListParams{} - params.Limit = stripe.Int64(3) - result := review.List(params) +func TestRefundUpdate(t *testing.T) { + params := &stripe.RefundParams{} + params.AddMetadata("order_id", "6735") + result, _ := refund.Update("re_xxxxxxxxxxxxx", params) assert.NotNil(t, result) - assert.Nil(t, result.Err()) } -func TestIssuingAuthorizationRetrieve(t *testing.T) { - params := &stripe.IssuingAuthorizationParams{} - result, _ := issuing_authorization.Get("iauth_xxxxxxxxxxxxx", params) +func TestRefundCancel(t *testing.T) { + params := &stripe.RefundCancelParams{} + result, _ := refund.Cancel("re_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestIssuingAuthorizationUpdate(t *testing.T) { - params := &stripe.IssuingAuthorizationParams{} - params.AddMetadata("order_id", "6735") - result, _ := issuing_authorization.Update("iauth_xxxxxxxxxxxxx", params) +func TestReviewList(t *testing.T) { + params := &stripe.ReviewListParams{} + params.Limit = stripe.Int64(3) + result := review.List(params) assert.NotNil(t, result) + assert.Nil(t, result.Err()) } -func TestIssuingAuthorizationApprove(t *testing.T) { - params := &stripe.IssuingAuthorizationApproveParams{} - result, _ := issuing_authorization.Approve("iauth_xxxxxxxxxxxxx", params) +func TestReviewRetrieve(t *testing.T) { + params := &stripe.ReviewParams{} + result, _ := review.Get("prv_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestIssuingAuthorizationDecline(t *testing.T) { - params := &stripe.IssuingAuthorizationDeclineParams{} - result, _ := issuing_authorization.Decline("iauth_xxxxxxxxxxxxx", params) +func TestReviewApprove(t *testing.T) { + params := &stripe.ReviewApproveParams{} + result, _ := review.Approve("prv_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestIssuingAuthorizationList(t *testing.T) { - params := &stripe.IssuingAuthorizationListParams{} +func TestSetupIntentList(t *testing.T) { + params := &stripe.SetupIntentListParams{} params.Limit = stripe.Int64(3) - result := issuing_authorization.List(params) + result := setupintent.List(params) assert.NotNil(t, result) assert.Nil(t, result.Err()) } -func TestIssuingCardholderCreate(t *testing.T) { - params := &stripe.IssuingCardholderParams{ - Type: stripe.String(string(stripe.IssuingCardholderTypeIndividual)), - Name: stripe.String("Jenny Rosen"), - Email: stripe.String("jenny.rosen@example.com"), - PhoneNumber: stripe.String("+18888675309"), - Billing: &stripe.IssuingCardholderBillingParams{ - Address: &stripe.AddressParams{ - Line1: stripe.String("1234 Main Street"), - City: stripe.String("San Francisco"), - State: stripe.String("CA"), - Country: stripe.String("US"), - PostalCode: stripe.String("94111"), - }, - }, +func TestSetupIntentCreate(t *testing.T) { + params := &stripe.SetupIntentParams{ + PaymentMethodTypes: []*string{stripe.String("card")}, } - result, _ := issuing_cardholder.New(params) - assert.NotNil(t, result) -} - -func TestIssuingCardholderRetrieve(t *testing.T) { - params := &stripe.IssuingCardholderParams{} - result, _ := issuing_cardholder.Get("ich_xxxxxxxxxxxxx", params) - assert.NotNil(t, result) -} - -func TestIssuingCardholderUpdate(t *testing.T) { - params := &stripe.IssuingCardholderParams{} - params.AddMetadata("order_id", "6735") - result, _ := issuing_cardholder.Update("ich_xxxxxxxxxxxxx", params) + result, _ := setupintent.New(params) assert.NotNil(t, result) } -func TestIssuingCardholderList(t *testing.T) { - params := &stripe.IssuingCardholderListParams{} - params.Limit = stripe.Int64(3) - result := issuing_cardholder.List(params) +func TestSetupIntentRetrieve(t *testing.T) { + params := &stripe.SetupIntentParams{} + result, _ := setupintent.Get("seti_xxxxxxxxxxxxx", params) assert.NotNil(t, result) - assert.Nil(t, result.Err()) } -func TestIssuingCardCreate(t *testing.T) { - params := &stripe.IssuingCardParams{ - Cardholder: stripe.String("ich_xxxxxxxxxxxxx"), - Currency: stripe.String(string(stripe.CurrencyUSD)), - Type: stripe.String(string(stripe.IssuingCardTypeVirtual)), - } - result, _ := issuing_card.New(params) +func TestSetupIntentUpdate(t *testing.T) { + params := &stripe.SetupIntentParams{} + params.AddMetadata("user_id", "3435453") + result, _ := setupintent.Update("seti_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestIssuingCardRetrieve(t *testing.T) { - params := &stripe.IssuingCardParams{} - result, _ := issuing_card.Get("ic_xxxxxxxxxxxxx", params) +func TestSetupIntentCancel(t *testing.T) { + params := &stripe.SetupIntentCancelParams{} + result, _ := setupintent.Cancel("seti_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestIssuingCardUpdate(t *testing.T) { - params := &stripe.IssuingCardParams{} - params.AddMetadata("order_id", "6735") - result, _ := issuing_card.Update("ic_xxxxxxxxxxxxx", params) +func TestSetupIntentConfirm(t *testing.T) { + params := &stripe.SetupIntentConfirmParams{ + PaymentMethod: stripe.String("pm_card_visa"), + } + result, _ := setupintent.Confirm("seti_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestIssuingCardList(t *testing.T) { - params := &stripe.IssuingCardListParams{} +func TestShippingRateList2(t *testing.T) { + params := &stripe.ShippingRateListParams{} params.Limit = stripe.Int64(3) - result := issuing_card.List(params) + result := shippingrate.List(params) assert.NotNil(t, result) assert.Nil(t, result.Err()) } -func TestIssuingDisputeCreate(t *testing.T) { - params := &stripe.IssuingDisputeParams{ - Transaction: stripe.String("ipi_xxxxxxxxxxxxx"), - Evidence: &stripe.IssuingDisputeEvidenceParams{ - Reason: stripe.String(string(stripe.IssuingDisputeEvidenceReasonFraudulent)), - Fraudulent: &stripe.IssuingDisputeEvidenceFraudulentParams{ - Explanation: stripe.String("Purchase was unrecognized."), - }, +func TestShippingRateCreate2(t *testing.T) { + params := &stripe.ShippingRateParams{ + DisplayName: stripe.String("Ground shipping"), + Type: stripe.String("fixed_amount"), + FixedAmount: &stripe.ShippingRateFixedAmountParams{ + Amount: stripe.Int64(500), + Currency: stripe.String(string(stripe.CurrencyUSD)), }, } - result, _ := issuing_dispute.New(params) + result, _ := shippingrate.New(params) assert.NotNil(t, result) } -func TestIssuingDisputeSubmit(t *testing.T) { - params := &stripe.IssuingDisputeSubmitParams{} - result, _ := issuing_dispute.Submit("idp_xxxxxxxxxxxxx", params) +func TestShippingRateRetrieve(t *testing.T) { + params := &stripe.ShippingRateParams{} + result, _ := shippingrate.Get("shr_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestIssuingDisputeRetrieve(t *testing.T) { - params := &stripe.IssuingDisputeParams{} - result, _ := issuing_dispute.Get("idp_xxxxxxxxxxxxx", params) +func TestShippingRateUpdate(t *testing.T) { + params := &stripe.ShippingRateParams{} + params.AddMetadata("order_id", "6735") + result, _ := shippingrate.Update("shr_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestIssuingDisputeUpdate(t *testing.T) { - params := &stripe.IssuingDisputeParams{ - Evidence: &stripe.IssuingDisputeEvidenceParams{ - Reason: stripe.String(string(stripe.IssuingDisputeEvidenceReasonNotReceived)), - NotReceived: &stripe.IssuingDisputeEvidenceNotReceivedParams{ - ExpectedAt: stripe.Int64(1590000000), - Explanation: stripe.String(""), - ProductDescription: stripe.String("Baseball cap"), - ProductType: stripe.String(string(stripe.IssuingDisputeEvidenceNotReceivedProductTypeMerchandise)), - }, - }, - } - result, _ := issuing_dispute.Update("idp_xxxxxxxxxxxxx", params) +func TestSigmaScheduledQueryRunList(t *testing.T) { + params := &stripe.SigmaScheduledQueryRunListParams{} + params.Limit = stripe.Int64(3) + result := sigma_scheduledqueryrun.List(params) assert.NotNil(t, result) + assert.Nil(t, result.Err()) } -func TestIssuingDisputeList(t *testing.T) { - params := &stripe.IssuingDisputeListParams{} - params.Limit = stripe.Int64(3) - result := issuing_dispute.List(params) +func TestSigmaScheduledQueryRunRetrieve(t *testing.T) { + params := &stripe.SigmaScheduledQueryRunParams{} + result, _ := sigma_scheduledqueryrun.Get("sqr_xxxxxxxxxxxxx", params) assert.NotNil(t, result) - assert.Nil(t, result.Err()) } -func TestIssuingTransactionRetrieve(t *testing.T) { - params := &stripe.IssuingTransactionParams{} - result, _ := issuing_transaction.Get("ipi_xxxxxxxxxxxxx", params) +func TestSKUList(t *testing.T) { + params := &stripe.SKUListParams{} + params.Limit = stripe.Int64(3) + result := sku.List(params) assert.NotNil(t, result) + assert.Nil(t, result.Err()) } -func TestIssuingTransactionUpdate(t *testing.T) { - params := &stripe.IssuingTransactionParams{} - params.AddMetadata("order_id", "6735") - result, _ := issuing_transaction.Update("ipi_xxxxxxxxxxxxx", params) +func TestSKUCreate(t *testing.T) { + params := &stripe.SKUParams{ + Attributes: map[string]string{"size": "Medium", "gender": "Unisex"}, + Price: stripe.Int64(1500), + Currency: stripe.String(string(stripe.CurrencyUSD)), + Inventory: &stripe.InventoryParams{ + Type: stripe.String(string(stripe.SKUInventoryTypeFinite)), + Quantity: stripe.Int64(500), + }, + Product: stripe.String("prod_xxxxxxxxxxxxx"), + } + result, _ := sku.New(params) assert.NotNil(t, result) } -func TestIssuingTransactionList(t *testing.T) { - params := &stripe.IssuingTransactionListParams{} - params.Limit = stripe.Int64(3) - result := issuing_transaction.List(params) +func TestSKUDelete(t *testing.T) { + params := &stripe.SKUParams{} + result, _ := sku.Del("sku_xxxxxxxxxxxxx", params) assert.NotNil(t, result) - assert.Nil(t, result.Err()) } -func TestTerminalConnectionTokenCreate(t *testing.T) { - params := &stripe.TerminalConnectionTokenParams{} - result, _ := terminal_connectiontoken.New(params) +func TestSKURetrieve(t *testing.T) { + params := &stripe.SKUParams{} + result, _ := sku.Get("sku_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestTerminalLocationCreate(t *testing.T) { - params := &stripe.TerminalLocationParams{ - DisplayName: stripe.String("My First Store"), - Address: &stripe.AccountAddressParams{ - Line1: stripe.String("1234 Main Street"), - City: stripe.String("San Francisco"), - Country: stripe.String("US"), - PostalCode: stripe.String("94111"), - }, - } - result, _ := terminal_location.New(params) +func TestSKUUpdate(t *testing.T) { + params := &stripe.SKUParams{} + params.AddMetadata("order_id", "6735") + result, _ := sku.Update("sku_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestTerminalLocationRetrieve(t *testing.T) { - params := &stripe.TerminalLocationParams{} - result, _ := terminal_location.Get("tml_xxxxxxxxxxxxx", params) +func TestSourceRetrieve(t *testing.T) { + params := &stripe.SourceObjectParams{} + result, _ := source.Get("src_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestTerminalLocationUpdate(t *testing.T) { - params := &stripe.TerminalLocationParams{ - DisplayName: stripe.String("My First Store"), - } - result, _ := terminal_location.Update("tml_xxxxxxxxxxxxx", params) +func TestSourceRetrieve2(t *testing.T) { + params := &stripe.SourceObjectParams{} + result, _ := source.Get("src_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestTerminalLocationDelete(t *testing.T) { - params := &stripe.TerminalLocationParams{} - result, _ := terminal_location.Del("tml_xxxxxxxxxxxxx", params) +func TestSourceUpdate(t *testing.T) { + params := &stripe.SourceObjectParams{} + params.AddMetadata("order_id", "6735") + result, _ := source.Update("src_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestTerminalLocationList(t *testing.T) { - params := &stripe.TerminalLocationListParams{} +func TestUsageRecordSummaryList(t *testing.T) { + params := &stripe.UsageRecordSummaryListParams{ + SubscriptionItem: stripe.String("si_xxxxxxxxxxxxx"), + } params.Limit = stripe.Int64(3) - result := terminal_location.List(params) + result := usagerecordsummary.List(params) assert.NotNil(t, result) assert.Nil(t, result.Err()) } -func TestTerminalReaderCreate(t *testing.T) { - params := &stripe.TerminalReaderParams{ - RegistrationCode: stripe.String("puppies-plug-could"), - Label: stripe.String("Blue Rabbit"), - Location: stripe.String("tml_1234"), +func TestUsageRecordCreate(t *testing.T) { + params := &stripe.UsageRecordParams{ + Quantity: stripe.Int64(100), + Timestamp: stripe.Int64(1571252444), } - result, _ := terminal_reader.New(params) + result, _ := usagerecord.New(params) assert.NotNil(t, result) } -func TestTerminalReaderUpdate(t *testing.T) { - params := &stripe.TerminalReaderParams{Label: stripe.String("Blue Rabbit")} - result, _ := terminal_reader.Update("tmr_xxxxxxxxxxxxx", params) +func TestTaxCodeList(t *testing.T) { + params := &stripe.TaxCodeListParams{} + params.Limit = stripe.Int64(3) + result := taxcode.List(params) assert.NotNil(t, result) + assert.Nil(t, result.Err()) } -func TestTerminalReaderDelete(t *testing.T) { - params := &stripe.TerminalReaderParams{} - result, _ := terminal_reader.Del("tmr_xxxxxxxxxxxxx", params) +func TestTaxCodeRetrieve(t *testing.T) { + params := &stripe.TaxCodeParams{} + result, _ := taxcode.Get("txcd_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestTerminalReaderList(t *testing.T) { - params := &stripe.TerminalReaderListParams{} +func TestTaxRateList(t *testing.T) { + params := &stripe.TaxRateListParams{} params.Limit = stripe.Int64(3) - result := terminal_reader.List(params) + result := taxrate.List(params) assert.NotNil(t, result) assert.Nil(t, result.Err()) } -func TestTerminalReaderProcessPaymentIntent(t *testing.T) { - params := &stripe.TerminalReaderProcessPaymentIntentParams{ - PaymentIntent: stripe.String("pi_xxxxxxxxxxxxx"), +func TestTaxRateCreate(t *testing.T) { + params := &stripe.TaxRateParams{ + DisplayName: stripe.String("VAT"), + Description: stripe.String("VAT Germany"), + Jurisdiction: stripe.String("DE"), + Percentage: stripe.Float64(16), + Inclusive: stripe.Bool(false), } - result, _ := terminal_reader.ProcessPaymentIntent( - "tmr_xxxxxxxxxxxxx", - params, - ) + result, _ := taxrate.New(params) assert.NotNil(t, result) } -func TestTerminalReaderProcessSetupIntent(t *testing.T) { - params := &stripe.TerminalReaderProcessSetupIntentParams{ - SetupIntent: stripe.String("seti_xxxxxxxxxxxxx"), - CustomerConsentCollected: stripe.Bool(true), - } - result, _ := terminal_reader.ProcessSetupIntent("tmr_xxxxxxxxxxxxx", params) +func TestTaxRateRetrieve(t *testing.T) { + params := &stripe.TaxRateParams{} + result, _ := taxrate.Get("txr_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestTerminalReaderCancelAction(t *testing.T) { - params := &stripe.TerminalReaderCancelActionParams{} - result, _ := terminal_reader.CancelAction("tmr_xxxxxxxxxxxxx", params) +func TestTaxRateUpdate(t *testing.T) { + params := &stripe.TaxRateParams{Active: stripe.Bool(false)} + result, _ := taxrate.Update("txr_xxxxxxxxxxxxx", params) + assert.NotNil(t, result) +} + +func TestTerminalConfigurationList2(t *testing.T) { + params := &stripe.TerminalConfigurationListParams{} + params.Limit = stripe.Int64(3) + result := terminal_configuration.List(params) assert.NotNil(t, result) + assert.Nil(t, result.Err()) } func TestTerminalConfigurationCreate2(t *testing.T) { @@ -2092,6 +2088,12 @@ func TestTerminalConfigurationCreate2(t *testing.T) { assert.NotNil(t, result) } +func TestTerminalConfigurationDelete2(t *testing.T) { + params := &stripe.TerminalConfigurationParams{} + result, _ := terminal_configuration.Del("tmc_xxxxxxxxxxxxx", params) + assert.NotNil(t, result) +} + func TestTerminalConfigurationRetrieve2(t *testing.T) { params := &stripe.TerminalConfigurationParams{} result, _ := terminal_configuration.Get("tmc_xxxxxxxxxxxxx", params) @@ -2108,452 +2110,501 @@ func TestTerminalConfigurationUpdate2(t *testing.T) { assert.NotNil(t, result) } -func TestTerminalConfigurationDelete2(t *testing.T) { - params := &stripe.TerminalConfigurationParams{} - result, _ := terminal_configuration.Del("tmc_xxxxxxxxxxxxx", params) +func TestTerminalConnectionTokenCreate(t *testing.T) { + params := &stripe.TerminalConnectionTokenParams{} + result, _ := terminal_connectiontoken.New(params) + assert.NotNil(t, result) +} + +func TestTerminalLocationList(t *testing.T) { + params := &stripe.TerminalLocationListParams{} + params.Limit = stripe.Int64(3) + result := terminal_location.List(params) + assert.NotNil(t, result) + assert.Nil(t, result.Err()) +} + +func TestTerminalLocationCreate(t *testing.T) { + params := &stripe.TerminalLocationParams{ + DisplayName: stripe.String("My First Store"), + Address: &stripe.AccountAddressParams{ + Line1: stripe.String("1234 Main Street"), + City: stripe.String("San Francisco"), + Country: stripe.String("US"), + PostalCode: stripe.String("94111"), + }, + } + result, _ := terminal_location.New(params) + assert.NotNil(t, result) +} + +func TestTerminalLocationDelete(t *testing.T) { + params := &stripe.TerminalLocationParams{} + result, _ := terminal_location.Del("tml_xxxxxxxxxxxxx", params) + assert.NotNil(t, result) +} + +func TestTerminalLocationRetrieve(t *testing.T) { + params := &stripe.TerminalLocationParams{} + result, _ := terminal_location.Get("tml_xxxxxxxxxxxxx", params) + assert.NotNil(t, result) +} + +func TestTerminalLocationUpdate(t *testing.T) { + params := &stripe.TerminalLocationParams{ + DisplayName: stripe.String("My First Store"), + } + result, _ := terminal_location.Update("tml_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestTerminalConfigurationList2(t *testing.T) { - params := &stripe.TerminalConfigurationListParams{} +func TestTerminalReaderList(t *testing.T) { + params := &stripe.TerminalReaderListParams{} params.Limit = stripe.Int64(3) - result := terminal_configuration.List(params) + result := terminal_reader.List(params) assert.NotNil(t, result) assert.Nil(t, result.Err()) } -func TestTreasuryFinancialAccountCreate(t *testing.T) { - params := &stripe.TreasuryFinancialAccountParams{ - SupportedCurrencies: []*string{stripe.String("usd")}, - Features: &stripe.TreasuryFinancialAccountFeaturesParams{}, +func TestTerminalReaderCreate(t *testing.T) { + params := &stripe.TerminalReaderParams{ + RegistrationCode: stripe.String("puppies-plug-could"), + Label: stripe.String("Blue Rabbit"), + Location: stripe.String("tml_1234"), } - result, _ := treasury_financialaccount.New(params) + result, _ := terminal_reader.New(params) assert.NotNil(t, result) } -func TestTreasuryFinancialAccountUpdate(t *testing.T) { - params := &stripe.TreasuryFinancialAccountParams{} - params.AddMetadata("order_id", "6735") - result, _ := treasury_financialaccount.Update("fa_xxxxxxxxxxxxx", params) +func TestTerminalReaderDelete(t *testing.T) { + params := &stripe.TerminalReaderParams{} + result, _ := terminal_reader.Del("tmr_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestTreasuryFinancialAccountRetrieve(t *testing.T) { - params := &stripe.TreasuryFinancialAccountParams{} - result, _ := treasury_financialaccount.Get("fa_xxxxxxxxxxxxx", params) +func TestTerminalReaderUpdate(t *testing.T) { + params := &stripe.TerminalReaderParams{Label: stripe.String("Blue Rabbit")} + result, _ := terminal_reader.Update("tmr_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestTreasuryFinancialAccountList(t *testing.T) { - params := &stripe.TreasuryFinancialAccountListParams{} - params.Limit = stripe.Int64(3) - result := treasury_financialaccount.List(params) +func TestTerminalReaderCancelAction(t *testing.T) { + params := &stripe.TerminalReaderCancelActionParams{} + result, _ := terminal_reader.CancelAction("tmr_xxxxxxxxxxxxx", params) assert.NotNil(t, result) - assert.Nil(t, result.Err()) } -func TestTreasuryFinancialAccountUpdateFeatures(t *testing.T) { - params := &stripe.TreasuryFinancialAccountUpdateFeaturesParams{} - result, _ := treasury_financialaccount.UpdateFeatures( - "fa_xxxxxxxxxxxxx", +func TestTerminalReaderProcessPaymentIntent(t *testing.T) { + params := &stripe.TerminalReaderProcessPaymentIntentParams{ + PaymentIntent: stripe.String("pi_xxxxxxxxxxxxx"), + } + result, _ := terminal_reader.ProcessPaymentIntent( + "tmr_xxxxxxxxxxxxx", params, ) assert.NotNil(t, result) } -func TestTreasuryFinancialAccountRetrieveFeatures(t *testing.T) { - params := &stripe.TreasuryFinancialAccountRetrieveFeaturesParams{} - result, _ := treasury_financialaccount.RetrieveFeatures( - "fa_xxxxxxxxxxxxx", - params, - ) +func TestTestHelpersTestClockList2(t *testing.T) { + params := &stripe.TestHelpersTestClockListParams{} + params.Limit = stripe.Int64(3) + result := testhelpers_testclock.List(params) assert.NotNil(t, result) + assert.Nil(t, result.Err()) } -func TestTreasuryTransactionRetrieve(t *testing.T) { - params := &stripe.TreasuryTransactionParams{} - result, _ := treasury_transaction.Get("trxn_xxxxxxxxxxxxx", params) +func TestTestHelpersTestClockCreate2(t *testing.T) { + params := &stripe.TestHelpersTestClockParams{ + FrozenTime: stripe.Int64(1577836800), + } + result, _ := testhelpers_testclock.New(params) assert.NotNil(t, result) } -func TestTreasuryTransactionList(t *testing.T) { - params := &stripe.TreasuryTransactionListParams{ - FinancialAccount: stripe.String("fa_xxxxxxxxxxxxx"), - } - params.Limit = stripe.Int64(3) - result := treasury_transaction.List(params) +func TestTestHelpersTestClockDelete2(t *testing.T) { + params := &stripe.TestHelpersTestClockParams{} + result, _ := testhelpers_testclock.Del("clock_xxxxxxxxxxxxx", params) assert.NotNil(t, result) - assert.Nil(t, result.Err()) } -func TestTreasuryTransactionEntryRetrieve(t *testing.T) { - params := &stripe.TreasuryTransactionEntryParams{} - result, _ := treasury_transactionentry.Get("trxne_xxxxxxxxxxxxx", params) +func TestTestHelpersTestClockRetrieve2(t *testing.T) { + params := &stripe.TestHelpersTestClockParams{} + result, _ := testhelpers_testclock.Get("clock_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestTreasuryTransactionEntryList(t *testing.T) { - params := &stripe.TreasuryTransactionEntryListParams{ - FinancialAccount: stripe.String("fa_xxxxxxxxxxxxx"), +func TestTestHelpersTestClockAdvance2(t *testing.T) { + params := &stripe.TestHelpersTestClockAdvanceParams{ + FrozenTime: stripe.Int64(1652390605), } + result, _ := testhelpers_testclock.Advance("clock_xxxxxxxxxxxxx", params) + assert.NotNil(t, result) +} + +func TestTopupList(t *testing.T) { + params := &stripe.TopupListParams{} params.Limit = stripe.Int64(3) - result := treasury_transactionentry.List(params) + result := topup.List(params) assert.NotNil(t, result) assert.Nil(t, result.Err()) } -func TestTreasuryOutboundTransferCreate(t *testing.T) { - params := &stripe.TreasuryOutboundTransferParams{ - FinancialAccount: stripe.String("fa_xxxxxxxxxxxxx"), - DestinationPaymentMethod: stripe.String("pm_xxxxxxxxxxxxx"), - Amount: stripe.Int64(500), - Currency: stripe.String(string(stripe.CurrencyUSD)), - Description: stripe.String("OutboundTransfer to my external bank account"), +func TestTopupCreate(t *testing.T) { + params := &stripe.TopupParams{ + Amount: stripe.Int64(2000), + Currency: stripe.String(string(stripe.CurrencyUSD)), + Description: stripe.String("Top-up for Jenny Rosen"), + StatementDescriptor: stripe.String("Top-up"), } - result, _ := treasury_outboundtransfer.New(params) + result, _ := topup.New(params) assert.NotNil(t, result) } -func TestTreasuryOutboundTransferCancel(t *testing.T) { - params := &stripe.TreasuryOutboundTransferCancelParams{} - result, _ := treasury_outboundtransfer.Cancel("obt_xxxxxxxxxxxxx", params) +func TestTopupRetrieve(t *testing.T) { + params := &stripe.TopupParams{} + result, _ := topup.Get("tu_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestTreasuryOutboundTransferRetrieve(t *testing.T) { - params := &stripe.TreasuryOutboundTransferParams{} - result, _ := treasury_outboundtransfer.Get("obt_xxxxxxxxxxxxx", params) +func TestTopupUpdate(t *testing.T) { + params := &stripe.TopupParams{} + params.AddMetadata("order_id", "6735") + result, _ := topup.Update("tu_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestTreasuryOutboundTransferList(t *testing.T) { - params := &stripe.TreasuryOutboundTransferListParams{ - FinancialAccount: stripe.String("fa_xxxxxxxxxxxxx"), - } +func TestTransferList(t *testing.T) { + params := &stripe.TransferListParams{} params.Limit = stripe.Int64(3) - result := treasury_outboundtransfer.List(params) + result := transfer.List(params) assert.NotNil(t, result) assert.Nil(t, result.Err()) } -func TestTreasuryOutboundPaymentCreate(t *testing.T) { - params := &stripe.TreasuryOutboundPaymentParams{ - FinancialAccount: stripe.String("fa_xxxxxxxxxxxxx"), - Amount: stripe.Int64(10000), - Currency: stripe.String(string(stripe.CurrencyUSD)), - Customer: stripe.String("cu_xxxxxxxxxxxxx"), - DestinationPaymentMethod: stripe.String("pm_xxxxxxxxxxxxx"), - Description: stripe.String("OutboundPayment to a 3rd party"), +func TestTransferCreate(t *testing.T) { + params := &stripe.TransferParams{ + Amount: stripe.Int64(400), + Currency: stripe.String(string(stripe.CurrencyUSD)), + Destination: stripe.String("acct_xxxxxxxxxxxxx"), + TransferGroup: stripe.String("ORDER_95"), } - result, _ := treasury_outboundpayment.New(params) + result, _ := transfer.New(params) assert.NotNil(t, result) } -func TestTreasuryOutboundPaymentCancel(t *testing.T) { - params := &stripe.TreasuryOutboundPaymentCancelParams{} - result, _ := treasury_outboundpayment.Cancel("obp_xxxxxxxxxxxxx", params) +func TestTransferRetrieve(t *testing.T) { + params := &stripe.TransferParams{} + result, _ := transfer.Get("tr_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestTreasuryOutboundPaymentRetrieve(t *testing.T) { - params := &stripe.TreasuryOutboundPaymentParams{} - result, _ := treasury_outboundpayment.Get("obp_xxxxxxxxxxxxx", params) +func TestTransferUpdate(t *testing.T) { + params := &stripe.TransferParams{} + params.AddMetadata("order_id", "6735") + result, _ := transfer.Update("tr_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestTreasuryOutboundPaymentList(t *testing.T) { - params := &stripe.TreasuryOutboundPaymentListParams{ - FinancialAccount: stripe.String("fa_xxxxxxxxxxxxx"), +func TestReversalList(t *testing.T) { + params := &stripe.ReversalListParams{ + Transfer: stripe.String("tr_xxxxxxxxxxxxx"), } params.Limit = stripe.Int64(3) - result := treasury_outboundpayment.List(params) + result := reversal.List(params) assert.NotNil(t, result) assert.Nil(t, result.Err()) } -func TestTreasuryInboundTransferCreate(t *testing.T) { - params := &stripe.TreasuryInboundTransferParams{ - FinancialAccount: stripe.String("fa_xxxxxxxxxxxxx"), - Amount: stripe.Int64(10000), - Currency: stripe.String(string(stripe.CurrencyUSD)), - OriginPaymentMethod: stripe.String("pm_xxxxxxxxxxxxx"), - Description: stripe.String("InboundTransfer from my bank account"), - } - result, _ := treasury_inboundtransfer.New(params) +func TestReversalCreate(t *testing.T) { + params := &stripe.ReversalParams{Amount: stripe.Int64(100)} + result, _ := reversal.New(params) assert.NotNil(t, result) } -func TestTreasuryInboundTransferRetrieve(t *testing.T) { - params := &stripe.TreasuryInboundTransferParams{} - result, _ := treasury_inboundtransfer.Get("ibt_xxxxxxxxxxxxx", params) +func TestReversalRetrieve(t *testing.T) { + params := &stripe.ReversalParams{Transfer: stripe.String("tr_xxxxxxxxxxxxx")} + result, _ := reversal.Get("trr_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestTreasuryInboundTransferList(t *testing.T) { - params := &stripe.TreasuryInboundTransferListParams{ +func TestReversalUpdate(t *testing.T) { + params := &stripe.ReversalParams{Transfer: stripe.String("tr_xxxxxxxxxxxxx")} + params.AddMetadata("order_id", "6735") + result, _ := reversal.Update("trr_xxxxxxxxxxxxx", params) + assert.NotNil(t, result) +} + +func TestTreasuryCreditReversalList(t *testing.T) { + params := &stripe.TreasuryCreditReversalListParams{ FinancialAccount: stripe.String("fa_xxxxxxxxxxxxx"), } params.Limit = stripe.Int64(3) - result := treasury_inboundtransfer.List(params) + result := treasury_creditreversal.List(params) assert.NotNil(t, result) assert.Nil(t, result.Err()) } -func TestTreasuryInboundTransferCancel(t *testing.T) { - params := &stripe.TreasuryInboundTransferCancelParams{} - result, _ := treasury_inboundtransfer.Cancel("ibt_xxxxxxxxxxxxx", params) +func TestTreasuryCreditReversalCreate(t *testing.T) { + params := &stripe.TreasuryCreditReversalParams{ + ReceivedCredit: stripe.String("rc_xxxxxxxxxxxxx"), + } + result, _ := treasury_creditreversal.New(params) assert.NotNil(t, result) } -func TestTreasuryReceivedCreditRetrieve(t *testing.T) { - params := &stripe.TreasuryReceivedCreditParams{} - result, _ := treasury_receivedcredit.Get("rc_xxxxxxxxxxxxx", params) +func TestTreasuryCreditReversalRetrieve(t *testing.T) { + params := &stripe.TreasuryCreditReversalParams{} + result, _ := treasury_creditreversal.Get("credrev_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestTreasuryReceivedCreditList(t *testing.T) { - params := &stripe.TreasuryReceivedCreditListParams{ +func TestTreasuryDebitReversalList(t *testing.T) { + params := &stripe.TreasuryDebitReversalListParams{ FinancialAccount: stripe.String("fa_xxxxxxxxxxxxx"), } params.Limit = stripe.Int64(3) - result := treasury_receivedcredit.List(params) + result := treasury_debitreversal.List(params) assert.NotNil(t, result) assert.Nil(t, result.Err()) } -func TestTreasuryReceivedDebitRetrieve(t *testing.T) { - params := &stripe.TreasuryReceivedDebitParams{} - result, _ := treasury_receiveddebit.Get("rd_xxxxxxxxxxxxx", params) +func TestTreasuryDebitReversalCreate(t *testing.T) { + params := &stripe.TreasuryDebitReversalParams{ + ReceivedDebit: stripe.String("rd_xxxxxxxxxxxxx"), + } + result, _ := treasury_debitreversal.New(params) assert.NotNil(t, result) } -func TestTreasuryReceivedDebitList(t *testing.T) { - params := &stripe.TreasuryReceivedDebitListParams{ - FinancialAccount: stripe.String("fa_xxxxxxxxxxxxx"), - } +func TestTreasuryDebitReversalRetrieve(t *testing.T) { + params := &stripe.TreasuryDebitReversalParams{} + result, _ := treasury_debitreversal.Get("debrev_xxxxxxxxxxxxx", params) + assert.NotNil(t, result) +} + +func TestTreasuryFinancialAccountList(t *testing.T) { + params := &stripe.TreasuryFinancialAccountListParams{} params.Limit = stripe.Int64(3) - result := treasury_receiveddebit.List(params) + result := treasury_financialaccount.List(params) assert.NotNil(t, result) assert.Nil(t, result.Err()) } -func TestTreasuryCreditReversalCreate(t *testing.T) { - params := &stripe.TreasuryCreditReversalParams{ - ReceivedCredit: stripe.String("rc_xxxxxxxxxxxxx"), +func TestTreasuryFinancialAccountCreate(t *testing.T) { + params := &stripe.TreasuryFinancialAccountParams{ + SupportedCurrencies: []*string{stripe.String("usd")}, + Features: &stripe.TreasuryFinancialAccountFeaturesParams{}, } - result, _ := treasury_creditreversal.New(params) + result, _ := treasury_financialaccount.New(params) assert.NotNil(t, result) } -func TestTreasuryCreditReversalRetrieve(t *testing.T) { - params := &stripe.TreasuryCreditReversalParams{} - result, _ := treasury_creditreversal.Get("credrev_xxxxxxxxxxxxx", params) +func TestTreasuryFinancialAccountRetrieve(t *testing.T) { + params := &stripe.TreasuryFinancialAccountParams{} + result, _ := treasury_financialaccount.Get("fa_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestTreasuryCreditReversalList(t *testing.T) { - params := &stripe.TreasuryCreditReversalListParams{ - FinancialAccount: stripe.String("fa_xxxxxxxxxxxxx"), - } - params.Limit = stripe.Int64(3) - result := treasury_creditreversal.List(params) +func TestTreasuryFinancialAccountUpdate(t *testing.T) { + params := &stripe.TreasuryFinancialAccountParams{} + params.AddMetadata("order_id", "6735") + result, _ := treasury_financialaccount.Update("fa_xxxxxxxxxxxxx", params) assert.NotNil(t, result) - assert.Nil(t, result.Err()) } -func TestTreasuryDebitReversalCreate(t *testing.T) { - params := &stripe.TreasuryDebitReversalParams{ - ReceivedDebit: stripe.String("rd_xxxxxxxxxxxxx"), - } - result, _ := treasury_debitreversal.New(params) +func TestTreasuryFinancialAccountRetrieveFeatures(t *testing.T) { + params := &stripe.TreasuryFinancialAccountRetrieveFeaturesParams{} + result, _ := treasury_financialaccount.RetrieveFeatures( + "fa_xxxxxxxxxxxxx", + params, + ) assert.NotNil(t, result) } -func TestTreasuryDebitReversalRetrieve(t *testing.T) { - params := &stripe.TreasuryDebitReversalParams{} - result, _ := treasury_debitreversal.Get("debrev_xxxxxxxxxxxxx", params) +func TestTreasuryFinancialAccountUpdateFeatures(t *testing.T) { + params := &stripe.TreasuryFinancialAccountUpdateFeaturesParams{ + CardIssuing: &stripe.TreasuryFinancialAccountUpdateFeaturesCardIssuingParams{ + Requested: stripe.Bool(false), + }, + } + result, _ := treasury_financialaccount.UpdateFeatures( + "fa_xxxxxxxxxxxxx", + params, + ) assert.NotNil(t, result) } -func TestTreasuryDebitReversalList(t *testing.T) { - params := &stripe.TreasuryDebitReversalListParams{ +func TestTreasuryInboundTransferList(t *testing.T) { + params := &stripe.TreasuryInboundTransferListParams{ FinancialAccount: stripe.String("fa_xxxxxxxxxxxxx"), } params.Limit = stripe.Int64(3) - result := treasury_debitreversal.List(params) + result := treasury_inboundtransfer.List(params) assert.NotNil(t, result) assert.Nil(t, result.Err()) } -func TestSKUCreate(t *testing.T) { - params := &stripe.SKUParams{ - Attributes: map[string]string{"size": "Medium", "gender": "Unisex"}, - Price: stripe.Int64(1500), - Currency: stripe.String(string(stripe.CurrencyUSD)), - Inventory: &stripe.InventoryParams{ - Type: stripe.String(string(stripe.SKUInventoryTypeFinite)), - Quantity: stripe.Int64(500), - }, - Product: stripe.String("prod_xxxxxxxxxxxxx"), +func TestTreasuryInboundTransferCreate(t *testing.T) { + params := &stripe.TreasuryInboundTransferParams{ + FinancialAccount: stripe.String("fa_xxxxxxxxxxxxx"), + Amount: stripe.Int64(10000), + Currency: stripe.String(string(stripe.CurrencyUSD)), + OriginPaymentMethod: stripe.String("pm_xxxxxxxxxxxxx"), + Description: stripe.String("InboundTransfer from my bank account"), } - result, _ := sku.New(params) + result, _ := treasury_inboundtransfer.New(params) assert.NotNil(t, result) } -func TestSKURetrieve(t *testing.T) { - params := &stripe.SKUParams{} - result, _ := sku.Get("sku_xxxxxxxxxxxxx", params) +func TestTreasuryInboundTransferRetrieve(t *testing.T) { + params := &stripe.TreasuryInboundTransferParams{} + result, _ := treasury_inboundtransfer.Get("ibt_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestSKUUpdate(t *testing.T) { - params := &stripe.SKUParams{} - params.AddMetadata("order_id", "6735") - result, _ := sku.Update("sku_xxxxxxxxxxxxx", params) +func TestTreasuryInboundTransferCancel(t *testing.T) { + params := &stripe.TreasuryInboundTransferCancelParams{} + result, _ := treasury_inboundtransfer.Cancel("ibt_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestSKUList(t *testing.T) { - params := &stripe.SKUListParams{} +func TestTreasuryOutboundPaymentList(t *testing.T) { + params := &stripe.TreasuryOutboundPaymentListParams{ + FinancialAccount: stripe.String("fa_xxxxxxxxxxxxx"), + } params.Limit = stripe.Int64(3) - result := sku.List(params) + result := treasury_outboundpayment.List(params) assert.NotNil(t, result) assert.Nil(t, result.Err()) } -func TestSKUDelete(t *testing.T) { - params := &stripe.SKUParams{} - result, _ := sku.Del("sku_xxxxxxxxxxxxx", params) - assert.NotNil(t, result) -} - -func TestSigmaScheduledQueryRunRetrieve(t *testing.T) { - params := &stripe.SigmaScheduledQueryRunParams{} - result, _ := sigma_scheduledqueryrun.Get("sqr_xxxxxxxxxxxxx", params) +func TestTreasuryOutboundPaymentCreate(t *testing.T) { + params := &stripe.TreasuryOutboundPaymentParams{ + FinancialAccount: stripe.String("fa_xxxxxxxxxxxxx"), + Amount: stripe.Int64(10000), + Currency: stripe.String(string(stripe.CurrencyUSD)), + Customer: stripe.String("cu_xxxxxxxxxxxxx"), + DestinationPaymentMethod: stripe.String("pm_xxxxxxxxxxxxx"), + Description: stripe.String("OutboundPayment to a 3rd party"), + } + result, _ := treasury_outboundpayment.New(params) assert.NotNil(t, result) } -func TestSigmaScheduledQueryRunList(t *testing.T) { - params := &stripe.SigmaScheduledQueryRunListParams{} - params.Limit = stripe.Int64(3) - result := sigma_scheduledqueryrun.List(params) +func TestTreasuryOutboundPaymentRetrieve(t *testing.T) { + params := &stripe.TreasuryOutboundPaymentParams{} + result, _ := treasury_outboundpayment.Get("obp_xxxxxxxxxxxxx", params) assert.NotNil(t, result) - assert.Nil(t, result.Err()) } -func TestFinancialConnectionsAccountRetrieve2(t *testing.T) { - params := &stripe.FinancialConnectionsAccountParams{} - result, _ := financialconnections_account.GetByID( - "fca_xxxxxxxxxxxxx", - params, - ) +func TestTreasuryOutboundPaymentCancel(t *testing.T) { + params := &stripe.TreasuryOutboundPaymentCancelParams{} + result, _ := treasury_outboundpayment.Cancel("obp_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestFinancialConnectionsAccountList2(t *testing.T) { - params := &stripe.FinancialConnectionsAccountListParams{ - AccountHolder: &stripe.FinancialConnectionsAccountListAccountHolderParams{ - Customer: stripe.String("cus_xxxxxxxxxxxxx"), - }, +func TestTreasuryOutboundTransferList(t *testing.T) { + params := &stripe.TreasuryOutboundTransferListParams{ + FinancialAccount: stripe.String("fa_xxxxxxxxxxxxx"), } - result := financialconnections_account.List(params) + params.Limit = stripe.Int64(3) + result := treasury_outboundtransfer.List(params) assert.NotNil(t, result) assert.Nil(t, result.Err()) } -func TestFinancialConnectionsAccountListOwners2(t *testing.T) { - params := &stripe.FinancialConnectionsAccountListOwnersParams{ - Ownership: stripe.String("fcaowns_xxxxxxxxxxxxx"), - Account: stripe.String("fca_xxxxxxxxxxxxx"), +func TestTreasuryOutboundTransferCreate(t *testing.T) { + params := &stripe.TreasuryOutboundTransferParams{ + FinancialAccount: stripe.String("fa_xxxxxxxxxxxxx"), + DestinationPaymentMethod: stripe.String("pm_xxxxxxxxxxxxx"), + Amount: stripe.Int64(500), + Currency: stripe.String(string(stripe.CurrencyUSD)), + Description: stripe.String("OutboundTransfer to my external bank account"), } - params.Limit = stripe.Int64(3) - result := financialconnections_account.ListOwners(params) + result, _ := treasury_outboundtransfer.New(params) assert.NotNil(t, result) - assert.Nil(t, result.Err()) } -func TestFinancialConnectionsSessionCreate2(t *testing.T) { - params := &stripe.FinancialConnectionsSessionParams{ - AccountHolder: &stripe.FinancialConnectionsSessionAccountHolderParams{ - Type: stripe.String(string(stripe.FinancialConnectionsSessionAccountHolderTypeCustomer)), - Customer: stripe.String("cus_xxxxxxxxxxxxx"), - }, - Permissions: []*string{ - stripe.String(string(stripe.FinancialConnectionsSessionPermissionPaymentMethod)), - stripe.String(string(stripe.FinancialConnectionsSessionPermissionBalances)), - }, - Filters: &stripe.FinancialConnectionsSessionFiltersParams{ - Countries: []*string{stripe.String("US")}, - }, - } - result, _ := financialconnections_session.New(params) +func TestTreasuryOutboundTransferRetrieve(t *testing.T) { + params := &stripe.TreasuryOutboundTransferParams{} + result, _ := treasury_outboundtransfer.Get("obt_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestFinancialConnectionsSessionRetrieve2(t *testing.T) { - params := &stripe.FinancialConnectionsSessionParams{} - result, _ := financialconnections_session.Get("fcsess_xxxxxxxxxxxxx", params) +func TestTreasuryOutboundTransferCancel(t *testing.T) { + params := &stripe.TreasuryOutboundTransferCancelParams{} + result, _ := treasury_outboundtransfer.Cancel("obt_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestSourceRetrieve2(t *testing.T) { - params := &stripe.SourceObjectParams{} - result, _ := source.Get("src_xxxxxxxxxxxxx", params) +func TestTreasuryReceivedCreditList(t *testing.T) { + params := &stripe.TreasuryReceivedCreditListParams{ + FinancialAccount: stripe.String("fa_xxxxxxxxxxxxx"), + } + params.Limit = stripe.Int64(3) + result := treasury_receivedcredit.List(params) assert.NotNil(t, result) + assert.Nil(t, result.Err()) } -func TestIdentityVerificationSessionCreate(t *testing.T) { - params := &stripe.IdentityVerificationSessionParams{ - Type: stripe.String(string(stripe.IdentityVerificationSessionTypeDocument)), - } - result, _ := identity_verificationsession.New(params) +func TestTreasuryReceivedCreditRetrieve(t *testing.T) { + params := &stripe.TreasuryReceivedCreditParams{} + result, _ := treasury_receivedcredit.Get("rc_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestIdentityVerificationSessionList(t *testing.T) { - params := &stripe.IdentityVerificationSessionListParams{} +func TestTreasuryReceivedDebitList(t *testing.T) { + params := &stripe.TreasuryReceivedDebitListParams{ + FinancialAccount: stripe.String("fa_xxxxxxxxxxxxx"), + } params.Limit = stripe.Int64(3) - result := identity_verificationsession.List(params) + result := treasury_receiveddebit.List(params) assert.NotNil(t, result) assert.Nil(t, result.Err()) } -func TestIdentityVerificationSessionRetrieve(t *testing.T) { - params := &stripe.IdentityVerificationSessionParams{} - result, _ := identity_verificationsession.Get("vs_xxxxxxxxxxxxx", params) +func TestTreasuryReceivedDebitRetrieve(t *testing.T) { + params := &stripe.TreasuryReceivedDebitParams{} + result, _ := treasury_receiveddebit.Get("rd_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestIdentityVerificationSessionUpdate(t *testing.T) { - params := &stripe.IdentityVerificationSessionParams{ - Type: stripe.String(string(stripe.IdentityVerificationSessionTypeIDNumber)), +func TestTreasuryTransactionEntryList(t *testing.T) { + params := &stripe.TreasuryTransactionEntryListParams{ + FinancialAccount: stripe.String("fa_xxxxxxxxxxxxx"), } - result, _ := identity_verificationsession.Update("vs_xxxxxxxxxxxxx", params) + params.Limit = stripe.Int64(3) + result := treasury_transactionentry.List(params) assert.NotNil(t, result) + assert.Nil(t, result.Err()) } -func TestIdentityVerificationSessionCancel(t *testing.T) { - params := &stripe.IdentityVerificationSessionCancelParams{} - result, _ := identity_verificationsession.Cancel("vs_xxxxxxxxxxxxx", params) +func TestTreasuryTransactionEntryRetrieve(t *testing.T) { + params := &stripe.TreasuryTransactionEntryParams{} + result, _ := treasury_transactionentry.Get("trxne_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestIdentityVerificationSessionRedact(t *testing.T) { - params := &stripe.IdentityVerificationSessionRedactParams{} - result, _ := identity_verificationsession.Redact("vs_xxxxxxxxxxxxx", params) +func TestTreasuryTransactionList(t *testing.T) { + params := &stripe.TreasuryTransactionListParams{ + FinancialAccount: stripe.String("fa_xxxxxxxxxxxxx"), + } + params.Limit = stripe.Int64(3) + result := treasury_transaction.List(params) assert.NotNil(t, result) + assert.Nil(t, result.Err()) } -func TestIdentityVerificationReportRetrieve(t *testing.T) { - params := &stripe.IdentityVerificationReportParams{} - result, _ := identity_verificationreport.Get("vr_xxxxxxxxxxxxx", params) +func TestTreasuryTransactionRetrieve(t *testing.T) { + params := &stripe.TreasuryTransactionParams{} + result, _ := treasury_transaction.Get("trxn_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } -func TestIdentityVerificationReportList(t *testing.T) { - params := &stripe.IdentityVerificationReportListParams{} +func TestWebhookEndpointList(t *testing.T) { + params := &stripe.WebhookEndpointListParams{} params.Limit = stripe.Int64(3) - result := identity_verificationreport.List(params) + result := webhookendpoint.List(params) assert.NotNil(t, result) assert.Nil(t, result.Err()) } @@ -2570,6 +2621,12 @@ func TestWebhookEndpointCreate(t *testing.T) { assert.NotNil(t, result) } +func TestWebhookEndpointDelete(t *testing.T) { + params := &stripe.WebhookEndpointParams{} + result, _ := webhookendpoint.Del("we_xxxxxxxxxxxxx", params) + assert.NotNil(t, result) +} + func TestWebhookEndpointRetrieve(t *testing.T) { params := &stripe.WebhookEndpointParams{} result, _ := webhookendpoint.Get("we_xxxxxxxxxxxxx", params) @@ -2583,17 +2640,3 @@ func TestWebhookEndpointUpdate(t *testing.T) { result, _ := webhookendpoint.Update("we_xxxxxxxxxxxxx", params) assert.NotNil(t, result) } - -func TestWebhookEndpointList(t *testing.T) { - params := &stripe.WebhookEndpointListParams{} - params.Limit = stripe.Int64(3) - result := webhookendpoint.List(params) - assert.NotNil(t, result) - assert.Nil(t, result.Err()) -} - -func TestWebhookEndpointDelete(t *testing.T) { - params := &stripe.WebhookEndpointParams{} - result, _ := webhookendpoint.Del("we_xxxxxxxxxxxxx", params) - assert.NotNil(t, result) -} diff --git a/invoice.go b/invoice.go index 99e12e0e87..06e0699042 100644 --- a/invoice.go +++ b/invoice.go @@ -173,7 +173,7 @@ type InvoiceListParams struct { // Settings for automatic tax lookup for this invoice. type InvoiceAutomaticTaxParams struct { - // Controls whether Stripe will automatically compute tax on this invoice. + // Whether Stripe automatically computes tax on this invoice. Note that incompatible invoice items (invoice items with manually specified [tax rates](https://stripe.com/docs/api/tax_rates), negative amounts, or `tax_behavior=unspecified`) cannot be added to automatic tax invoices. Enabled *bool `form:"enabled"` } @@ -528,7 +528,7 @@ type InvoiceLineListParams struct { Subscription *string `form:"subscription"` } type InvoiceAutomaticTax struct { - // Whether Stripe automatically computes tax on this invoice. + // Whether Stripe automatically computes tax on this invoice. Note that incompatible invoice items (invoice items with manually specified [tax rates](https://stripe.com/docs/api/tax_rates), negative amounts, or `tax_behavior=unspecified`) cannot be added to automatic tax invoices. Enabled bool `json:"enabled"` // The status of the most recent automated tax calculation for this invoice. Status InvoiceAutomaticTaxStatus `json:"status"` diff --git a/paymentlink.go b/paymentlink.go index 40eabe2b74..64695bcdd3 100644 --- a/paymentlink.go +++ b/paymentlink.go @@ -66,7 +66,29 @@ type PaymentLinkPaymentMethodType string // List of values that PaymentLinkPaymentMethodType can take const ( - PaymentLinkPaymentMethodTypeCard PaymentLinkPaymentMethodType = "card" + PaymentLinkPaymentMethodTypeAffirm PaymentLinkPaymentMethodType = "affirm" + PaymentLinkPaymentMethodTypeAfterpayClearpay PaymentLinkPaymentMethodType = "afterpay_clearpay" + PaymentLinkPaymentMethodTypeAlipay PaymentLinkPaymentMethodType = "alipay" + PaymentLinkPaymentMethodTypeAUBECSDebit PaymentLinkPaymentMethodType = "au_becs_debit" + PaymentLinkPaymentMethodTypeBACSDebit PaymentLinkPaymentMethodType = "bacs_debit" + PaymentLinkPaymentMethodTypeBancontact PaymentLinkPaymentMethodType = "bancontact" + PaymentLinkPaymentMethodTypeBoleto PaymentLinkPaymentMethodType = "boleto" + PaymentLinkPaymentMethodTypeCard PaymentLinkPaymentMethodType = "card" + PaymentLinkPaymentMethodTypeEPS PaymentLinkPaymentMethodType = "eps" + PaymentLinkPaymentMethodTypeFPX PaymentLinkPaymentMethodType = "fpx" + PaymentLinkPaymentMethodTypeGiropay PaymentLinkPaymentMethodType = "giropay" + PaymentLinkPaymentMethodTypeGrabpay PaymentLinkPaymentMethodType = "grabpay" + PaymentLinkPaymentMethodTypeIdeal PaymentLinkPaymentMethodType = "ideal" + PaymentLinkPaymentMethodTypeKlarna PaymentLinkPaymentMethodType = "klarna" + PaymentLinkPaymentMethodTypeKonbini PaymentLinkPaymentMethodType = "konbini" + PaymentLinkPaymentMethodTypeOXXO PaymentLinkPaymentMethodType = "oxxo" + PaymentLinkPaymentMethodTypeP24 PaymentLinkPaymentMethodType = "p24" + PaymentLinkPaymentMethodTypePayNow PaymentLinkPaymentMethodType = "paynow" + PaymentLinkPaymentMethodTypePromptPay PaymentLinkPaymentMethodType = "promptpay" + PaymentLinkPaymentMethodTypeSepaDebit PaymentLinkPaymentMethodType = "sepa_debit" + PaymentLinkPaymentMethodTypeSofort PaymentLinkPaymentMethodType = "sofort" + PaymentLinkPaymentMethodTypeUSBankAccount PaymentLinkPaymentMethodType = "us_bank_account" + PaymentLinkPaymentMethodTypeWechatPay PaymentLinkPaymentMethodType = "wechat_pay" ) // Indicates the type of transaction being performed which customizes relevant text on the page, such as the submit button. diff --git a/testhelpers/issuing/card/client.go b/testhelpers/issuing/card/client.go new file mode 100644 index 0000000000..9234d3fc9f --- /dev/null +++ b/testhelpers/issuing/card/client.go @@ -0,0 +1,88 @@ +// +// +// File generated from our OpenAPI spec +// +// + +// Package card provides the /issuing/cards APIs +package card + +import ( + "net/http" + + stripe "github.com/stripe/stripe-go/v72" +) + +// Client is used to invoke /issuing/cards APIs. +type Client struct { + B stripe.Backend + Key string +} + +// DeliverCard is the method for the `POST /v1/test_helpers/issuing/cards/{card}/shipping/deliver` API. +func DeliverCard(id string, params *stripe.TestHelpersIssuingCardDeliverCardParams) (*stripe.IssuingCard, error) { + return getC().DeliverCard(id, params) +} + +// DeliverCard is the method for the `POST /v1/test_helpers/issuing/cards/{card}/shipping/deliver` API. +func (c Client) DeliverCard(id string, params *stripe.TestHelpersIssuingCardDeliverCardParams) (*stripe.IssuingCard, error) { + path := stripe.FormatURLPath( + "/v1/test_helpers/issuing/cards/%s/shipping/deliver", + id, + ) + card := &stripe.IssuingCard{} + err := c.B.Call(http.MethodPost, path, c.Key, params, card) + return card, err +} + +// FailCard is the method for the `POST /v1/test_helpers/issuing/cards/{card}/shipping/fail` API. +func FailCard(id string, params *stripe.TestHelpersIssuingCardFailCardParams) (*stripe.IssuingCard, error) { + return getC().FailCard(id, params) +} + +// FailCard is the method for the `POST /v1/test_helpers/issuing/cards/{card}/shipping/fail` API. +func (c Client) FailCard(id string, params *stripe.TestHelpersIssuingCardFailCardParams) (*stripe.IssuingCard, error) { + path := stripe.FormatURLPath( + "/v1/test_helpers/issuing/cards/%s/shipping/fail", + id, + ) + card := &stripe.IssuingCard{} + err := c.B.Call(http.MethodPost, path, c.Key, params, card) + return card, err +} + +// ReturnCard is the method for the `POST /v1/test_helpers/issuing/cards/{card}/shipping/return` API. +func ReturnCard(id string, params *stripe.TestHelpersIssuingCardReturnCardParams) (*stripe.IssuingCard, error) { + return getC().ReturnCard(id, params) +} + +// ReturnCard is the method for the `POST /v1/test_helpers/issuing/cards/{card}/shipping/return` API. +func (c Client) ReturnCard(id string, params *stripe.TestHelpersIssuingCardReturnCardParams) (*stripe.IssuingCard, error) { + path := stripe.FormatURLPath( + "/v1/test_helpers/issuing/cards/%s/shipping/return", + id, + ) + card := &stripe.IssuingCard{} + err := c.B.Call(http.MethodPost, path, c.Key, params, card) + return card, err +} + +// ShipCard is the method for the `POST /v1/test_helpers/issuing/cards/{card}/shipping/ship` API. +func ShipCard(id string, params *stripe.TestHelpersIssuingCardShipCardParams) (*stripe.IssuingCard, error) { + return getC().ShipCard(id, params) +} + +// ShipCard is the method for the `POST /v1/test_helpers/issuing/cards/{card}/shipping/ship` API. +func (c Client) ShipCard(id string, params *stripe.TestHelpersIssuingCardShipCardParams) (*stripe.IssuingCard, error) { + path := stripe.FormatURLPath( + "/v1/test_helpers/issuing/cards/%s/shipping/ship", + id, + ) + card := &stripe.IssuingCard{} + err := c.B.Call(http.MethodPost, path, c.Key, params, card) + return card, err +} + +func getC() Client { + return Client{stripe.GetBackend(stripe.APIBackend), stripe.Key} +} diff --git a/testhelpersissuing_card.go b/testhelpersissuing_card.go new file mode 100644 index 0000000000..783cfbb98c --- /dev/null +++ b/testhelpersissuing_card.go @@ -0,0 +1,27 @@ +// +// +// File generated from our OpenAPI spec +// +// + +package stripe + +// Updates the shipping status of the specified Issuing Card object to delivered. +type TestHelpersIssuingCardDeliverCardParams struct { + Params `form:"*"` +} + +// Updates the shipping status of the specified Issuing Card object to shipped. +type TestHelpersIssuingCardShipCardParams struct { + Params `form:"*"` +} + +// Updates the shipping status of the specified Issuing Card object to returned. +type TestHelpersIssuingCardReturnCardParams struct { + Params `form:"*"` +} + +// Updates the shipping status of the specified Issuing Card object to failure. +type TestHelpersIssuingCardFailCardParams struct { + Params `form:"*"` +} diff --git a/treasury_receivedcredit.go b/treasury_receivedcredit.go index e39702bed0..b62b561667 100644 --- a/treasury_receivedcredit.go +++ b/treasury_receivedcredit.go @@ -168,7 +168,7 @@ type TreasuryReceivedCreditLinkedFlows struct { IssuingAuthorization string `json:"issuing_authorization"` // Set if the ReceivedCredit is also viewable as an [Issuing transaction](https://stripe.com/docs/api#issuing_transactions) object. IssuingTransaction string `json:"issuing_transaction"` - // ID of the source flow. Set if `network` is `stripe` and the source flow is visible to the merchant. Examples of source flows include OutboundPayments, payouts, or CreditReversals. + // ID of the source flow. Set if `network` is `stripe` and the source flow is visible to the user. Examples of source flows include OutboundPayments, payouts, or CreditReversals. SourceFlow string `json:"source_flow"` // The expandable object of the source flow. SourceFlowDetails *TreasuryReceivedCreditLinkedFlowsSourceFlowDetails `json:"source_flow_details"` @@ -199,6 +199,8 @@ type TreasuryReceivedCredit struct { FailureCode TreasuryReceivedCreditFailureCode `json:"failure_code"` // The FinancialAccount that received the funds. FinancialAccount string `json:"financial_account"` + // A [hosted transaction receipt](https://stripe.com/docs/treasury/moving-money/regulatory-receipts) URL that is provided when money movement is considered regulated under Stripe's money transmission licenses. + HostedRegulatoryReceiptURL string `json:"hosted_regulatory_receipt_url"` // Unique identifier for the object. ID string `json:"id"` InitiatingPaymentMethodDetails *TreasuryReceivedCreditInitiatingPaymentMethodDetails `json:"initiating_payment_method_details"` diff --git a/treasury_receiveddebit.go b/treasury_receiveddebit.go index 23632dd3e0..4d6e09ca2a 100644 --- a/treasury_receiveddebit.go +++ b/treasury_receiveddebit.go @@ -155,6 +155,8 @@ type TreasuryReceivedDebit struct { FailureCode TreasuryReceivedDebitFailureCode `json:"failure_code"` // The FinancialAccount that funds were pulled from. FinancialAccount string `json:"financial_account"` + // A [hosted transaction receipt](https://stripe.com/docs/treasury/moving-money/regulatory-receipts) URL that is provided when money movement is considered regulated under Stripe's money transmission licenses. + HostedRegulatoryReceiptURL string `json:"hosted_regulatory_receipt_url"` // Unique identifier for the object. ID string `json:"id"` InitiatingPaymentMethodDetails *TreasuryReceivedDebitInitiatingPaymentMethodDetails `json:"initiating_payment_method_details"` From c44374086c258b9c6674441bcc9d3baaecb1cfca Mon Sep 17 00:00:00 2001 From: Dominic Charley-Roy Date: Wed, 29 Jun 2022 17:56:57 -0400 Subject: [PATCH 11/17] Bump version to 72.117.0 --- CHANGELOG.md | 8 ++++++++ VERSION | 2 +- stripe.go | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 96b488e4cc..0d97b6af95 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 72.117.0 - 2022-06-29 +* [#1487](https://github.com/stripe/stripe-go/pull/1487) API Updates + * Add support for `DeliverCard`, `FailCard`, `ReturnCard`, and `ShipCard` test helper methods on resource `Issuing.Card` + * Change type of `PaymentLinkPaymentMethodTypesParams` and `PaymentLinkPaymentMethodTypes` from `literal('card')` to `enum` + * Add support for `HostedRegulatoryReceiptURL` on `TreasuryReceivedCredit` and `TreasuryReceivedDebit` + +* [#1483](https://github.com/stripe/stripe-go/pull/1483) Document use of undocumented parameters/properties + ## 72.116.0 - 2022-06-23 * [#1484](https://github.com/stripe/stripe-go/pull/1484) API Updates * Add support for `CaptureMethod` on `PaymentIntentConfirmParams` and `PaymentIntentParams` diff --git a/VERSION b/VERSION index 13bcfd1cb2..4f1703b3bc 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -72.116.0 +72.117.0 diff --git a/stripe.go b/stripe.go index 75bceea7d9..9156c39243 100644 --- a/stripe.go +++ b/stripe.go @@ -1203,7 +1203,7 @@ func StringSlice(v []string) []*string { // // clientversion is the binding version -const clientversion = "72.116.0" +const clientversion = "72.117.0" // defaultHTTPTimeout is the default timeout on the http.Client used by the library. // This is chosen to be consistent with the other Stripe language libraries and From 6cbd4bb01d79cada1c03d93b9c5100b33a20f207 Mon Sep 17 00:00:00 2001 From: pakrym-stripe <99349468+pakrym-stripe@users.noreply.github.com> Date: Wed, 6 Jul 2022 12:31:55 -0700 Subject: [PATCH 12/17] Codegen for openapi v162 (#1491) --- OPENAPI_VERSION | 2 +- cashbalance.go | 16 +++---- checkout_session.go | 2 + customer.go | 9 +--- example/generated_examples_test.go | 68 +++++++++++++++--------------- paymentlink.go | 2 +- refund.go | 16 +++++-- 7 files changed, 57 insertions(+), 58 deletions(-) diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index 08f46537f5..b164d836dc 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v160 \ No newline at end of file +v162 \ No newline at end of file diff --git a/cashbalance.go b/cashbalance.go index f2cfab7dcc..5c13fccda9 100644 --- a/cashbalance.go +++ b/cashbalance.go @@ -17,19 +17,15 @@ const ( // Retrieves a customer's cash balance. type CashBalanceParams struct { - Params `form:"*"` + Params `form:"*"` + // A hash of settings for this cash balance. Settings *CashBalanceSettingsParams `form:"settings"` Customer *string `form:"-"` // Included in URL } + +// A hash of settings for this cash balance. type CashBalanceSettingsParams struct { - // Method for using the customer balance to pay outstanding - // `customer_balance` PaymentIntents. If set to `automatic`, all available - // funds will automatically be used to pay any outstanding PaymentIntent. - // If set to `manual`, only customer balance funds from bank transfers - // with a reference code matching - // `payment_intent.next_action.display_bank_transfer_intructions.reference_code` will - // automatically be used to pay the corresponding outstanding - // PaymentIntent. + // Controls how funds transferred by the customer are applied to payment intents and invoices. Valid options are `automatic` or `manual`. For more information about these reconciliation modes, see [Reconciliation](https://stripe.com/docs/payments/customer-balance/reconciliation). ReconciliationMode *string `form:"reconciliation_mode"` } type CashBalanceSettings struct { @@ -40,7 +36,7 @@ type CashBalanceSettings struct { // A customer's `Cash balance` represents real funds. Customers can add funds to their cash balance by sending a bank transfer. These funds can be used for payment and can eventually be paid out to your bank account. type CashBalance struct { APIResource - // A hash of all cash balances available to this customer. You cannot delete a customer with any cash balances, even if the balance is 0. + // A hash of all cash balances available to this customer. You cannot delete a customer with any cash balances, even if the balance is 0. Amounts are represented in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal). Available map[string]int64 `json:"available"` // The ID of the customer whose cash balance this object represents. Customer string `json:"customer"` diff --git a/checkout_session.go b/checkout_session.go index 99bebb4b42..b5942f0245 100644 --- a/checkout_session.go +++ b/checkout_session.go @@ -504,6 +504,8 @@ const ( // Returns a list of Checkout Sessions. type CheckoutSessionListParams struct { ListParams `form:"*"` + // Only return the Checkout Sessions for the Customer specified. + Customer *string `form:"customer"` // Only return the Checkout Session for the PaymentIntent specified. PaymentIntent *string `form:"payment_intent"` // Only return the Checkout Session for the subscription specified. diff --git a/customer.go b/customer.go index 9e79296119..f5ba546642 100644 --- a/customer.go +++ b/customer.go @@ -64,14 +64,7 @@ type CustomerListParams struct { // Settings controlling the behavior of the customer's cash balance, // such as reconciliation of funds received. type CustomerCashBalanceSettingsParams struct { - // Method for using the customer balance to pay outstanding - // `customer_balance` PaymentIntents. If set to `automatic`, all available - // funds will automatically be used to pay any outstanding PaymentIntent. - // If set to `manual`, only customer balance funds from bank transfers - // with a reference code matching - // `payment_intent.next_action.display_bank_transfer_intructions.reference_code` will - // automatically be used to pay the corresponding outstanding - // PaymentIntent. + // Controls how funds transferred by the customer are applied to payment intents and invoices. Valid options are `automatic` or `manual`. For more information about these reconciliation modes, see [Reconciliation](https://stripe.com/docs/payments/customer-balance/reconciliation). ReconciliationMode *string `form:"reconciliation_mode"` } diff --git a/example/generated_examples_test.go b/example/generated_examples_test.go index b13b62fa9f..ccf9e41671 100644 --- a/example/generated_examples_test.go +++ b/example/generated_examples_test.go @@ -282,6 +282,16 @@ func TestPaymentLinkListLineItems(t *testing.T) { assert.Nil(t, result.Err()) } +func TestSetupAttemptList(t *testing.T) { + params := &stripe.SetupAttemptListParams{ + SetupIntent: stripe.String("si_xyz"), + } + params.Limit = stripe.Int64(3) + result := setupattempt.List(params) + assert.NotNil(t, result) + assert.Nil(t, result.Err()) +} + func TestSetupIntentVerifyMicrodeposits(t *testing.T) { params := &stripe.SetupIntentVerifyMicrodepositsParams{} result, _ := setupintent.VerifyMicrodeposits("seti_xxxxxxxxxxxxx", params) @@ -354,6 +364,30 @@ func TestTestHelpersCustomerFundCashBalance(t *testing.T) { assert.NotNil(t, result) } +func TestTestHelpersIssuingCardDeliverCard(t *testing.T) { + params := &stripe.TestHelpersIssuingCardDeliverCardParams{} + result, _ := testhelpers_issuing_card.DeliverCard("card_123", params) + assert.NotNil(t, result) +} + +func TestTestHelpersIssuingCardFailCard(t *testing.T) { + params := &stripe.TestHelpersIssuingCardFailCardParams{} + result, _ := testhelpers_issuing_card.FailCard("card_123", params) + assert.NotNil(t, result) +} + +func TestTestHelpersIssuingCardReturnCard(t *testing.T) { + params := &stripe.TestHelpersIssuingCardReturnCardParams{} + result, _ := testhelpers_issuing_card.ReturnCard("card_123", params) + assert.NotNil(t, result) +} + +func TestTestHelpersIssuingCardShipCard(t *testing.T) { + params := &stripe.TestHelpersIssuingCardShipCardParams{} + result, _ := testhelpers_issuing_card.ShipCard("card_123", params) + assert.NotNil(t, result) +} + func TestTestHelpersRefundExpire(t *testing.T) { params := &stripe.TestHelpersRefundExpireParams{} result, _ := testhelpers_refund.Expire("re_123", params) @@ -470,40 +504,6 @@ func TestTestHelpersTreasuryReceivedDebitCreate(t *testing.T) { assert.NotNil(t, result) } -func TestSetupAttemptList(t *testing.T) { - params := &stripe.SetupAttemptListParams{ - SetupIntent: stripe.String("si_xyz"), - } - params.Limit = stripe.Int64(3) - result := setupattempt.List(params) - assert.NotNil(t, result) - assert.Nil(t, result.Err()) -} - -func TestTestHelpersIssuingCardDeliverCard(t *testing.T) { - params := &stripe.TestHelpersIssuingCardDeliverCardParams{} - result, _ := testhelpers_issuing_card.DeliverCard("card_123", params) - assert.NotNil(t, result) -} - -func TestTestHelpersIssuingCardFailCard(t *testing.T) { - params := &stripe.TestHelpersIssuingCardFailCardParams{} - result, _ := testhelpers_issuing_card.FailCard("card_123", params) - assert.NotNil(t, result) -} - -func TestTestHelpersIssuingCardReturnCard(t *testing.T) { - params := &stripe.TestHelpersIssuingCardReturnCardParams{} - result, _ := testhelpers_issuing_card.ReturnCard("card_123", params) - assert.NotNil(t, result) -} - -func TestTestHelpersIssuingCardShipCard(t *testing.T) { - params := &stripe.TestHelpersIssuingCardShipCardParams{} - result, _ := testhelpers_issuing_card.ShipCard("card_123", params) - assert.NotNil(t, result) -} - func TestAccountLinkCreate(t *testing.T) { params := &stripe.AccountLinkParams{ Account: stripe.String("acct_xxxxxxxxxxxxx"), diff --git a/paymentlink.go b/paymentlink.go index 64695bcdd3..54800196dc 100644 --- a/paymentlink.go +++ b/paymentlink.go @@ -266,7 +266,7 @@ type PaymentLinkParams struct { ShippingAddressCollection *PaymentLinkShippingAddressCollectionParams `form:"shipping_address_collection"` // The shipping rate options to apply to [checkout sessions](https://stripe.com/docs/api/checkout/sessions) created by this payment link. ShippingOptions []*PaymentLinkShippingOptionParams `form:"shipping_options"` - // Describes the type of transaction being performed in order to customize relevant text on the page, such as the submit button. + // Describes the type of transaction being performed in order to customize relevant text on the page, such as the submit button. Changing this value will also affect the hostname in the [url](https://stripe.com/docs/api/payment_links/payment_links/object#url) property (example: `donate.stripe.com`). SubmitType *string `form:"submit_type"` // When creating a subscription, the specified configuration data will be used. There must be at least one line item with a recurring price to use `subscription_data`. SubscriptionData *PaymentLinkSubscriptionDataParams `form:"subscription_data"` diff --git a/refund.go b/refund.go index 5b655acdb7..0c1521f31c 100644 --- a/refund.go +++ b/refund.go @@ -53,10 +53,18 @@ type RefundListParams struct { // Create a refund. type RefundParams struct { - Params `form:"*"` - Amount *int64 `form:"amount"` - Charge *string `form:"charge"` - InstructionsEmail *string `form:"instructions_email"` + Params `form:"*"` + // A positive integer representing how much to refund. + Amount *int64 `form:"amount"` + Charge *string `form:"charge"` + // 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"` + // Customer whose customer balance to refund from. + Customer *string `form:"customer"` + // Address to send refund email, use customer email if not specified + InstructionsEmail *string `form:"instructions_email"` + // Origin of the refund + Origin *string `form:"origin"` PaymentIntent *string `form:"payment_intent"` Reason *string `form:"reason"` RefundApplicationFee *bool `form:"refund_application_fee"` From a18c086aa92f5485f54fad4c484218ca22d9108f Mon Sep 17 00:00:00 2001 From: pakrym-stripe <99349468+pakrym-stripe@users.noreply.github.com> Date: Thu, 7 Jul 2022 10:36:20 -0700 Subject: [PATCH 13/17] Codegen for openapi v163 (#1492) --- OPENAPI_VERSION | 2 +- checkout_session.go | 28 +++++--- coupon.go | 18 +++++- example/generated_examples_test.go | 19 +++++- invoice.go | 2 + paymentlink.go | 2 + price.go | 100 +++++++++++++++++++++++++++++ product.go | 55 +++++++++++++++- promotioncode.go | 16 +++++ shippingrate.go | 30 +++++++++ sub.go | 4 ++ subschedule.go | 4 ++ 12 files changed, 268 insertions(+), 12 deletions(-) diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index b164d836dc..1f7b99f730 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v162 \ No newline at end of file +v163 \ No newline at end of file diff --git a/checkout_session.go b/checkout_session.go index b5942f0245..ac119405fc 100644 --- a/checkout_session.go +++ b/checkout_session.go @@ -56,7 +56,7 @@ const ( CheckoutSessionCustomerCreationIfRequired CheckoutSessionCustomerCreation = "if_required" ) -// The customer's tax exempt status at time of checkout. +// The customer's tax exempt status after a completed Checkout Session. type CheckoutSessionCustomerDetailsTaxExempt string // List of values that CheckoutSessionCustomerDetailsTaxExempt can take @@ -1090,12 +1090,22 @@ type CheckoutSessionShippingOptionShippingRateDataDeliveryEstimateParams struct Minimum *CheckoutSessionShippingOptionShippingRateDataDeliveryEstimateMinimumParams `form:"minimum"` } +// Shipping rates defined in each available currency option. Each key must be a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html) and a [supported currency](https://stripe.com/docs/currencies). +type CheckoutSessionShippingOptionShippingRateDataFixedAmountCurrencyOptionsParams struct { + // A non-negative integer in cents representing how much to charge. + Amount *int64 `form:"amount"` + // Specifies whether the rate is considered inclusive of taxes or exclusive of taxes. One of `inclusive`, `exclusive`, or `unspecified`. + TaxBehavior *string `form:"tax_behavior"` +} + // Describes a fixed amount to charge for shipping. Must be present if type is `fixed_amount`. type CheckoutSessionShippingOptionShippingRateDataFixedAmountParams struct { // A non-negative integer in cents representing how much to charge. 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"` + // Shipping rates defined in each available currency option. Each key must be a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html) and a [supported currency](https://stripe.com/docs/currencies). + CurrencyOptions map[string]*CheckoutSessionShippingOptionShippingRateDataFixedAmountCurrencyOptionsParams `form:"currency_options"` } // Parameters to be passed to Shipping Rate creation for this shipping option @@ -1200,6 +1210,8 @@ type CheckoutSessionParams struct { ClientReferenceID *string `form:"client_reference_id"` // Configure fields for the Checkout Session to gather active consent from customers. ConsentCollection *CheckoutSessionConsentCollectionParams `form:"consent_collection"` + // 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"` // ID of an existing Customer, if one exists. In `payment` mode, the customer's most recent card // payment method will be used to prefill the email, name, card details, and billing address // on the Checkout page. In `subscription` mode, the customer's [default payment method](https://stripe.com/docs/api/customers/update#update_customer-invoice_settings-default_payment_method) @@ -1342,7 +1354,7 @@ type CheckoutSessionConsentCollection struct { Promotions CheckoutSessionConsentCollectionPromotions `json:"promotions"` } -// The customer's tax IDs at time of checkout. +// The customer's tax IDs after a completed Checkout Session. type CheckoutSessionCustomerDetailsTaxIDs struct { // The type of the tax ID, one of `eu_vat`, `br_cnpj`, `br_cpf`, `eu_oss_vat`, `gb_vat`, `nz_gst`, `au_abn`, `au_arn`, `in_gst`, `no_vat`, `za_vat`, `ch_vat`, `mx_rfc`, `sg_uen`, `ru_inn`, `ru_kpp`, `ca_bn`, `hk_br`, `es_cif`, `tw_vat`, `th_vat`, `jp_cn`, `jp_rn`, `li_uid`, `my_itn`, `us_ein`, `kr_brn`, `ca_qst`, `ca_gst_hst`, `ca_pst_bc`, `ca_pst_mb`, `ca_pst_sk`, `my_sst`, `sg_gst`, `ae_trn`, `cl_tin`, `sa_vat`, `id_npwp`, `my_frp`, `il_vat`, `ge_vat`, `ua_vat`, `is_vat`, `bg_uic`, `hu_tin`, `si_tin`, or `unknown` Type CheckoutSessionCustomerDetailsTaxIDsType `json:"type"` @@ -1352,18 +1364,18 @@ type CheckoutSessionCustomerDetailsTaxIDs struct { // The customer details including the customer's tax exempt status and the customer's tax IDs. Only the customer's email is present on Sessions in `setup` mode. type CheckoutSessionCustomerDetails struct { - // The customer's address at the time of checkout. Note: This property is populated only for sessions on or after March 30, 2022. + // The customer's address after a completed Checkout Session. Note: This property is populated only for sessions on or after March 30, 2022. Address *Address `json:"address"` - // The email associated with the Customer, if one exists, on the Checkout Session at the time of checkout or at time of session expiry. + // The email associated with the Customer, if one exists, on the Checkout Session after a completed Checkout Session or at time of session expiry. // Otherwise, if the customer has consented to promotional content, this value is the most recent valid email provided by the customer on the Checkout form. Email string `json:"email"` - // The customer's name at the time of checkout. Note: This property is populated only for sessions on or after March 30, 2022. + // The customer's name after a completed Checkout Session. Note: This property is populated only for sessions on or after March 30, 2022. Name string `json:"name"` - // The customer's phone number at the time of checkout + // The customer's phone number after a completed Checkout Session. Phone string `json:"phone"` - // The customer's tax exempt status at time of checkout. + // The customer's tax exempt status after a completed Checkout Session. TaxExempt CheckoutSessionCustomerDetailsTaxExempt `json:"tax_exempt"` - // The customer's tax IDs at time of checkout. + // The customer's tax IDs after a completed Checkout Session. TaxIDs []*CheckoutSessionCustomerDetailsTaxIDs `json:"tax_ids"` } type CheckoutSessionPaymentMethodOptionsACSSDebitMandateOptions struct { diff --git a/coupon.go b/coupon.go index e03a7a8ced..247160247d 100644 --- a/coupon.go +++ b/coupon.go @@ -33,6 +33,12 @@ type CouponAppliesToParams struct { Products []*string `form:"products"` } +// Coupons defined in each available currency option (only supported if `amount_off` is passed). Each key must be a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html) and a [supported currency](https://stripe.com/docs/currencies). +type CouponCurrencyOptionsParams struct { + // A positive integer representing the amount to subtract from an invoice total. + AmountOff *int64 `form:"amount_off"` +} + // You can create coupons easily via the [coupon management](https://dashboard.stripe.com/coupons) page of the Stripe dashboard. Coupon creation is also accessible via the API if you need to create coupons on the fly. // // A coupon has either a percent_off or an amount_off and currency. If you set an amount_off, that amount will be subtracted from any invoice's subtotal. For example, an invoice with a subtotal of 100 will have a final total of 0 if a coupon with an amount_off of 200 is applied to it and an invoice with a subtotal of 300 will have a final total of 100 if a coupon with an amount_off of 200 is applied to it. @@ -44,6 +50,8 @@ type CouponParams struct { AppliesTo *CouponAppliesToParams `form:"applies_to"` // Three-letter [ISO code for the currency](https://stripe.com/docs/currencies) of the `amount_off` parameter (required if `amount_off` is passed). Currency *string `form:"currency"` + // Coupons defined in each available currency option (only supported if the coupon is amount-based). Each key must be a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html) and a [supported currency](https://stripe.com/docs/currencies). + CurrencyOptions map[string]*CouponCurrencyOptionsParams `form:"currency_options"` // Specifies how long the discount will be in effect if used on a subscription. Can be `forever`, `once`, or `repeating`. Defaults to `once`. Duration *string `form:"duration"` // Required only if `duration` is `repeating`, in which case it must be a positive integer that specifies the number of months the discount will be in effect. @@ -64,6 +72,12 @@ type CouponAppliesTo struct { Products []string `json:"products"` } +// Coupons defined in each available currency option. Each key must be a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html) and a [supported currency](https://stripe.com/docs/currencies). +type CouponCurrencyOptions struct { + // Amount (in the `currency` specified) that will be taken off the subtotal of any invoices for this customer. + AmountOff int64 `json:"amount_off"` +} + // A coupon contains information about a percent-off or amount-off discount you // might want to apply to a customer. Coupons may be applied to [subscriptions](https://stripe.com/docs/api#subscriptions), [invoices](https://stripe.com/docs/api#invoices), // [checkout sessions](https://stripe.com/docs/api/checkout/sessions), [quotes](https://stripe.com/docs/api#quotes), and more. Coupons do not work with conventional one-off [charges](https://stripe.com/docs/api#create_charge) or [payment intents](https://stripe.com/docs/api/payment_intents). @@ -76,7 +90,9 @@ type Coupon struct { Created int64 `json:"created"` // If `amount_off` has been set, the three-letter [ISO code for the currency](https://stripe.com/docs/currencies) of the amount to take off. Currency Currency `json:"currency"` - Deleted bool `json:"deleted"` + // Coupons defined in each available currency option. Each key must be a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html) and a [supported currency](https://stripe.com/docs/currencies). + CurrencyOptions map[string]*CouponCurrencyOptions `json:"currency_options"` + Deleted bool `json:"deleted"` // One of `forever`, `once`, and `repeating`. Describes how long a customer who applies this coupon will get the discount. Duration CouponDuration `json:"duration"` // If `duration` is `repeating`, the number of months the coupon applies. Null if coupon `duration` is `forever` or `once`. diff --git a/example/generated_examples_test.go b/example/generated_examples_test.go index ccf9e41671..7549a68663 100644 --- a/example/generated_examples_test.go +++ b/example/generated_examples_test.go @@ -282,6 +282,23 @@ func TestPaymentLinkListLineItems(t *testing.T) { assert.Nil(t, result.Err()) } +func TestPriceCreate(t *testing.T) { + params := &stripe.PriceParams{ + UnitAmount: stripe.Int64(2000), + Currency: stripe.String(string(stripe.CurrencyUSD)), + CurrencyOptions: map[string]*stripe.PriceCurrencyOptionsParams{ + "uah": &stripe.PriceCurrencyOptionsParams{UnitAmount: stripe.Int64(5000)}, + "eur": &stripe.PriceCurrencyOptionsParams{UnitAmount: stripe.Int64(1800)}, + }, + Recurring: &stripe.PriceRecurringParams{ + Interval: stripe.String(string(stripe.PriceRecurringIntervalMonth)), + }, + Product: stripe.String("prod_xxxxxxxxxxxxx"), + } + result, _ := price.New(params) + assert.NotNil(t, result) +} + func TestSetupAttemptList(t *testing.T) { params := &stripe.SetupAttemptListParams{ SetupIntent: stripe.String("si_xyz"), @@ -1625,7 +1642,7 @@ func TestPriceList(t *testing.T) { assert.Nil(t, result.Err()) } -func TestPriceCreate(t *testing.T) { +func TestPriceCreate2(t *testing.T) { params := &stripe.PriceParams{ UnitAmount: stripe.Int64(2000), Currency: stripe.String(string(stripe.CurrencyUSD)), diff --git a/invoice.go b/invoice.go index 06e0699042..dad1c8d623 100644 --- a/invoice.go +++ b/invoice.go @@ -309,6 +309,8 @@ type InvoiceParams struct { AutomaticTax *InvoiceAutomaticTaxParams `form:"automatic_tax"` // Either `charge_automatically` or `send_invoice`. This field can be updated only on `draft` invoices. CollectionMethod *string `form:"collection_method"` + // The currency to preview this invoice in. Defaults to that of `customer` if not specified. + Currency *string `form:"currency"` // The identifier of the customer whose upcoming invoice you'd like to retrieve. Customer *string `form:"customer"` // A list of up to 4 custom fields to be displayed on the invoice. If a value for `custom_fields` is specified, the list specified will replace the existing custom field list on this invoice. Pass an empty string to remove previously-defined fields. diff --git a/paymentlink.go b/paymentlink.go index 54800196dc..ac2fa38b4b 100644 --- a/paymentlink.go +++ b/paymentlink.go @@ -248,6 +248,8 @@ type PaymentLinkParams struct { BillingAddressCollection *string `form:"billing_address_collection"` // Configure fields to gather active consent from customers. ConsentCollection *PaymentLinkConsentCollectionParams `form:"consent_collection"` + // 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) and supported by each line item's price. + Currency *string `form:"currency"` // Configures whether [checkout sessions](https://stripe.com/docs/api/checkout/sessions) created by this payment link create a [Customer](https://stripe.com/docs/api/customers). CustomerCreation *string `form:"customer_creation"` // The line items representing what is being sold. Each line item represents an item being sold. Up to 20 line items are supported. diff --git a/price.go b/price.go index a6c7dddd14..f9cc46e3b0 100644 --- a/price.go +++ b/price.go @@ -20,6 +20,16 @@ const ( PriceBillingSchemeTiered PriceBillingScheme = "tiered" ) +// Specifies whether the price is considered inclusive of taxes or exclusive of taxes. One of `inclusive`, `exclusive`, or `unspecified`. Once specified as either `inclusive` or `exclusive`, it cannot be changed. +type PriceCurrencyOptionsTaxBehavior string + +// List of values that PriceCurrencyOptionsTaxBehavior can take +const ( + PriceCurrencyOptionsTaxBehaviorExclusive PriceCurrencyOptionsTaxBehavior = "exclusive" + PriceCurrencyOptionsTaxBehaviorInclusive PriceCurrencyOptionsTaxBehavior = "inclusive" + PriceCurrencyOptionsTaxBehaviorUnspecified PriceCurrencyOptionsTaxBehavior = "unspecified" +) + // Specifies a usage aggregation strategy for prices of `usage_type=metered`. Allowed values are `sum` for summing up all usage during a period, `last_during_period` for using the last usage record reported within a period, `last_ever` for using the last usage record ever (across period bounds) or `max` which uses the usage record with the maximum reported usage during a period. Defaults to `sum`. type PriceRecurringAggregateUsage string @@ -127,6 +137,54 @@ type PriceListParams struct { Type *string `form:"type"` } +// When set, provides configuration for the amount to be adjusted by the customer during Checkout Sessions and Payment Links. +type PriceCurrencyOptionsCustomUnitAmountParams struct { + // Pass in `true` to enable `custom_unit_amount`, otherwise omit `custom_unit_amount`. + Enabled *bool `form:"enabled"` + // The maximum unit amount the customer can specify for this item. + Maximum *int64 `form:"maximum"` + // The minimum unit amount the customer can specify for this item. Must be at least the minimum charge amount. + Minimum *int64 `form:"minimum"` + // The starting unit amount which can be updated by the customer. + Preset *int64 `form:"preset"` +} + +// Each element represents a pricing tier. This parameter requires `billing_scheme` to be set to `tiered`. See also the documentation for `billing_scheme`. +type PriceCurrencyOptionsTierParams struct { + // The flat billing amount for an entire tier, regardless of the number of units in the tier. + FlatAmount *int64 `form:"flat_amount"` + // Same as `flat_amount`, but accepts a decimal value representing an integer in the minor units of the currency. Only one of `flat_amount` and `flat_amount_decimal` can be set. + FlatAmountDecimal *float64 `form:"flat_amount_decimal,high_precision"` + // The per unit billing amount for each individual unit for which this tier applies. + UnitAmount *int64 `form:"unit_amount"` + // Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set. + UnitAmountDecimal *float64 `form:"unit_amount_decimal,high_precision"` + // Specifies the upper bound of this tier. The lower bound of a tier is the upper bound of the previous tier adding one. Use `inf` to define a fallback tier. + UpTo *int64 `form:"up_to"` + UpToInf *bool `form:"-"` // See custom AppendTo +} + +// AppendTo implements custom encoding logic for PriceCurrencyOptionsTierParams. +func (p *PriceCurrencyOptionsTierParams) AppendTo(body *form.Values, keyParts []string) { + if BoolValue(p.UpToInf) { + body.Add(form.FormatKey(append(keyParts, "up_to")), "inf") + } +} + +// Prices defined in each available currency option. Each key must be a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html) and a [supported currency](https://stripe.com/docs/currencies). +type PriceCurrencyOptionsParams struct { + // When set, provides configuration for the amount to be adjusted by the customer during Checkout Sessions and Payment Links. + CustomUnitAmount *PriceCurrencyOptionsCustomUnitAmountParams `form:"custom_unit_amount"` + // Specifies whether the price is considered inclusive of taxes or exclusive of taxes. One of `inclusive`, `exclusive`, or `unspecified`. Once specified as either `inclusive` or `exclusive`, it cannot be changed. + TaxBehavior *string `form:"tax_behavior"` + // Each element represents a pricing tier. This parameter requires `billing_scheme` to be set to `tiered`. See also the documentation for `billing_scheme`. + Tiers []*PriceCurrencyOptionsTierParams `form:"tiers"` + // A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge. + UnitAmount *int64 `form:"unit_amount"` + // Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set. + UnitAmountDecimal *float64 `form:"unit_amount_decimal,high_precision"` +} + // When set, provides configuration for the amount to be adjusted by the customer during Checkout Sessions and Payment Links. type PriceCustomUnitAmountParams struct { // Pass in `true` to enable `custom_unit_amount`, otherwise omit `custom_unit_amount`. @@ -212,6 +270,8 @@ type PriceParams struct { BillingScheme *string `form:"billing_scheme"` // 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"` + // Prices defined in each available currency option. Each key must be a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html) and a [supported currency](https://stripe.com/docs/currencies). + CurrencyOptions map[string]*PriceCurrencyOptionsParams `form:"currency_options"` // When set, provides configuration for the amount to be adjusted by the customer during Checkout Sessions and Payment Links. CustomUnitAmount *PriceCustomUnitAmountParams `form:"custom_unit_amount"` // A lookup key used to retrieve prices dynamically from a static string. This may be up to 200 characters. @@ -240,6 +300,44 @@ type PriceParams struct { UnitAmountDecimal *float64 `form:"unit_amount_decimal,high_precision"` } +// When set, provides configuration for the amount to be adjusted by the customer during Checkout Sessions and Payment Links. +type PriceCurrencyOptionsCustomUnitAmount struct { + // The maximum unit amount the customer can specify for this item. + Maximum int64 `json:"maximum"` + // The minimum unit amount the customer can specify for this item. Must be at least the minimum charge amount. + Minimum int64 `json:"minimum"` + // The starting unit amount which can be updated by the customer. + Preset int64 `json:"preset"` +} + +// Each element represents a pricing tier. This parameter requires `billing_scheme` to be set to `tiered`. See also the documentation for `billing_scheme`. +type PriceCurrencyOptionsTier struct { + // Price for the entire tier. + FlatAmount int64 `json:"flat_amount"` + // Same as `flat_amount`, but contains a decimal value with at most 12 decimal places. + FlatAmountDecimal float64 `json:"flat_amount_decimal,string"` + // Per unit price for units relevant to the tier. + UnitAmount int64 `json:"unit_amount"` + // Same as `unit_amount`, but contains a decimal value with at most 12 decimal places. + UnitAmountDecimal float64 `json:"unit_amount_decimal,string"` + // Up to and including to this quantity will be contained in the tier. + UpTo int64 `json:"up_to"` +} + +// Prices defined in each available currency option. Each key must be a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html) and a [supported currency](https://stripe.com/docs/currencies). +type PriceCurrencyOptions struct { + // When set, provides configuration for the amount to be adjusted by the customer during Checkout Sessions and Payment Links. + CustomUnitAmount *PriceCurrencyOptionsCustomUnitAmount `json:"custom_unit_amount"` + // Specifies whether the price is considered inclusive of taxes or exclusive of taxes. One of `inclusive`, `exclusive`, or `unspecified`. Once specified as either `inclusive` or `exclusive`, it cannot be changed. + TaxBehavior PriceCurrencyOptionsTaxBehavior `json:"tax_behavior"` + // Each element represents a pricing tier. This parameter requires `billing_scheme` to be set to `tiered`. See also the documentation for `billing_scheme`. + Tiers []*PriceCurrencyOptionsTier `json:"tiers"` + // The unit amount in %s to be charged, represented as a whole integer if possible. Only set if `billing_scheme=per_unit`. + UnitAmount int64 `json:"unit_amount"` + // The unit amount in %s to be charged, represented as a decimal string with at most 12 decimal places. Only set if `billing_scheme=per_unit`. + UnitAmountDecimal float64 `json:"unit_amount_decimal,string"` +} + // When set, provides configuration for the amount to be adjusted by the customer during Checkout Sessions and Payment Links. type PriceCustomUnitAmount struct { // The maximum unit amount the customer can specify for this item. @@ -302,6 +400,8 @@ type Price struct { Created int64 `json:"created"` // 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 Currency `json:"currency"` + // Prices defined in each available currency option. Each key must be a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html) and a [supported currency](https://stripe.com/docs/currencies). + CurrencyOptions map[string]*PriceCurrencyOptions `json:"currency_options"` // When set, provides configuration for the amount to be adjusted by the customer during Checkout Sessions and Payment Links. CustomUnitAmount *PriceCustomUnitAmount `json:"custom_unit_amount"` Deleted bool `json:"deleted"` diff --git a/product.go b/product.go index 3be57e6ad3..3904247056 100644 --- a/product.go +++ b/product.go @@ -6,7 +6,10 @@ package stripe -import "encoding/json" +import ( + "encoding/json" + "github.com/stripe/stripe-go/v72/form" +) // The type of the product. The product is either of type `good`, which is eligible for use with Orders and SKUs, or `service`, which is eligible for use with Subscriptions and Plans. type ProductType string @@ -27,6 +30,54 @@ type ProductSearchParams struct { Page *string `form:"page"` } +// When set, provides configuration for the amount to be adjusted by the customer during Checkout Sessions and Payment Links. +type ProductDefaultPriceDataCurrencyOptionsCustomUnitAmountParams struct { + // Pass in `true` to enable `custom_unit_amount`, otherwise omit `custom_unit_amount`. + Enabled *bool `form:"enabled"` + // The maximum unit amount the customer can specify for this item. + Maximum *int64 `form:"maximum"` + // The minimum unit amount the customer can specify for this item. Must be at least the minimum charge amount. + Minimum *int64 `form:"minimum"` + // The starting unit amount which can be updated by the customer. + Preset *int64 `form:"preset"` +} + +// Each element represents a pricing tier. This parameter requires `billing_scheme` to be set to `tiered`. See also the documentation for `billing_scheme`. +type ProductDefaultPriceDataCurrencyOptionsTierParams struct { + // The flat billing amount for an entire tier, regardless of the number of units in the tier. + FlatAmount *int64 `form:"flat_amount"` + // Same as `flat_amount`, but accepts a decimal value representing an integer in the minor units of the currency. Only one of `flat_amount` and `flat_amount_decimal` can be set. + FlatAmountDecimal *float64 `form:"flat_amount_decimal,high_precision"` + // The per unit billing amount for each individual unit for which this tier applies. + UnitAmount *int64 `form:"unit_amount"` + // Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set. + UnitAmountDecimal *float64 `form:"unit_amount_decimal,high_precision"` + // Specifies the upper bound of this tier. The lower bound of a tier is the upper bound of the previous tier adding one. Use `inf` to define a fallback tier. + UpTo *int64 `form:"up_to"` + UpToInf *bool `form:"-"` // See custom AppendTo +} + +// AppendTo implements custom encoding logic for ProductDefaultPriceDataCurrencyOptionsTierParams. +func (p *ProductDefaultPriceDataCurrencyOptionsTierParams) AppendTo(body *form.Values, keyParts []string) { + if BoolValue(p.UpToInf) { + body.Add(form.FormatKey(append(keyParts, "up_to")), "inf") + } +} + +// Prices defined in each available currency option. Each key must be a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html) and a [supported currency](https://stripe.com/docs/currencies). +type ProductDefaultPriceDataCurrencyOptionsParams struct { + // When set, provides configuration for the amount to be adjusted by the customer during Checkout Sessions and Payment Links. + CustomUnitAmount *ProductDefaultPriceDataCurrencyOptionsCustomUnitAmountParams `form:"custom_unit_amount"` + // Specifies whether the price is considered inclusive of taxes or exclusive of taxes. One of `inclusive`, `exclusive`, or `unspecified`. Once specified as either `inclusive` or `exclusive`, it cannot be changed. + TaxBehavior *string `form:"tax_behavior"` + // Each element represents a pricing tier. This parameter requires `billing_scheme` to be set to `tiered`. See also the documentation for `billing_scheme`. + Tiers []*ProductDefaultPriceDataCurrencyOptionsTierParams `form:"tiers"` + // A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge. + UnitAmount *int64 `form:"unit_amount"` + // Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set. + UnitAmountDecimal *float64 `form:"unit_amount_decimal,high_precision"` +} + // The recurring components of a price such as `interval` and `interval_count`. type ProductDefaultPriceDataRecurringParams struct { // Specifies billing frequency. Either `day`, `week`, `month` or `year`. @@ -39,6 +90,8 @@ type ProductDefaultPriceDataRecurringParams struct { type ProductDefaultPriceDataParams struct { // 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"` + // Prices defined in each available currency option. Each key must be a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html) and a [supported currency](https://stripe.com/docs/currencies). + CurrencyOptions map[string]*ProductDefaultPriceDataCurrencyOptionsParams `form:"currency_options"` // The recurring components of a price such as `interval` and `interval_count`. Recurring *ProductDefaultPriceDataRecurringParams `form:"recurring"` // Specifies whether the price is considered inclusive of taxes or exclusive of taxes. One of `inclusive`, `exclusive`, or `unspecified`. Once specified as either `inclusive` or `exclusive`, it cannot be changed. diff --git a/promotioncode.go b/promotioncode.go index 37aa87eb8d..2e26cde6f6 100644 --- a/promotioncode.go +++ b/promotioncode.go @@ -27,8 +27,16 @@ type PromotionCodeParams struct { Restrictions *PromotionCodeRestrictionsParams `form:"restrictions"` } +// Promotion codes defined in each available currency option. Each key must be a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html) and a [supported currency](https://stripe.com/docs/currencies). +type PromotionCodeRestrictionsCurrencyOptionsParams struct { + // Minimum amount required to redeem this Promotion Code into a Coupon (e.g., a purchase must be $100 or more to work). + MinimumAmount *int64 `form:"minimum_amount"` +} + // Settings that restrict the redemption of the promotion code. type PromotionCodeRestrictionsParams struct { + // Promotion codes defined in each available currency option. Each key must be a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html) and a [supported currency](https://stripe.com/docs/currencies). + CurrencyOptions map[string]*PromotionCodeRestrictionsCurrencyOptionsParams `form:"currency_options"` // A Boolean indicating if the Promotion Code should only be redeemed for Customers without any successful payments or invoices FirstTimeTransaction *bool `form:"first_time_transaction"` // Minimum amount required to redeem this Promotion Code into a Coupon (e.g., a purchase must be $100 or more to work). @@ -53,7 +61,15 @@ type PromotionCodeListParams struct { // Only return promotion codes that are restricted to this customer. Customer *string `form:"customer"` } + +// Promotion code restrictions defined in each available currency option. Each key must be a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html) and a [supported currency](https://stripe.com/docs/currencies). +type PromotionCodeRestrictionsCurrencyOptions struct { + // Minimum amount required to redeem this Promotion Code into a Coupon (e.g., a purchase must be $100 or more to work). + MinimumAmount int64 `json:"minimum_amount"` +} type PromotionCodeRestrictions struct { + // Promotion code restrictions defined in each available currency option. Each key must be a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html) and a [supported currency](https://stripe.com/docs/currencies). + CurrencyOptions map[string]*PromotionCodeRestrictionsCurrencyOptions `json:"currency_options"` // A Boolean indicating if the Promotion Code should only be redeemed for Customers without any successful payments or invoices FirstTimeTransaction bool `json:"first_time_transaction"` // Minimum amount required to redeem this Promotion Code into a Coupon (e.g., a purchase must be $100 or more to work). diff --git a/shippingrate.go b/shippingrate.go index 68cd471075..e4d3ed976d 100644 --- a/shippingrate.go +++ b/shippingrate.go @@ -32,6 +32,16 @@ const ( ShippingRateDeliveryEstimateMinimumUnitWeek ShippingRateDeliveryEstimateMinimumUnit = "week" ) +// Specifies whether the rate is considered inclusive of taxes or exclusive of taxes. One of `inclusive`, `exclusive`, or `unspecified`. +type ShippingRateFixedAmountCurrencyOptionsTaxBehavior string + +// List of values that ShippingRateFixedAmountCurrencyOptionsTaxBehavior can take +const ( + ShippingRateFixedAmountCurrencyOptionsTaxBehaviorExclusive ShippingRateFixedAmountCurrencyOptionsTaxBehavior = "exclusive" + ShippingRateFixedAmountCurrencyOptionsTaxBehaviorInclusive ShippingRateFixedAmountCurrencyOptionsTaxBehavior = "inclusive" + ShippingRateFixedAmountCurrencyOptionsTaxBehaviorUnspecified ShippingRateFixedAmountCurrencyOptionsTaxBehavior = "unspecified" +) + // Specifies whether the rate is considered inclusive of taxes or exclusive of taxes. One of `inclusive`, `exclusive`, or `unspecified`. type ShippingRateTaxBehavior string @@ -87,12 +97,22 @@ type ShippingRateDeliveryEstimateParams struct { Minimum *ShippingRateDeliveryEstimateMinimumParams `form:"minimum"` } +// Shipping rates defined in each available currency option. Each key must be a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html) and a [supported currency](https://stripe.com/docs/currencies). +type ShippingRateFixedAmountCurrencyOptionsParams struct { + // A non-negative integer in cents representing how much to charge. + Amount *int64 `form:"amount"` + // Specifies whether the rate is considered inclusive of taxes or exclusive of taxes. One of `inclusive`, `exclusive`, or `unspecified`. + TaxBehavior *string `form:"tax_behavior"` +} + // Describes a fixed amount to charge for shipping. Must be present if type is `fixed_amount`. type ShippingRateFixedAmountParams struct { // A non-negative integer in cents representing how much to charge. 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"` + // Shipping rates defined in each available currency option. Each key must be a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html) and a [supported currency](https://stripe.com/docs/currencies). + CurrencyOptions map[string]*ShippingRateFixedAmountCurrencyOptionsParams `form:"currency_options"` } // Creates a new shipping rate object. @@ -137,11 +157,21 @@ type ShippingRateDeliveryEstimate struct { // The lower bound of the estimated range. If empty, represents no lower bound. Minimum *ShippingRateDeliveryEstimateMinimum `json:"minimum"` } + +// Shipping rates defined in each available currency option. Each key must be a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html) and a [supported currency](https://stripe.com/docs/currencies). +type ShippingRateFixedAmountCurrencyOptions struct { + // A non-negative integer in cents representing how much to charge. + Amount int64 `json:"amount"` + // Specifies whether the rate is considered inclusive of taxes or exclusive of taxes. One of `inclusive`, `exclusive`, or `unspecified`. + TaxBehavior ShippingRateFixedAmountCurrencyOptionsTaxBehavior `json:"tax_behavior"` +} type ShippingRateFixedAmount struct { // A non-negative integer in cents representing how much to charge. Amount int64 `json:"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 Currency `json:"currency"` + // Shipping rates defined in each available currency option. Each key must be a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html) and a [supported currency](https://stripe.com/docs/currencies). + CurrencyOptions map[string]*ShippingRateFixedAmountCurrencyOptions `json:"currency_options"` } // Shipping rates describe the price of shipping presented to your customers and can be diff --git a/sub.go b/sub.go index 993f35081a..52c568b5cd 100644 --- a/sub.go +++ b/sub.go @@ -423,6 +423,8 @@ type SubscriptionParams struct { CollectionMethod *string `form:"collection_method"` // The ID of the coupon to apply to this subscription. A coupon applied to a subscription will only affect invoices created for that particular subscription. Coupon *string `form:"coupon"` + // 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"` // The identifier of the customer to subscribe. Customer *string `form:"customer"` // Number of days a customer has to pay invoices generated by this subscription. Valid only for subscriptions where `collection_method` is set to `send_invoice`. @@ -669,6 +671,8 @@ type Subscription struct { CollectionMethod SubscriptionCollectionMethod `json:"collection_method"` // Time at which the object was created. Measured in seconds since the Unix epoch. Created int64 `json:"created"` + // 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 Currency `json:"currency"` // End of the current period that the subscription has been invoiced for. At the end of this period, a new invoice will be created. CurrentPeriodEnd int64 `json:"current_period_end"` // Start of the current period that the subscription has been invoiced for. diff --git a/subschedule.go b/subschedule.go index 876e6868f2..11b89d75f6 100644 --- a/subschedule.go +++ b/subschedule.go @@ -176,6 +176,8 @@ type SubscriptionSchedulePhaseParams struct { CollectionMethod *string `form:"collection_method"` // The identifier of the coupon to apply to this phase of the subscription schedule. Coupon *string `form:"coupon"` + // 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"` // ID of the default payment method for the subscription schedule. It must belong to the customer associated with the subscription schedule. If not set, invoices will use the default payment method in the customer's invoice settings. DefaultPaymentMethod *string `form:"default_payment_method"` // A list of [Tax Rate](https://stripe.com/docs/api/tax_rates) ids. These Tax Rates will set the Subscription's [`default_tax_rates`](https://stripe.com/docs/api/subscriptions/create#create_subscription-default_tax_rates), which means they will be the Invoice's [`default_tax_rates`](https://stripe.com/docs/api/invoices/create#create_invoice-default_tax_rates) for any Invoices issued by the Subscription during this Phase. @@ -331,6 +333,8 @@ type SubscriptionSchedulePhase struct { CollectionMethod SubscriptionCollectionMethod `json:"collection_method"` // ID of the coupon to use during this phase of the subscription schedule. Coupon *Coupon `json:"coupon"` + // 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 Currency `json:"currency"` // ID of the default payment method for the subscription schedule. It must belong to the customer associated with the subscription schedule. If not set, invoices will use the default payment method in the customer's invoice settings. DefaultPaymentMethod *PaymentMethod `json:"default_payment_method"` // The default tax rates to apply to the subscription during this phase of the subscription schedule. From b1530e83549f7e529d43de59657fb639c7d57202 Mon Sep 17 00:00:00 2001 From: Pavel Krymets Date: Thu, 7 Jul 2022 10:39:04 -0700 Subject: [PATCH 14/17] Bump version to 72.118.0 --- CHANGELOG.md | 41 ++++++++++++++++++++++++++--------------- VERSION | 2 +- stripe.go | 2 +- 3 files changed, 28 insertions(+), 17 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0d97b6af95..de1380c8d7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,28 +1,39 @@ # Changelog +## 72.118.0 - 2022-07-07 +* [#1492](https://github.com/stripe/stripe-go/pull/1492) API Updates + * Add support for `Currency` on `CheckoutSessionParams`, `InvoiceUpcomingLinesParams`, `InvoiceUpcomingParams`, `PaymentLinkParams`, `SubscriptionParams`, `SubscriptionSchedulePhasesParams`, `SubscriptionSchedulePhases`, and `Subscription` + * Add support for `CurrencyOptions` on `CheckoutSessionShippingOptionsShippingRateDataFixedAmountParams`, `CouponParams`, `Coupon`, `OrderShippingCostShippingRateDataFixedAmountParams`, `PriceParams`, `Price`, `ProductDefaultPriceDataParams`, `PromotionCodeRestrictionsParams`, `PromotionCodeRestrictions`, `ShippingRateFixedAmountParams`, and `ShippingRateFixedAmount` + * Add support for `Restrictions` on `PromotionCodeParams` + * Add support for `FixedAmount` and `TaxBehavior` on `ShippingRateParams` +* [#1491](https://github.com/stripe/stripe-go/pull/1491) API Updates + * Add support for `Customer` on `CheckoutSessionListParams` and `RefundParams` + * Add support for `Currency` and `Origin` on `RefundParams` + + ## 72.117.0 - 2022-06-29 * [#1487](https://github.com/stripe/stripe-go/pull/1487) API Updates - * Add support for `DeliverCard`, `FailCard`, `ReturnCard`, and `ShipCard` test helper methods on resource `Issuing.Card` - * Change type of `PaymentLinkPaymentMethodTypesParams` and `PaymentLinkPaymentMethodTypes` from `literal('card')` to `enum` - * Add support for `HostedRegulatoryReceiptURL` on `TreasuryReceivedCredit` and `TreasuryReceivedDebit` - + * Add support for `DeliverCard`, `FailCard`, `ReturnCard`, and `ShipCard` test helper methods on resource `Issuing.Card` + * Change type of `PaymentLinkPaymentMethodTypesParams` and `PaymentLinkPaymentMethodTypes` from `literal('card')` to `enum` + * Add support for `HostedRegulatoryReceiptURL` on `TreasuryReceivedCredit` and `TreasuryReceivedDebit` + * [#1483](https://github.com/stripe/stripe-go/pull/1483) Document use of undocumented parameters/properties ## 72.116.0 - 2022-06-23 * [#1484](https://github.com/stripe/stripe-go/pull/1484) API Updates * Add support for `CaptureMethod` on `PaymentIntentConfirmParams` and `PaymentIntentParams` * [#1481](https://github.com/stripe/stripe-go/pull/1481) API Updates - * Add support for `PromptPayPayments` on `AccountCapabilitiesParams` and `AccountCapabilities` - * Add support for `PromptPay` on `ChargePaymentMethodDetails`, `PaymentIntentConfirmPaymentMethodDataParams`, `PaymentIntentConfirmPaymentMethodOptionsParams`, `PaymentIntentPaymentMethodDataParams`, `PaymentIntentPaymentMethodOptionsParams`, `PaymentIntentPaymentMethodOptions`, `PaymentMethodParams`, `PaymentMethod`, `SetupIntentConfirmPaymentMethodDataParams`, and `SetupIntentPaymentMethodDataParams` - * Add support for `SubtotalExcludingTax` on `CreditNote` and `Invoice` - * Add support for `AmountExcludingTax` and `UnitAmountExcludingTax` on `CreditNoteLineItem` and `InvoiceLineItem` - * Add support for `RenderingOptions` on `InvoiceParams` - * Add support for `TotalExcludingTax` on `Invoice` - * Add support for new value `promptpay` on enums `InvoicePaymentSettingsPaymentMethodTypes` and `SubscriptionPaymentSettingsPaymentMethodTypes` - * Add support for `AutomaticPaymentMethods` on `OrderPaymentSettings` - * Add support for `PromptPayDisplayQRCode` on `PaymentIntentNextAction` - * Add support for new value `promptpay` on enum `PaymentMethodType` - + * Add support for `PromptPayPayments` on `AccountCapabilitiesParams` and `AccountCapabilities` + * Add support for `PromptPay` on `ChargePaymentMethodDetails`, `PaymentIntentConfirmPaymentMethodDataParams`, `PaymentIntentConfirmPaymentMethodOptionsParams`, `PaymentIntentPaymentMethodDataParams`, `PaymentIntentPaymentMethodOptionsParams`, `PaymentIntentPaymentMethodOptions`, `PaymentMethodParams`, `PaymentMethod`, `SetupIntentConfirmPaymentMethodDataParams`, and `SetupIntentPaymentMethodDataParams` + * Add support for `SubtotalExcludingTax` on `CreditNote` and `Invoice` + * Add support for `AmountExcludingTax` and `UnitAmountExcludingTax` on `CreditNoteLineItem` and `InvoiceLineItem` + * Add support for `RenderingOptions` on `InvoiceParams` + * Add support for `TotalExcludingTax` on `Invoice` + * Add support for new value `promptpay` on enums `InvoicePaymentSettingsPaymentMethodTypes` and `SubscriptionPaymentSettingsPaymentMethodTypes` + * Add support for `AutomaticPaymentMethods` on `OrderPaymentSettings` + * Add support for `PromptPayDisplayQRCode` on `PaymentIntentNextAction` + * Add support for new value `promptpay` on enum `PaymentMethodType` + * [#1482](https://github.com/stripe/stripe-go/pull/1482) Use the generated API version ## 72.115.0 - 2022-06-17 diff --git a/VERSION b/VERSION index 4f1703b3bc..07b862cd7d 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -72.117.0 +72.118.0 diff --git a/stripe.go b/stripe.go index 9156c39243..7c997f2bb4 100644 --- a/stripe.go +++ b/stripe.go @@ -1203,7 +1203,7 @@ func StringSlice(v []string) []*string { // // clientversion is the binding version -const clientversion = "72.117.0" +const clientversion = "72.118.0" // defaultHTTPTimeout is the default timeout on the http.Client used by the library. // This is chosen to be consistent with the other Stripe language libraries and From 985bff628896a31f4dc24d5791a561a0976437fe Mon Sep 17 00:00:00 2001 From: Pavel Krymets Date: Thu, 7 Jul 2022 11:06:03 -0700 Subject: [PATCH 15/17] Set version to 72.118.0 to simplify merge --- VERSION | 2 +- stripe.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index 323faffb0c..07b862cd7d 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -72.115.0-beta.1 +72.118.0 diff --git a/stripe.go b/stripe.go index 563a113168..7c997f2bb4 100644 --- a/stripe.go +++ b/stripe.go @@ -1203,7 +1203,7 @@ func StringSlice(v []string) []*string { // // clientversion is the binding version -const clientversion = "72.115.0-beta.1" +const clientversion = "72.118.0" // defaultHTTPTimeout is the default timeout on the http.Client used by the library. // This is chosen to be consistent with the other Stripe language libraries and From de2d52c7ff6b14bdea8fa573c8121fb99ac52a36 Mon Sep 17 00:00:00 2001 From: Pavel Krymets Date: Thu, 7 Jul 2022 11:06:04 -0700 Subject: [PATCH 16/17] Reset version to 72.115.0-beta.1 --- VERSION | 2 +- stripe.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index 07b862cd7d..323faffb0c 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -72.118.0 +72.115.0-beta.1 diff --git a/stripe.go b/stripe.go index 7c997f2bb4..563a113168 100644 --- a/stripe.go +++ b/stripe.go @@ -1203,7 +1203,7 @@ func StringSlice(v []string) []*string { // // clientversion is the binding version -const clientversion = "72.118.0" +const clientversion = "72.115.0-beta.1" // defaultHTTPTimeout is the default timeout on the http.Client used by the library. // This is chosen to be consistent with the other Stripe language libraries and From 3ad8d010073c622b87747b4299c50893ff1722b7 Mon Sep 17 00:00:00 2001 From: Pavel Krymets Date: Thu, 7 Jul 2022 11:06:19 -0700 Subject: [PATCH 17/17] Codegen for openapi v163 --- OPENAPI_VERSION | 2 +- api_version.go | 2 +- example/generated_examples_test.go | 19 ++++++++++++++++++- paymentintent.go | 17 ++++++++++++++++- treasury_receivedcredit.go | 24 ++++++++++++++++++++++++ treasury_receiveddebit.go | 26 ++++++++++++++++++++++++++ 6 files changed, 86 insertions(+), 4 deletions(-) diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index b164d836dc..1f7b99f730 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v162 \ No newline at end of file +v163 \ No newline at end of file diff --git a/api_version.go b/api_version.go index 63ecf7fccd..e948d82367 100644 --- a/api_version.go +++ b/api_version.go @@ -7,5 +7,5 @@ package stripe const ( - apiVersion string = "2020-08-27" + apiVersion string = "2020-08-27; server_side_confirmation_beta=v1" ) diff --git a/example/generated_examples_test.go b/example/generated_examples_test.go index ccf9e41671..7549a68663 100644 --- a/example/generated_examples_test.go +++ b/example/generated_examples_test.go @@ -282,6 +282,23 @@ func TestPaymentLinkListLineItems(t *testing.T) { assert.Nil(t, result.Err()) } +func TestPriceCreate(t *testing.T) { + params := &stripe.PriceParams{ + UnitAmount: stripe.Int64(2000), + Currency: stripe.String(string(stripe.CurrencyUSD)), + CurrencyOptions: map[string]*stripe.PriceCurrencyOptionsParams{ + "uah": &stripe.PriceCurrencyOptionsParams{UnitAmount: stripe.Int64(5000)}, + "eur": &stripe.PriceCurrencyOptionsParams{UnitAmount: stripe.Int64(1800)}, + }, + Recurring: &stripe.PriceRecurringParams{ + Interval: stripe.String(string(stripe.PriceRecurringIntervalMonth)), + }, + Product: stripe.String("prod_xxxxxxxxxxxxx"), + } + result, _ := price.New(params) + assert.NotNil(t, result) +} + func TestSetupAttemptList(t *testing.T) { params := &stripe.SetupAttemptListParams{ SetupIntent: stripe.String("si_xyz"), @@ -1625,7 +1642,7 @@ func TestPriceList(t *testing.T) { assert.Nil(t, result.Err()) } -func TestPriceCreate(t *testing.T) { +func TestPriceCreate2(t *testing.T) { params := &stripe.PriceParams{ UnitAmount: stripe.Int64(2000), Currency: stripe.String(string(stripe.CurrencyUSD)), diff --git a/paymentintent.go b/paymentintent.go index f962e6a61c..27d0711911 100644 --- a/paymentintent.go +++ b/paymentintent.go @@ -629,6 +629,15 @@ const ( PaymentIntentProcessingTypeCard PaymentIntentProcessingType = "card" ) +// Indicates whether confirmation for this PaymentIntent using a secret key is `required` or `optional`. +type PaymentIntentSecretKeyConfirmation string + +// List of values that PaymentIntentSecretKeyConfirmation can take +const ( + PaymentIntentSecretKeyConfirmationOptional PaymentIntentSecretKeyConfirmation = "optional" + PaymentIntentSecretKeyConfirmationRequired PaymentIntentSecretKeyConfirmation = "required" +) + // Indicates that you intend to make future payments with this PaymentIntent's payment method. // // Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. If no Customer was provided, the payment method can still be [attached](https://stripe.com/docs/api/payment_methods/attach) to a Customer after the transaction completes. @@ -1430,7 +1439,7 @@ type PaymentIntentParams struct { Description *string `form:"description"` // ID of the mandate to be used for this payment. This parameter can only be used with [`confirm=true`](https://stripe.com/docs/api/payment_intents/create#create_payment_intent-confirm). Mandate *string `form:"mandate"` - // This hash contains details about the Mandate to create. This parameter can only be used with [`confirm=true`](https://stripe.com/docs/api/payment_intents/create#create_payment_intent-confirm). + // This hash contains details about the Mandate to create. MandateData *PaymentIntentMandateDataParams `form:"mandate_data"` // The Stripe account ID for which these funds are intended. For details, see the PaymentIntents [use case for connected accounts](https://stripe.com/docs/payments/connected-accounts). OnBehalfOf *string `form:"on_behalf_of"` @@ -1450,6 +1459,8 @@ type PaymentIntentParams struct { ReceiptEmail *string `form:"receipt_email"` // The URL to redirect your customer back to after they authenticate or cancel their payment on the payment method's app or site. If you'd prefer to redirect to a mobile application, you can alternatively supply an application URI scheme. This parameter can only be used with [`confirm=true`](https://stripe.com/docs/api/payment_intents/create#create_payment_intent-confirm). ReturnURL *string `form:"return_url"` + // Indicates whether confirmation for this PaymentIntent using a secret key is `required` or `optional`. + SecretKeyConfirmation *string `form:"secret_key_confirmation"` // Indicates that you intend to make future payments with this PaymentIntent's payment method. // // Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. If no Customer was provided, the payment method can still be [attached](https://stripe.com/docs/api/payment_methods/attach) to a Customer after the transaction completes. @@ -1521,6 +1532,8 @@ type PaymentIntentConfirmRadarOptionsParams struct { // to learn more about manual confirmation. type PaymentIntentConfirmParams struct { Params `form:"*"` + // The amount of the application fee (if any) that will be requested to be applied to the payment and transferred to the application owner's Stripe account. The amount of the application fee collected will be capped at the total payment amount. For more information, see the PaymentIntents [use case for connected accounts](https://stripe.com/docs/payments/connected-accounts). + ApplicationFeeAmount *int64 `form:"application_fee_amount"` // Controls when the funds will be captured from the customer's account. CaptureMethod *string `form:"capture_method"` // Set to `true` to fail the payment attempt if the PaymentIntent transitions into `requires_action`. This parameter is intended for simpler integrations that do not handle customer actions, like [saving cards without authentication](https://stripe.com/docs/payments/save-card-without-authentication). @@ -2430,6 +2443,8 @@ type PaymentIntent struct { ReceiptEmail string `json:"receipt_email"` // ID of the review associated with this PaymentIntent, if any. Review *Review `json:"review"` + // Indicates whether confirmation for this PaymentIntent using a secret key is `required` or `optional`. + SecretKeyConfirmation PaymentIntentSecretKeyConfirmation `json:"secret_key_confirmation"` // Indicates that you intend to make future payments with this PaymentIntent's payment method. // // Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. If no Customer was provided, the payment method can still be [attached](https://stripe.com/docs/api/payment_methods/attach) to a Customer after the transaction completes. diff --git a/treasury_receivedcredit.go b/treasury_receivedcredit.go index b62b561667..a2b9b10f58 100644 --- a/treasury_receivedcredit.go +++ b/treasury_receivedcredit.go @@ -66,6 +66,14 @@ const ( TreasuryReceivedCreditNetworkUSDomesticWire TreasuryReceivedCreditNetwork = "us_domestic_wire" ) +// The type of flow that originated the ReceivedCredit. +type TreasuryReceivedCreditNetworkDetailsType string + +// List of values that TreasuryReceivedCreditNetworkDetailsType can take +const ( + TreasuryReceivedCreditNetworkDetailsTypeAch TreasuryReceivedCreditNetworkDetailsType = "ach" +) + // Set if a ReceivedCredit cannot be reversed. type TreasuryReceivedCreditReversalDetailsRestrictedReason string @@ -176,6 +184,20 @@ type TreasuryReceivedCreditLinkedFlows struct { SourceFlowType string `json:"source_flow_type"` } +// Details about an ACH transaction. +type TreasuryReceivedCreditNetworkDetailsAch struct { + // ACH Addenda record + Addenda string `json:"addenda"` +} + +// Details specific to the money movement rails. +type TreasuryReceivedCreditNetworkDetails struct { + // Details about an ACH transaction. + Ach *TreasuryReceivedCreditNetworkDetailsAch `json:"ach"` + // The type of flow that originated the ReceivedCredit. + Type TreasuryReceivedCreditNetworkDetailsType `json:"type"` +} + // Details describing when a ReceivedCredit may be reversed. type TreasuryReceivedCreditReversalDetails struct { // Time before which a ReceivedCredit can be reversed. @@ -209,6 +231,8 @@ type TreasuryReceivedCredit struct { Livemode bool `json:"livemode"` // The rails used to send the funds. Network TreasuryReceivedCreditNetwork `json:"network"` + // Details specific to the money movement rails. + NetworkDetails *TreasuryReceivedCreditNetworkDetails `json:"network_details"` // String representing the object's type. Objects of the same type share the same value. Object string `json:"object"` // Details describing when a ReceivedCredit may be reversed. diff --git a/treasury_receiveddebit.go b/treasury_receiveddebit.go index 4d6e09ca2a..5424098b45 100644 --- a/treasury_receiveddebit.go +++ b/treasury_receiveddebit.go @@ -55,6 +55,14 @@ const ( TreasuryReceivedDebitNetworkStripe TreasuryReceivedDebitNetwork = "stripe" ) +// The type of flow that originated the ReceivedDebit. +type TreasuryReceivedDebitNetworkDetailsType string + +// List of values that TreasuryReceivedDebitNetworkDetailsType can take +const ( + TreasuryReceivedDebitNetworkDetailsTypeAch TreasuryReceivedDebitNetworkDetailsType = "ach" +) + // Set if a ReceivedDebit can't be reversed. type TreasuryReceivedDebitReversalDetailsRestrictedReason string @@ -130,6 +138,22 @@ type TreasuryReceivedDebitLinkedFlows struct { 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"` + // The ReceivedCredit that Capital withheld from + ReceivedCreditCapitalWithholding string `json:"received_credit_capital_withholding"` +} + +// Details about an ACH transaction. +type TreasuryReceivedDebitNetworkDetailsAch struct { + // ACH Addenda record + Addenda string `json:"addenda"` +} + +// Details specific to the money movement rails. +type TreasuryReceivedDebitNetworkDetails struct { + // Details about an ACH transaction. + Ach *TreasuryReceivedDebitNetworkDetailsAch `json:"ach"` + // The type of flow that originated the ReceivedDebit. + Type TreasuryReceivedDebitNetworkDetailsType `json:"type"` } // Details describing when a ReceivedDebit might be reversed. @@ -165,6 +189,8 @@ type TreasuryReceivedDebit struct { Livemode bool `json:"livemode"` // The network used for the ReceivedDebit. Network TreasuryReceivedDebitNetwork `json:"network"` + // Details specific to the money movement rails. + NetworkDetails *TreasuryReceivedDebitNetworkDetails `json:"network_details"` // String representing the object's type. Objects of the same type share the same value. Object string `json:"object"` // Details describing when a ReceivedDebit might be reversed.