diff --git a/CHANGELOG.md b/CHANGELOG.md index 2027ff73f..7455b1c63 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,17 @@ # Changelog +## 10.12.0 - 2024-09-18 +* [#1394](https://github.com/stripe/stripe-python/pull/1394) Update generated code + * Add support for `international_transaction` on enum `stripe.treasury.ReceivedDebit.failure_code` +* [#1393](https://github.com/stripe/stripe-python/pull/1393) Update generated code + * Add support for `payer_details` on resource class `stripe.Charge.PaymentMethodDetails.Klarna` + * Add support for `amazon_pay` on resource class `stripe.Dispute.PaymentMethodDetails` + * Add support for `automatically_finalizes_at` on resource `stripe.Invoice` + * Add support for `state_sales_tax` on resource class `stripe.tax.Registration.CountryOptions.Us` and parameter class `stripe.tax.Registration.CreateParamsCountryOptionsUs` + * Add support for `verification_supportability` on enums `stripe.Account.FutureRequirements.Error.code`, `stripe.Account.Requirements.Error.code`, `stripe.BankAccount.FutureRequirements.Error.code`, `stripe.BankAccount.Requirements.Error.code`, `stripe.Capability.FutureRequirements.Error.code`, `stripe.Capability.Requirements.Error.code`, `stripe.Person.FutureRequirements.Error.code`, and `stripe.Person.Requirements.Error.code` + * Add support for `amazon_pay` on enum `stripe.Dispute.PaymentMethodDetails.type` + * Add support for `terminal_reader_invalid_location_for_activation` on enums `stripe.Invoice.LastFinalizationError.code`, `stripe.PaymentIntent.LastPaymentError.code`, `stripe.SetupAttempt.SetupError.code`, and `stripe.SetupIntent.LastSetupError.code` + ## 10.12.0b1 - 2024-09-13 * [#1389](https://github.com/stripe/stripe-python/pull/1389) Update generated code for beta * Add support for `template` on resource class `stripe.QuotePreviewInvoice.Rendering` @@ -13,6 +25,16 @@ * Add support for `issuing_settlement.created` on enums `stripe.Event.type`, `stripe.WebhookEndpoint.CreateParams.enabled_events`, and `stripe.WebhookEndpoint.ModifyParams.enabled_events` * Add support for `issuing_settlement.updated` on enums `stripe.Event.type`, `stripe.WebhookEndpoint.CreateParams.enabled_events`, and `stripe.WebhookEndpoint.ModifyParams.enabled_events` +## 10.11.0 - 2024-09-12 +* [#1391](https://github.com/stripe/stripe-python/pull/1391) Update generated code + * Add support for `template` on parameter classes `stripe.Customer.CreateParamsInvoiceSettingsRenderingOptions`, `stripe.Customer.ModifyParamsInvoiceSettingsRenderingOptions`, `stripe.Invoice.CreateParamsRendering`, and `stripe.Invoice.ModifyParamsRendering` and resource classes `stripe.Customer.InvoiceSettings.RenderingOptions` and `stripe.Invoice.Rendering` + * Add support for resource `stripe.InvoiceRenderingTemplate` + * Add support for `required` on parameter classes `stripe.PaymentLink.CreateParamsTaxIdCollection`, `stripe.PaymentLink.ModifyParamsTaxIdCollection`, and `stripe.checkout.Session.CreateParamsTaxIdCollection` and resource classes `stripe.PaymentLink.TaxIdCollection` and `stripe.checkout.Session.TaxIdCollection` + * Add support for `submitted` on enum `stripe.issuing.Card.Shipping.status` + * Change type of `tax_amounts` on `stripe.InvoiceLineItem` from `Optional[List[TaxAmount]]` to `List[TaxAmount]` + * Change type of `tax_rates` on `stripe.InvoiceLineItem` from `Optional[List[TaxRate]]` to `List[TaxRate]` + * Change type of `status_details` on `stripe.test_helpers.TestClock` from `Optional[StatusDetails]` to `StatusDetails` + ## 10.11.0b1 - 2024-09-05 * [#1387](https://github.com/stripe/stripe-python/pull/1387) Update generated code for beta * Add support for `recipients` on parameter class `stripe.AccountSession.CreateParamsComponents` diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index ad548b855..5f5b31119 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v1260 \ No newline at end of file +v1267 \ No newline at end of file diff --git a/stripe/__init__.py b/stripe/__init__.py index 078928efd..05f0b87bb 100644 --- a/stripe/__init__.py +++ b/stripe/__init__.py @@ -487,8 +487,6 @@ def __getattr__(name): QuoteLineItemService as QuoteLineItemService, ) from stripe._quote_line_service import QuoteLineService as QuoteLineService -from stripe._quote_phase import QuotePhase as QuotePhase -from stripe._quote_phase_service import QuotePhaseService as QuotePhaseService from stripe._quote_preview_invoice import ( QuotePreviewInvoice as QuotePreviewInvoice, ) diff --git a/stripe/_account.py b/stripe/_account.py index aeabe447a..cca5a584b 100644 --- a/stripe/_account.py +++ b/stripe/_account.py @@ -787,6 +787,7 @@ class Error(StripeObject): "verification_missing_owners", "verification_requires_additional_memorandum_of_associations", "verification_requires_additional_proof_of_registration", + "verification_supportability", ] """ The code for the type of error. @@ -936,6 +937,7 @@ class Error(StripeObject): "verification_missing_owners", "verification_requires_additional_memorandum_of_associations", "verification_requires_additional_proof_of_registration", + "verification_supportability", ] """ The code for the type of error. diff --git a/stripe/_account_session.py b/stripe/_account_session.py index 10ac106ec..65c6a707c 100644 --- a/stripe/_account_session.py +++ b/stripe/_account_session.py @@ -615,6 +615,14 @@ class CreateParamsComponentsFinancialAccountFeatures(TypedDict): """ Whether to allow money movement features. """ + send_money: NotRequired[bool] + """ + Whether to allow sending money. + """ + transfer_balance: NotRequired[bool] + """ + Whether to allow transferring balance. + """ class CreateParamsComponentsFinancialAccountTransactions(TypedDict): enabled: bool diff --git a/stripe/_account_session_service.py b/stripe/_account_session_service.py index 2da730f61..6416d983c 100644 --- a/stripe/_account_session_service.py +++ b/stripe/_account_session_service.py @@ -354,6 +354,14 @@ class CreateParamsComponentsFinancialAccountFeatures(TypedDict): """ Whether to allow money movement features. """ + send_money: NotRequired[bool] + """ + Whether to allow sending money. + """ + transfer_balance: NotRequired[bool] + """ + Whether to allow transferring balance. + """ class CreateParamsComponentsFinancialAccountTransactions(TypedDict): enabled: bool diff --git a/stripe/_api_version.py b/stripe/_api_version.py index 0088a088a..1338d69dd 100644 --- a/stripe/_api_version.py +++ b/stripe/_api_version.py @@ -2,4 +2,4 @@ # File generated from our OpenAPI spec class _ApiVersion: CURRENT = "2024-06-20" - PREVIEW = "2024-09-05.preview-v2" + PREVIEW = "cs_ubb_launch" diff --git a/stripe/_bank_account.py b/stripe/_bank_account.py index 733b7ba0e..fc827b93b 100644 --- a/stripe/_bank_account.py +++ b/stripe/_bank_account.py @@ -126,6 +126,7 @@ class Error(StripeObject): "verification_missing_owners", "verification_requires_additional_memorandum_of_associations", "verification_requires_additional_proof_of_registration", + "verification_supportability", ] """ The code for the type of error. @@ -249,6 +250,7 @@ class Error(StripeObject): "verification_missing_owners", "verification_requires_additional_memorandum_of_associations", "verification_requires_additional_proof_of_registration", + "verification_supportability", ] """ The code for the type of error. diff --git a/stripe/_capability.py b/stripe/_capability.py index 0974b8d52..944236d60 100644 --- a/stripe/_capability.py +++ b/stripe/_capability.py @@ -120,6 +120,7 @@ class Error(StripeObject): "verification_missing_owners", "verification_requires_additional_memorandum_of_associations", "verification_requires_additional_proof_of_registration", + "verification_supportability", ] """ The code for the type of error. @@ -282,6 +283,7 @@ class Error(StripeObject): "verification_missing_owners", "verification_requires_additional_memorandum_of_associations", "verification_requires_additional_proof_of_registration", + "verification_supportability", ] """ The code for the type of error. diff --git a/stripe/_charge.py b/stripe/_charge.py index b1955514e..082fe7e86 100644 --- a/stripe/_charge.py +++ b/stripe/_charge.py @@ -1294,6 +1294,23 @@ class Receipt(StripeObject): _inner_class_types = {"receipt": Receipt} class Klarna(StripeObject): + class PayerDetails(StripeObject): + class Address(StripeObject): + country: Optional[str] + """ + The payer address country + """ + + address: Optional[Address] + """ + The payer's address + """ + _inner_class_types = {"address": Address} + + payer_details: Optional[PayerDetails] + """ + The payer details for this transaction. + """ payment_method_category: Optional[str] """ The Klarna payment method used for this transaction. @@ -1304,6 +1321,7 @@ class Klarna(StripeObject): Preferred language of the Klarna authorization page that the customer is redirected to. Can be one of `de-AT`, `en-AT`, `nl-BE`, `fr-BE`, `en-BE`, `de-DE`, `en-DE`, `da-DK`, `en-DK`, `es-ES`, `en-ES`, `fi-FI`, `sv-FI`, `en-FI`, `en-GB`, `en-IE`, `it-IT`, `en-IT`, `nl-NL`, `en-NL`, `nb-NO`, `en-NO`, `sv-SE`, `en-SE`, `en-US`, `es-US`, `fr-FR`, `en-FR`, `cs-CZ`, `en-CZ`, `ro-RO`, `en-RO`, `el-GR`, `en-GR`, `en-AU`, `en-NZ`, `en-CA`, `fr-CA`, `pl-PL`, `en-PL`, `pt-PT`, `en-PT`, `de-CH`, `fr-CH`, `it-CH`, or `en-CH` """ + _inner_class_types = {"payer_details": PayerDetails} class Konbini(StripeObject): class Store(StripeObject): diff --git a/stripe/_dispute.py b/stripe/_dispute.py index 3908023e1..4405d33ec 100644 --- a/stripe/_dispute.py +++ b/stripe/_dispute.py @@ -339,6 +339,12 @@ class VisaCompellingEvidence3(StripeObject): _inner_class_types = {"enhanced_eligibility": EnhancedEligibility} class PaymentMethodDetails(StripeObject): + class AmazonPay(StripeObject): + dispute_type: Optional[Literal["chargeback", "claim"]] + """ + The AmazonPay dispute type, chargeback or claim + """ + class Card(StripeObject): brand: str """ @@ -369,14 +375,20 @@ class Paypal(StripeObject): The reason for the dispute as defined by PayPal """ + amazon_pay: Optional[AmazonPay] card: Optional[Card] klarna: Optional[Klarna] paypal: Optional[Paypal] - type: Literal["card", "klarna", "paypal"] + type: Literal["amazon_pay", "card", "klarna", "paypal"] """ Payment method type. """ - _inner_class_types = {"card": Card, "klarna": Klarna, "paypal": Paypal} + _inner_class_types = { + "amazon_pay": AmazonPay, + "card": Card, + "klarna": Klarna, + "paypal": Paypal, + } class CloseParams(RequestOptions): expand: NotRequired[List[str]] diff --git a/stripe/_invoice.py b/stripe/_invoice.py index 965c5dfe6..d22f75a63 100644 --- a/stripe/_invoice.py +++ b/stripe/_invoice.py @@ -522,6 +522,7 @@ class LastFinalizationError(StripeObject): "terminal_reader_busy", "terminal_reader_collected_data_invalid", "terminal_reader_hardware_fault", + "terminal_reader_invalid_location_for_activation", "terminal_reader_invalid_location_for_payment", "terminal_reader_offline", "terminal_reader_timeout", @@ -9250,6 +9251,10 @@ class VoidInvoiceParams(RequestOptions): Controls whether Stripe performs [automatic collection](https://stripe.com/docs/invoicing/integration/automatic-advancement-collection) of the invoice. If `false`, the invoice's state doesn't automatically advance without an explicit action. """ automatic_tax: AutomaticTax + automatically_finalizes_at: Optional[int] + """ + The time when this invoice is currently scheduled to be automatically finalized. The field will be `null` if the invoice is not scheduled to finalize in the future. If the invoice is not in the draft state, this field will always be `null` - see `finalized_at` for the time when an already-finalized invoice was finalized. + """ billing_reason: Optional[ Literal[ "automatic_pending_invoice_item_invoice", diff --git a/stripe/_invoice_rendering_template.py b/stripe/_invoice_rendering_template.py index 5a57cf743..5d7dc7e2f 100644 --- a/stripe/_invoice_rendering_template.py +++ b/stripe/_invoice_rendering_template.py @@ -11,6 +11,11 @@ class InvoiceRenderingTemplate( ListableAPIResource["InvoiceRenderingTemplate"] ): + """ + Invoice Rendering Templates are used to configure how invoices are rendered on surfaces like the PDF. Invoice Rendering Templates + can be created from within the Dashboard, and they can be used over the API when creating invoices. + """ + OBJECT_NAME: ClassVar[Literal["invoice_rendering_template"]] = ( "invoice_rendering_template" ) diff --git a/stripe/_object_classes.py b/stripe/_object_classes.py index 7467189a2..b6123d384 100644 --- a/stripe/_object_classes.py +++ b/stripe/_object_classes.py @@ -107,7 +107,6 @@ stripe.PromotionCode.OBJECT_NAME: stripe.PromotionCode, stripe.Quote.OBJECT_NAME: stripe.Quote, stripe.QuoteLine.OBJECT_NAME: stripe.QuoteLine, - stripe.QuotePhase.OBJECT_NAME: stripe.QuotePhase, stripe.QuotePreviewInvoice.OBJECT_NAME: stripe.QuotePreviewInvoice, stripe.QuotePreviewSubscriptionSchedule.OBJECT_NAME: stripe.QuotePreviewSubscriptionSchedule, stripe.radar.EarlyFraudWarning.OBJECT_NAME: stripe.radar.EarlyFraudWarning, diff --git a/stripe/_payment_intent.py b/stripe/_payment_intent.py index ef6161c94..33d1d9597 100644 --- a/stripe/_payment_intent.py +++ b/stripe/_payment_intent.py @@ -275,6 +275,7 @@ class LastPaymentError(StripeObject): "terminal_reader_busy", "terminal_reader_collected_data_invalid", "terminal_reader_hardware_fault", + "terminal_reader_invalid_location_for_activation", "terminal_reader_invalid_location_for_payment", "terminal_reader_offline", "terminal_reader_timeout", diff --git a/stripe/_payment_link.py b/stripe/_payment_link.py index 194b11485..e5b887159 100644 --- a/stripe/_payment_link.py +++ b/stripe/_payment_link.py @@ -800,6 +800,7 @@ class CreateParams(RequestOptions): "payto", "pix", "promptpay", + "rechnung", "sepa_debit", "sofort", "swish", @@ -1680,7 +1681,7 @@ class ModifyParams(RequestOptions): If you'd like information on how to collect a payment method outside of Checkout, read the guide on [configuring subscriptions with a free trial](https://stripe.com/docs/payments/checkout/free-trials). """ payment_method_types: NotRequired[ - "Literal['']|List[Literal['affirm', 'afterpay_clearpay', 'alipay', 'au_becs_debit', 'bacs_debit', 'bancontact', 'blik', 'boleto', 'card', 'cashapp', 'eps', 'fpx', 'giropay', 'grabpay', 'ideal', 'klarna', 'konbini', 'link', 'mb_way', 'mobilepay', 'multibanco', 'oxxo', 'p24', 'paynow', 'paypal', 'payto', 'pix', 'promptpay', 'sepa_debit', 'sofort', 'swish', 'twint', 'us_bank_account', 'wechat_pay', 'zip']]" + "Literal['']|List[Literal['affirm', 'afterpay_clearpay', 'alipay', 'au_becs_debit', 'bacs_debit', 'bancontact', 'blik', 'boleto', 'card', 'cashapp', 'eps', 'fpx', 'giropay', 'grabpay', 'ideal', 'klarna', 'konbini', 'link', 'mb_way', 'mobilepay', 'multibanco', 'oxxo', 'p24', 'paynow', 'paypal', 'payto', 'pix', 'promptpay', 'rechnung', 'sepa_debit', 'sofort', 'swish', 'twint', 'us_bank_account', 'wechat_pay', 'zip']]" ] """ The list of payment method types that customers can use. Pass an empty string to enable dynamic payment methods that use your [payment method settings](https://dashboard.stripe.com/settings/payment_methods). @@ -2457,6 +2458,7 @@ class RetrieveParams(RequestOptions): "payto", "pix", "promptpay", + "rechnung", "sepa_debit", "sofort", "swish", diff --git a/stripe/_payment_link_service.py b/stripe/_payment_link_service.py index 5468c6338..4f80b869a 100644 --- a/stripe/_payment_link_service.py +++ b/stripe/_payment_link_service.py @@ -141,6 +141,7 @@ class CreateParams(TypedDict): "payto", "pix", "promptpay", + "rechnung", "sepa_debit", "sofort", "swish", @@ -1023,7 +1024,7 @@ class UpdateParams(TypedDict): If you'd like information on how to collect a payment method outside of Checkout, read the guide on [configuring subscriptions with a free trial](https://stripe.com/docs/payments/checkout/free-trials). """ payment_method_types: NotRequired[ - "Literal['']|List[Literal['affirm', 'afterpay_clearpay', 'alipay', 'au_becs_debit', 'bacs_debit', 'bancontact', 'blik', 'boleto', 'card', 'cashapp', 'eps', 'fpx', 'giropay', 'grabpay', 'ideal', 'klarna', 'konbini', 'link', 'mb_way', 'mobilepay', 'multibanco', 'oxxo', 'p24', 'paynow', 'paypal', 'payto', 'pix', 'promptpay', 'sepa_debit', 'sofort', 'swish', 'twint', 'us_bank_account', 'wechat_pay', 'zip']]" + "Literal['']|List[Literal['affirm', 'afterpay_clearpay', 'alipay', 'au_becs_debit', 'bacs_debit', 'bancontact', 'blik', 'boleto', 'card', 'cashapp', 'eps', 'fpx', 'giropay', 'grabpay', 'ideal', 'klarna', 'konbini', 'link', 'mb_way', 'mobilepay', 'multibanco', 'oxxo', 'p24', 'paynow', 'paypal', 'payto', 'pix', 'promptpay', 'rechnung', 'sepa_debit', 'sofort', 'swish', 'twint', 'us_bank_account', 'wechat_pay', 'zip']]" ] """ The list of payment method types that customers can use. Pass an empty string to enable dynamic payment methods that use your [payment method settings](https://dashboard.stripe.com/settings/payment_methods). diff --git a/stripe/_person.py b/stripe/_person.py index 33b573801..7082f215b 100644 --- a/stripe/_person.py +++ b/stripe/_person.py @@ -246,6 +246,7 @@ class Error(StripeObject): "verification_missing_owners", "verification_requires_additional_memorandum_of_associations", "verification_requires_additional_proof_of_registration", + "verification_supportability", ] """ The code for the type of error. @@ -443,6 +444,7 @@ class Error(StripeObject): "verification_missing_owners", "verification_requires_additional_memorandum_of_associations", "verification_requires_additional_proof_of_registration", + "verification_supportability", ] """ The code for the type of error. diff --git a/stripe/_quote_phase.py b/stripe/_quote_phase.py deleted file mode 100644 index 650af32dd..000000000 --- a/stripe/_quote_phase.py +++ /dev/null @@ -1,340 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from stripe._api_resource import APIResource -from stripe._expandable_field import ExpandableField -from stripe._list_object import ListObject -from stripe._request_options import RequestOptions -from stripe._stripe_object import StripeObject -from stripe._util import class_method_variant, sanitize_id -from typing import ClassVar, Dict, List, Optional, cast, overload -from typing_extensions import Literal, NotRequired, Unpack, TYPE_CHECKING - -if TYPE_CHECKING: - from stripe._discount import Discount as DiscountResource - from stripe._line_item import LineItem - from stripe._tax_rate import TaxRate - - -class QuotePhase(APIResource["QuotePhase"]): - """ - A quote phase describes the line items, coupons, and trialing status of a subscription for a predefined time period. - """ - - OBJECT_NAME: ClassVar[Literal["quote_phase"]] = "quote_phase" - - class InvoiceSettings(StripeObject): - days_until_due: Optional[int] - """ - Number of days within which a customer must pay invoices generated by this subscription schedule. This value will be `null` for subscription schedules where `billing=charge_automatically`. - """ - - class TotalDetails(StripeObject): - class Breakdown(StripeObject): - class Discount(StripeObject): - amount: int - """ - The amount discounted. - """ - discount: "DiscountResource" - """ - A discount represents the actual application of a [coupon](https://stripe.com/docs/api#coupons) or [promotion code](https://stripe.com/docs/api#promotion_codes). - It contains information about when the discount began, when it will end, and what it is applied to. - - Related guide: [Applying discounts to subscriptions](https://stripe.com/docs/billing/subscriptions/discounts) - """ - - class Tax(StripeObject): - amount: int - """ - Amount of tax applied for this rate. - """ - rate: "TaxRate" - """ - Tax rates can be applied to [invoices](https://stripe.com/docs/billing/invoices/tax-rates), [subscriptions](https://stripe.com/docs/billing/subscriptions/taxes) and [Checkout Sessions](https://stripe.com/docs/payments/checkout/set-up-a-subscription#tax-rates) to collect tax. - - Related guide: [Tax rates](https://stripe.com/docs/billing/taxes/tax-rates) - """ - taxability_reason: Optional[ - Literal[ - "customer_exempt", - "not_collecting", - "not_subject_to_tax", - "not_supported", - "portion_product_exempt", - "portion_reduced_rated", - "portion_standard_rated", - "product_exempt", - "product_exempt_holiday", - "proportionally_rated", - "reduced_rated", - "reverse_charge", - "standard_rated", - "taxable_basis_reduced", - "zero_rated", - ] - ] - """ - The reasoning behind this tax, for example, if the product is tax exempt. The possible values for this field may be extended as new tax rules are supported. - """ - taxable_amount: Optional[int] - """ - The amount on which tax is calculated, in cents (or local equivalent). - """ - - discounts: List[Discount] - """ - The aggregated discounts. - """ - taxes: List[Tax] - """ - The aggregated tax amounts by rate. - """ - _inner_class_types = {"discounts": Discount, "taxes": Tax} - - amount_discount: int - """ - This is the sum of all the discounts. - """ - amount_shipping: Optional[int] - """ - This is the sum of all the shipping amounts. - """ - amount_tax: int - """ - This is the sum of all the tax amounts. - """ - breakdown: Optional[Breakdown] - _inner_class_types = {"breakdown": Breakdown} - - class ListLineItemsParams(RequestOptions): - ending_before: NotRequired[str] - """ - A cursor for use in pagination. `ending_before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. - """ - expand: NotRequired[List[str]] - """ - Specifies which fields in the response should be expanded. - """ - limit: NotRequired[int] - """ - A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10. - """ - starting_after: NotRequired[str] - """ - A cursor for use in pagination. `starting_after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list. - """ - - class RetrieveParams(RequestOptions): - expand: NotRequired[List[str]] - """ - Specifies which fields in the response should be expanded. - """ - - amount_subtotal: int - """ - Total before any discounts or taxes are applied. - """ - amount_total: int - """ - Total after discounts and taxes are applied. - """ - billing_cycle_anchor: Optional[Literal["reset"]] - """ - If set to `reset`, the billing_cycle_anchor of the subscription is set to the start of the phase when entering the phase. If unset, then the billing cycle anchor is automatically modified as needed when entering the phase. For more information, see the billing cycle [documentation](https://stripe.com/docs/billing/subscriptions/billing-cycle). - """ - collection_method: Optional[ - Literal["charge_automatically", "send_invoice"] - ] - """ - Either `charge_automatically`, or `send_invoice`. When charging automatically, Stripe will attempt to pay the underlying subscription at the end of each billing cycle using the default source attached to the customer. When sending an invoice, Stripe will email your customer an invoice with payment instructions and mark the subscription as `active`. - """ - default_tax_rates: Optional[List[ExpandableField["TaxRate"]]] - """ - The default tax rates to apply to the subscription during this phase of the quote. - """ - discounts: List[ExpandableField["DiscountResource"]] - """ - The stackable discounts that will be applied to the subscription on this phase. Subscription item discounts are applied before subscription discounts. - """ - end_date: Optional[int] - """ - The end of this phase of the quote - """ - id: str - """ - Unique identifier for the object. - """ - invoice_settings: Optional[InvoiceSettings] - """ - The invoice settings applicable during this phase. - """ - iterations: Optional[int] - """ - Integer representing the multiplier applied to the price interval. For example, `iterations=2` applied to a price with `interval=month` and `interval_count=3` results in a phase of duration `2 * 3 months = 6 months`. - """ - line_items: Optional[ListObject["LineItem"]] - """ - A list of items the customer is being quoted for. - """ - metadata: Optional[Dict[str, str]] - """ - Set of [key-value pairs](https://stripe.com/docs/api/metadata) that will declaratively set metadata on the subscription schedule's phases when the quote is accepted. - """ - object: Literal["quote_phase"] - """ - String representing the object's type. Objects of the same type share the same value. - """ - proration_behavior: Literal["always_invoice", "create_prorations", "none"] - """ - If the quote will prorate when transitioning to this phase. Possible values are `create_prorations` and `none`. - """ - total_details: TotalDetails - trial: Optional[bool] - """ - If set to true the entire phase is counted as a trial and the customer will not be charged for any recurring fees. - """ - trial_end: Optional[int] - """ - When the trial ends within the phase. - """ - - @classmethod - def _cls_list_line_items( - cls, - quote_phase: str, - **params: Unpack["QuotePhase.ListLineItemsParams"], - ) -> ListObject["LineItem"]: - """ - When retrieving a quote phase, there is an includable line_items property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items. - """ - return cast( - ListObject["LineItem"], - cls._static_request( - "get", - "/v1/quote_phases/{quote_phase}/line_items".format( - quote_phase=sanitize_id(quote_phase) - ), - params=params, - ), - ) - - @overload - @staticmethod - def list_line_items( - quote_phase: str, **params: Unpack["QuotePhase.ListLineItemsParams"] - ) -> ListObject["LineItem"]: - """ - When retrieving a quote phase, there is an includable line_items property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items. - """ - ... - - @overload - def list_line_items( - self, **params: Unpack["QuotePhase.ListLineItemsParams"] - ) -> ListObject["LineItem"]: - """ - When retrieving a quote phase, there is an includable line_items property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items. - """ - ... - - @class_method_variant("_cls_list_line_items") - def list_line_items( # pyright: ignore[reportGeneralTypeIssues] - self, **params: Unpack["QuotePhase.ListLineItemsParams"] - ) -> ListObject["LineItem"]: - """ - When retrieving a quote phase, there is an includable line_items property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items. - """ - return cast( - ListObject["LineItem"], - self._request( - "get", - "/v1/quote_phases/{quote_phase}/line_items".format( - quote_phase=sanitize_id(self.get("id")) - ), - params=params, - ), - ) - - @classmethod - async def _cls_list_line_items_async( - cls, - quote_phase: str, - **params: Unpack["QuotePhase.ListLineItemsParams"], - ) -> ListObject["LineItem"]: - """ - When retrieving a quote phase, there is an includable line_items property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items. - """ - return cast( - ListObject["LineItem"], - await cls._static_request_async( - "get", - "/v1/quote_phases/{quote_phase}/line_items".format( - quote_phase=sanitize_id(quote_phase) - ), - params=params, - ), - ) - - @overload - @staticmethod - async def list_line_items_async( - quote_phase: str, **params: Unpack["QuotePhase.ListLineItemsParams"] - ) -> ListObject["LineItem"]: - """ - When retrieving a quote phase, there is an includable line_items property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items. - """ - ... - - @overload - async def list_line_items_async( - self, **params: Unpack["QuotePhase.ListLineItemsParams"] - ) -> ListObject["LineItem"]: - """ - When retrieving a quote phase, there is an includable line_items property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items. - """ - ... - - @class_method_variant("_cls_list_line_items_async") - async def list_line_items_async( # pyright: ignore[reportGeneralTypeIssues] - self, **params: Unpack["QuotePhase.ListLineItemsParams"] - ) -> ListObject["LineItem"]: - """ - When retrieving a quote phase, there is an includable line_items property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items. - """ - return cast( - ListObject["LineItem"], - await self._request_async( - "get", - "/v1/quote_phases/{quote_phase}/line_items".format( - quote_phase=sanitize_id(self.get("id")) - ), - params=params, - ), - ) - - @classmethod - def retrieve( - cls, id: str, **params: Unpack["QuotePhase.RetrieveParams"] - ) -> "QuotePhase": - """ - Retrieves the quote phase with the given ID. - """ - instance = cls(id, **params) - instance.refresh() - return instance - - @classmethod - async def retrieve_async( - cls, id: str, **params: Unpack["QuotePhase.RetrieveParams"] - ) -> "QuotePhase": - """ - Retrieves the quote phase with the given ID. - """ - instance = cls(id, **params) - await instance.refresh_async() - return instance - - _inner_class_types = { - "invoice_settings": InvoiceSettings, - "total_details": TotalDetails, - } diff --git a/stripe/_quote_phase_service.py b/stripe/_quote_phase_service.py deleted file mode 100644 index 157a3744c..000000000 --- a/stripe/_quote_phase_service.py +++ /dev/null @@ -1,124 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from stripe._line_item import LineItem -from stripe._list_object import ListObject -from stripe._quote_phase import QuotePhase -from stripe._request_options import RequestOptions -from stripe._stripe_service import StripeService -from stripe._util import sanitize_id -from typing import List, cast -from typing_extensions import NotRequired, TypedDict - - -class QuotePhaseService(StripeService): - class ListLineItemsParams(TypedDict): - ending_before: NotRequired[str] - """ - A cursor for use in pagination. `ending_before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. - """ - expand: NotRequired[List[str]] - """ - Specifies which fields in the response should be expanded. - """ - limit: NotRequired[int] - """ - A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10. - """ - starting_after: NotRequired[str] - """ - A cursor for use in pagination. `starting_after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list. - """ - - class RetrieveParams(TypedDict): - expand: NotRequired[List[str]] - """ - Specifies which fields in the response should be expanded. - """ - - def retrieve( - self, - quote_phase: str, - params: "QuotePhaseService.RetrieveParams" = {}, - options: RequestOptions = {}, - ) -> QuotePhase: - """ - Retrieves the quote phase with the given ID. - """ - return cast( - QuotePhase, - self._request( - "get", - "/v1/quote_phases/{quote_phase}".format( - quote_phase=sanitize_id(quote_phase), - ), - base_address="api", - params=params, - options=options, - ), - ) - - async def retrieve_async( - self, - quote_phase: str, - params: "QuotePhaseService.RetrieveParams" = {}, - options: RequestOptions = {}, - ) -> QuotePhase: - """ - Retrieves the quote phase with the given ID. - """ - return cast( - QuotePhase, - await self._request_async( - "get", - "/v1/quote_phases/{quote_phase}".format( - quote_phase=sanitize_id(quote_phase), - ), - base_address="api", - params=params, - options=options, - ), - ) - - def list_line_items( - self, - quote_phase: str, - params: "QuotePhaseService.ListLineItemsParams" = {}, - options: RequestOptions = {}, - ) -> ListObject[LineItem]: - """ - When retrieving a quote phase, there is an includable line_items property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items. - """ - return cast( - ListObject[LineItem], - self._request( - "get", - "/v1/quote_phases/{quote_phase}/line_items".format( - quote_phase=sanitize_id(quote_phase), - ), - base_address="api", - params=params, - options=options, - ), - ) - - async def list_line_items_async( - self, - quote_phase: str, - params: "QuotePhaseService.ListLineItemsParams" = {}, - options: RequestOptions = {}, - ) -> ListObject[LineItem]: - """ - When retrieving a quote phase, there is an includable line_items property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items. - """ - return cast( - ListObject[LineItem], - await self._request_async( - "get", - "/v1/quote_phases/{quote_phase}/line_items".format( - quote_phase=sanitize_id(quote_phase), - ), - base_address="api", - params=params, - options=options, - ), - ) diff --git a/stripe/_quote_preview_invoice.py b/stripe/_quote_preview_invoice.py index 45ac84872..89ae85449 100644 --- a/stripe/_quote_preview_invoice.py +++ b/stripe/_quote_preview_invoice.py @@ -504,6 +504,7 @@ class LastFinalizationError(StripeObject): "terminal_reader_busy", "terminal_reader_collected_data_invalid", "terminal_reader_hardware_fault", + "terminal_reader_invalid_location_for_activation", "terminal_reader_invalid_location_for_payment", "terminal_reader_offline", "terminal_reader_timeout", @@ -1125,6 +1126,10 @@ class TransferData(StripeObject): Whether an attempt has been made to pay the invoice. An invoice is not attempted until 1 hour after the `invoice.created` webhook, for example, so you might not want to display that invoice as unpaid to your users. """ automatic_tax: AutomaticTax + automatically_finalizes_at: Optional[int] + """ + The time when this invoice is currently scheduled to be automatically finalized. The field will be `null` if the invoice is not scheduled to finalize in the future. If the invoice is not in the draft state, this field will always be `null` - see `finalized_at` for the time when an already-finalized invoice was finalized. + """ billing_reason: Optional[ Literal[ "automatic_pending_invoice_item_invoice", diff --git a/stripe/_setup_attempt.py b/stripe/_setup_attempt.py index 85bb49a48..52d3699f2 100644 --- a/stripe/_setup_attempt.py +++ b/stripe/_setup_attempt.py @@ -602,6 +602,7 @@ class SetupError(StripeObject): "terminal_reader_busy", "terminal_reader_collected_data_invalid", "terminal_reader_hardware_fault", + "terminal_reader_invalid_location_for_activation", "terminal_reader_invalid_location_for_payment", "terminal_reader_offline", "terminal_reader_timeout", diff --git a/stripe/_setup_intent.py b/stripe/_setup_intent.py index 72bc2dfa9..e71794908 100644 --- a/stripe/_setup_intent.py +++ b/stripe/_setup_intent.py @@ -246,6 +246,7 @@ class LastSetupError(StripeObject): "terminal_reader_busy", "terminal_reader_collected_data_invalid", "terminal_reader_hardware_fault", + "terminal_reader_invalid_location_for_activation", "terminal_reader_invalid_location_for_payment", "terminal_reader_offline", "terminal_reader_timeout", diff --git a/stripe/_stripe_client.py b/stripe/_stripe_client.py index 8f5c90a59..43361af53 100644 --- a/stripe/_stripe_client.py +++ b/stripe/_stripe_client.py @@ -83,7 +83,6 @@ from stripe._product_service import ProductService from stripe._promotion_code_service import PromotionCodeService from stripe._quote_service import QuoteService -from stripe._quote_phase_service import QuotePhaseService from stripe._radar_service import RadarService from stripe._refund_service import RefundService from stripe._reporting_service import ReportingService @@ -239,7 +238,6 @@ def __init__( self.products = ProductService(self._requestor) self.promotion_codes = PromotionCodeService(self._requestor) self.quotes = QuoteService(self._requestor) - self.quote_phases = QuotePhaseService(self._requestor) self.radar = RadarService(self._requestor) self.refunds = RefundService(self._requestor) self.reporting = ReportingService(self._requestor) diff --git a/stripe/api_resources/__init__.py b/stripe/api_resources/__init__.py index 865a5c847..6544e6ceb 100644 --- a/stripe/api_resources/__init__.py +++ b/stripe/api_resources/__init__.py @@ -107,7 +107,6 @@ from stripe.api_resources.promotion_code import PromotionCode from stripe.api_resources.quote import Quote from stripe.api_resources.quote_line import QuoteLine - from stripe.api_resources.quote_phase import QuotePhase from stripe.api_resources.quote_preview_invoice import QuotePreviewInvoice from stripe.api_resources.quote_preview_subscription_schedule import ( QuotePreviewSubscriptionSchedule, diff --git a/stripe/api_resources/quote_phase.py b/stripe/api_resources/quote_phase.py deleted file mode 100644 index 4982743b7..000000000 --- a/stripe/api_resources/quote_phase.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.quote_phase package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.api_resources.quote_phase import QuotePhase - To: - from stripe import QuotePhase - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe._quote_phase import ( # noqa - QuotePhase, - ) diff --git a/stripe/tax/_registration.py b/stripe/tax/_registration.py index 807558ad0..43bcb69a7 100644 --- a/stripe/tax/_registration.py +++ b/stripe/tax/_registration.py @@ -582,12 +582,34 @@ class LocalLeaseTax(StripeObject): A [FIPS code](https://www.census.gov/library/reference/code-lists/ansi.html) representing the local jurisdiction. """ + class StateSalesTax(StripeObject): + class Election(StripeObject): + jurisdiction: Optional[str] + """ + A [FIPS code](https://www.census.gov/library/reference/code-lists/ansi.html) representing the local jurisdiction. + """ + type: Literal[ + "local_use_tax", + "simplified_sellers_use_tax", + "single_local_use_tax", + ] + """ + The type of the election for the state sales tax registration. + """ + + elections: Optional[List[Election]] + """ + Elections for the state sales tax registration. + """ + _inner_class_types = {"elections": Election} + local_amusement_tax: Optional[LocalAmusementTax] local_lease_tax: Optional[LocalLeaseTax] state: str """ Two-letter US state code ([ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2)). """ + state_sales_tax: Optional[StateSalesTax] type: Literal[ "local_amusement_tax", "local_lease_tax", @@ -600,6 +622,7 @@ class LocalLeaseTax(StripeObject): _inner_class_types = { "local_amusement_tax": LocalAmusementTax, "local_lease_tax": LocalLeaseTax, + "state_sales_tax": StateSalesTax, } class Vn(StripeObject): @@ -1650,6 +1673,12 @@ class CreateParamsCountryOptionsUs(TypedDict): """ Two-letter US state code ([ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2)). """ + state_sales_tax: NotRequired[ + "Registration.CreateParamsCountryOptionsUsStateSalesTax" + ] + """ + Options for the state sales tax registration. + """ type: Literal[ "local_amusement_tax", "local_lease_tax", @@ -1672,6 +1701,28 @@ class CreateParamsCountryOptionsUsLocalLeaseTax(TypedDict): A [FIPS code](https://www.census.gov/library/reference/code-lists/ansi.html) representing the local jurisdiction. Supported FIPS codes are: `14000` (Chicago). """ + class CreateParamsCountryOptionsUsStateSalesTax(TypedDict): + elections: List[ + "Registration.CreateParamsCountryOptionsUsStateSalesTaxElection" + ] + """ + Elections for the state sales tax registration. + """ + + class CreateParamsCountryOptionsUsStateSalesTaxElection(TypedDict): + jurisdiction: NotRequired[str] + """ + A [FIPS code](https://www.census.gov/library/reference/code-lists/ansi.html) representing the local jurisdiction. Supported FIPS codes are: `003` (Allegheny County) and `60000` (Philadelphia City). + """ + type: Literal[ + "local_use_tax", + "simplified_sellers_use_tax", + "single_local_use_tax", + ] + """ + The type of the election for the state sales tax registration. + """ + class CreateParamsCountryOptionsVn(TypedDict): type: Literal["simplified"] """ diff --git a/stripe/tax/_registration_service.py b/stripe/tax/_registration_service.py index 1f9b4ba93..fd7ccda89 100644 --- a/stripe/tax/_registration_service.py +++ b/stripe/tax/_registration_service.py @@ -934,6 +934,12 @@ class CreateParamsCountryOptionsUs(TypedDict): """ Two-letter US state code ([ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2)). """ + state_sales_tax: NotRequired[ + "RegistrationService.CreateParamsCountryOptionsUsStateSalesTax" + ] + """ + Options for the state sales tax registration. + """ type: Literal[ "local_amusement_tax", "local_lease_tax", @@ -956,6 +962,28 @@ class CreateParamsCountryOptionsUsLocalLeaseTax(TypedDict): A [FIPS code](https://www.census.gov/library/reference/code-lists/ansi.html) representing the local jurisdiction. Supported FIPS codes are: `14000` (Chicago). """ + class CreateParamsCountryOptionsUsStateSalesTax(TypedDict): + elections: List[ + "RegistrationService.CreateParamsCountryOptionsUsStateSalesTaxElection" + ] + """ + Elections for the state sales tax registration. + """ + + class CreateParamsCountryOptionsUsStateSalesTaxElection(TypedDict): + jurisdiction: NotRequired[str] + """ + A [FIPS code](https://www.census.gov/library/reference/code-lists/ansi.html) representing the local jurisdiction. Supported FIPS codes are: `003` (Allegheny County) and `60000` (Philadelphia City). + """ + type: Literal[ + "local_use_tax", + "simplified_sellers_use_tax", + "single_local_use_tax", + ] + """ + The type of the election for the state sales tax registration. + """ + class CreateParamsCountryOptionsVn(TypedDict): type: Literal["simplified"] """ diff --git a/stripe/treasury/_received_debit.py b/stripe/treasury/_received_debit.py index 2bdb2dea9..6fbf73d67 100644 --- a/stripe/treasury/_received_debit.py +++ b/stripe/treasury/_received_debit.py @@ -310,7 +310,11 @@ class RetrieveParams(RequestOptions): """ failure_code: Optional[ Literal[ - "account_closed", "account_frozen", "insufficient_funds", "other" + "account_closed", + "account_frozen", + "insufficient_funds", + "international_transaction", + "other", ] ] """