From f9ef46feb246a6d949185544ded1862e7d2f578c Mon Sep 17 00:00:00 2001 From: Ramya Rao Date: Thu, 5 Sep 2024 13:55:35 -0700 Subject: [PATCH 01/12] Bump version to 10.10.0 --- CHANGELOG.md | 5 +++++ VERSION | 2 +- stripe/_version.py | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b4c6abdf5..30b85abb7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 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/VERSION b/VERSION index fe6d2ac74..e8a306979 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -10.9.0 +10.10.0 diff --git a/stripe/_version.py b/stripe/_version.py index 164606a55..2be36b44b 100644 --- a/stripe/_version.py +++ b/stripe/_version.py @@ -1 +1 @@ -VERSION = "10.9.0" +VERSION = "10.10.0" From 973a021685e864a681d529c227e0a4eb2bcf4220 Mon Sep 17 00:00:00 2001 From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Fri, 6 Sep 2024 17:39:03 +0000 Subject: [PATCH 02/12] 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 b7ea530db..6c75f8d76 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v1247 \ No newline at end of file +v1249 \ No newline at end of file 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. From 0b630f7c010df52e1aff057f49d2c004f77d748f Mon Sep 17 00:00:00 2001 From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Fri, 6 Sep 2024 19:44:16 +0000 Subject: [PATCH 03/12] 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 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_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]] """ From 75f81e29b823ed6dbf1657e576122e839522f4cf Mon Sep 17 00:00:00 2001 From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Mon, 9 Sep 2024 15:16:40 +0000 Subject: [PATCH 04/12] Update generated code for v1251 --- OPENAPI_VERSION | 2 +- stripe/checkout/_session.py | 1 + stripe/checkout/_session_service.py | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index 51381b4db..ea799bc1d 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v1250 \ No newline at end of file +v1251 \ No newline at end of file diff --git a/stripe/checkout/_session.py b/stripe/checkout/_session.py index 14a147b5b..30f95aff0 100644 --- a/stripe/checkout/_session.py +++ b/stripe/checkout/_session.py @@ -2122,6 +2122,7 @@ class CreateParams(RequestOptions): "payto", "pix", "promptpay", + "rechnung", "revolut_pay", "sepa_debit", "sofort", diff --git a/stripe/checkout/_session_service.py b/stripe/checkout/_session_service.py index 0d8e5320d..2e336d29c 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", From 968b6956d56d82f5fdfe4dd8a352d4a825f60c2f Mon Sep 17 00:00:00 2001 From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Mon, 9 Sep 2024 18:28:23 +0000 Subject: [PATCH 05/12] 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 ea799bc1d..068fe5345 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v1251 \ 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 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. """ From e82b87b4b1cab115057bb983eec1843021dde60a Mon Sep 17 00:00:00 2001 From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Mon, 9 Sep 2024 19:09:02 +0000 Subject: [PATCH 06/12] Update generated code for v1253 --- OPENAPI_VERSION | 2 +- stripe/_quote_phase.py | 66 ++-------------------------------- stripe/_quote_phase_service.py | 61 ------------------------------- 3 files changed, 3 insertions(+), 126 deletions(-) diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index 068fe5345..b2164f87a 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v1252 \ No newline at end of file +v1253 \ No newline at end of file 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_service.py b/stripe/_quote_phase_service.py index ce059f80b..0e1cd4239 100644 --- a/stripe/_quote_phase_service.py +++ b/stripe/_quote_phase_service.py @@ -1,6 +1,5 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec -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 @@ -15,72 +14,12 @@ def __init__(self, requestor): super().__init__(requestor) self.line_items = QuotePhaseLineItemService(self._requestor) - 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. - """ - 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(TypedDict): expand: NotRequired[List[str]] """ Specifies which fields in the response should be expanded. """ - def list( - self, - params: "QuotePhaseService.ListParams", - options: RequestOptions = {}, - ) -> ListObject[QuotePhase]: - """ - Returns a list of quote phases. - """ - return cast( - ListObject[QuotePhase], - self._request( - "get", - "/v1/quote_phases", - base_address="api", - params=params, - options=options, - ), - ) - - async def list_async( - self, - params: "QuotePhaseService.ListParams", - options: RequestOptions = {}, - ) -> ListObject[QuotePhase]: - """ - Returns a list of quote phases. - """ - return cast( - ListObject[QuotePhase], - await self._request_async( - "get", - "/v1/quote_phases", - base_address="api", - params=params, - options=options, - ), - ) - def retrieve( self, quote_phase: str, From 37dca6494cbda07022e29ad1eb460a8246a4044e 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:20 +0000 Subject: [PATCH 07/12] 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/_quote_preview_invoice.py | 8 + 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 +- 15 files changed, 712 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 b2164f87a..6dbaaddab 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v1253 \ No newline at end of file +v1255 \ No newline at end of file diff --git a/stripe/__init__.py b/stripe/__init__.py index bd0559243..0ba5ba1d2 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, 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/_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_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/_object_classes.py b/stripe/_object_classes.py index 90d763fe2..cef5e7a56 100644 --- a/stripe/_object_classes.py +++ b/stripe/_object_classes.py @@ -76,6 +76,7 @@ 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, 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/_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/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/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 0008b76995a230e69bd0eaa3085d6ea455f78c81 Mon Sep 17 00:00:00 2001 From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Tue, 10 Sep 2024 16:00:15 +0000 Subject: [PATCH 08/12] 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 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/checkout/_session.py b/stripe/checkout/_session.py index 30f95aff0..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): @@ -4179,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 2e336d29c..8dac7b655 100644 --- a/stripe/checkout/_session_service.py +++ b/stripe/checkout/_session_service.py @@ -2356,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]] From 1877bcbe546927fd9de53767a0068e8914f8f34c Mon Sep 17 00:00:00 2001 From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Tue, 10 Sep 2024 16:19:59 +0000 Subject: [PATCH 09/12] Update generated code for v1257 --- stripe/__init__.py | 3 - stripe/_quote_phase_line_item_service.py | 73 ------------------------ stripe/_quote_phase_service.py | 67 ++++++++++++++++++++-- 3 files changed, 63 insertions(+), 80 deletions(-) delete mode 100644 stripe/_quote_phase_line_item_service.py diff --git a/stripe/__init__.py b/stripe/__init__.py index 0ba5ba1d2..078928efd 100644 --- a/stripe/__init__.py +++ b/stripe/__init__.py @@ -488,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/_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 0e1cd4239..157a3744c 100644 --- a/stripe/_quote_phase_service.py +++ b/stripe/_quote_phase_service.py @@ -1,7 +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 @@ -10,9 +11,23 @@ class QuotePhaseService(StripeService): - def __init__(self, requestor): - super().__init__(requestor) - self.line_items = QuotePhaseLineItemService(self._requestor) + class ListLineItemsParams(TypedDict): + ending_before: NotRequired[str] + """ + A cursor for use in pagination. `ending_before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. + """ + expand: NotRequired[List[str]] + """ + Specifies which fields in the response should be expanded. + """ + limit: NotRequired[int] + """ + A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10. + """ + starting_after: NotRequired[str] + """ + A cursor for use in pagination. `starting_after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list. + """ class RetrieveParams(TypedDict): expand: NotRequired[List[str]] @@ -63,3 +78,47 @@ async def retrieve_async( options=options, ), ) + + def list_line_items( + self, + quote_phase: str, + params: "QuotePhaseService.ListLineItemsParams" = {}, + options: RequestOptions = {}, + ) -> ListObject[LineItem]: + """ + When retrieving a quote phase, there is an includable line_items property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items. + """ + return cast( + ListObject[LineItem], + self._request( + "get", + "/v1/quote_phases/{quote_phase}/line_items".format( + quote_phase=sanitize_id(quote_phase), + ), + base_address="api", + params=params, + options=options, + ), + ) + + async def list_line_items_async( + self, + quote_phase: str, + params: "QuotePhaseService.ListLineItemsParams" = {}, + options: RequestOptions = {}, + ) -> ListObject[LineItem]: + """ + When retrieving a quote phase, there is an includable line_items property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items. + """ + return cast( + ListObject[LineItem], + await self._request_async( + "get", + "/v1/quote_phases/{quote_phase}/line_items".format( + quote_phase=sanitize_id(quote_phase), + ), + base_address="api", + params=params, + options=options, + ), + ) From 3400dc48adb9a6483194641fb702708a8aa9c764 Mon Sep 17 00:00:00 2001 From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Tue, 10 Sep 2024 18:27:06 +0000 Subject: [PATCH 10/12] Update generated code for v1258 --- OPENAPI_VERSION | 2 +- stripe/_event.py | 4 + stripe/_issuing_service.py | 6 + stripe/_object_classes.py | 2 + stripe/_webhook_endpoint.py | 8 + stripe/_webhook_endpoint_service.py | 8 + stripe/api_resources/issuing/__init__.py | 4 + .../issuing/dispute_settlement_detail.py | 21 +++ stripe/api_resources/issuing/settlement.py | 21 +++ stripe/issuing/__init__.py | 7 + stripe/issuing/_dispute_settlement_detail.py | 156 ++++++++++++++++++ .../_dispute_settlement_detail_service.py | 125 ++++++++++++++ stripe/issuing/_settlement.py | 81 +++++++++ stripe/issuing/_transaction.py | 6 + stripe/issuing/_transaction_service.py | 4 + 15 files changed, 454 insertions(+), 1 deletion(-) create mode 100644 stripe/api_resources/issuing/dispute_settlement_detail.py create mode 100644 stripe/api_resources/issuing/settlement.py create mode 100644 stripe/issuing/_dispute_settlement_detail.py create mode 100644 stripe/issuing/_dispute_settlement_detail_service.py create mode 100644 stripe/issuing/_settlement.py diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index 292b2c94a..5f789190c 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v1257 \ No newline at end of file +v1258 \ No newline at end of file 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/_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 cef5e7a56..7467189a2 100644 --- a/stripe/_object_classes.py +++ b/stripe/_object_classes.py @@ -82,8 +82,10 @@ 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/_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/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/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/_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. From 6b2995e2ff11d7d037b654375f42ae4569cb067d 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:45 +0000 Subject: [PATCH 11/12] 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 5f789190c..b39b96e37 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v1258 \ 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 995063f32d151c6399f6af1b15690b9009c4eb0c Mon Sep 17 00:00:00 2001 From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Tue, 10 Sep 2024 20:49:20 +0000 Subject: [PATCH 12/12] 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