diff --git a/CHANGELOG.md b/CHANGELOG.md index b2a7fde7a..234c2d912 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,11 @@ * Add support for `mb_way` on enum `stripe.checkout.Session.CreateParams.payment_method_types` * Add support for `terminal_reader_collected_data_invalid` on enums `stripe.Invoice.LastFinalizationError.code`, `stripe.PaymentIntent.LastPaymentError.code`, `stripe.QuotePreviewInvoice.LastFinalizationError.code`, `stripe.SetupAttempt.SetupError.code`, and `stripe.SetupIntent.LastSetupError.code` +## 10.10.0 - 2024-09-05 +* [#1376](https://github.com/stripe/stripe-python/pull/1376) Update generated code + * Add support for `subscription` on parameter class `stripe.billing.Alert.CreateParamsFilter` + * Change type of `customer_consent_collected` on `stripe.terminal.Reader.ProcessSetupIntentParams` from `bool` to `NotRequired[bool]` + ## 10.9.0 - 2024-08-29 * [#1385](https://github.com/stripe/stripe-python/pull/1385) Generate SDK for OpenAPI spec version 1230 * Add support for `status_details` on resource `stripe.test_helpers.TestClock` diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index b7ea530db..ad548b855 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v1247 \ No newline at end of file +v1260 \ No newline at end of file diff --git a/stripe/__init__.py b/stripe/__init__.py index bd0559243..078928efd 100644 --- a/stripe/__init__.py +++ b/stripe/__init__.py @@ -412,6 +412,12 @@ def __getattr__(name): from stripe._invoice_payment_service import ( InvoicePaymentService as InvoicePaymentService, ) +from stripe._invoice_rendering_template import ( + InvoiceRenderingTemplate as InvoiceRenderingTemplate, +) +from stripe._invoice_rendering_template_service import ( + InvoiceRenderingTemplateService as InvoiceRenderingTemplateService, +) from stripe._invoice_service import InvoiceService as InvoiceService from stripe._invoice_upcoming_lines_service import ( InvoiceUpcomingLinesService as InvoiceUpcomingLinesService, @@ -482,9 +488,6 @@ def __getattr__(name): ) from stripe._quote_line_service import QuoteLineService as QuoteLineService from stripe._quote_phase import QuotePhase as QuotePhase -from stripe._quote_phase_line_item_service import ( - QuotePhaseLineItemService as QuotePhaseLineItemService, -) from stripe._quote_phase_service import QuotePhaseService as QuotePhaseService from stripe._quote_preview_invoice import ( QuotePreviewInvoice as QuotePreviewInvoice, diff --git a/stripe/_customer.py b/stripe/_customer.py index 09965538c..1f4b83ac6 100644 --- a/stripe/_customer.py +++ b/stripe/_customer.py @@ -112,6 +112,10 @@ class RenderingOptions(StripeObject): """ How line-item prices and amounts will be displayed with respect to tax on invoice PDFs. """ + template: Optional[str] + """ + ID of the invoice rendering template to be used for this customer's invoices. If set, the template will be used on all invoices for this customer unless a template is set directly on the invoice. + """ custom_fields: Optional[List[CustomField]] """ @@ -452,6 +456,10 @@ class CreateParamsInvoiceSettingsRenderingOptions(TypedDict): """ 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. """ + template: NotRequired[str] + """ + ID of the invoice rendering template to use for future invoices. + """ class CreateParamsShipping(TypedDict): address: "Customer.CreateParamsShippingAddress" @@ -1115,6 +1123,10 @@ class ModifyParamsInvoiceSettingsRenderingOptions(TypedDict): """ 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. """ + template: NotRequired[str] + """ + ID of the invoice rendering template to use for future invoices. + """ class ModifyParamsShipping(TypedDict): address: "Customer.ModifyParamsShippingAddress" diff --git a/stripe/_customer_service.py b/stripe/_customer_service.py index 3c01eb8df..100c7c367 100644 --- a/stripe/_customer_service.py +++ b/stripe/_customer_service.py @@ -217,6 +217,10 @@ class CreateParamsInvoiceSettingsRenderingOptions(TypedDict): """ 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. """ + template: NotRequired[str] + """ + ID of the invoice rendering template to use for future invoices. + """ class CreateParamsShipping(TypedDict): address: "CustomerService.CreateParamsShippingAddress" @@ -600,6 +604,10 @@ class UpdateParamsInvoiceSettingsRenderingOptions(TypedDict): """ 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. """ + template: NotRequired[str] + """ + ID of the invoice rendering template to use for future invoices. + """ class UpdateParamsShipping(TypedDict): address: "CustomerService.UpdateParamsShippingAddress" diff --git a/stripe/_event.py b/stripe/_event.py index 1a08cd591..a6fd5972d 100644 --- a/stripe/_event.py +++ b/stripe/_event.py @@ -337,10 +337,14 @@ class RetrieveParams(RequestOptions): "issuing_dispute.funds_rescinded", "issuing_dispute.submitted", "issuing_dispute.updated", + "issuing_dispute_settlement_detail.created", + "issuing_dispute_settlement_detail.updated", "issuing_personalization_design.activated", "issuing_personalization_design.deactivated", "issuing_personalization_design.rejected", "issuing_personalization_design.updated", + "issuing_settlement.created", + "issuing_settlement.updated", "issuing_token.created", "issuing_token.updated", "issuing_transaction.created", diff --git a/stripe/_invoice.py b/stripe/_invoice.py index 12d4ceb42..965c5dfe6 100644 --- a/stripe/_invoice.py +++ b/stripe/_invoice.py @@ -845,6 +845,14 @@ class Pdf(StripeObject): """ Invoice pdf rendering options """ + template: Optional[str] + """ + ID of the rendering template that the invoice is formatted by. + """ + template_version: Optional[int] + """ + Version of the rendering template that the invoice is using. + """ _inner_class_types = {"pdf": Pdf} class ShippingCost(StripeObject): @@ -1900,6 +1908,14 @@ class CreateParamsRendering(TypedDict): """ Invoice pdf rendering options """ + template: NotRequired[str] + """ + ID of the invoice rendering template to use for this invoice. + """ + template_version: NotRequired["Literal['']|int"] + """ + The specific version of invoice rendering template to use for this invoice. + """ class CreateParamsRenderingPdf(TypedDict): page_size: NotRequired[Literal["a4", "auto", "letter"]] @@ -4554,6 +4570,14 @@ class ModifyParamsRendering(TypedDict): """ Invoice pdf rendering options """ + template: NotRequired[str] + """ + ID of the invoice rendering template to use for this invoice. + """ + template_version: NotRequired["Literal['']|int"] + """ + The specific version of invoice rendering template to use for this invoice. + """ class ModifyParamsRenderingPdf(TypedDict): page_size: NotRequired[Literal["a4", "auto", "letter"]] diff --git a/stripe/_invoice_line_item.py b/stripe/_invoice_line_item.py index f4479e5b6..31a42a326 100644 --- a/stripe/_invoice_line_item.py +++ b/stripe/_invoice_line_item.py @@ -441,11 +441,11 @@ class ModifyParamsTaxAmountTaxRateData(TypedDict): """ The subscription item that generated this line item. Left empty if the line item is not an explicit result of a subscription. """ - tax_amounts: Optional[List[TaxAmount]] + tax_amounts: List[TaxAmount] """ The amount of tax calculated per tax rate for this line item """ - tax_rates: Optional[List["TaxRate"]] + tax_rates: List["TaxRate"] """ The tax rates which apply to the line item. """ diff --git a/stripe/_invoice_rendering_template.py b/stripe/_invoice_rendering_template.py new file mode 100644 index 000000000..5a57cf743 --- /dev/null +++ b/stripe/_invoice_rendering_template.py @@ -0,0 +1,385 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from stripe._list_object import ListObject +from stripe._listable_api_resource import ListableAPIResource +from stripe._request_options import RequestOptions +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 + + +class InvoiceRenderingTemplate( + ListableAPIResource["InvoiceRenderingTemplate"] +): + OBJECT_NAME: ClassVar[Literal["invoice_rendering_template"]] = ( + "invoice_rendering_template" + ) + + class ArchiveParams(RequestOptions): + expand: NotRequired[List[str]] + """ + Specifies which fields in the response should be expanded. + """ + + class ListParams(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. + """ + status: NotRequired[Literal["active", "archived"]] + + class RetrieveParams(RequestOptions): + expand: NotRequired[List[str]] + """ + Specifies which fields in the response should be expanded. + """ + version: NotRequired[int] + + class UnarchiveParams(RequestOptions): + expand: NotRequired[List[str]] + """ + Specifies which fields in the response should be expanded. + """ + + created: int + """ + Time at which the object was created. Measured in seconds since the Unix epoch. + """ + id: str + """ + Unique identifier for the object. + """ + livemode: bool + """ + Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. + """ + metadata: Optional[Dict[str, str]] + """ + 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. + """ + nickname: Optional[str] + """ + A brief description of the template, hidden from customers + """ + object: Literal["invoice_rendering_template"] + """ + String representing the object's type. Objects of the same type share the same value. + """ + status: Literal["active", "archived"] + """ + The status of the template, one of `active` or `archived`. + """ + version: int + """ + Version of this template; version increases by one when an update on the template changes any field that controls invoice rendering + """ + + @classmethod + def _cls_archive( + cls, + template: str, + **params: Unpack["InvoiceRenderingTemplate.ArchiveParams"], + ) -> "InvoiceRenderingTemplate": + """ + Updates the status of an invoice rendering template to ‘archived' so no new Stripe objects (customers, invoices, etc.) can reference it. The template can also no longer be updated. However, if the template is already set on a Stripe object, it will continue to be applied on invoices generated by it. + """ + return cast( + "InvoiceRenderingTemplate", + cls._static_request( + "post", + "/v1/invoice_rendering_templates/{template}/archive".format( + template=sanitize_id(template) + ), + params=params, + ), + ) + + @overload + @staticmethod + def archive( + template: str, + **params: Unpack["InvoiceRenderingTemplate.ArchiveParams"], + ) -> "InvoiceRenderingTemplate": + """ + Updates the status of an invoice rendering template to ‘archived' so no new Stripe objects (customers, invoices, etc.) can reference it. The template can also no longer be updated. However, if the template is already set on a Stripe object, it will continue to be applied on invoices generated by it. + """ + ... + + @overload + def archive( + self, **params: Unpack["InvoiceRenderingTemplate.ArchiveParams"] + ) -> "InvoiceRenderingTemplate": + """ + Updates the status of an invoice rendering template to ‘archived' so no new Stripe objects (customers, invoices, etc.) can reference it. The template can also no longer be updated. However, if the template is already set on a Stripe object, it will continue to be applied on invoices generated by it. + """ + ... + + @class_method_variant("_cls_archive") + def archive( # pyright: ignore[reportGeneralTypeIssues] + self, **params: Unpack["InvoiceRenderingTemplate.ArchiveParams"] + ) -> "InvoiceRenderingTemplate": + """ + Updates the status of an invoice rendering template to ‘archived' so no new Stripe objects (customers, invoices, etc.) can reference it. The template can also no longer be updated. However, if the template is already set on a Stripe object, it will continue to be applied on invoices generated by it. + """ + return cast( + "InvoiceRenderingTemplate", + self._request( + "post", + "/v1/invoice_rendering_templates/{template}/archive".format( + template=sanitize_id(self.get("id")) + ), + params=params, + ), + ) + + @classmethod + async def _cls_archive_async( + cls, + template: str, + **params: Unpack["InvoiceRenderingTemplate.ArchiveParams"], + ) -> "InvoiceRenderingTemplate": + """ + Updates the status of an invoice rendering template to ‘archived' so no new Stripe objects (customers, invoices, etc.) can reference it. The template can also no longer be updated. However, if the template is already set on a Stripe object, it will continue to be applied on invoices generated by it. + """ + return cast( + "InvoiceRenderingTemplate", + await cls._static_request_async( + "post", + "/v1/invoice_rendering_templates/{template}/archive".format( + template=sanitize_id(template) + ), + params=params, + ), + ) + + @overload + @staticmethod + async def archive_async( + template: str, + **params: Unpack["InvoiceRenderingTemplate.ArchiveParams"], + ) -> "InvoiceRenderingTemplate": + """ + Updates the status of an invoice rendering template to ‘archived' so no new Stripe objects (customers, invoices, etc.) can reference it. The template can also no longer be updated. However, if the template is already set on a Stripe object, it will continue to be applied on invoices generated by it. + """ + ... + + @overload + async def archive_async( + self, **params: Unpack["InvoiceRenderingTemplate.ArchiveParams"] + ) -> "InvoiceRenderingTemplate": + """ + Updates the status of an invoice rendering template to ‘archived' so no new Stripe objects (customers, invoices, etc.) can reference it. The template can also no longer be updated. However, if the template is already set on a Stripe object, it will continue to be applied on invoices generated by it. + """ + ... + + @class_method_variant("_cls_archive_async") + async def archive_async( # pyright: ignore[reportGeneralTypeIssues] + self, **params: Unpack["InvoiceRenderingTemplate.ArchiveParams"] + ) -> "InvoiceRenderingTemplate": + """ + Updates the status of an invoice rendering template to ‘archived' so no new Stripe objects (customers, invoices, etc.) can reference it. The template can also no longer be updated. However, if the template is already set on a Stripe object, it will continue to be applied on invoices generated by it. + """ + return cast( + "InvoiceRenderingTemplate", + await self._request_async( + "post", + "/v1/invoice_rendering_templates/{template}/archive".format( + template=sanitize_id(self.get("id")) + ), + params=params, + ), + ) + + @classmethod + def list( + cls, **params: Unpack["InvoiceRenderingTemplate.ListParams"] + ) -> ListObject["InvoiceRenderingTemplate"]: + """ + List all templates, ordered by creation date, with the most recently created template appearing first. + """ + result = cls._static_request( + "get", + cls.class_url(), + params=params, + ) + if not isinstance(result, ListObject): + raise TypeError( + "Expected list object from API, got %s" + % (type(result).__name__) + ) + + return result + + @classmethod + async def list_async( + cls, **params: Unpack["InvoiceRenderingTemplate.ListParams"] + ) -> ListObject["InvoiceRenderingTemplate"]: + """ + List all templates, ordered by creation date, with the most recently created template appearing first. + """ + result = await cls._static_request_async( + "get", + cls.class_url(), + params=params, + ) + if not isinstance(result, ListObject): + raise TypeError( + "Expected list object from API, got %s" + % (type(result).__name__) + ) + + return result + + @classmethod + def retrieve( + cls, + id: str, + **params: Unpack["InvoiceRenderingTemplate.RetrieveParams"], + ) -> "InvoiceRenderingTemplate": + """ + Retrieves an invoice rendering template with the given ID. It by default returns the latest version of the template. Optionally, specify a version to see previous versions. + """ + instance = cls(id, **params) + instance.refresh() + return instance + + @classmethod + async def retrieve_async( + cls, + id: str, + **params: Unpack["InvoiceRenderingTemplate.RetrieveParams"], + ) -> "InvoiceRenderingTemplate": + """ + Retrieves an invoice rendering template with the given ID. It by default returns the latest version of the template. Optionally, specify a version to see previous versions. + """ + instance = cls(id, **params) + await instance.refresh_async() + return instance + + @classmethod + def _cls_unarchive( + cls, + template: str, + **params: Unpack["InvoiceRenderingTemplate.UnarchiveParams"], + ) -> "InvoiceRenderingTemplate": + """ + Unarchive an invoice rendering template so it can be used on new Stripe objects again. + """ + return cast( + "InvoiceRenderingTemplate", + cls._static_request( + "post", + "/v1/invoice_rendering_templates/{template}/unarchive".format( + template=sanitize_id(template) + ), + params=params, + ), + ) + + @overload + @staticmethod + def unarchive( + template: str, + **params: Unpack["InvoiceRenderingTemplate.UnarchiveParams"], + ) -> "InvoiceRenderingTemplate": + """ + Unarchive an invoice rendering template so it can be used on new Stripe objects again. + """ + ... + + @overload + def unarchive( + self, **params: Unpack["InvoiceRenderingTemplate.UnarchiveParams"] + ) -> "InvoiceRenderingTemplate": + """ + Unarchive an invoice rendering template so it can be used on new Stripe objects again. + """ + ... + + @class_method_variant("_cls_unarchive") + def unarchive( # pyright: ignore[reportGeneralTypeIssues] + self, **params: Unpack["InvoiceRenderingTemplate.UnarchiveParams"] + ) -> "InvoiceRenderingTemplate": + """ + Unarchive an invoice rendering template so it can be used on new Stripe objects again. + """ + return cast( + "InvoiceRenderingTemplate", + self._request( + "post", + "/v1/invoice_rendering_templates/{template}/unarchive".format( + template=sanitize_id(self.get("id")) + ), + params=params, + ), + ) + + @classmethod + async def _cls_unarchive_async( + cls, + template: str, + **params: Unpack["InvoiceRenderingTemplate.UnarchiveParams"], + ) -> "InvoiceRenderingTemplate": + """ + Unarchive an invoice rendering template so it can be used on new Stripe objects again. + """ + return cast( + "InvoiceRenderingTemplate", + await cls._static_request_async( + "post", + "/v1/invoice_rendering_templates/{template}/unarchive".format( + template=sanitize_id(template) + ), + params=params, + ), + ) + + @overload + @staticmethod + async def unarchive_async( + template: str, + **params: Unpack["InvoiceRenderingTemplate.UnarchiveParams"], + ) -> "InvoiceRenderingTemplate": + """ + Unarchive an invoice rendering template so it can be used on new Stripe objects again. + """ + ... + + @overload + async def unarchive_async( + self, **params: Unpack["InvoiceRenderingTemplate.UnarchiveParams"] + ) -> "InvoiceRenderingTemplate": + """ + Unarchive an invoice rendering template so it can be used on new Stripe objects again. + """ + ... + + @class_method_variant("_cls_unarchive_async") + async def unarchive_async( # pyright: ignore[reportGeneralTypeIssues] + self, **params: Unpack["InvoiceRenderingTemplate.UnarchiveParams"] + ) -> "InvoiceRenderingTemplate": + """ + Unarchive an invoice rendering template so it can be used on new Stripe objects again. + """ + return cast( + "InvoiceRenderingTemplate", + await self._request_async( + "post", + "/v1/invoice_rendering_templates/{template}/unarchive".format( + template=sanitize_id(self.get("id")) + ), + params=params, + ), + ) diff --git a/stripe/_invoice_rendering_template_service.py b/stripe/_invoice_rendering_template_service.py new file mode 100644 index 000000000..239ee25b8 --- /dev/null +++ b/stripe/_invoice_rendering_template_service.py @@ -0,0 +1,219 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from stripe._invoice_rendering_template import InvoiceRenderingTemplate +from stripe._list_object import ListObject +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 Literal, NotRequired, TypedDict + + +class InvoiceRenderingTemplateService(StripeService): + class ArchiveParams(TypedDict): + expand: NotRequired[List[str]] + """ + Specifies which fields in the response should be expanded. + """ + + class ListParams(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. + """ + status: NotRequired[Literal["active", "archived"]] + + class RetrieveParams(TypedDict): + expand: NotRequired[List[str]] + """ + Specifies which fields in the response should be expanded. + """ + version: NotRequired[int] + + class UnarchiveParams(TypedDict): + expand: NotRequired[List[str]] + """ + Specifies which fields in the response should be expanded. + """ + + def list( + self, + params: "InvoiceRenderingTemplateService.ListParams" = {}, + options: RequestOptions = {}, + ) -> ListObject[InvoiceRenderingTemplate]: + """ + List all templates, ordered by creation date, with the most recently created template appearing first. + """ + return cast( + ListObject[InvoiceRenderingTemplate], + self._request( + "get", + "/v1/invoice_rendering_templates", + base_address="api", + params=params, + options=options, + ), + ) + + async def list_async( + self, + params: "InvoiceRenderingTemplateService.ListParams" = {}, + options: RequestOptions = {}, + ) -> ListObject[InvoiceRenderingTemplate]: + """ + List all templates, ordered by creation date, with the most recently created template appearing first. + """ + return cast( + ListObject[InvoiceRenderingTemplate], + await self._request_async( + "get", + "/v1/invoice_rendering_templates", + base_address="api", + params=params, + options=options, + ), + ) + + def retrieve( + self, + template: str, + params: "InvoiceRenderingTemplateService.RetrieveParams" = {}, + options: RequestOptions = {}, + ) -> InvoiceRenderingTemplate: + """ + Retrieves an invoice rendering template with the given ID. It by default returns the latest version of the template. Optionally, specify a version to see previous versions. + """ + return cast( + InvoiceRenderingTemplate, + self._request( + "get", + "/v1/invoice_rendering_templates/{template}".format( + template=sanitize_id(template), + ), + base_address="api", + params=params, + options=options, + ), + ) + + async def retrieve_async( + self, + template: str, + params: "InvoiceRenderingTemplateService.RetrieveParams" = {}, + options: RequestOptions = {}, + ) -> InvoiceRenderingTemplate: + """ + Retrieves an invoice rendering template with the given ID. It by default returns the latest version of the template. Optionally, specify a version to see previous versions. + """ + return cast( + InvoiceRenderingTemplate, + await self._request_async( + "get", + "/v1/invoice_rendering_templates/{template}".format( + template=sanitize_id(template), + ), + base_address="api", + params=params, + options=options, + ), + ) + + def archive( + self, + template: str, + params: "InvoiceRenderingTemplateService.ArchiveParams" = {}, + options: RequestOptions = {}, + ) -> InvoiceRenderingTemplate: + """ + Updates the status of an invoice rendering template to ‘archived' so no new Stripe objects (customers, invoices, etc.) can reference it. The template can also no longer be updated. However, if the template is already set on a Stripe object, it will continue to be applied on invoices generated by it. + """ + return cast( + InvoiceRenderingTemplate, + self._request( + "post", + "/v1/invoice_rendering_templates/{template}/archive".format( + template=sanitize_id(template), + ), + base_address="api", + params=params, + options=options, + ), + ) + + async def archive_async( + self, + template: str, + params: "InvoiceRenderingTemplateService.ArchiveParams" = {}, + options: RequestOptions = {}, + ) -> InvoiceRenderingTemplate: + """ + Updates the status of an invoice rendering template to ‘archived' so no new Stripe objects (customers, invoices, etc.) can reference it. The template can also no longer be updated. However, if the template is already set on a Stripe object, it will continue to be applied on invoices generated by it. + """ + return cast( + InvoiceRenderingTemplate, + await self._request_async( + "post", + "/v1/invoice_rendering_templates/{template}/archive".format( + template=sanitize_id(template), + ), + base_address="api", + params=params, + options=options, + ), + ) + + def unarchive( + self, + template: str, + params: "InvoiceRenderingTemplateService.UnarchiveParams" = {}, + options: RequestOptions = {}, + ) -> InvoiceRenderingTemplate: + """ + Unarchive an invoice rendering template so it can be used on new Stripe objects again. + """ + return cast( + InvoiceRenderingTemplate, + self._request( + "post", + "/v1/invoice_rendering_templates/{template}/unarchive".format( + template=sanitize_id(template), + ), + base_address="api", + params=params, + options=options, + ), + ) + + async def unarchive_async( + self, + template: str, + params: "InvoiceRenderingTemplateService.UnarchiveParams" = {}, + options: RequestOptions = {}, + ) -> InvoiceRenderingTemplate: + """ + Unarchive an invoice rendering template so it can be used on new Stripe objects again. + """ + return cast( + InvoiceRenderingTemplate, + await self._request_async( + "post", + "/v1/invoice_rendering_templates/{template}/unarchive".format( + template=sanitize_id(template), + ), + base_address="api", + params=params, + options=options, + ), + ) diff --git a/stripe/_invoice_service.py b/stripe/_invoice_service.py index da6f1b301..16767823d 100644 --- a/stripe/_invoice_service.py +++ b/stripe/_invoice_service.py @@ -843,6 +843,14 @@ class CreateParamsRendering(TypedDict): """ Invoice pdf rendering options """ + template: NotRequired[str] + """ + ID of the invoice rendering template to use for this invoice. + """ + template_version: NotRequired["Literal['']|int"] + """ + The specific version of invoice rendering template to use for this invoice. + """ class CreateParamsRenderingPdf(TypedDict): page_size: NotRequired[Literal["a4", "auto", "letter"]] @@ -5840,6 +5848,14 @@ class UpdateParamsRendering(TypedDict): """ Invoice pdf rendering options """ + template: NotRequired[str] + """ + ID of the invoice rendering template to use for this invoice. + """ + template_version: NotRequired["Literal['']|int"] + """ + The specific version of invoice rendering template to use for this invoice. + """ class UpdateParamsRenderingPdf(TypedDict): page_size: NotRequired[Literal["a4", "auto", "letter"]] diff --git a/stripe/_issuing_service.py b/stripe/_issuing_service.py index 688edc4f4..db00a3983 100644 --- a/stripe/_issuing_service.py +++ b/stripe/_issuing_service.py @@ -8,6 +8,9 @@ CreditUnderwritingRecordService, ) from stripe.issuing._dispute_service import DisputeService +from stripe.issuing._dispute_settlement_detail_service import ( + DisputeSettlementDetailService, +) from stripe.issuing._personalization_design_service import ( PersonalizationDesignService, ) @@ -26,6 +29,9 @@ def __init__(self, requestor): self._requestor, ) self.disputes = DisputeService(self._requestor) + self.dispute_settlement_details = DisputeSettlementDetailService( + self._requestor, + ) self.personalization_designs = PersonalizationDesignService( self._requestor, ) diff --git a/stripe/_object_classes.py b/stripe/_object_classes.py index 90d763fe2..7467189a2 100644 --- a/stripe/_object_classes.py +++ b/stripe/_object_classes.py @@ -76,13 +76,16 @@ stripe.InvoiceItem.OBJECT_NAME: stripe.InvoiceItem, stripe.InvoiceLineItem.OBJECT_NAME: stripe.InvoiceLineItem, stripe.InvoicePayment.OBJECT_NAME: stripe.InvoicePayment, + stripe.InvoiceRenderingTemplate.OBJECT_NAME: stripe.InvoiceRenderingTemplate, stripe.issuing.Authorization.OBJECT_NAME: stripe.issuing.Authorization, stripe.issuing.Card.OBJECT_NAME: stripe.issuing.Card, stripe.issuing.Cardholder.OBJECT_NAME: stripe.issuing.Cardholder, stripe.issuing.CreditUnderwritingRecord.OBJECT_NAME: stripe.issuing.CreditUnderwritingRecord, stripe.issuing.Dispute.OBJECT_NAME: stripe.issuing.Dispute, + stripe.issuing.DisputeSettlementDetail.OBJECT_NAME: stripe.issuing.DisputeSettlementDetail, stripe.issuing.PersonalizationDesign.OBJECT_NAME: stripe.issuing.PersonalizationDesign, stripe.issuing.PhysicalBundle.OBJECT_NAME: stripe.issuing.PhysicalBundle, + stripe.issuing.Settlement.OBJECT_NAME: stripe.issuing.Settlement, stripe.issuing.Token.OBJECT_NAME: stripe.issuing.Token, stripe.issuing.Transaction.OBJECT_NAME: stripe.issuing.Transaction, stripe.LineItem.OBJECT_NAME: stripe.LineItem, diff --git a/stripe/_payment_link.py b/stripe/_payment_link.py index cfcfde3e5..194b11485 100644 --- a/stripe/_payment_link.py +++ b/stripe/_payment_link.py @@ -666,6 +666,7 @@ class TaxIdCollection(StripeObject): """ Indicates whether tax ID collection is enabled for the session. """ + required: Literal["if_supported", "never"] class TransferData(StripeObject): amount: Optional[int] @@ -1545,6 +1546,10 @@ class CreateParamsTaxIdCollection(TypedDict): """ Enable tax ID collection during checkout. Defaults to `false`. """ + required: NotRequired[Literal["if_supported", "never"]] + """ + Describes whether a tax ID is required during checkout. Defaults to `never`. + """ class CreateParamsTransferData(TypedDict): amount: NotRequired[int] @@ -2327,6 +2332,10 @@ class ModifyParamsTaxIdCollection(TypedDict): """ Enable tax ID collection during checkout. Defaults to `false`. """ + required: NotRequired[Literal["if_supported", "never"]] + """ + Describes whether a tax ID is required during checkout. Defaults to `never`. + """ class RetrieveParams(RequestOptions): expand: NotRequired[List[str]] diff --git a/stripe/_payment_link_service.py b/stripe/_payment_link_service.py index e74d57178..5468c6338 100644 --- a/stripe/_payment_link_service.py +++ b/stripe/_payment_link_service.py @@ -897,6 +897,10 @@ class CreateParamsTaxIdCollection(TypedDict): """ Enable tax ID collection during checkout. Defaults to `false`. """ + required: NotRequired[Literal["if_supported", "never"]] + """ + Describes whether a tax ID is required during checkout. Defaults to `never`. + """ class CreateParamsTransferData(TypedDict): amount: NotRequired[int] @@ -1677,6 +1681,10 @@ class UpdateParamsTaxIdCollection(TypedDict): """ Enable tax ID collection during checkout. Defaults to `false`. """ + required: NotRequired[Literal["if_supported", "never"]] + """ + Describes whether a tax ID is required during checkout. Defaults to `never`. + """ def list( self, diff --git a/stripe/_quote.py b/stripe/_quote.py index 7d2061e58..fc88d32c4 100644 --- a/stripe/_quote.py +++ b/stripe/_quote.py @@ -943,7 +943,7 @@ class CreateParams(RequestOptions): """ discounts: NotRequired["Literal['']|List[Quote.CreateParamsDiscount]"] """ - The discounts applied to the quote. You can only set up to one discount. + The discounts applied to the quote. """ expand: NotRequired[List[str]] """ @@ -2237,7 +2237,7 @@ class ModifyParams(RequestOptions): """ discounts: NotRequired["Literal['']|List[Quote.ModifyParamsDiscount]"] """ - The discounts applied to the quote. You can only set up to one discount. + The discounts applied to the quote. """ expand: NotRequired[List[str]] """ diff --git a/stripe/_quote_phase.py b/stripe/_quote_phase.py index b87e55be3..650af32dd 100644 --- a/stripe/_quote_phase.py +++ b/stripe/_quote_phase.py @@ -1,8 +1,8 @@ # -*- 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._listable_api_resource import ListableAPIResource from stripe._request_options import RequestOptions from stripe._stripe_object import StripeObject from stripe._util import class_method_variant, sanitize_id @@ -15,7 +15,7 @@ from stripe._tax_rate import TaxRate -class QuotePhase(ListableAPIResource["QuotePhase"]): +class QuotePhase(APIResource["QuotePhase"]): """ A quote phase describes the line items, coupons, and trialing status of a subscription for a predefined time period. """ @@ -124,28 +124,6 @@ class ListLineItemsParams(RequestOptions): 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 ListParams(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. - """ - quote: str - """ - The ID of the quote whose phases will be retrieved. - """ - 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]] """ @@ -220,46 +198,6 @@ class RetrieveParams(RequestOptions): When the trial ends within the phase. """ - @classmethod - def list( - cls, **params: Unpack["QuotePhase.ListParams"] - ) -> ListObject["QuotePhase"]: - """ - Returns a list of quote phases. - """ - result = cls._static_request( - "get", - cls.class_url(), - params=params, - ) - if not isinstance(result, ListObject): - raise TypeError( - "Expected list object from API, got %s" - % (type(result).__name__) - ) - - return result - - @classmethod - async def list_async( - cls, **params: Unpack["QuotePhase.ListParams"] - ) -> ListObject["QuotePhase"]: - """ - Returns a list of quote phases. - """ - result = await cls._static_request_async( - "get", - cls.class_url(), - params=params, - ) - if not isinstance(result, ListObject): - raise TypeError( - "Expected list object from API, got %s" - % (type(result).__name__) - ) - - return result - @classmethod def _cls_list_line_items( cls, diff --git a/stripe/_quote_phase_line_item_service.py b/stripe/_quote_phase_line_item_service.py deleted file mode 100644 index 5569c4858..000000000 --- a/stripe/_quote_phase_line_item_service.py +++ /dev/null @@ -1,73 +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._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 QuotePhaseLineItemService(StripeService): - class ListParams(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. - """ - - def list( - self, - quote_phase: str, - params: "QuotePhaseLineItemService.ListParams" = {}, - 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_async( - self, - quote_phase: str, - params: "QuotePhaseLineItemService.ListParams" = {}, - 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_phase_service.py b/stripe/_quote_phase_service.py index ce059f80b..157a3744c 100644 --- a/stripe/_quote_phase_service.py +++ b/stripe/_quote_phase_service.py @@ -1,8 +1,8 @@ # -*- 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._quote_phase_line_item_service import QuotePhaseLineItemService from stripe._request_options import RequestOptions from stripe._stripe_service import StripeService from stripe._util import sanitize_id @@ -11,11 +11,7 @@ class QuotePhaseService(StripeService): - def __init__(self, requestor): - super().__init__(requestor) - self.line_items = QuotePhaseLineItemService(self._requestor) - - class ListParams(TypedDict): + 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. @@ -28,10 +24,6 @@ class ListParams(TypedDict): """ A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10. """ - quote: str - """ - The ID of the quote whose phases will be retrieved. - """ 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. @@ -43,58 +35,64 @@ class RetrieveParams(TypedDict): Specifies which fields in the response should be expanded. """ - def list( + def retrieve( self, - params: "QuotePhaseService.ListParams", + quote_phase: str, + params: "QuotePhaseService.RetrieveParams" = {}, options: RequestOptions = {}, - ) -> ListObject[QuotePhase]: + ) -> QuotePhase: """ - Returns a list of quote phases. + Retrieves the quote phase with the given ID. """ return cast( - ListObject[QuotePhase], + QuotePhase, self._request( "get", - "/v1/quote_phases", + "/v1/quote_phases/{quote_phase}".format( + quote_phase=sanitize_id(quote_phase), + ), base_address="api", params=params, options=options, ), ) - async def list_async( + async def retrieve_async( self, - params: "QuotePhaseService.ListParams", + quote_phase: str, + params: "QuotePhaseService.RetrieveParams" = {}, options: RequestOptions = {}, - ) -> ListObject[QuotePhase]: + ) -> QuotePhase: """ - Returns a list of quote phases. + Retrieves the quote phase with the given ID. """ return cast( - ListObject[QuotePhase], + QuotePhase, await self._request_async( "get", - "/v1/quote_phases", + "/v1/quote_phases/{quote_phase}".format( + quote_phase=sanitize_id(quote_phase), + ), base_address="api", params=params, options=options, ), ) - def retrieve( + def list_line_items( self, quote_phase: str, - params: "QuotePhaseService.RetrieveParams" = {}, + params: "QuotePhaseService.ListLineItemsParams" = {}, options: RequestOptions = {}, - ) -> QuotePhase: + ) -> ListObject[LineItem]: """ - Retrieves the quote phase with the given ID. + 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( - QuotePhase, + ListObject[LineItem], self._request( "get", - "/v1/quote_phases/{quote_phase}".format( + "/v1/quote_phases/{quote_phase}/line_items".format( quote_phase=sanitize_id(quote_phase), ), base_address="api", @@ -103,20 +101,20 @@ def retrieve( ), ) - async def retrieve_async( + async def list_line_items_async( self, quote_phase: str, - params: "QuotePhaseService.RetrieveParams" = {}, + params: "QuotePhaseService.ListLineItemsParams" = {}, options: RequestOptions = {}, - ) -> QuotePhase: + ) -> ListObject[LineItem]: """ - Retrieves the quote phase with the given ID. + 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( - QuotePhase, + ListObject[LineItem], await self._request_async( "get", - "/v1/quote_phases/{quote_phase}".format( + "/v1/quote_phases/{quote_phase}/line_items".format( quote_phase=sanitize_id(quote_phase), ), base_address="api", diff --git a/stripe/_quote_preview_invoice.py b/stripe/_quote_preview_invoice.py index 7a9cdca22..45ac84872 100644 --- a/stripe/_quote_preview_invoice.py +++ b/stripe/_quote_preview_invoice.py @@ -827,6 +827,14 @@ class Pdf(StripeObject): """ Invoice pdf rendering options """ + template: Optional[str] + """ + ID of the rendering template that the invoice is formatted by. + """ + template_version: Optional[int] + """ + Version of the rendering template that the invoice is using. + """ _inner_class_types = {"pdf": Pdf} class ShippingCost(StripeObject): diff --git a/stripe/_quote_service.py b/stripe/_quote_service.py index d5ecad4b6..589e7d22b 100644 --- a/stripe/_quote_service.py +++ b/stripe/_quote_service.py @@ -87,7 +87,7 @@ class CreateParams(TypedDict): "Literal['']|List[QuoteService.CreateParamsDiscount]" ] """ - The discounts applied to the quote. You can only set up to one discount. + The discounts applied to the quote. """ expand: NotRequired[List[str]] """ @@ -1339,7 +1339,7 @@ class UpdateParams(TypedDict): "Literal['']|List[QuoteService.UpdateParamsDiscount]" ] """ - The discounts applied to the quote. You can only set up to one discount. + The discounts applied to the quote. """ expand: NotRequired[List[str]] """ diff --git a/stripe/_stripe_client.py b/stripe/_stripe_client.py index 3011fb88b..8f5c90a59 100644 --- a/stripe/_stripe_client.py +++ b/stripe/_stripe_client.py @@ -62,6 +62,9 @@ from stripe._gift_cards_service import GiftCardsService from stripe._identity_service import IdentityService from stripe._invoice_service import InvoiceService +from stripe._invoice_rendering_template_service import ( + InvoiceRenderingTemplateService, +) from stripe._invoice_item_service import InvoiceItemService from stripe._issuing_service import IssuingService from stripe._mandate_service import MandateService @@ -213,6 +216,9 @@ def __init__( self.gift_cards = GiftCardsService(self._requestor) self.identity = IdentityService(self._requestor) self.invoices = InvoiceService(self._requestor) + self.invoice_rendering_templates = InvoiceRenderingTemplateService( + self._requestor, + ) self.invoice_items = InvoiceItemService(self._requestor) self.issuing = IssuingService(self._requestor) self.mandates = MandateService(self._requestor) diff --git a/stripe/_subscription.py b/stripe/_subscription.py index ab3a6eac2..268b12b22 100644 --- a/stripe/_subscription.py +++ b/stripe/_subscription.py @@ -1395,9 +1395,15 @@ class ListParams(RequestOptions): current_period_end: NotRequired[ "Subscription.ListParamsCurrentPeriodEnd|int" ] + """ + Only return subscriptions whose current_period_end falls within the given date interval. + """ current_period_start: NotRequired[ "Subscription.ListParamsCurrentPeriodStart|int" ] + """ + Only return subscriptions whose current_period_start falls within the given date interval. + """ customer: NotRequired[str] """ The ID of the customer whose subscriptions will be retrieved. diff --git a/stripe/_subscription_service.py b/stripe/_subscription_service.py index e2954af47..26072ac95 100644 --- a/stripe/_subscription_service.py +++ b/stripe/_subscription_service.py @@ -906,9 +906,15 @@ class ListParams(TypedDict): current_period_end: NotRequired[ "SubscriptionService.ListParamsCurrentPeriodEnd|int" ] + """ + Only return subscriptions whose current_period_end falls within the given date interval. + """ current_period_start: NotRequired[ "SubscriptionService.ListParamsCurrentPeriodStart|int" ] + """ + Only return subscriptions whose current_period_start falls within the given date interval. + """ customer: NotRequired[str] """ The ID of the customer whose subscriptions will be retrieved. diff --git a/stripe/_webhook_endpoint.py b/stripe/_webhook_endpoint.py index 1559ed78b..0d1006b02 100644 --- a/stripe/_webhook_endpoint.py +++ b/stripe/_webhook_endpoint.py @@ -282,10 +282,14 @@ class CreateParams(RequestOptions): "issuing_dispute.funds_rescinded", "issuing_dispute.submitted", "issuing_dispute.updated", + "issuing_dispute_settlement_detail.created", + "issuing_dispute_settlement_detail.updated", "issuing_personalization_design.activated", "issuing_personalization_design.deactivated", "issuing_personalization_design.rejected", "issuing_personalization_design.updated", + "issuing_settlement.created", + "issuing_settlement.updated", "issuing_token.created", "issuing_token.updated", "issuing_transaction.created", @@ -599,10 +603,14 @@ class ModifyParams(RequestOptions): "issuing_dispute.funds_rescinded", "issuing_dispute.submitted", "issuing_dispute.updated", + "issuing_dispute_settlement_detail.created", + "issuing_dispute_settlement_detail.updated", "issuing_personalization_design.activated", "issuing_personalization_design.deactivated", "issuing_personalization_design.rejected", "issuing_personalization_design.updated", + "issuing_settlement.created", + "issuing_settlement.updated", "issuing_token.created", "issuing_token.updated", "issuing_transaction.created", diff --git a/stripe/_webhook_endpoint_service.py b/stripe/_webhook_endpoint_service.py index 54bb9c59f..dd937216c 100644 --- a/stripe/_webhook_endpoint_service.py +++ b/stripe/_webhook_endpoint_service.py @@ -263,10 +263,14 @@ class CreateParams(TypedDict): "issuing_dispute.funds_rescinded", "issuing_dispute.submitted", "issuing_dispute.updated", + "issuing_dispute_settlement_detail.created", + "issuing_dispute_settlement_detail.updated", "issuing_personalization_design.activated", "issuing_personalization_design.deactivated", "issuing_personalization_design.rejected", "issuing_personalization_design.updated", + "issuing_settlement.created", + "issuing_settlement.updated", "issuing_token.created", "issuing_token.updated", "issuing_transaction.created", @@ -586,10 +590,14 @@ class UpdateParams(TypedDict): "issuing_dispute.funds_rescinded", "issuing_dispute.submitted", "issuing_dispute.updated", + "issuing_dispute_settlement_detail.created", + "issuing_dispute_settlement_detail.updated", "issuing_personalization_design.activated", "issuing_personalization_design.deactivated", "issuing_personalization_design.rejected", "issuing_personalization_design.updated", + "issuing_settlement.created", + "issuing_settlement.updated", "issuing_token.created", "issuing_token.updated", "issuing_transaction.created", diff --git a/stripe/api_resources/__init__.py b/stripe/api_resources/__init__.py index a113daa1d..865a5c847 100644 --- a/stripe/api_resources/__init__.py +++ b/stripe/api_resources/__init__.py @@ -82,6 +82,9 @@ from stripe.api_resources.invoice_item import InvoiceItem from stripe.api_resources.invoice_line_item import InvoiceLineItem from stripe.api_resources.invoice_payment import InvoicePayment + from stripe.api_resources.invoice_rendering_template import ( + InvoiceRenderingTemplate, + ) from stripe.api_resources.line_item import LineItem from stripe.api_resources.list_object import ListObject from stripe.api_resources.login_link import LoginLink diff --git a/stripe/api_resources/invoice_rendering_template.py b/stripe/api_resources/invoice_rendering_template.py new file mode 100644 index 000000000..e0b96650e --- /dev/null +++ b/stripe/api_resources/invoice_rendering_template.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from typing_extensions import TYPE_CHECKING +from warnings import warn + +warn( + """ + The stripe.api_resources.invoice_rendering_template package is deprecated, please change your + imports to import from stripe directly. + From: + from stripe.api_resources.invoice_rendering_template import InvoiceRenderingTemplate + To: + from stripe import InvoiceRenderingTemplate + """, + DeprecationWarning, + stacklevel=2, +) +if not TYPE_CHECKING: + from stripe._invoice_rendering_template import ( # noqa + InvoiceRenderingTemplate, + ) diff --git a/stripe/api_resources/issuing/__init__.py b/stripe/api_resources/issuing/__init__.py index 2bfdc5cb6..e8c0b7097 100644 --- a/stripe/api_resources/issuing/__init__.py +++ b/stripe/api_resources/issuing/__init__.py @@ -23,9 +23,13 @@ CreditUnderwritingRecord, ) from stripe.api_resources.issuing.dispute import Dispute + from stripe.api_resources.issuing.dispute_settlement_detail import ( + DisputeSettlementDetail, + ) from stripe.api_resources.issuing.personalization_design import ( PersonalizationDesign, ) from stripe.api_resources.issuing.physical_bundle import PhysicalBundle + from stripe.api_resources.issuing.settlement import Settlement from stripe.api_resources.issuing.token import Token from stripe.api_resources.issuing.transaction import Transaction diff --git a/stripe/api_resources/issuing/dispute_settlement_detail.py b/stripe/api_resources/issuing/dispute_settlement_detail.py new file mode 100644 index 000000000..73b932877 --- /dev/null +++ b/stripe/api_resources/issuing/dispute_settlement_detail.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from typing_extensions import TYPE_CHECKING +from warnings import warn + +warn( + """ + The stripe.api_resources.issuing.dispute_settlement_detail package is deprecated, please change your + imports to import from stripe.issuing directly. + From: + from stripe.api_resources.issuing.dispute_settlement_detail import DisputeSettlementDetail + To: + from stripe.issuing import DisputeSettlementDetail + """, + DeprecationWarning, + stacklevel=2, +) +if not TYPE_CHECKING: + from stripe.issuing._dispute_settlement_detail import ( # noqa + DisputeSettlementDetail, + ) diff --git a/stripe/api_resources/issuing/settlement.py b/stripe/api_resources/issuing/settlement.py new file mode 100644 index 000000000..54e88615d --- /dev/null +++ b/stripe/api_resources/issuing/settlement.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from typing_extensions import TYPE_CHECKING +from warnings import warn + +warn( + """ + The stripe.api_resources.issuing.settlement package is deprecated, please change your + imports to import from stripe.issuing directly. + From: + from stripe.api_resources.issuing.settlement import Settlement + To: + from stripe.issuing import Settlement + """, + DeprecationWarning, + stacklevel=2, +) +if not TYPE_CHECKING: + from stripe.issuing._settlement import ( # noqa + Settlement, + ) diff --git a/stripe/checkout/_session.py b/stripe/checkout/_session.py index 14a147b5b..3dbc5eb59 100644 --- a/stripe/checkout/_session.py +++ b/stripe/checkout/_session.py @@ -1813,6 +1813,10 @@ class TaxIdCollection(StripeObject): """ Indicates whether tax ID collection is enabled for the session """ + required: Literal["if_supported", "never"] + """ + Indicates whether a tax ID is required on the payment page + """ class TotalDetails(StripeObject): class Breakdown(StripeObject): @@ -2122,6 +2126,7 @@ class CreateParams(RequestOptions): "payto", "pix", "promptpay", + "rechnung", "revolut_pay", "sepa_debit", "sofort", @@ -4178,6 +4183,10 @@ class CreateParamsTaxIdCollection(TypedDict): """ Enable tax ID collection during checkout. Defaults to `false`. """ + required: NotRequired[Literal["if_supported", "never"]] + """ + Describes whether a tax ID is required during checkout. Defaults to `never`. + """ class ExpireParams(RequestOptions): expand: NotRequired[List[str]] diff --git a/stripe/checkout/_session_service.py b/stripe/checkout/_session_service.py index 0d8e5320d..8dac7b655 100644 --- a/stripe/checkout/_session_service.py +++ b/stripe/checkout/_session_service.py @@ -253,6 +253,7 @@ class CreateParams(TypedDict): "payto", "pix", "promptpay", + "rechnung", "revolut_pay", "sepa_debit", "sofort", @@ -2355,6 +2356,10 @@ class CreateParamsTaxIdCollection(TypedDict): """ Enable tax ID collection during checkout. Defaults to `false`. """ + required: NotRequired[Literal["if_supported", "never"]] + """ + Describes whether a tax ID is required during checkout. Defaults to `never`. + """ class ExpireParams(TypedDict): expand: NotRequired[List[str]] diff --git a/stripe/issuing/__init__.py b/stripe/issuing/__init__.py index c096ff5d7..627a58e97 100644 --- a/stripe/issuing/__init__.py +++ b/stripe/issuing/__init__.py @@ -18,6 +18,12 @@ ) from stripe.issuing._dispute import Dispute as Dispute from stripe.issuing._dispute_service import DisputeService as DisputeService +from stripe.issuing._dispute_settlement_detail import ( + DisputeSettlementDetail as DisputeSettlementDetail, +) +from stripe.issuing._dispute_settlement_detail_service import ( + DisputeSettlementDetailService as DisputeSettlementDetailService, +) from stripe.issuing._personalization_design import ( PersonalizationDesign as PersonalizationDesign, ) @@ -28,6 +34,7 @@ from stripe.issuing._physical_bundle_service import ( PhysicalBundleService as PhysicalBundleService, ) +from stripe.issuing._settlement import Settlement as Settlement from stripe.issuing._token import Token as Token from stripe.issuing._token_service import TokenService as TokenService from stripe.issuing._transaction import Transaction as Transaction diff --git a/stripe/issuing/_card.py b/stripe/issuing/_card.py index f4c190958..37dc34817 100644 --- a/stripe/issuing/_card.py +++ b/stripe/issuing/_card.py @@ -160,6 +160,7 @@ class Customs(StripeObject): "pending", "returned", "shipped", + "submitted", ] ] """ diff --git a/stripe/issuing/_dispute_settlement_detail.py b/stripe/issuing/_dispute_settlement_detail.py new file mode 100644 index 000000000..1fc03d69a --- /dev/null +++ b/stripe/issuing/_dispute_settlement_detail.py @@ -0,0 +1,156 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from stripe._list_object import ListObject +from stripe._listable_api_resource import ListableAPIResource +from stripe._request_options import RequestOptions +from typing import ClassVar, List, Optional +from typing_extensions import Literal, NotRequired, Unpack + + +class DisputeSettlementDetail(ListableAPIResource["DisputeSettlementDetail"]): + """ + Represents a record from the card network of a money movement or change in state for an Issuing dispute. These records are included in the settlement reports that we receive from networks and expose to users as Settlement objects. + """ + + OBJECT_NAME: ClassVar[Literal["issuing.dispute_settlement_detail"]] = ( + "issuing.dispute_settlement_detail" + ) + + class ListParams(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. + """ + settlement: NotRequired[str] + """ + Select the Issuing dispute settlement details for the given settlement. + """ + 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: int + """ + Disputed amount in the card's currency and in the smallest currency unit. Usually the amount of the transaction, but can differ (usually because of currency fluctuation). + """ + card: str + """ + The card used to make the original transaction. + """ + created: int + """ + Time at which the object was created. Measured in seconds since the Unix epoch. + """ + currency: str + """ + The currency the original transaction was made in. 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). + """ + dispute: str + """ + The ID of the linked dispute. + """ + event_type: Literal["filing", "loss", "representment", "win"] + """ + The type of event corresponding to this dispute settlement detail, representing the stage in the dispute network lifecycle. + """ + id: str + """ + Unique identifier for the object. + """ + livemode: bool + """ + Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. + """ + network: Literal["maestro", "mastercard", "visa"] + """ + The card network for this dispute settlement detail. One of ["visa", "mastercard", "maestro"] + """ + object: Literal["issuing.dispute_settlement_detail"] + """ + String representing the object's type. Objects of the same type share the same value. + """ + settlement: Optional[str] + """ + The ID of the linked card network settlement. + """ + + @classmethod + def list( + cls, **params: Unpack["DisputeSettlementDetail.ListParams"] + ) -> ListObject["DisputeSettlementDetail"]: + """ + Returns a list of Issuing DisputeSettlementDetail objects. The objects are sorted in descending order by creation date, with the most recently created object appearing first. + """ + result = cls._static_request( + "get", + cls.class_url(), + params=params, + ) + if not isinstance(result, ListObject): + raise TypeError( + "Expected list object from API, got %s" + % (type(result).__name__) + ) + + return result + + @classmethod + async def list_async( + cls, **params: Unpack["DisputeSettlementDetail.ListParams"] + ) -> ListObject["DisputeSettlementDetail"]: + """ + Returns a list of Issuing DisputeSettlementDetail objects. The objects are sorted in descending order by creation date, with the most recently created object appearing first. + """ + result = await cls._static_request_async( + "get", + cls.class_url(), + params=params, + ) + if not isinstance(result, ListObject): + raise TypeError( + "Expected list object from API, got %s" + % (type(result).__name__) + ) + + return result + + @classmethod + def retrieve( + cls, + id: str, + **params: Unpack["DisputeSettlementDetail.RetrieveParams"], + ) -> "DisputeSettlementDetail": + """ + Retrieves an Issuing DisputeSettlementDetail object. + """ + instance = cls(id, **params) + instance.refresh() + return instance + + @classmethod + async def retrieve_async( + cls, + id: str, + **params: Unpack["DisputeSettlementDetail.RetrieveParams"], + ) -> "DisputeSettlementDetail": + """ + Retrieves an Issuing DisputeSettlementDetail object. + """ + instance = cls(id, **params) + await instance.refresh_async() + return instance diff --git a/stripe/issuing/_dispute_settlement_detail_service.py b/stripe/issuing/_dispute_settlement_detail_service.py new file mode 100644 index 000000000..8924dbc00 --- /dev/null +++ b/stripe/issuing/_dispute_settlement_detail_service.py @@ -0,0 +1,125 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from stripe._list_object import ListObject +from stripe._request_options import RequestOptions +from stripe._stripe_service import StripeService +from stripe._util import sanitize_id +from stripe.issuing._dispute_settlement_detail import DisputeSettlementDetail +from typing import List, cast +from typing_extensions import NotRequired, TypedDict + + +class DisputeSettlementDetailService(StripeService): + class ListParams(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. + """ + settlement: NotRequired[str] + """ + Select the Issuing dispute settlement details for the given settlement. + """ + 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 list( + self, + params: "DisputeSettlementDetailService.ListParams" = {}, + options: RequestOptions = {}, + ) -> ListObject[DisputeSettlementDetail]: + """ + Returns a list of Issuing DisputeSettlementDetail objects. The objects are sorted in descending order by creation date, with the most recently created object appearing first. + """ + return cast( + ListObject[DisputeSettlementDetail], + self._request( + "get", + "/v1/issuing/dispute_settlement_details", + base_address="api", + params=params, + options=options, + ), + ) + + async def list_async( + self, + params: "DisputeSettlementDetailService.ListParams" = {}, + options: RequestOptions = {}, + ) -> ListObject[DisputeSettlementDetail]: + """ + Returns a list of Issuing DisputeSettlementDetail objects. The objects are sorted in descending order by creation date, with the most recently created object appearing first. + """ + return cast( + ListObject[DisputeSettlementDetail], + await self._request_async( + "get", + "/v1/issuing/dispute_settlement_details", + base_address="api", + params=params, + options=options, + ), + ) + + def retrieve( + self, + dispute_settlement_detail: str, + params: "DisputeSettlementDetailService.RetrieveParams" = {}, + options: RequestOptions = {}, + ) -> DisputeSettlementDetail: + """ + Retrieves an Issuing DisputeSettlementDetail object. + """ + return cast( + DisputeSettlementDetail, + self._request( + "get", + "/v1/issuing/dispute_settlement_details/{dispute_settlement_detail}".format( + dispute_settlement_detail=sanitize_id( + dispute_settlement_detail + ), + ), + base_address="api", + params=params, + options=options, + ), + ) + + async def retrieve_async( + self, + dispute_settlement_detail: str, + params: "DisputeSettlementDetailService.RetrieveParams" = {}, + options: RequestOptions = {}, + ) -> DisputeSettlementDetail: + """ + Retrieves an Issuing DisputeSettlementDetail object. + """ + return cast( + DisputeSettlementDetail, + await self._request_async( + "get", + "/v1/issuing/dispute_settlement_details/{dispute_settlement_detail}".format( + dispute_settlement_detail=sanitize_id( + dispute_settlement_detail + ), + ), + base_address="api", + params=params, + options=options, + ), + ) diff --git a/stripe/issuing/_settlement.py b/stripe/issuing/_settlement.py new file mode 100644 index 000000000..38716760f --- /dev/null +++ b/stripe/issuing/_settlement.py @@ -0,0 +1,81 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from stripe._stripe_object import StripeObject +from typing import ClassVar, Dict +from typing_extensions import Literal + + +class Settlement(StripeObject): + """ + When a non-stripe BIN is used, any use of an [issued card](https://stripe.com/docs/issuing) must be settled directly with the card network. The net amount owed is represented by an Issuing `Settlement` object. + """ + + OBJECT_NAME: ClassVar[Literal["issuing.settlement"]] = "issuing.settlement" + bin: str + """ + The Bank Identification Number reflecting this settlement record. + """ + clearing_date: int + """ + The date that the transactions are cleared and posted to user's accounts. + """ + created: int + """ + Time at which the object was created. Measured in seconds since the Unix epoch. + """ + currency: str + """ + 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). + """ + id: str + """ + Unique identifier for the object. + """ + interchange_fees: int + """ + The total interchange received as reimbursement for the transactions. + """ + livemode: bool + """ + Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. + """ + metadata: Dict[str, str] + """ + 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. + """ + net_total: int + """ + The total net amount required to settle with the network. + """ + network: Literal["maestro", "visa"] + """ + The card network for this settlement report. One of ["visa", "maestro"] + """ + network_fees: int + """ + The total amount of fees owed to the network. + """ + network_settlement_identifier: str + """ + The Settlement Identification Number assigned by the network. + """ + object: Literal["issuing.settlement"] + """ + String representing the object's type. Objects of the same type share the same value. + """ + settlement_service: str + """ + One of `international` or `uk_national_net`. + """ + status: Literal["complete", "pending"] + """ + The current processing status of this settlement. + """ + transaction_count: int + """ + The total number of transactions reflected in this settlement. + """ + transaction_volume: int + """ + The total transaction amount reflected in this settlement. + """ diff --git a/stripe/issuing/_transaction.py b/stripe/issuing/_transaction.py index dbfde9e50..c5cd4b000 100644 --- a/stripe/issuing/_transaction.py +++ b/stripe/issuing/_transaction.py @@ -24,6 +24,7 @@ from stripe.issuing._card import Card from stripe.issuing._cardholder import Cardholder from stripe.issuing._dispute import Dispute + from stripe.issuing._settlement import Settlement from stripe.issuing._token import Token @@ -1591,6 +1592,10 @@ class ListParams(RequestOptions): """ A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10. """ + settlement: NotRequired[str] + """ + Only return transactions that are associated with the given settlement. + """ 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. @@ -1713,6 +1718,7 @@ class RetrieveParams(RequestOptions): """ Additional purchase information that is optionally provided by the merchant. """ + settlement: Optional[ExpandableField["Settlement"]] token: Optional[ExpandableField["Token"]] """ [Token](https://stripe.com/docs/api/issuing/tokens/object) object used for this transaction. If a network token was not used for this transaction, this field will be null. diff --git a/stripe/issuing/_transaction_service.py b/stripe/issuing/_transaction_service.py index f61d4622a..c17898263 100644 --- a/stripe/issuing/_transaction_service.py +++ b/stripe/issuing/_transaction_service.py @@ -35,6 +35,10 @@ class ListParams(TypedDict): """ A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10. """ + settlement: NotRequired[str] + """ + Only return transactions that are associated with the given settlement. + """ 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. diff --git a/stripe/terminal/_location.py b/stripe/terminal/_location.py index 1d5990791..e0a4cb4a2 100644 --- a/stripe/terminal/_location.py +++ b/stripe/terminal/_location.py @@ -63,7 +63,7 @@ class CreateParams(RequestOptions): """ display_name: str """ - A name for the location. + A name for the location. Maximum length is 1000 characters. """ expand: NotRequired[List[str]] """ diff --git a/stripe/terminal/_location_service.py b/stripe/terminal/_location_service.py index 427c395f7..bcbfed219 100644 --- a/stripe/terminal/_location_service.py +++ b/stripe/terminal/_location_service.py @@ -21,7 +21,7 @@ class CreateParams(TypedDict): """ display_name: str """ - A name for the location. + A name for the location. Maximum length is 1000 characters. """ expand: NotRequired[List[str]] """ diff --git a/stripe/test_helpers/_test_clock.py b/stripe/test_helpers/_test_clock.py index c9eaab7ae..0bee1d8f0 100644 --- a/stripe/test_helpers/_test_clock.py +++ b/stripe/test_helpers/_test_clock.py @@ -119,7 +119,7 @@ class RetrieveParams(RequestOptions): """ The status of the Test Clock. """ - status_details: Optional[StatusDetails] + status_details: StatusDetails deleted: Optional[Literal[True]] """ Always true for a deleted object