From 173845885fa90b70c6f341c77f733f734804227e Mon Sep 17 00:00:00 2001 From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Fri, 6 Sep 2024 17:38:36 +0000 Subject: [PATCH 1/7] Update generated code for v1249 --- OPENAPI_VERSION | 2 +- stripe/_subscription.py | 6 ++++++ stripe/_subscription_service.py | 6 ++++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index 340c4578c..6c75f8d76 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v1246 \ No newline at end of file +v1249 \ No newline at end of file diff --git a/stripe/_subscription.py b/stripe/_subscription.py index f35851929..ad418161e 100644 --- a/stripe/_subscription.py +++ b/stripe/_subscription.py @@ -1202,9 +1202,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 3735278e8..e034f9751 100644 --- a/stripe/_subscription_service.py +++ b/stripe/_subscription_service.py @@ -771,9 +771,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. From 6a3994f7a198a1523305c9f87d51f00122fd1747 Mon Sep 17 00:00:00 2001 From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Fri, 6 Sep 2024 19:43:48 +0000 Subject: [PATCH 2/7] Update generated code for v1250 --- OPENAPI_VERSION | 2 +- stripe/_quote.py | 4 ++-- stripe/_quote_service.py | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index 6c75f8d76..51381b4db 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v1249 \ No newline at end of file +v1250 \ No newline at end of file diff --git a/stripe/_quote.py b/stripe/_quote.py index 89da6af2d..4a6aada48 100644 --- a/stripe/_quote.py +++ b/stripe/_quote.py @@ -466,7 +466,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]] """ @@ -802,7 +802,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_service.py b/stripe/_quote_service.py index c5d72560f..31ea86ee9 100644 --- a/stripe/_quote_service.py +++ b/stripe/_quote_service.py @@ -70,7 +70,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]] """ @@ -392,7 +392,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]] """ From 4190e04541ffa0e86ede62dd69c575981f219ab1 Mon Sep 17 00:00:00 2001 From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Mon, 9 Sep 2024 18:27:58 +0000 Subject: [PATCH 3/7] Update generated code for v1252 --- OPENAPI_VERSION | 2 +- stripe/_invoice_line_item.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index 51381b4db..068fe5345 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v1250 \ No newline at end of file +v1252 \ No newline at end of file diff --git a/stripe/_invoice_line_item.py b/stripe/_invoice_line_item.py index 6d75beb36..0985834a8 100644 --- a/stripe/_invoice_line_item.py +++ b/stripe/_invoice_line_item.py @@ -386,11 +386,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. """ From d0d3e99d2a69b0470b107cab29566ce343167181 Mon Sep 17 00:00:00 2001 From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Mon, 9 Sep 2024 23:58:00 +0000 Subject: [PATCH 4/7] Update generated code for v1255 --- OPENAPI_VERSION | 2 +- stripe/__init__.py | 6 + stripe/_customer.py | 12 + stripe/_customer_service.py | 8 + stripe/_invoice.py | 24 ++ stripe/_invoice_rendering_template.py | 385 ++++++++++++++++++ stripe/_invoice_rendering_template_service.py | 219 ++++++++++ stripe/_invoice_service.py | 16 + stripe/_object_classes.py | 1 + stripe/_stripe_client.py | 6 + stripe/api_resources/__init__.py | 3 + .../invoice_rendering_template.py | 21 + stripe/terminal/_location.py | 2 +- stripe/terminal/_location_service.py | 2 +- 14 files changed, 704 insertions(+), 3 deletions(-) create mode 100644 stripe/_invoice_rendering_template.py create mode 100644 stripe/_invoice_rendering_template_service.py create mode 100644 stripe/api_resources/invoice_rendering_template.py diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index 068fe5345..6dbaaddab 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v1252 \ No newline at end of file +v1255 \ No newline at end of file diff --git a/stripe/__init__.py b/stripe/__init__.py index e8d3e8578..9edd2b715 100644 --- a/stripe/__init__.py +++ b/stripe/__init__.py @@ -382,6 +382,12 @@ def __getattr__(name): from stripe._invoice_line_item_service import ( InvoiceLineItemService as InvoiceLineItemService, ) +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, diff --git a/stripe/_customer.py b/stripe/_customer.py index 500ba4759..b163859fc 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" @@ -1112,6 +1120,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/_invoice.py b/stripe/_invoice.py index 60d4947ea..8e83f0200 100644 --- a/stripe/_invoice.py +++ b/stripe/_invoice.py @@ -791,6 +791,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): @@ -1656,6 +1664,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"]] @@ -3342,6 +3358,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_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 340514e9e..016c3c1bb 100644 --- a/stripe/_invoice_service.py +++ b/stripe/_invoice_service.py @@ -674,6 +674,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"]] @@ -3782,6 +3790,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/_object_classes.py b/stripe/_object_classes.py index c1d9e20d1..083d02566 100644 --- a/stripe/_object_classes.py +++ b/stripe/_object_classes.py @@ -66,6 +66,7 @@ stripe.Invoice.OBJECT_NAME: stripe.Invoice, stripe.InvoiceItem.OBJECT_NAME: stripe.InvoiceItem, stripe.InvoiceLineItem.OBJECT_NAME: stripe.InvoiceLineItem, + 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, diff --git a/stripe/_stripe_client.py b/stripe/_stripe_client.py index d88ea65a4..8f52c2da8 100644 --- a/stripe/_stripe_client.py +++ b/stripe/_stripe_client.py @@ -59,6 +59,9 @@ from stripe._forwarding_service import ForwardingService 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 @@ -204,6 +207,9 @@ def __init__( self.forwarding = ForwardingService(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/api_resources/__init__.py b/stripe/api_resources/__init__.py index 73e6b55f7..99bf65826 100644 --- a/stripe/api_resources/__init__.py +++ b/stripe/api_resources/__init__.py @@ -78,6 +78,9 @@ from stripe.api_resources.invoice import Invoice from stripe.api_resources.invoice_item import InvoiceItem from stripe.api_resources.invoice_line_item import InvoiceLineItem + 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/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]] """ From c316d00b89b6c4601716fa05e424a4926cadd6e8 Mon Sep 17 00:00:00 2001 From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Tue, 10 Sep 2024 15:59:50 +0000 Subject: [PATCH 5/7] Update generated code for v1257 --- OPENAPI_VERSION | 2 +- stripe/_payment_link.py | 9 +++++++++ stripe/_payment_link_service.py | 8 ++++++++ stripe/checkout/_session.py | 8 ++++++++ stripe/checkout/_session_service.py | 4 ++++ 5 files changed, 30 insertions(+), 1 deletion(-) diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index 6dbaaddab..292b2c94a 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v1255 \ No newline at end of file +v1257 \ No newline at end of file diff --git a/stripe/_payment_link.py b/stripe/_payment_link.py index f6bf3ba2f..9f22c9806 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] @@ -1543,6 +1544,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] @@ -2325,6 +2330,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 678cd5b7c..3ff76553a 100644 --- a/stripe/_payment_link_service.py +++ b/stripe/_payment_link_service.py @@ -895,6 +895,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] @@ -1675,6 +1679,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/checkout/_session.py b/stripe/checkout/_session.py index a447c8af4..e6f7ba017 100644 --- a/stripe/checkout/_session.py +++ b/stripe/checkout/_session.py @@ -1542,6 +1542,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): @@ -3791,6 +3795,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 628f7f237..e1010120d 100644 --- a/stripe/checkout/_session_service.py +++ b/stripe/checkout/_session_service.py @@ -2237,6 +2237,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]] From 375a48c4f19a9905a61c61d388252c7242fae186 Mon Sep 17 00:00:00 2001 From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Tue, 10 Sep 2024 18:59:22 +0000 Subject: [PATCH 6/7] Update generated code for v1259 --- OPENAPI_VERSION | 2 +- stripe/issuing/_card.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index 292b2c94a..b39b96e37 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v1257 \ No newline at end of file +v1259 \ No newline at end of file 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", ] ] """ From 772c6c301b9f91e1b506cb78464fe3a4a2a28c05 Mon Sep 17 00:00:00 2001 From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Tue, 10 Sep 2024 20:48:51 +0000 Subject: [PATCH 7/7] Update generated code for v1260 --- OPENAPI_VERSION | 2 +- stripe/test_helpers/_test_clock.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index b39b96e37..ad548b855 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v1259 \ No newline at end of file +v1260 \ No newline at end of file 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