diff --git a/CODEGEN_VERSION b/CODEGEN_VERSION index 8576feb6a..47a9a28f9 100644 --- a/CODEGEN_VERSION +++ b/CODEGEN_VERSION @@ -1 +1 @@ -9e950cbf7b5a814a98f27d1a94b72cd6f1df2078 \ No newline at end of file +25e6bd225852aa44d783e9fb3b9895af39479331 \ No newline at end of file diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index 604997fea..19b4cc885 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v2203 \ No newline at end of file +v2206 \ No newline at end of file diff --git a/stripe/_account_service.py b/stripe/_account_service.py index 46e457756..2bf76eeb3 100644 --- a/stripe/_account_service.py +++ b/stripe/_account_service.py @@ -1,8 +1,11 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +import json +from stripe._api_version import _ApiVersion from stripe._stripe_service import StripeService from stripe._util import sanitize_id from typing import Optional, cast +from uuid import uuid4 from importlib import import_module from typing_extensions import TYPE_CHECKING @@ -398,3 +401,27 @@ async def reject_async( options=options, ), ) + + def serialize_batch_update( + self, + account: str, + params: Optional["AccountUpdateParams"] = None, + options: Optional["RequestOptions"] = None, + ) -> str: + """ + Serializes an Account update request into a batch job JSONL line. + """ + item_id = str(uuid4()) + stripe_version = ( + options.get("stripe_version") if options else None + ) or _ApiVersion.CURRENT + context = options.get("stripe_context") if options else None + item = { + "id": item_id, + "path_params": {"account": account}, + "params": params, + "stripe_version": stripe_version, + } + if context is not None: + item["context"] = context + return json.dumps(item) diff --git a/stripe/_api_requestor.py b/stripe/_api_requestor.py index 60ec6b139..133901228 100644 --- a/stripe/_api_requestor.py +++ b/stripe/_api_requestor.py @@ -518,6 +518,7 @@ def specific_oauth_error(self, rbody, rcode, resp, rheaders, error_code): ("CODEX_CI", "codex_cli"), ("CURSOR_AGENT", "cursor"), ("GEMINI_CLI", "gemini_cli"), + ("OPENCLAW_SHELL", "openclaw"), ("OPENCODE", "open_code"), # aiAgents: The end of the section generated from our OpenAPI spec ] diff --git a/stripe/_credit_note_line_item.py b/stripe/_credit_note_line_item.py index 826e71e7b..7000b0343 100644 --- a/stripe/_credit_note_line_item.py +++ b/stripe/_credit_note_line_item.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from decimal import Decimal from stripe._expandable_field import ExpandableField from stripe._stripe_object import StripeObject from typing import ClassVar, List, Optional @@ -172,7 +173,7 @@ class TaxRateDetails(StripeObject): """ The cost of each unit of product being credited. """ - unit_amount_decimal: Optional[str] + unit_amount_decimal: Optional[Decimal] """ Same as `unit_amount`, but contains a decimal value with at most 12 decimal places. """ @@ -182,3 +183,4 @@ class TaxRateDetails(StripeObject): "tax_calculation_reference": TaxCalculationReference, "taxes": Tax, } + _field_encodings = {"unit_amount_decimal": "decimal_string"} diff --git a/stripe/_credit_note_service.py b/stripe/_credit_note_service.py index 4d716f4ce..dda4556f3 100644 --- a/stripe/_credit_note_service.py +++ b/stripe/_credit_note_service.py @@ -1,8 +1,11 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +import json +from stripe._api_version import _ApiVersion from stripe._stripe_service import StripeService from stripe._util import sanitize_id from typing import Optional, cast +from uuid import uuid4 from importlib import import_module from typing_extensions import TYPE_CHECKING @@ -319,3 +322,25 @@ async def void_credit_note_async( options=options, ), ) + + def serialize_batch_create( + self, + params: Optional["CreditNoteCreateParams"] = None, + options: Optional["RequestOptions"] = None, + ) -> str: + """ + Serializes a CreditNote create request into a batch job JSONL line. + """ + item_id = str(uuid4()) + stripe_version = ( + options.get("stripe_version") if options else None + ) or _ApiVersion.CURRENT + context = options.get("stripe_context") if options else None + item = { + "id": item_id, + "params": params, + "stripe_version": stripe_version, + } + if context is not None: + item["context"] = context + return json.dumps(item) diff --git a/stripe/_customer_service.py b/stripe/_customer_service.py index e7037cde1..f90e27044 100644 --- a/stripe/_customer_service.py +++ b/stripe/_customer_service.py @@ -1,8 +1,11 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +import json +from stripe._api_version import _ApiVersion from stripe._stripe_service import StripeService from stripe._util import sanitize_id from typing import Optional, cast +from uuid import uuid4 from importlib import import_module from typing_extensions import TYPE_CHECKING @@ -397,3 +400,27 @@ async def search_async( options=options, ), ) + + def serialize_batch_update( + self, + customer: str, + params: Optional["CustomerUpdateParams"] = None, + options: Optional["RequestOptions"] = None, + ) -> str: + """ + Serializes a Customer update request into a batch job JSONL line. + """ + item_id = str(uuid4()) + stripe_version = ( + options.get("stripe_version") if options else None + ) or _ApiVersion.CURRENT + context = options.get("stripe_context") if options else None + item = { + "id": item_id, + "path_params": {"customer": customer}, + "params": params, + "stripe_version": stripe_version, + } + if context is not None: + item["context"] = context + return json.dumps(item) diff --git a/stripe/_encode.py b/stripe/_encode.py index b27749857..85847e87a 100644 --- a/stripe/_encode.py +++ b/stripe/_encode.py @@ -2,6 +2,7 @@ import datetime import time from collections import OrderedDict +from decimal import Decimal from typing import Any, Dict, Generator, Mapping, Optional, Tuple, Union @@ -25,6 +26,8 @@ def _encode_nested_dict(key, data, fmt="%s[%s]"): def _json_encode_date_callback(value): if isinstance(value, datetime.datetime): return _encode_datetime(value) + if isinstance(value, Decimal): + return str(value) return value @@ -82,6 +85,31 @@ def _coerce_int64_string(value: Any, *, encode: bool) -> Any: return value +def _coerce_decimal_string(value: Any, *, encode: bool) -> Any: + """ + Coerce a decimal_string value in either direction. + + encode=True: Decimal/int/float → str (request serialization) + encode=False: str → Decimal (response hydration) + """ + if value is None: + return None + + if isinstance(value, list): + return [_coerce_decimal_string(v, encode=encode) for v in value] + + if encode: + if isinstance(value, (Decimal, int, float)) and not isinstance( + value, bool + ): + return str(value) + return value + else: + if isinstance(value, str): + return Decimal(value) + return value + + def _coerce_value(value: Any, schema: _SchemaNode) -> Any: """Coerce a single value according to its schema node.""" if value is None: @@ -90,6 +118,9 @@ def _coerce_value(value: Any, schema: _SchemaNode) -> Any: if schema == "int64_string": return _coerce_int64_string(value, encode=True) + if schema == "decimal_string": + return _coerce_decimal_string(value, encode=True) + if isinstance(schema, dict): # Nested object schema if isinstance(value, list): diff --git a/stripe/_invoice_item.py b/stripe/_invoice_item.py index 99a1e4d15..374588be4 100644 --- a/stripe/_invoice_item.py +++ b/stripe/_invoice_item.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from decimal import Decimal from stripe._createable_api_resource import CreateableAPIResource from stripe._deletable_api_resource import DeletableAPIResource from stripe._expandable_field import ExpandableField @@ -206,7 +207,7 @@ class RateCardRateDetails(StripeObject): """ The type of the pricing details. """ - unit_amount_decimal: Optional[str] + unit_amount_decimal: Optional[Decimal] """ The unit amount (in the `currency` specified) of the item which contains a decimal value with at most 12 decimal places. """ @@ -216,6 +217,7 @@ class RateCardRateDetails(StripeObject): "rate_card_custom_pricing_unit_overage_rate_details": RateCardCustomPricingUnitOverageRateDetails, "rate_card_rate_details": RateCardRateDetails, } + _field_encodings = {"unit_amount_decimal": "decimal_string"} class ProrationDetails(StripeObject): class DiscountAmount(StripeObject): diff --git a/stripe/_invoice_line_item.py b/stripe/_invoice_line_item.py index 80159a64d..e987c8d71 100644 --- a/stripe/_invoice_line_item.py +++ b/stripe/_invoice_line_item.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from decimal import Decimal from stripe._expandable_field import ExpandableField from stripe._stripe_object import StripeObject from stripe._updateable_api_resource import UpdateableAPIResource @@ -337,7 +338,7 @@ class RateCardRateDetails(StripeObject): """ The type of the pricing details. """ - unit_amount_decimal: Optional[str] + unit_amount_decimal: Optional[Decimal] """ The unit amount (in the `currency` specified) of the item which contains a decimal value with at most 12 decimal places. """ @@ -347,6 +348,7 @@ class RateCardRateDetails(StripeObject): "rate_card_custom_pricing_unit_overage_rate_details": RateCardCustomPricingUnitOverageRateDetails, "rate_card_rate_details": RateCardRateDetails, } + _field_encodings = {"unit_amount_decimal": "decimal_string"} class TaxCalculationReference(StripeObject): calculation_id: Optional[str] diff --git a/stripe/_invoice_service.py b/stripe/_invoice_service.py index e3c93e6c5..3464f016c 100644 --- a/stripe/_invoice_service.py +++ b/stripe/_invoice_service.py @@ -1,8 +1,11 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +import json +from stripe._api_version import _ApiVersion from stripe._stripe_service import StripeService from stripe._util import sanitize_id from typing import Optional, cast +from uuid import uuid4 from importlib import import_module from typing_extensions import TYPE_CHECKING @@ -847,3 +850,51 @@ async def create_preview_async( options=options, ), ) + + def serialize_batch_update( + self, + invoice: str, + params: Optional["InvoiceUpdateParams"] = None, + options: Optional["RequestOptions"] = None, + ) -> str: + """ + Serializes an Invoice update request into a batch job JSONL line. + """ + item_id = str(uuid4()) + stripe_version = ( + options.get("stripe_version") if options else None + ) or _ApiVersion.CURRENT + context = options.get("stripe_context") if options else None + item = { + "id": item_id, + "path_params": {"invoice": invoice}, + "params": params, + "stripe_version": stripe_version, + } + if context is not None: + item["context"] = context + return json.dumps(item) + + def serialize_batch_pay( + self, + invoice: str, + params: Optional["InvoicePayParams"] = None, + options: Optional["RequestOptions"] = None, + ) -> str: + """ + Serializes an Invoice pay request into a batch job JSONL line. + """ + item_id = str(uuid4()) + stripe_version = ( + options.get("stripe_version") if options else None + ) or _ApiVersion.CURRENT + context = options.get("stripe_context") if options else None + item = { + "id": item_id, + "path_params": {"invoice": invoice}, + "params": params, + "stripe_version": stripe_version, + } + if context is not None: + item["context"] = context + return json.dumps(item) diff --git a/stripe/_object_classes.py b/stripe/_object_classes.py index fccd065c9..af28097e6 100644 --- a/stripe/_object_classes.py +++ b/stripe/_object_classes.py @@ -480,10 +480,6 @@ "LicensedItem", ), "v2.billing.license_fee": ("stripe.v2.billing._license_fee", "LicenseFee"), - "v2.billing.license_fee_subscription": ( - "stripe.v2.billing._license_fee_subscription", - "LicenseFeeSubscription", - ), "v2.billing.license_fee_version": ( "stripe.v2.billing._license_fee_version", "LicenseFeeVersion", @@ -517,10 +513,6 @@ "stripe.v2.billing._pricing_plan_subscription", "PricingPlanSubscription", ), - "v2.billing.pricing_plan_subscription_components": ( - "stripe.v2.billing._pricing_plan_subscription_components", - "PricingPlanSubscriptionComponents", - ), "v2.billing.pricing_plan_version": ( "stripe.v2.billing._pricing_plan_version", "PricingPlanVersion", @@ -548,6 +540,10 @@ "ServiceAction", ), "v2.core.account": ("stripe.v2.core._account", "Account"), + "v2.core.account_evaluation": ( + "stripe.v2.core._account_evaluation", + "AccountEvaluation", + ), "v2.core.account_link": ("stripe.v2.core._account_link", "AccountLink"), "v2.core.account_person": ( "stripe.v2.core._account_person", @@ -558,6 +554,7 @@ "AccountPersonToken", ), "v2.core.account_token": ("stripe.v2.core._account_token", "AccountToken"), + "v2.core.batch_job": ("stripe.v2.core._batch_job", "BatchJob"), "v2.core.claimable_sandbox": ( "stripe.v2.core._claimable_sandbox", "ClaimableSandbox", diff --git a/stripe/_payment_intent.py b/stripe/_payment_intent.py index a4bc718ab..2ec661828 100644 --- a/stripe/_payment_intent.py +++ b/stripe/_payment_intent.py @@ -4188,12 +4188,6 @@ class MandateOptions(StripeObject): financial_connections: Optional[FinancialConnections] mandate_options: Optional[MandateOptions] - preferred_settlement_speed: Optional[ - Literal["fastest", "standard"] - ] - """ - Preferred transaction settlement speed - """ setup_future_usage: Optional[ Literal["none", "off_session", "on_session"] ] diff --git a/stripe/_plan.py b/stripe/_plan.py index dd6e6b95c..3d274bf26 100644 --- a/stripe/_plan.py +++ b/stripe/_plan.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from decimal import Decimal from stripe._createable_api_resource import CreateableAPIResource from stripe._deletable_api_resource import DeletableAPIResource from stripe._expandable_field import ExpandableField @@ -44,7 +45,7 @@ class Tier(StripeObject): """ Price for the entire tier. """ - flat_amount_decimal: Optional[str] + flat_amount_decimal: Optional[Decimal] """ Same as `flat_amount`, but contains a decimal value with at most 12 decimal places. """ @@ -52,7 +53,7 @@ class Tier(StripeObject): """ Per unit price for units relevant to the tier. """ - unit_amount_decimal: Optional[str] + unit_amount_decimal: Optional[Decimal] """ Same as `unit_amount`, but contains a decimal value with at most 12 decimal places. """ @@ -60,6 +61,10 @@ class Tier(StripeObject): """ Up to and including to this quantity will be contained in the tier. """ + _field_encodings = { + "flat_amount_decimal": "decimal_string", + "unit_amount_decimal": "decimal_string", + } class TransformUsage(StripeObject): divide_by: int @@ -79,7 +84,7 @@ class TransformUsage(StripeObject): """ The unit amount in cents (or local equivalent) to be charged, represented as a whole integer if possible. Only set if `billing_scheme=per_unit`. """ - amount_decimal: Optional[str] + amount_decimal: Optional[Decimal] """ The unit amount in cents (or local equivalent) to be charged, represented as a decimal string with at most 12 decimal places. Only set if `billing_scheme=per_unit`. """ @@ -377,3 +382,4 @@ async def retrieve_async( return instance _inner_class_types = {"tiers": Tier, "transform_usage": TransformUsage} + _field_encodings = {"amount_decimal": "decimal_string"} diff --git a/stripe/_price.py b/stripe/_price.py index 5182cc1d7..532d6018d 100644 --- a/stripe/_price.py +++ b/stripe/_price.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from decimal import Decimal from stripe._createable_api_resource import CreateableAPIResource from stripe._expandable_field import ExpandableField from stripe._list_object import ListObject @@ -66,7 +67,7 @@ class Tier(StripeObject): """ Price for the entire tier. """ - flat_amount_decimal: Optional[str] + flat_amount_decimal: Optional[Decimal] """ Same as `flat_amount`, but contains a decimal value with at most 12 decimal places. """ @@ -74,7 +75,7 @@ class Tier(StripeObject): """ Per unit price for units relevant to the tier. """ - unit_amount_decimal: Optional[str] + unit_amount_decimal: Optional[Decimal] """ Same as `unit_amount`, but contains a decimal value with at most 12 decimal places. """ @@ -82,6 +83,10 @@ class Tier(StripeObject): """ Up to and including to this quantity will be contained in the tier. """ + _field_encodings = { + "flat_amount_decimal": "decimal_string", + "unit_amount_decimal": "decimal_string", + } custom_unit_amount: Optional[CustomUnitAmount] """ @@ -101,7 +106,7 @@ class Tier(StripeObject): """ The unit amount in cents (or local equivalent) to be charged, represented as a whole integer if possible. Only set if `billing_scheme=per_unit`. """ - unit_amount_decimal: Optional[str] + unit_amount_decimal: Optional[Decimal] """ The unit amount in cents (or local equivalent) to be charged, represented as a decimal string with at most 12 decimal places. Only set if `billing_scheme=per_unit`. """ @@ -109,6 +114,7 @@ class Tier(StripeObject): "custom_unit_amount": CustomUnitAmount, "tiers": Tier, } + _field_encodings = {"unit_amount_decimal": "decimal_string"} class CustomUnitAmount(StripeObject): maximum: Optional[int] @@ -165,7 +171,7 @@ class Tier(StripeObject): """ Price for the entire tier. """ - flat_amount_decimal: Optional[str] + flat_amount_decimal: Optional[Decimal] """ Same as `flat_amount`, but contains a decimal value with at most 12 decimal places. """ @@ -173,7 +179,7 @@ class Tier(StripeObject): """ Per unit price for units relevant to the tier. """ - unit_amount_decimal: Optional[str] + unit_amount_decimal: Optional[Decimal] """ Same as `unit_amount`, but contains a decimal value with at most 12 decimal places. """ @@ -181,6 +187,10 @@ class Tier(StripeObject): """ Up to and including to this quantity will be contained in the tier. """ + _field_encodings = { + "flat_amount_decimal": "decimal_string", + "unit_amount_decimal": "decimal_string", + } class TransformQuantity(StripeObject): divide_by: int @@ -284,7 +294,7 @@ class TransformQuantity(StripeObject): """ The unit amount in cents (or local equivalent) to be charged, represented as a whole integer if possible. Only set if `billing_scheme=per_unit`. """ - unit_amount_decimal: Optional[str] + unit_amount_decimal: Optional[Decimal] """ The unit amount in cents (or local equivalent) to be charged, represented as a decimal string with at most 12 decimal places. Only set if `billing_scheme=per_unit`. """ @@ -457,3 +467,4 @@ async def search_auto_paging_iter_async( "tiers": Tier, "transform_quantity": TransformQuantity, } + _field_encodings = {"unit_amount_decimal": "decimal_string"} diff --git a/stripe/_promotion_code_service.py b/stripe/_promotion_code_service.py index b8aaa4450..eef6ffafa 100644 --- a/stripe/_promotion_code_service.py +++ b/stripe/_promotion_code_service.py @@ -1,8 +1,11 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +import json +from stripe._api_version import _ApiVersion from stripe._stripe_service import StripeService from stripe._util import sanitize_id from typing import Optional, cast +from uuid import uuid4 from typing_extensions import TYPE_CHECKING if TYPE_CHECKING: @@ -187,3 +190,49 @@ async def update_async( options=options, ), ) + + def serialize_batch_create( + self, + params: Optional["PromotionCodeCreateParams"] = None, + options: Optional["RequestOptions"] = None, + ) -> str: + """ + Serializes a PromotionCode create request into a batch job JSONL line. + """ + item_id = str(uuid4()) + stripe_version = ( + options.get("stripe_version") if options else None + ) or _ApiVersion.CURRENT + context = options.get("stripe_context") if options else None + item = { + "id": item_id, + "params": params, + "stripe_version": stripe_version, + } + if context is not None: + item["context"] = context + return json.dumps(item) + + def serialize_batch_update( + self, + promotion_code: str, + params: Optional["PromotionCodeUpdateParams"] = None, + options: Optional["RequestOptions"] = None, + ) -> str: + """ + Serializes a PromotionCode update request into a batch job JSONL line. + """ + item_id = str(uuid4()) + stripe_version = ( + options.get("stripe_version") if options else None + ) or _ApiVersion.CURRENT + context = options.get("stripe_context") if options else None + item = { + "id": item_id, + "path_params": {"promotion_code": promotion_code}, + "params": params, + "stripe_version": stripe_version, + } + if context is not None: + item["context"] = context + return json.dumps(item) diff --git a/stripe/_stripe_client.py b/stripe/_stripe_client.py index c2696195a..af91f7dab 100644 --- a/stripe/_stripe_client.py +++ b/stripe/_stripe_client.py @@ -272,6 +272,10 @@ def construct_event( requestor=self._requestor, api_mode="V1", ) + if event.object == "v2.core.event": # type: ignore + raise ValueError( + "You passed a thin event notification to StripeClient.construct_event, which expects a webhook payload. Use StripeClient.parse_event_notification instead." + ) return event diff --git a/stripe/_stripe_object.py b/stripe/_stripe_object.py index 5109cdb29..cd42fb10f 100644 --- a/stripe/_stripe_object.py +++ b/stripe/_stripe_object.py @@ -27,7 +27,7 @@ StripeStreamResponseAsync, ) from stripe._encode import _encode_datetime # pyright: ignore -from stripe._encode import _coerce_int64_string # pyright: ignore +from stripe._encode import _coerce_int64_string, _coerce_decimal_string # pyright: ignore from stripe._request_options import ( PERSISTENT_OPTIONS_KEYS, extract_options_from_dict, @@ -646,7 +646,8 @@ def _coerce_field_value(self, field_name: str, value: Any) -> Any: Apply field encoding coercion based on _field_encodings metadata. For int64_string fields, converts string values from the API response - to native Python ints. + to native Python ints. For decimal_string fields, converts string + values to decimal.Decimal. """ encoding = self._field_encodings.get(field_name) if encoding is None or value is None: @@ -655,4 +656,7 @@ def _coerce_field_value(self, field_name: str, value: Any) -> Any: if encoding == "int64_string": return _coerce_int64_string(value, encode=False) + if encoding == "decimal_string": + return _coerce_decimal_string(value, encode=False) + return value diff --git a/stripe/_subscription_schedule_service.py b/stripe/_subscription_schedule_service.py index 30934f084..be4f15618 100644 --- a/stripe/_subscription_schedule_service.py +++ b/stripe/_subscription_schedule_service.py @@ -1,8 +1,11 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +import json +from stripe._api_version import _ApiVersion from stripe._stripe_service import StripeService from stripe._util import sanitize_id from typing import Optional, cast +from uuid import uuid4 from typing_extensions import TYPE_CHECKING if TYPE_CHECKING: @@ -328,3 +331,73 @@ async def release_async( options=options, ), ) + + def serialize_batch_create( + self, + params: Optional["SubscriptionScheduleCreateParams"] = None, + options: Optional["RequestOptions"] = None, + ) -> str: + """ + Serializes a SubscriptionSchedule create request into a batch job JSONL line. + """ + item_id = str(uuid4()) + stripe_version = ( + options.get("stripe_version") if options else None + ) or _ApiVersion.CURRENT + context = options.get("stripe_context") if options else None + item = { + "id": item_id, + "params": params, + "stripe_version": stripe_version, + } + if context is not None: + item["context"] = context + return json.dumps(item) + + def serialize_batch_update( + self, + schedule: str, + params: Optional["SubscriptionScheduleUpdateParams"] = None, + options: Optional["RequestOptions"] = None, + ) -> str: + """ + Serializes a SubscriptionSchedule update request into a batch job JSONL line. + """ + item_id = str(uuid4()) + stripe_version = ( + options.get("stripe_version") if options else None + ) or _ApiVersion.CURRENT + context = options.get("stripe_context") if options else None + item = { + "id": item_id, + "path_params": {"schedule": schedule}, + "params": params, + "stripe_version": stripe_version, + } + if context is not None: + item["context"] = context + return json.dumps(item) + + def serialize_batch_cancel( + self, + schedule: str, + params: Optional["SubscriptionScheduleCancelParams"] = None, + options: Optional["RequestOptions"] = None, + ) -> str: + """ + Serializes a SubscriptionSchedule cancel request into a batch job JSONL line. + """ + item_id = str(uuid4()) + stripe_version = ( + options.get("stripe_version") if options else None + ) or _ApiVersion.CURRENT + context = options.get("stripe_context") if options else None + item = { + "id": item_id, + "path_params": {"schedule": schedule}, + "params": params, + "stripe_version": stripe_version, + } + if context is not None: + item["context"] = context + return json.dumps(item) diff --git a/stripe/_subscription_service.py b/stripe/_subscription_service.py index edef4765e..c8224dd04 100644 --- a/stripe/_subscription_service.py +++ b/stripe/_subscription_service.py @@ -1,8 +1,11 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +import json +from stripe._api_version import _ApiVersion from stripe._stripe_service import StripeService from stripe._util import sanitize_id from typing import Optional, cast +from uuid import uuid4 from typing_extensions import TYPE_CHECKING if TYPE_CHECKING: @@ -592,3 +595,53 @@ async def resume_async( options=options, ), ) + + def serialize_batch_update( + self, + subscription_exposed_id: str, + params: Optional["SubscriptionUpdateParams"] = None, + options: Optional["RequestOptions"] = None, + ) -> str: + """ + Serializes a Subscription update request into a batch job JSONL line. + """ + item_id = str(uuid4()) + stripe_version = ( + options.get("stripe_version") if options else None + ) or _ApiVersion.CURRENT + context = options.get("stripe_context") if options else None + item = { + "id": item_id, + "path_params": { + "subscription_exposed_id": subscription_exposed_id + }, + "params": params, + "stripe_version": stripe_version, + } + if context is not None: + item["context"] = context + return json.dumps(item) + + def serialize_batch_migrate( + self, + subscription: str, + params: Optional["SubscriptionMigrateParams"] = None, + options: Optional["RequestOptions"] = None, + ) -> str: + """ + Serializes a Subscription migrate request into a batch job JSONL line. + """ + item_id = str(uuid4()) + stripe_version = ( + options.get("stripe_version") if options else None + ) or _ApiVersion.CURRENT + context = options.get("stripe_context") if options else None + item = { + "id": item_id, + "path_params": {"subscription": subscription}, + "params": params, + "stripe_version": stripe_version, + } + if context is not None: + item["context"] = context + return json.dumps(item) diff --git a/stripe/_webhook.py b/stripe/_webhook.py index 61686386e..fcead1260 100644 --- a/stripe/_webhook.py +++ b/stripe/_webhook.py @@ -33,6 +33,10 @@ def construct_event( api_mode="V1", ) + if event.object == "v2.core.event": # type: ignore + raise ValueError( + "You passed a thin event notification to Webhook.construct_event, which expects a webhook payload. Use StripeClient.parse_event_notification instead." + ) return event diff --git a/stripe/billing/_alert.py b/stripe/billing/_alert.py index adb57e425..104d583ff 100644 --- a/stripe/billing/_alert.py +++ b/stripe/billing/_alert.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from decimal import Decimal from stripe._createable_api_resource import CreateableAPIResource from stripe._expandable_field import ExpandableField from stripe._list_object import ListObject @@ -77,13 +78,14 @@ class CustomPricingUnitDetails(StripeObject): """ Unique identifier for the object. """ - value: str + value: Decimal """ A positive decimal string representing the amount. """ _inner_class_types = { "custom_pricing_unit_details": CustomPricingUnitDetails, } + _field_encodings = {"value": "decimal_string"} class Monetary(StripeObject): currency: str @@ -184,13 +186,14 @@ class CustomPricingUnitDetails(StripeObject): """ Unique identifier for the object. """ - value: str + value: Decimal """ A positive decimal string representing the amount. """ _inner_class_types = { "custom_pricing_unit_details": CustomPricingUnitDetails, } + _field_encodings = {"value": "decimal_string"} amount: Optional[Amount] """ diff --git a/stripe/billing/_alert_recovered.py b/stripe/billing/_alert_recovered.py index 33621219d..03257de38 100644 --- a/stripe/billing/_alert_recovered.py +++ b/stripe/billing/_alert_recovered.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from decimal import Decimal from stripe._stripe_object import StripeObject from typing import ClassVar, Optional from typing_extensions import Literal, TYPE_CHECKING @@ -44,7 +45,8 @@ class AlertRecovered(StripeObject): """ String representing the object's type. Objects of the same type share the same value. """ - value: str + value: Decimal """ The value at which the alert recovered """ + _field_encodings = {"value": "decimal_string"} diff --git a/stripe/billing/_alert_triggered.py b/stripe/billing/_alert_triggered.py index 3d51495ff..a51bd3b1a 100644 --- a/stripe/billing/_alert_triggered.py +++ b/stripe/billing/_alert_triggered.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from decimal import Decimal from stripe._stripe_object import StripeObject from typing import ClassVar, Optional from typing_extensions import Literal, TYPE_CHECKING @@ -81,7 +82,7 @@ class GroupBy(StripeObject): """ Timestamp at which the threshold was crossed """ - value: str + value: Decimal """ The value triggering the alert """ @@ -89,3 +90,4 @@ class GroupBy(StripeObject): "aggregation_period": AggregationPeriod, "group_by": GroupBy, } + _field_encodings = {"value": "decimal_string"} diff --git a/stripe/billing/_credit_balance_summary.py b/stripe/billing/_credit_balance_summary.py index 42c42b633..2239a3ebc 100644 --- a/stripe/billing/_credit_balance_summary.py +++ b/stripe/billing/_credit_balance_summary.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from decimal import Decimal from stripe._expandable_field import ExpandableField from stripe._singleton_api_resource import SingletonAPIResource from stripe._stripe_object import StripeObject @@ -59,13 +60,14 @@ class CustomPricingUnitDetails(StripeObject): """ Unique identifier for the object. """ - value: str + value: Decimal """ A positive integer representing the amount. """ _inner_class_types = { "custom_pricing_unit_details": CustomPricingUnitDetails, } + _field_encodings = {"value": "decimal_string"} class Monetary(StripeObject): currency: str @@ -147,13 +149,14 @@ class CustomPricingUnitDetails(StripeObject): """ Unique identifier for the object. """ - value: str + value: Decimal """ A positive integer representing the amount. """ _inner_class_types = { "custom_pricing_unit_details": CustomPricingUnitDetails, } + _field_encodings = {"value": "decimal_string"} class Monetary(StripeObject): currency: str diff --git a/stripe/billing/_credit_balance_transaction.py b/stripe/billing/_credit_balance_transaction.py index 9f760e43b..84c1d3df5 100644 --- a/stripe/billing/_credit_balance_transaction.py +++ b/stripe/billing/_credit_balance_transaction.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from decimal import Decimal from stripe._expandable_field import ExpandableField from stripe._list_object import ListObject from stripe._listable_api_resource import ListableAPIResource @@ -67,13 +68,14 @@ class CustomPricingUnitDetails(StripeObject): """ Unique identifier for the object. """ - value: str + value: Decimal """ A positive integer representing the amount. """ _inner_class_types = { "custom_pricing_unit_details": CustomPricingUnitDetails, } + _field_encodings = {"value": "decimal_string"} class Monetary(StripeObject): currency: str @@ -165,13 +167,14 @@ class CustomPricingUnitDetails(StripeObject): """ Unique identifier for the object. """ - value: str + value: Decimal """ A positive integer representing the amount. """ _inner_class_types = { "custom_pricing_unit_details": CustomPricingUnitDetails, } + _field_encodings = {"value": "decimal_string"} class Monetary(StripeObject): currency: str diff --git a/stripe/billing/_credit_grant.py b/stripe/billing/_credit_grant.py index b1a365180..0faafc5a4 100644 --- a/stripe/billing/_credit_grant.py +++ b/stripe/billing/_credit_grant.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from decimal import Decimal from stripe._createable_api_resource import CreateableAPIResource from stripe._expandable_field import ExpandableField from stripe._list_object import ListObject @@ -84,13 +85,14 @@ class CustomPricingUnitDetails(StripeObject): """ Unique identifier for the object. """ - value: str + value: Decimal """ A positive integer representing the amount. """ _inner_class_types = { "custom_pricing_unit_details": CustomPricingUnitDetails, } + _field_encodings = {"value": "decimal_string"} class Monetary(StripeObject): currency: str diff --git a/stripe/checkout/_session.py b/stripe/checkout/_session.py index e82b8b335..a7e349d86 100644 --- a/stripe/checkout/_session.py +++ b/stripe/checkout/_session.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from decimal import Decimal from stripe._createable_api_resource import CreateableAPIResource from stripe._expandable_field import ExpandableField from stripe._list_object import ListObject @@ -468,7 +469,7 @@ class CurrencyConversion(StripeObject): """ Total of all items in source currency after discounts and taxes are applied. """ - fx_rate: str + fx_rate: Decimal """ Exchange rate used to convert source currency amounts to customer currency amounts """ @@ -476,6 +477,7 @@ class CurrencyConversion(StripeObject): """ Creation currency of the CheckoutSession before localization """ + _field_encodings = {"fx_rate": "decimal_string"} class CurrentAttempt(StripeObject): class BillingDetails(StripeObject): diff --git a/stripe/climate/_order.py b/stripe/climate/_order.py index 1f7acab6e..a162d7e51 100644 --- a/stripe/climate/_order.py +++ b/stripe/climate/_order.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from decimal import Decimal from stripe._createable_api_resource import CreateableAPIResource from stripe._expandable_field import ExpandableField from stripe._list_object import ListObject @@ -152,7 +153,7 @@ class Location(StripeObject): """ Set of [key-value pairs](https://docs.stripe.com/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. """ - metric_tons: str + metric_tons: Decimal """ Quantity of carbon removal that is included in this order. """ @@ -435,3 +436,4 @@ async def retrieve_async( "beneficiary": Beneficiary, "delivery_details": DeliveryDetail, } + _field_encodings = {"metric_tons": "decimal_string"} diff --git a/stripe/climate/_product.py b/stripe/climate/_product.py index 613352ec9..1c833cc4d 100644 --- a/stripe/climate/_product.py +++ b/stripe/climate/_product.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from decimal import Decimal from stripe._list_object import ListObject from stripe._listable_api_resource import ListableAPIResource from stripe._stripe_object import StripeObject @@ -58,7 +59,7 @@ class CurrentPricesPerMetricTon(StripeObject): """ Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. """ - metric_tons_available: str + metric_tons_available: Decimal """ The quantity of metric tons available for reservation. """ @@ -140,3 +141,4 @@ async def retrieve_async( _inner_class_types = { "current_prices_per_metric_ton": CurrentPricesPerMetricTon, } + _field_encodings = {"metric_tons_available": "decimal_string"} diff --git a/stripe/events/__init__.py b/stripe/events/__init__.py index 91e0333ec..1d8d3e7ee 100644 --- a/stripe/events/__init__.py +++ b/stripe/events/__init__.py @@ -13,6 +13,10 @@ from stripe.events._event_classes import ( ALL_EVENT_NOTIFICATIONS as ALL_EVENT_NOTIFICATIONS, ) + from stripe.events._v1_account_signals_including_delinquency_created_event import ( + V1AccountSignalsIncludingDelinquencyCreatedEvent as V1AccountSignalsIncludingDelinquencyCreatedEvent, + V1AccountSignalsIncludingDelinquencyCreatedEventNotification as V1AccountSignalsIncludingDelinquencyCreatedEventNotification, + ) from stripe.events._v1_billing_meter_error_report_triggered_event import ( V1BillingMeterErrorReportTriggeredEvent as V1BillingMeterErrorReportTriggeredEvent, V1BillingMeterErrorReportTriggeredEventNotification as V1BillingMeterErrorReportTriggeredEventNotification, @@ -253,10 +257,54 @@ V2CoreAccountPersonUpdatedEvent as V2CoreAccountPersonUpdatedEvent, V2CoreAccountPersonUpdatedEventNotification as V2CoreAccountPersonUpdatedEventNotification, ) + from stripe.events._v2_core_account_signals_fraudulent_website_ready_event import ( + V2CoreAccountSignalsFraudulentWebsiteReadyEvent as V2CoreAccountSignalsFraudulentWebsiteReadyEvent, + V2CoreAccountSignalsFraudulentWebsiteReadyEventNotification as V2CoreAccountSignalsFraudulentWebsiteReadyEventNotification, + ) from stripe.events._v2_core_account_updated_event import ( V2CoreAccountUpdatedEvent as V2CoreAccountUpdatedEvent, V2CoreAccountUpdatedEventNotification as V2CoreAccountUpdatedEventNotification, ) + from stripe.events._v2_core_batch_job_batch_failed_event import ( + V2CoreBatchJobBatchFailedEvent as V2CoreBatchJobBatchFailedEvent, + V2CoreBatchJobBatchFailedEventNotification as V2CoreBatchJobBatchFailedEventNotification, + ) + from stripe.events._v2_core_batch_job_canceled_event import ( + V2CoreBatchJobCanceledEvent as V2CoreBatchJobCanceledEvent, + V2CoreBatchJobCanceledEventNotification as V2CoreBatchJobCanceledEventNotification, + ) + from stripe.events._v2_core_batch_job_completed_event import ( + V2CoreBatchJobCompletedEvent as V2CoreBatchJobCompletedEvent, + V2CoreBatchJobCompletedEventNotification as V2CoreBatchJobCompletedEventNotification, + ) + from stripe.events._v2_core_batch_job_created_event import ( + V2CoreBatchJobCreatedEvent as V2CoreBatchJobCreatedEvent, + V2CoreBatchJobCreatedEventNotification as V2CoreBatchJobCreatedEventNotification, + ) + from stripe.events._v2_core_batch_job_ready_for_upload_event import ( + V2CoreBatchJobReadyForUploadEvent as V2CoreBatchJobReadyForUploadEvent, + V2CoreBatchJobReadyForUploadEventNotification as V2CoreBatchJobReadyForUploadEventNotification, + ) + from stripe.events._v2_core_batch_job_timeout_event import ( + V2CoreBatchJobTimeoutEvent as V2CoreBatchJobTimeoutEvent, + V2CoreBatchJobTimeoutEventNotification as V2CoreBatchJobTimeoutEventNotification, + ) + from stripe.events._v2_core_batch_job_updated_event import ( + V2CoreBatchJobUpdatedEvent as V2CoreBatchJobUpdatedEvent, + V2CoreBatchJobUpdatedEventNotification as V2CoreBatchJobUpdatedEventNotification, + ) + from stripe.events._v2_core_batch_job_upload_timeout_event import ( + V2CoreBatchJobUploadTimeoutEvent as V2CoreBatchJobUploadTimeoutEvent, + V2CoreBatchJobUploadTimeoutEventNotification as V2CoreBatchJobUploadTimeoutEventNotification, + ) + from stripe.events._v2_core_batch_job_validating_event import ( + V2CoreBatchJobValidatingEvent as V2CoreBatchJobValidatingEvent, + V2CoreBatchJobValidatingEventNotification as V2CoreBatchJobValidatingEventNotification, + ) + from stripe.events._v2_core_batch_job_validation_failed_event import ( + V2CoreBatchJobValidationFailedEvent as V2CoreBatchJobValidationFailedEvent, + V2CoreBatchJobValidationFailedEventNotification as V2CoreBatchJobValidationFailedEventNotification, + ) from stripe.events._v2_core_claimable_sandbox_claimed_event import ( V2CoreClaimableSandboxClaimedEvent as V2CoreClaimableSandboxClaimedEvent, V2CoreClaimableSandboxClaimedEventNotification as V2CoreClaimableSandboxClaimedEventNotification, @@ -657,10 +705,22 @@ V2ReportingReportRunUpdatedEvent as V2ReportingReportRunUpdatedEvent, V2ReportingReportRunUpdatedEventNotification as V2ReportingReportRunUpdatedEventNotification, ) + from stripe.events._v2_signals_account_signal_fraudulent_merchant_ready_event import ( + V2SignalsAccountSignalFraudulentMerchantReadyEvent as V2SignalsAccountSignalFraudulentMerchantReadyEvent, + V2SignalsAccountSignalFraudulentMerchantReadyEventNotification as V2SignalsAccountSignalFraudulentMerchantReadyEventNotification, + ) # name -> (import_target, is_submodule) _import_map = { "ALL_EVENT_NOTIFICATIONS": ("stripe.events._event_classes", False), + "V1AccountSignalsIncludingDelinquencyCreatedEvent": ( + "stripe.events._v1_account_signals_including_delinquency_created_event", + False, + ), + "V1AccountSignalsIncludingDelinquencyCreatedEventNotification": ( + "stripe.events._v1_account_signals_including_delinquency_created_event", + False, + ), "V1BillingMeterErrorReportTriggeredEvent": ( "stripe.events._v1_billing_meter_error_report_triggered_event", False, @@ -1141,6 +1201,14 @@ "stripe.events._v2_core_account_person_updated_event", False, ), + "V2CoreAccountSignalsFraudulentWebsiteReadyEvent": ( + "stripe.events._v2_core_account_signals_fraudulent_website_ready_event", + False, + ), + "V2CoreAccountSignalsFraudulentWebsiteReadyEventNotification": ( + "stripe.events._v2_core_account_signals_fraudulent_website_ready_event", + False, + ), "V2CoreAccountUpdatedEvent": ( "stripe.events._v2_core_account_updated_event", False, @@ -1149,6 +1217,86 @@ "stripe.events._v2_core_account_updated_event", False, ), + "V2CoreBatchJobBatchFailedEvent": ( + "stripe.events._v2_core_batch_job_batch_failed_event", + False, + ), + "V2CoreBatchJobBatchFailedEventNotification": ( + "stripe.events._v2_core_batch_job_batch_failed_event", + False, + ), + "V2CoreBatchJobCanceledEvent": ( + "stripe.events._v2_core_batch_job_canceled_event", + False, + ), + "V2CoreBatchJobCanceledEventNotification": ( + "stripe.events._v2_core_batch_job_canceled_event", + False, + ), + "V2CoreBatchJobCompletedEvent": ( + "stripe.events._v2_core_batch_job_completed_event", + False, + ), + "V2CoreBatchJobCompletedEventNotification": ( + "stripe.events._v2_core_batch_job_completed_event", + False, + ), + "V2CoreBatchJobCreatedEvent": ( + "stripe.events._v2_core_batch_job_created_event", + False, + ), + "V2CoreBatchJobCreatedEventNotification": ( + "stripe.events._v2_core_batch_job_created_event", + False, + ), + "V2CoreBatchJobReadyForUploadEvent": ( + "stripe.events._v2_core_batch_job_ready_for_upload_event", + False, + ), + "V2CoreBatchJobReadyForUploadEventNotification": ( + "stripe.events._v2_core_batch_job_ready_for_upload_event", + False, + ), + "V2CoreBatchJobTimeoutEvent": ( + "stripe.events._v2_core_batch_job_timeout_event", + False, + ), + "V2CoreBatchJobTimeoutEventNotification": ( + "stripe.events._v2_core_batch_job_timeout_event", + False, + ), + "V2CoreBatchJobUpdatedEvent": ( + "stripe.events._v2_core_batch_job_updated_event", + False, + ), + "V2CoreBatchJobUpdatedEventNotification": ( + "stripe.events._v2_core_batch_job_updated_event", + False, + ), + "V2CoreBatchJobUploadTimeoutEvent": ( + "stripe.events._v2_core_batch_job_upload_timeout_event", + False, + ), + "V2CoreBatchJobUploadTimeoutEventNotification": ( + "stripe.events._v2_core_batch_job_upload_timeout_event", + False, + ), + "V2CoreBatchJobValidatingEvent": ( + "stripe.events._v2_core_batch_job_validating_event", + False, + ), + "V2CoreBatchJobValidatingEventNotification": ( + "stripe.events._v2_core_batch_job_validating_event", + False, + ), + "V2CoreBatchJobValidationFailedEvent": ( + "stripe.events._v2_core_batch_job_validation_failed_event", + False, + ), + "V2CoreBatchJobValidationFailedEventNotification": ( + "stripe.events._v2_core_batch_job_validation_failed_event", + False, + ), "V2CoreClaimableSandboxClaimedEvent": ( "stripe.events._v2_core_claimable_sandbox_claimed_event", False, @@ -1949,6 +2097,14 @@ "stripe.events._v2_reporting_report_run_updated_event", False, ), + "V2SignalsAccountSignalFraudulentMerchantReadyEvent": ( + "stripe.events._v2_signals_account_signal_fraudulent_merchant_ready_event", + False, + ), + "V2SignalsAccountSignalFraudulentMerchantReadyEventNotification": ( + "stripe.events._v2_signals_account_signal_fraudulent_merchant_ready_event", + False, + ), } if not TYPE_CHECKING: diff --git a/stripe/events/_event_classes.py b/stripe/events/_event_classes.py index 840b5aed9..063b444b4 100644 --- a/stripe/events/_event_classes.py +++ b/stripe/events/_event_classes.py @@ -7,6 +7,9 @@ from stripe._stripe_object import StripeObject if TYPE_CHECKING: + from stripe.events._v1_account_signals_including_delinquency_created_event import ( + V1AccountSignalsIncludingDelinquencyCreatedEventNotification, + ) from stripe.events._v1_billing_meter_error_report_triggered_event import ( V1BillingMeterErrorReportTriggeredEventNotification, ) @@ -187,9 +190,42 @@ from stripe.events._v2_core_account_person_updated_event import ( V2CoreAccountPersonUpdatedEventNotification, ) + from stripe.events._v2_core_account_signals_fraudulent_website_ready_event import ( + V2CoreAccountSignalsFraudulentWebsiteReadyEventNotification, + ) from stripe.events._v2_core_account_updated_event import ( V2CoreAccountUpdatedEventNotification, ) + from stripe.events._v2_core_batch_job_batch_failed_event import ( + V2CoreBatchJobBatchFailedEventNotification, + ) + from stripe.events._v2_core_batch_job_canceled_event import ( + V2CoreBatchJobCanceledEventNotification, + ) + from stripe.events._v2_core_batch_job_completed_event import ( + V2CoreBatchJobCompletedEventNotification, + ) + from stripe.events._v2_core_batch_job_created_event import ( + V2CoreBatchJobCreatedEventNotification, + ) + from stripe.events._v2_core_batch_job_ready_for_upload_event import ( + V2CoreBatchJobReadyForUploadEventNotification, + ) + from stripe.events._v2_core_batch_job_timeout_event import ( + V2CoreBatchJobTimeoutEventNotification, + ) + from stripe.events._v2_core_batch_job_updated_event import ( + V2CoreBatchJobUpdatedEventNotification, + ) + from stripe.events._v2_core_batch_job_upload_timeout_event import ( + V2CoreBatchJobUploadTimeoutEventNotification, + ) + from stripe.events._v2_core_batch_job_validating_event import ( + V2CoreBatchJobValidatingEventNotification, + ) + from stripe.events._v2_core_batch_job_validation_failed_event import ( + V2CoreBatchJobValidationFailedEventNotification, + ) from stripe.events._v2_core_claimable_sandbox_claimed_event import ( V2CoreClaimableSandboxClaimedEventNotification, ) @@ -490,9 +526,16 @@ from stripe.events._v2_reporting_report_run_updated_event import ( V2ReportingReportRunUpdatedEventNotification, ) + from stripe.events._v2_signals_account_signal_fraudulent_merchant_ready_event import ( + V2SignalsAccountSignalFraudulentMerchantReadyEventNotification, + ) _V2_EVENT_CLASS_LOOKUP = { + "v1.account_signals[delinquency].created": ( + "stripe.events._v1_account_signals_including_delinquency_created_event", + "V1AccountSignalsIncludingDelinquencyCreatedEvent", + ), "v1.billing.meter.error_report_triggered": ( "stripe.events._v1_billing_meter_error_report_triggered_event", "V1BillingMeterErrorReportTriggeredEvent", @@ -733,10 +776,54 @@ "stripe.events._v2_core_account_person_updated_event", "V2CoreAccountPersonUpdatedEvent", ), + "v2.core.account_signals.fraudulent_website_ready": ( + "stripe.events._v2_core_account_signals_fraudulent_website_ready_event", + "V2CoreAccountSignalsFraudulentWebsiteReadyEvent", + ), "v2.core.account.updated": ( "stripe.events._v2_core_account_updated_event", "V2CoreAccountUpdatedEvent", ), + "v2.core.batch_job.batch_failed": ( + "stripe.events._v2_core_batch_job_batch_failed_event", + "V2CoreBatchJobBatchFailedEvent", + ), + "v2.core.batch_job.canceled": ( + "stripe.events._v2_core_batch_job_canceled_event", + "V2CoreBatchJobCanceledEvent", + ), + "v2.core.batch_job.completed": ( + "stripe.events._v2_core_batch_job_completed_event", + "V2CoreBatchJobCompletedEvent", + ), + "v2.core.batch_job.created": ( + "stripe.events._v2_core_batch_job_created_event", + "V2CoreBatchJobCreatedEvent", + ), + "v2.core.batch_job.ready_for_upload": ( + "stripe.events._v2_core_batch_job_ready_for_upload_event", + "V2CoreBatchJobReadyForUploadEvent", + ), + "v2.core.batch_job.timeout": ( + "stripe.events._v2_core_batch_job_timeout_event", + "V2CoreBatchJobTimeoutEvent", + ), + "v2.core.batch_job.updated": ( + "stripe.events._v2_core_batch_job_updated_event", + "V2CoreBatchJobUpdatedEvent", + ), + "v2.core.batch_job.upload_timeout": ( + "stripe.events._v2_core_batch_job_upload_timeout_event", + "V2CoreBatchJobUploadTimeoutEvent", + ), + "v2.core.batch_job.validating": ( + "stripe.events._v2_core_batch_job_validating_event", + "V2CoreBatchJobValidatingEvent", + ), + "v2.core.batch_job.validation_failed": ( + "stripe.events._v2_core_batch_job_validation_failed_event", + "V2CoreBatchJobValidationFailedEvent", + ), "v2.core.claimable_sandbox.claimed": ( "stripe.events._v2_core_claimable_sandbox_claimed_event", "V2CoreClaimableSandboxClaimedEvent", @@ -1137,6 +1224,10 @@ "stripe.events._v2_reporting_report_run_updated_event", "V2ReportingReportRunUpdatedEvent", ), + "v2.signals.account_signal.fraudulent_merchant_ready": ( + "stripe.events._v2_signals_account_signal_fraudulent_merchant_ready_event", + "V2SignalsAccountSignalFraudulentMerchantReadyEvent", + ), } @@ -1152,6 +1243,10 @@ def get_v2_event_class(type_: str): _V2_EVENT_NOTIFICATION_CLASS_LOOKUP = { + "v1.account_signals[delinquency].created": ( + "stripe.events._v1_account_signals_including_delinquency_created_event", + "V1AccountSignalsIncludingDelinquencyCreatedEventNotification", + ), "v1.billing.meter.error_report_triggered": ( "stripe.events._v1_billing_meter_error_report_triggered_event", "V1BillingMeterErrorReportTriggeredEventNotification", @@ -1392,10 +1487,54 @@ def get_v2_event_class(type_: str): "stripe.events._v2_core_account_person_updated_event", "V2CoreAccountPersonUpdatedEventNotification", ), + "v2.core.account_signals.fraudulent_website_ready": ( + "stripe.events._v2_core_account_signals_fraudulent_website_ready_event", + "V2CoreAccountSignalsFraudulentWebsiteReadyEventNotification", + ), "v2.core.account.updated": ( "stripe.events._v2_core_account_updated_event", "V2CoreAccountUpdatedEventNotification", ), + "v2.core.batch_job.batch_failed": ( + "stripe.events._v2_core_batch_job_batch_failed_event", + "V2CoreBatchJobBatchFailedEventNotification", + ), + "v2.core.batch_job.canceled": ( + "stripe.events._v2_core_batch_job_canceled_event", + "V2CoreBatchJobCanceledEventNotification", + ), + "v2.core.batch_job.completed": ( + "stripe.events._v2_core_batch_job_completed_event", + "V2CoreBatchJobCompletedEventNotification", + ), + "v2.core.batch_job.created": ( + "stripe.events._v2_core_batch_job_created_event", + "V2CoreBatchJobCreatedEventNotification", + ), + "v2.core.batch_job.ready_for_upload": ( + "stripe.events._v2_core_batch_job_ready_for_upload_event", + "V2CoreBatchJobReadyForUploadEventNotification", + ), + "v2.core.batch_job.timeout": ( + "stripe.events._v2_core_batch_job_timeout_event", + "V2CoreBatchJobTimeoutEventNotification", + ), + "v2.core.batch_job.updated": ( + "stripe.events._v2_core_batch_job_updated_event", + "V2CoreBatchJobUpdatedEventNotification", + ), + "v2.core.batch_job.upload_timeout": ( + "stripe.events._v2_core_batch_job_upload_timeout_event", + "V2CoreBatchJobUploadTimeoutEventNotification", + ), + "v2.core.batch_job.validating": ( + "stripe.events._v2_core_batch_job_validating_event", + "V2CoreBatchJobValidatingEventNotification", + ), + "v2.core.batch_job.validation_failed": ( + "stripe.events._v2_core_batch_job_validation_failed_event", + "V2CoreBatchJobValidationFailedEventNotification", + ), "v2.core.claimable_sandbox.claimed": ( "stripe.events._v2_core_claimable_sandbox_claimed_event", "V2CoreClaimableSandboxClaimedEventNotification", @@ -1796,6 +1935,10 @@ def get_v2_event_class(type_: str): "stripe.events._v2_reporting_report_run_updated_event", "V2ReportingReportRunUpdatedEventNotification", ), + "v2.signals.account_signal.fraudulent_merchant_ready": ( + "stripe.events._v2_signals_account_signal_fraudulent_merchant_ready_event", + "V2SignalsAccountSignalFraudulentMerchantReadyEventNotification", + ), } @@ -1811,6 +1954,7 @@ def get_v2_event_notification_class(type_: str): ALL_EVENT_NOTIFICATIONS = Union[ + "V1AccountSignalsIncludingDelinquencyCreatedEventNotification", "V1BillingMeterErrorReportTriggeredEventNotification", "V1BillingMeterNoMeterFoundEventNotification", "V2BillingCadenceBilledEventNotification", @@ -1871,7 +2015,18 @@ def get_v2_event_notification_class(type_: str): "V2CoreAccountPersonCreatedEventNotification", "V2CoreAccountPersonDeletedEventNotification", "V2CoreAccountPersonUpdatedEventNotification", + "V2CoreAccountSignalsFraudulentWebsiteReadyEventNotification", "V2CoreAccountUpdatedEventNotification", + "V2CoreBatchJobBatchFailedEventNotification", + "V2CoreBatchJobCanceledEventNotification", + "V2CoreBatchJobCompletedEventNotification", + "V2CoreBatchJobCreatedEventNotification", + "V2CoreBatchJobReadyForUploadEventNotification", + "V2CoreBatchJobTimeoutEventNotification", + "V2CoreBatchJobUpdatedEventNotification", + "V2CoreBatchJobUploadTimeoutEventNotification", + "V2CoreBatchJobValidatingEventNotification", + "V2CoreBatchJobValidationFailedEventNotification", "V2CoreClaimableSandboxClaimedEventNotification", "V2CoreClaimableSandboxCreatedEventNotification", "V2CoreClaimableSandboxExpiredEventNotification", @@ -1972,4 +2127,5 @@ def get_v2_event_notification_class(type_: str): "V2ReportingReportRunFailedEventNotification", "V2ReportingReportRunSucceededEventNotification", "V2ReportingReportRunUpdatedEventNotification", + "V2SignalsAccountSignalFraudulentMerchantReadyEventNotification", ] diff --git a/stripe/events/_v1_account_signals_including_delinquency_created_event.py b/stripe/events/_v1_account_signals_including_delinquency_created_event.py new file mode 100644 index 000000000..639aeeb57 --- /dev/null +++ b/stripe/events/_v1_account_signals_including_delinquency_created_event.py @@ -0,0 +1,133 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from decimal import Decimal +from stripe._api_mode import ApiMode +from stripe._stripe_object import StripeObject +from stripe._stripe_response import StripeResponse +from stripe.v2.core._event import Event, EventNotification +from typing import Any, Dict, List, Optional, cast +from typing_extensions import Literal, TYPE_CHECKING, override + +if TYPE_CHECKING: + from stripe._api_requestor import _APIRequestor + + +class V1AccountSignalsIncludingDelinquencyCreatedEventNotification( + EventNotification, +): + LOOKUP_TYPE = "v1.account_signals[delinquency].created" + type: Literal["v1.account_signals[delinquency].created"] + + @override + def fetch_event( + self, + ) -> "V1AccountSignalsIncludingDelinquencyCreatedEvent": + return cast( + "V1AccountSignalsIncludingDelinquencyCreatedEvent", + super().fetch_event(), + ) + + @override + async def fetch_event_async( + self, + ) -> "V1AccountSignalsIncludingDelinquencyCreatedEvent": + return cast( + "V1AccountSignalsIncludingDelinquencyCreatedEvent", + await super().fetch_event_async(), + ) + + +class V1AccountSignalsIncludingDelinquencyCreatedEvent(Event): + LOOKUP_TYPE = "v1.account_signals[delinquency].created" + type: Literal["v1.account_signals[delinquency].created"] + + class V1AccountSignalsIncludingDelinquencyCreatedEventData(StripeObject): + class Indicator(StripeObject): + description: str + """ + A brief explanation of how this indicator contributed to the delinquency probability. + """ + impact: Literal[ + "decrease", "neutral", "slight_increase", "strong_increase" + ] + """ + The effect this indicator had on the overall risk level. + """ + indicator: Literal[ + "account_balance", + "aov", + "charge_concentration", + "disputes", + "dispute_window", + "duplicates", + "exposure", + "firmographic", + "lifetime_metrics", + "payment_processing", + "payment_volume", + "payouts", + "refunds", + "tenure", + "transfers", + ] + """ + The name of the specific indicator used in the risk assessment. + """ + + account: str + """ + The account for which the signals belong to. + """ + evaluated_at: str + """ + Time at which the signal was evaluated. + """ + indicators: List[Indicator] + """ + Array of objects representing individual factors that contributed to the calculated probability of delinquency. + """ + probability: Optional[Decimal] + """ + The probability of delinquency. Can be between 0.00 and 100.00. + """ + risk_level: Literal[ + "elevated", "highest", "low", "normal", "not_assessed", "unknown" + ] + """ + Categorical assessment of the delinquency risk based on probability. + """ + signal_id: str + """ + Unique identifier for the delinquency signal. + """ + _inner_class_types = {"indicators": Indicator} + _field_encodings = {"probability": "decimal_string"} + + data: V1AccountSignalsIncludingDelinquencyCreatedEventData + """ + Data for the v1.account_signals[delinquency].created event + """ + + @classmethod + def _construct_from( + cls, + *, + values: Dict[str, Any], + last_response: Optional[StripeResponse] = None, + requestor: "_APIRequestor", + api_mode: ApiMode, + ) -> "V1AccountSignalsIncludingDelinquencyCreatedEvent": + evt = super()._construct_from( + values=values, + last_response=last_response, + requestor=requestor, + api_mode=api_mode, + ) + if hasattr(evt, "data"): + evt.data = V1AccountSignalsIncludingDelinquencyCreatedEvent.V1AccountSignalsIncludingDelinquencyCreatedEventData._construct_from( + values=evt.data, + last_response=last_response, + requestor=requestor, + api_mode=api_mode, + ) + return evt diff --git a/stripe/events/_v2_core_account_signals_fraudulent_website_ready_event.py b/stripe/events/_v2_core_account_signals_fraudulent_website_ready_event.py new file mode 100644 index 000000000..be6d8910b --- /dev/null +++ b/stripe/events/_v2_core_account_signals_fraudulent_website_ready_event.py @@ -0,0 +1,96 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from stripe._api_mode import ApiMode +from stripe._stripe_object import StripeObject +from stripe._stripe_response import StripeResponse +from stripe.v2.core._event import Event, EventNotification +from typing import Any, Dict, Optional, cast +from typing_extensions import Literal, TYPE_CHECKING, override + +if TYPE_CHECKING: + from stripe._api_requestor import _APIRequestor + + +class V2CoreAccountSignalsFraudulentWebsiteReadyEventNotification( + EventNotification, +): + LOOKUP_TYPE = "v2.core.account_signals.fraudulent_website_ready" + type: Literal["v2.core.account_signals.fraudulent_website_ready"] + + @override + def fetch_event(self) -> "V2CoreAccountSignalsFraudulentWebsiteReadyEvent": + return cast( + "V2CoreAccountSignalsFraudulentWebsiteReadyEvent", + super().fetch_event(), + ) + + @override + async def fetch_event_async( + self, + ) -> "V2CoreAccountSignalsFraudulentWebsiteReadyEvent": + return cast( + "V2CoreAccountSignalsFraudulentWebsiteReadyEvent", + await super().fetch_event_async(), + ) + + +class V2CoreAccountSignalsFraudulentWebsiteReadyEvent(Event): + LOOKUP_TYPE = "v2.core.account_signals.fraudulent_website_ready" + type: Literal["v2.core.account_signals.fraudulent_website_ready"] + + class V2CoreAccountSignalsFraudulentWebsiteReadyEventData(StripeObject): + account: Optional[str] + """ + The account for which the signals belong to. Empty if this was an entityless request. + """ + details: str + """ + Human readable description of concerns found in the website, produced by LLM. If risk_level is unknown, this explains why evaluation could not run. + """ + evaluated_at: str + """ + Time at which the signal was evaluated. + """ + evaluation_id: str + """ + Unique identifier for the fraudulent website evaluation request. + """ + risk_level: Literal[ + "elevated", "highest", "low", "normal", "not_assessed", "unknown" + ] + """ + Risk level for the fraudulent website signal. If evaluation could not run (like invalid website), we return unknown. + """ + signal_id: str + """ + Unique identifier for the fraudulent website signal. + """ + + data: V2CoreAccountSignalsFraudulentWebsiteReadyEventData + """ + Data for the v2.core.account_signals.fraudulent_website_ready event + """ + + @classmethod + def _construct_from( + cls, + *, + values: Dict[str, Any], + last_response: Optional[StripeResponse] = None, + requestor: "_APIRequestor", + api_mode: ApiMode, + ) -> "V2CoreAccountSignalsFraudulentWebsiteReadyEvent": + evt = super()._construct_from( + values=values, + last_response=last_response, + requestor=requestor, + api_mode=api_mode, + ) + if hasattr(evt, "data"): + evt.data = V2CoreAccountSignalsFraudulentWebsiteReadyEvent.V2CoreAccountSignalsFraudulentWebsiteReadyEventData._construct_from( + values=evt.data, + last_response=last_response, + requestor=requestor, + api_mode=api_mode, + ) + return evt diff --git a/stripe/events/_v2_core_batch_job_batch_failed_event.py b/stripe/events/_v2_core_batch_job_batch_failed_event.py new file mode 100644 index 000000000..770b286de --- /dev/null +++ b/stripe/events/_v2_core_batch_job_batch_failed_event.py @@ -0,0 +1,113 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from stripe._stripe_object import StripeObject +from stripe._util import get_api_mode +from stripe.v2.core._event import Event, EventNotification, RelatedObject +from typing import Any, Dict, cast +from typing_extensions import Literal, TYPE_CHECKING, override + +if TYPE_CHECKING: + from stripe._stripe_client import StripeClient + from stripe.v2.core._batch_job import BatchJob + + +class V2CoreBatchJobBatchFailedEventNotification(EventNotification): + LOOKUP_TYPE = "v2.core.batch_job.batch_failed" + type: Literal["v2.core.batch_job.batch_failed"] + related_object: RelatedObject + + def __init__( + self, parsed_body: Dict[str, Any], client: "StripeClient" + ) -> None: + super().__init__( + parsed_body, + client, + ) + self.related_object = RelatedObject(parsed_body["related_object"]) + + @override + def fetch_event(self) -> "V2CoreBatchJobBatchFailedEvent": + return cast( + "V2CoreBatchJobBatchFailedEvent", + super().fetch_event(), + ) + + def fetch_related_object(self) -> "BatchJob": + response = self._client.raw_request( + "get", + self.related_object.url, + stripe_context=self.context, + headers={"Stripe-Request-Trigger": f"event={self.id}"}, + usage=["fetch_related_object"], + ) + return cast( + "BatchJob", + self._client.deserialize( + response, + api_mode=get_api_mode(self.related_object.url), + ), + ) + + @override + async def fetch_event_async(self) -> "V2CoreBatchJobBatchFailedEvent": + return cast( + "V2CoreBatchJobBatchFailedEvent", + await super().fetch_event_async(), + ) + + async def fetch_related_object_async(self) -> "BatchJob": + response = await self._client.raw_request_async( + "get", + self.related_object.url, + stripe_context=self.context, + headers={"Stripe-Request-Trigger": f"event={self.id}"}, + usage=["fetch_related_object"], + ) + return cast( + "BatchJob", + self._client.deserialize( + response, + api_mode=get_api_mode(self.related_object.url), + ), + ) + + +class V2CoreBatchJobBatchFailedEvent(Event): + LOOKUP_TYPE = "v2.core.batch_job.batch_failed" + type: Literal["v2.core.batch_job.batch_failed"] + + class RelatedObject(StripeObject): + id: str + """ + Unique identifier for the object relevant to the event. + """ + type: str + """ + Type of the object relevant to the event. + """ + url: str + """ + URL to retrieve the resource. + """ + + related_object: RelatedObject + """ + Object containing the reference to API resource relevant to the event + """ + + def fetch_related_object(self) -> "BatchJob": + """ + Retrieves the related object from the API. Makes an API request on every call. + """ + return cast( + "BatchJob", + self._requestor.request( + "get", + self.related_object.url, + base_address="api", + options={ + "stripe_context": self.context, + "headers": {"Stripe-Request-Trigger": f"event={self.id}"}, + }, + ), + ) diff --git a/stripe/events/_v2_core_batch_job_canceled_event.py b/stripe/events/_v2_core_batch_job_canceled_event.py new file mode 100644 index 000000000..35aaa37cf --- /dev/null +++ b/stripe/events/_v2_core_batch_job_canceled_event.py @@ -0,0 +1,113 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from stripe._stripe_object import StripeObject +from stripe._util import get_api_mode +from stripe.v2.core._event import Event, EventNotification, RelatedObject +from typing import Any, Dict, cast +from typing_extensions import Literal, TYPE_CHECKING, override + +if TYPE_CHECKING: + from stripe._stripe_client import StripeClient + from stripe.v2.core._batch_job import BatchJob + + +class V2CoreBatchJobCanceledEventNotification(EventNotification): + LOOKUP_TYPE = "v2.core.batch_job.canceled" + type: Literal["v2.core.batch_job.canceled"] + related_object: RelatedObject + + def __init__( + self, parsed_body: Dict[str, Any], client: "StripeClient" + ) -> None: + super().__init__( + parsed_body, + client, + ) + self.related_object = RelatedObject(parsed_body["related_object"]) + + @override + def fetch_event(self) -> "V2CoreBatchJobCanceledEvent": + return cast( + "V2CoreBatchJobCanceledEvent", + super().fetch_event(), + ) + + def fetch_related_object(self) -> "BatchJob": + response = self._client.raw_request( + "get", + self.related_object.url, + stripe_context=self.context, + headers={"Stripe-Request-Trigger": f"event={self.id}"}, + usage=["fetch_related_object"], + ) + return cast( + "BatchJob", + self._client.deserialize( + response, + api_mode=get_api_mode(self.related_object.url), + ), + ) + + @override + async def fetch_event_async(self) -> "V2CoreBatchJobCanceledEvent": + return cast( + "V2CoreBatchJobCanceledEvent", + await super().fetch_event_async(), + ) + + async def fetch_related_object_async(self) -> "BatchJob": + response = await self._client.raw_request_async( + "get", + self.related_object.url, + stripe_context=self.context, + headers={"Stripe-Request-Trigger": f"event={self.id}"}, + usage=["fetch_related_object"], + ) + return cast( + "BatchJob", + self._client.deserialize( + response, + api_mode=get_api_mode(self.related_object.url), + ), + ) + + +class V2CoreBatchJobCanceledEvent(Event): + LOOKUP_TYPE = "v2.core.batch_job.canceled" + type: Literal["v2.core.batch_job.canceled"] + + class RelatedObject(StripeObject): + id: str + """ + Unique identifier for the object relevant to the event. + """ + type: str + """ + Type of the object relevant to the event. + """ + url: str + """ + URL to retrieve the resource. + """ + + related_object: RelatedObject + """ + Object containing the reference to API resource relevant to the event + """ + + def fetch_related_object(self) -> "BatchJob": + """ + Retrieves the related object from the API. Makes an API request on every call. + """ + return cast( + "BatchJob", + self._requestor.request( + "get", + self.related_object.url, + base_address="api", + options={ + "stripe_context": self.context, + "headers": {"Stripe-Request-Trigger": f"event={self.id}"}, + }, + ), + ) diff --git a/stripe/events/_v2_core_batch_job_completed_event.py b/stripe/events/_v2_core_batch_job_completed_event.py new file mode 100644 index 000000000..cdf0189a7 --- /dev/null +++ b/stripe/events/_v2_core_batch_job_completed_event.py @@ -0,0 +1,113 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from stripe._stripe_object import StripeObject +from stripe._util import get_api_mode +from stripe.v2.core._event import Event, EventNotification, RelatedObject +from typing import Any, Dict, cast +from typing_extensions import Literal, TYPE_CHECKING, override + +if TYPE_CHECKING: + from stripe._stripe_client import StripeClient + from stripe.v2.core._batch_job import BatchJob + + +class V2CoreBatchJobCompletedEventNotification(EventNotification): + LOOKUP_TYPE = "v2.core.batch_job.completed" + type: Literal["v2.core.batch_job.completed"] + related_object: RelatedObject + + def __init__( + self, parsed_body: Dict[str, Any], client: "StripeClient" + ) -> None: + super().__init__( + parsed_body, + client, + ) + self.related_object = RelatedObject(parsed_body["related_object"]) + + @override + def fetch_event(self) -> "V2CoreBatchJobCompletedEvent": + return cast( + "V2CoreBatchJobCompletedEvent", + super().fetch_event(), + ) + + def fetch_related_object(self) -> "BatchJob": + response = self._client.raw_request( + "get", + self.related_object.url, + stripe_context=self.context, + headers={"Stripe-Request-Trigger": f"event={self.id}"}, + usage=["fetch_related_object"], + ) + return cast( + "BatchJob", + self._client.deserialize( + response, + api_mode=get_api_mode(self.related_object.url), + ), + ) + + @override + async def fetch_event_async(self) -> "V2CoreBatchJobCompletedEvent": + return cast( + "V2CoreBatchJobCompletedEvent", + await super().fetch_event_async(), + ) + + async def fetch_related_object_async(self) -> "BatchJob": + response = await self._client.raw_request_async( + "get", + self.related_object.url, + stripe_context=self.context, + headers={"Stripe-Request-Trigger": f"event={self.id}"}, + usage=["fetch_related_object"], + ) + return cast( + "BatchJob", + self._client.deserialize( + response, + api_mode=get_api_mode(self.related_object.url), + ), + ) + + +class V2CoreBatchJobCompletedEvent(Event): + LOOKUP_TYPE = "v2.core.batch_job.completed" + type: Literal["v2.core.batch_job.completed"] + + class RelatedObject(StripeObject): + id: str + """ + Unique identifier for the object relevant to the event. + """ + type: str + """ + Type of the object relevant to the event. + """ + url: str + """ + URL to retrieve the resource. + """ + + related_object: RelatedObject + """ + Object containing the reference to API resource relevant to the event + """ + + def fetch_related_object(self) -> "BatchJob": + """ + Retrieves the related object from the API. Makes an API request on every call. + """ + return cast( + "BatchJob", + self._requestor.request( + "get", + self.related_object.url, + base_address="api", + options={ + "stripe_context": self.context, + "headers": {"Stripe-Request-Trigger": f"event={self.id}"}, + }, + ), + ) diff --git a/stripe/events/_v2_core_batch_job_created_event.py b/stripe/events/_v2_core_batch_job_created_event.py new file mode 100644 index 000000000..3c9cf6e2a --- /dev/null +++ b/stripe/events/_v2_core_batch_job_created_event.py @@ -0,0 +1,113 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from stripe._stripe_object import StripeObject +from stripe._util import get_api_mode +from stripe.v2.core._event import Event, EventNotification, RelatedObject +from typing import Any, Dict, cast +from typing_extensions import Literal, TYPE_CHECKING, override + +if TYPE_CHECKING: + from stripe._stripe_client import StripeClient + from stripe.v2.core._batch_job import BatchJob + + +class V2CoreBatchJobCreatedEventNotification(EventNotification): + LOOKUP_TYPE = "v2.core.batch_job.created" + type: Literal["v2.core.batch_job.created"] + related_object: RelatedObject + + def __init__( + self, parsed_body: Dict[str, Any], client: "StripeClient" + ) -> None: + super().__init__( + parsed_body, + client, + ) + self.related_object = RelatedObject(parsed_body["related_object"]) + + @override + def fetch_event(self) -> "V2CoreBatchJobCreatedEvent": + return cast( + "V2CoreBatchJobCreatedEvent", + super().fetch_event(), + ) + + def fetch_related_object(self) -> "BatchJob": + response = self._client.raw_request( + "get", + self.related_object.url, + stripe_context=self.context, + headers={"Stripe-Request-Trigger": f"event={self.id}"}, + usage=["fetch_related_object"], + ) + return cast( + "BatchJob", + self._client.deserialize( + response, + api_mode=get_api_mode(self.related_object.url), + ), + ) + + @override + async def fetch_event_async(self) -> "V2CoreBatchJobCreatedEvent": + return cast( + "V2CoreBatchJobCreatedEvent", + await super().fetch_event_async(), + ) + + async def fetch_related_object_async(self) -> "BatchJob": + response = await self._client.raw_request_async( + "get", + self.related_object.url, + stripe_context=self.context, + headers={"Stripe-Request-Trigger": f"event={self.id}"}, + usage=["fetch_related_object"], + ) + return cast( + "BatchJob", + self._client.deserialize( + response, + api_mode=get_api_mode(self.related_object.url), + ), + ) + + +class V2CoreBatchJobCreatedEvent(Event): + LOOKUP_TYPE = "v2.core.batch_job.created" + type: Literal["v2.core.batch_job.created"] + + class RelatedObject(StripeObject): + id: str + """ + Unique identifier for the object relevant to the event. + """ + type: str + """ + Type of the object relevant to the event. + """ + url: str + """ + URL to retrieve the resource. + """ + + related_object: RelatedObject + """ + Object containing the reference to API resource relevant to the event + """ + + def fetch_related_object(self) -> "BatchJob": + """ + Retrieves the related object from the API. Makes an API request on every call. + """ + return cast( + "BatchJob", + self._requestor.request( + "get", + self.related_object.url, + base_address="api", + options={ + "stripe_context": self.context, + "headers": {"Stripe-Request-Trigger": f"event={self.id}"}, + }, + ), + ) diff --git a/stripe/events/_v2_core_batch_job_ready_for_upload_event.py b/stripe/events/_v2_core_batch_job_ready_for_upload_event.py new file mode 100644 index 000000000..48bc78368 --- /dev/null +++ b/stripe/events/_v2_core_batch_job_ready_for_upload_event.py @@ -0,0 +1,113 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from stripe._stripe_object import StripeObject +from stripe._util import get_api_mode +from stripe.v2.core._event import Event, EventNotification, RelatedObject +from typing import Any, Dict, cast +from typing_extensions import Literal, TYPE_CHECKING, override + +if TYPE_CHECKING: + from stripe._stripe_client import StripeClient + from stripe.v2.core._batch_job import BatchJob + + +class V2CoreBatchJobReadyForUploadEventNotification(EventNotification): + LOOKUP_TYPE = "v2.core.batch_job.ready_for_upload" + type: Literal["v2.core.batch_job.ready_for_upload"] + related_object: RelatedObject + + def __init__( + self, parsed_body: Dict[str, Any], client: "StripeClient" + ) -> None: + super().__init__( + parsed_body, + client, + ) + self.related_object = RelatedObject(parsed_body["related_object"]) + + @override + def fetch_event(self) -> "V2CoreBatchJobReadyForUploadEvent": + return cast( + "V2CoreBatchJobReadyForUploadEvent", + super().fetch_event(), + ) + + def fetch_related_object(self) -> "BatchJob": + response = self._client.raw_request( + "get", + self.related_object.url, + stripe_context=self.context, + headers={"Stripe-Request-Trigger": f"event={self.id}"}, + usage=["fetch_related_object"], + ) + return cast( + "BatchJob", + self._client.deserialize( + response, + api_mode=get_api_mode(self.related_object.url), + ), + ) + + @override + async def fetch_event_async(self) -> "V2CoreBatchJobReadyForUploadEvent": + return cast( + "V2CoreBatchJobReadyForUploadEvent", + await super().fetch_event_async(), + ) + + async def fetch_related_object_async(self) -> "BatchJob": + response = await self._client.raw_request_async( + "get", + self.related_object.url, + stripe_context=self.context, + headers={"Stripe-Request-Trigger": f"event={self.id}"}, + usage=["fetch_related_object"], + ) + return cast( + "BatchJob", + self._client.deserialize( + response, + api_mode=get_api_mode(self.related_object.url), + ), + ) + + +class V2CoreBatchJobReadyForUploadEvent(Event): + LOOKUP_TYPE = "v2.core.batch_job.ready_for_upload" + type: Literal["v2.core.batch_job.ready_for_upload"] + + class RelatedObject(StripeObject): + id: str + """ + Unique identifier for the object relevant to the event. + """ + type: str + """ + Type of the object relevant to the event. + """ + url: str + """ + URL to retrieve the resource. + """ + + related_object: RelatedObject + """ + Object containing the reference to API resource relevant to the event + """ + + def fetch_related_object(self) -> "BatchJob": + """ + Retrieves the related object from the API. Makes an API request on every call. + """ + return cast( + "BatchJob", + self._requestor.request( + "get", + self.related_object.url, + base_address="api", + options={ + "stripe_context": self.context, + "headers": {"Stripe-Request-Trigger": f"event={self.id}"}, + }, + ), + ) diff --git a/stripe/events/_v2_core_batch_job_timeout_event.py b/stripe/events/_v2_core_batch_job_timeout_event.py new file mode 100644 index 000000000..b695242d4 --- /dev/null +++ b/stripe/events/_v2_core_batch_job_timeout_event.py @@ -0,0 +1,113 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from stripe._stripe_object import StripeObject +from stripe._util import get_api_mode +from stripe.v2.core._event import Event, EventNotification, RelatedObject +from typing import Any, Dict, cast +from typing_extensions import Literal, TYPE_CHECKING, override + +if TYPE_CHECKING: + from stripe._stripe_client import StripeClient + from stripe.v2.core._batch_job import BatchJob + + +class V2CoreBatchJobTimeoutEventNotification(EventNotification): + LOOKUP_TYPE = "v2.core.batch_job.timeout" + type: Literal["v2.core.batch_job.timeout"] + related_object: RelatedObject + + def __init__( + self, parsed_body: Dict[str, Any], client: "StripeClient" + ) -> None: + super().__init__( + parsed_body, + client, + ) + self.related_object = RelatedObject(parsed_body["related_object"]) + + @override + def fetch_event(self) -> "V2CoreBatchJobTimeoutEvent": + return cast( + "V2CoreBatchJobTimeoutEvent", + super().fetch_event(), + ) + + def fetch_related_object(self) -> "BatchJob": + response = self._client.raw_request( + "get", + self.related_object.url, + stripe_context=self.context, + headers={"Stripe-Request-Trigger": f"event={self.id}"}, + usage=["fetch_related_object"], + ) + return cast( + "BatchJob", + self._client.deserialize( + response, + api_mode=get_api_mode(self.related_object.url), + ), + ) + + @override + async def fetch_event_async(self) -> "V2CoreBatchJobTimeoutEvent": + return cast( + "V2CoreBatchJobTimeoutEvent", + await super().fetch_event_async(), + ) + + async def fetch_related_object_async(self) -> "BatchJob": + response = await self._client.raw_request_async( + "get", + self.related_object.url, + stripe_context=self.context, + headers={"Stripe-Request-Trigger": f"event={self.id}"}, + usage=["fetch_related_object"], + ) + return cast( + "BatchJob", + self._client.deserialize( + response, + api_mode=get_api_mode(self.related_object.url), + ), + ) + + +class V2CoreBatchJobTimeoutEvent(Event): + LOOKUP_TYPE = "v2.core.batch_job.timeout" + type: Literal["v2.core.batch_job.timeout"] + + class RelatedObject(StripeObject): + id: str + """ + Unique identifier for the object relevant to the event. + """ + type: str + """ + Type of the object relevant to the event. + """ + url: str + """ + URL to retrieve the resource. + """ + + related_object: RelatedObject + """ + Object containing the reference to API resource relevant to the event + """ + + def fetch_related_object(self) -> "BatchJob": + """ + Retrieves the related object from the API. Makes an API request on every call. + """ + return cast( + "BatchJob", + self._requestor.request( + "get", + self.related_object.url, + base_address="api", + options={ + "stripe_context": self.context, + "headers": {"Stripe-Request-Trigger": f"event={self.id}"}, + }, + ), + ) diff --git a/stripe/events/_v2_core_batch_job_updated_event.py b/stripe/events/_v2_core_batch_job_updated_event.py new file mode 100644 index 000000000..3b1c01845 --- /dev/null +++ b/stripe/events/_v2_core_batch_job_updated_event.py @@ -0,0 +1,113 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from stripe._stripe_object import StripeObject +from stripe._util import get_api_mode +from stripe.v2.core._event import Event, EventNotification, RelatedObject +from typing import Any, Dict, cast +from typing_extensions import Literal, TYPE_CHECKING, override + +if TYPE_CHECKING: + from stripe._stripe_client import StripeClient + from stripe.v2.core._batch_job import BatchJob + + +class V2CoreBatchJobUpdatedEventNotification(EventNotification): + LOOKUP_TYPE = "v2.core.batch_job.updated" + type: Literal["v2.core.batch_job.updated"] + related_object: RelatedObject + + def __init__( + self, parsed_body: Dict[str, Any], client: "StripeClient" + ) -> None: + super().__init__( + parsed_body, + client, + ) + self.related_object = RelatedObject(parsed_body["related_object"]) + + @override + def fetch_event(self) -> "V2CoreBatchJobUpdatedEvent": + return cast( + "V2CoreBatchJobUpdatedEvent", + super().fetch_event(), + ) + + def fetch_related_object(self) -> "BatchJob": + response = self._client.raw_request( + "get", + self.related_object.url, + stripe_context=self.context, + headers={"Stripe-Request-Trigger": f"event={self.id}"}, + usage=["fetch_related_object"], + ) + return cast( + "BatchJob", + self._client.deserialize( + response, + api_mode=get_api_mode(self.related_object.url), + ), + ) + + @override + async def fetch_event_async(self) -> "V2CoreBatchJobUpdatedEvent": + return cast( + "V2CoreBatchJobUpdatedEvent", + await super().fetch_event_async(), + ) + + async def fetch_related_object_async(self) -> "BatchJob": + response = await self._client.raw_request_async( + "get", + self.related_object.url, + stripe_context=self.context, + headers={"Stripe-Request-Trigger": f"event={self.id}"}, + usage=["fetch_related_object"], + ) + return cast( + "BatchJob", + self._client.deserialize( + response, + api_mode=get_api_mode(self.related_object.url), + ), + ) + + +class V2CoreBatchJobUpdatedEvent(Event): + LOOKUP_TYPE = "v2.core.batch_job.updated" + type: Literal["v2.core.batch_job.updated"] + + class RelatedObject(StripeObject): + id: str + """ + Unique identifier for the object relevant to the event. + """ + type: str + """ + Type of the object relevant to the event. + """ + url: str + """ + URL to retrieve the resource. + """ + + related_object: RelatedObject + """ + Object containing the reference to API resource relevant to the event + """ + + def fetch_related_object(self) -> "BatchJob": + """ + Retrieves the related object from the API. Makes an API request on every call. + """ + return cast( + "BatchJob", + self._requestor.request( + "get", + self.related_object.url, + base_address="api", + options={ + "stripe_context": self.context, + "headers": {"Stripe-Request-Trigger": f"event={self.id}"}, + }, + ), + ) diff --git a/stripe/events/_v2_core_batch_job_upload_timeout_event.py b/stripe/events/_v2_core_batch_job_upload_timeout_event.py new file mode 100644 index 000000000..fa875c7a8 --- /dev/null +++ b/stripe/events/_v2_core_batch_job_upload_timeout_event.py @@ -0,0 +1,113 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from stripe._stripe_object import StripeObject +from stripe._util import get_api_mode +from stripe.v2.core._event import Event, EventNotification, RelatedObject +from typing import Any, Dict, cast +from typing_extensions import Literal, TYPE_CHECKING, override + +if TYPE_CHECKING: + from stripe._stripe_client import StripeClient + from stripe.v2.core._batch_job import BatchJob + + +class V2CoreBatchJobUploadTimeoutEventNotification(EventNotification): + LOOKUP_TYPE = "v2.core.batch_job.upload_timeout" + type: Literal["v2.core.batch_job.upload_timeout"] + related_object: RelatedObject + + def __init__( + self, parsed_body: Dict[str, Any], client: "StripeClient" + ) -> None: + super().__init__( + parsed_body, + client, + ) + self.related_object = RelatedObject(parsed_body["related_object"]) + + @override + def fetch_event(self) -> "V2CoreBatchJobUploadTimeoutEvent": + return cast( + "V2CoreBatchJobUploadTimeoutEvent", + super().fetch_event(), + ) + + def fetch_related_object(self) -> "BatchJob": + response = self._client.raw_request( + "get", + self.related_object.url, + stripe_context=self.context, + headers={"Stripe-Request-Trigger": f"event={self.id}"}, + usage=["fetch_related_object"], + ) + return cast( + "BatchJob", + self._client.deserialize( + response, + api_mode=get_api_mode(self.related_object.url), + ), + ) + + @override + async def fetch_event_async(self) -> "V2CoreBatchJobUploadTimeoutEvent": + return cast( + "V2CoreBatchJobUploadTimeoutEvent", + await super().fetch_event_async(), + ) + + async def fetch_related_object_async(self) -> "BatchJob": + response = await self._client.raw_request_async( + "get", + self.related_object.url, + stripe_context=self.context, + headers={"Stripe-Request-Trigger": f"event={self.id}"}, + usage=["fetch_related_object"], + ) + return cast( + "BatchJob", + self._client.deserialize( + response, + api_mode=get_api_mode(self.related_object.url), + ), + ) + + +class V2CoreBatchJobUploadTimeoutEvent(Event): + LOOKUP_TYPE = "v2.core.batch_job.upload_timeout" + type: Literal["v2.core.batch_job.upload_timeout"] + + class RelatedObject(StripeObject): + id: str + """ + Unique identifier for the object relevant to the event. + """ + type: str + """ + Type of the object relevant to the event. + """ + url: str + """ + URL to retrieve the resource. + """ + + related_object: RelatedObject + """ + Object containing the reference to API resource relevant to the event + """ + + def fetch_related_object(self) -> "BatchJob": + """ + Retrieves the related object from the API. Makes an API request on every call. + """ + return cast( + "BatchJob", + self._requestor.request( + "get", + self.related_object.url, + base_address="api", + options={ + "stripe_context": self.context, + "headers": {"Stripe-Request-Trigger": f"event={self.id}"}, + }, + ), + ) diff --git a/stripe/events/_v2_core_batch_job_validating_event.py b/stripe/events/_v2_core_batch_job_validating_event.py new file mode 100644 index 000000000..c7794401e --- /dev/null +++ b/stripe/events/_v2_core_batch_job_validating_event.py @@ -0,0 +1,113 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from stripe._stripe_object import StripeObject +from stripe._util import get_api_mode +from stripe.v2.core._event import Event, EventNotification, RelatedObject +from typing import Any, Dict, cast +from typing_extensions import Literal, TYPE_CHECKING, override + +if TYPE_CHECKING: + from stripe._stripe_client import StripeClient + from stripe.v2.core._batch_job import BatchJob + + +class V2CoreBatchJobValidatingEventNotification(EventNotification): + LOOKUP_TYPE = "v2.core.batch_job.validating" + type: Literal["v2.core.batch_job.validating"] + related_object: RelatedObject + + def __init__( + self, parsed_body: Dict[str, Any], client: "StripeClient" + ) -> None: + super().__init__( + parsed_body, + client, + ) + self.related_object = RelatedObject(parsed_body["related_object"]) + + @override + def fetch_event(self) -> "V2CoreBatchJobValidatingEvent": + return cast( + "V2CoreBatchJobValidatingEvent", + super().fetch_event(), + ) + + def fetch_related_object(self) -> "BatchJob": + response = self._client.raw_request( + "get", + self.related_object.url, + stripe_context=self.context, + headers={"Stripe-Request-Trigger": f"event={self.id}"}, + usage=["fetch_related_object"], + ) + return cast( + "BatchJob", + self._client.deserialize( + response, + api_mode=get_api_mode(self.related_object.url), + ), + ) + + @override + async def fetch_event_async(self) -> "V2CoreBatchJobValidatingEvent": + return cast( + "V2CoreBatchJobValidatingEvent", + await super().fetch_event_async(), + ) + + async def fetch_related_object_async(self) -> "BatchJob": + response = await self._client.raw_request_async( + "get", + self.related_object.url, + stripe_context=self.context, + headers={"Stripe-Request-Trigger": f"event={self.id}"}, + usage=["fetch_related_object"], + ) + return cast( + "BatchJob", + self._client.deserialize( + response, + api_mode=get_api_mode(self.related_object.url), + ), + ) + + +class V2CoreBatchJobValidatingEvent(Event): + LOOKUP_TYPE = "v2.core.batch_job.validating" + type: Literal["v2.core.batch_job.validating"] + + class RelatedObject(StripeObject): + id: str + """ + Unique identifier for the object relevant to the event. + """ + type: str + """ + Type of the object relevant to the event. + """ + url: str + """ + URL to retrieve the resource. + """ + + related_object: RelatedObject + """ + Object containing the reference to API resource relevant to the event + """ + + def fetch_related_object(self) -> "BatchJob": + """ + Retrieves the related object from the API. Makes an API request on every call. + """ + return cast( + "BatchJob", + self._requestor.request( + "get", + self.related_object.url, + base_address="api", + options={ + "stripe_context": self.context, + "headers": {"Stripe-Request-Trigger": f"event={self.id}"}, + }, + ), + ) diff --git a/stripe/events/_v2_core_batch_job_validation_failed_event.py b/stripe/events/_v2_core_batch_job_validation_failed_event.py new file mode 100644 index 000000000..b83936b9e --- /dev/null +++ b/stripe/events/_v2_core_batch_job_validation_failed_event.py @@ -0,0 +1,113 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from stripe._stripe_object import StripeObject +from stripe._util import get_api_mode +from stripe.v2.core._event import Event, EventNotification, RelatedObject +from typing import Any, Dict, cast +from typing_extensions import Literal, TYPE_CHECKING, override + +if TYPE_CHECKING: + from stripe._stripe_client import StripeClient + from stripe.v2.core._batch_job import BatchJob + + +class V2CoreBatchJobValidationFailedEventNotification(EventNotification): + LOOKUP_TYPE = "v2.core.batch_job.validation_failed" + type: Literal["v2.core.batch_job.validation_failed"] + related_object: RelatedObject + + def __init__( + self, parsed_body: Dict[str, Any], client: "StripeClient" + ) -> None: + super().__init__( + parsed_body, + client, + ) + self.related_object = RelatedObject(parsed_body["related_object"]) + + @override + def fetch_event(self) -> "V2CoreBatchJobValidationFailedEvent": + return cast( + "V2CoreBatchJobValidationFailedEvent", + super().fetch_event(), + ) + + def fetch_related_object(self) -> "BatchJob": + response = self._client.raw_request( + "get", + self.related_object.url, + stripe_context=self.context, + headers={"Stripe-Request-Trigger": f"event={self.id}"}, + usage=["fetch_related_object"], + ) + return cast( + "BatchJob", + self._client.deserialize( + response, + api_mode=get_api_mode(self.related_object.url), + ), + ) + + @override + async def fetch_event_async(self) -> "V2CoreBatchJobValidationFailedEvent": + return cast( + "V2CoreBatchJobValidationFailedEvent", + await super().fetch_event_async(), + ) + + async def fetch_related_object_async(self) -> "BatchJob": + response = await self._client.raw_request_async( + "get", + self.related_object.url, + stripe_context=self.context, + headers={"Stripe-Request-Trigger": f"event={self.id}"}, + usage=["fetch_related_object"], + ) + return cast( + "BatchJob", + self._client.deserialize( + response, + api_mode=get_api_mode(self.related_object.url), + ), + ) + + +class V2CoreBatchJobValidationFailedEvent(Event): + LOOKUP_TYPE = "v2.core.batch_job.validation_failed" + type: Literal["v2.core.batch_job.validation_failed"] + + class RelatedObject(StripeObject): + id: str + """ + Unique identifier for the object relevant to the event. + """ + type: str + """ + Type of the object relevant to the event. + """ + url: str + """ + URL to retrieve the resource. + """ + + related_object: RelatedObject + """ + Object containing the reference to API resource relevant to the event + """ + + def fetch_related_object(self) -> "BatchJob": + """ + Retrieves the related object from the API. Makes an API request on every call. + """ + return cast( + "BatchJob", + self._requestor.request( + "get", + self.related_object.url, + base_address="api", + options={ + "stripe_context": self.context, + "headers": {"Stripe-Request-Trigger": f"event={self.id}"}, + }, + ), + ) diff --git a/stripe/events/_v2_core_health_api_error_firing_event.py b/stripe/events/_v2_core_health_api_error_firing_event.py index b4b29303d..111527db5 100644 --- a/stripe/events/_v2_core_health_api_error_firing_event.py +++ b/stripe/events/_v2_core_health_api_error_firing_event.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from decimal import Decimal from stripe._api_mode import ApiMode from stripe._stripe_object import StripeObject from stripe._stripe_response import StripeResponse @@ -45,10 +46,13 @@ class TopImpactedAccount(StripeObject): """ The number of impacted requests. """ - impacted_requests_percentage: Optional[str] + impacted_requests_percentage: Optional[Decimal] """ The percentage of impacted requests. """ + _field_encodings = { + "impacted_requests_percentage": "decimal_string", + } canonical_path: str """ @@ -70,7 +74,7 @@ class TopImpactedAccount(StripeObject): """ The number of impacted requests. """ - impacted_requests_percentage: Optional[str] + impacted_requests_percentage: Optional[Decimal] """ The percentage of impacted requests. """ @@ -79,6 +83,9 @@ class TopImpactedAccount(StripeObject): The top impacted connected accounts (only for platforms). """ _inner_class_types = {"top_impacted_accounts": TopImpactedAccount} + _field_encodings = { + "impacted_requests_percentage": "decimal_string", + } alert_id: str """ diff --git a/stripe/events/_v2_core_health_api_error_resolved_event.py b/stripe/events/_v2_core_health_api_error_resolved_event.py index a8ed7f6a4..0b8312237 100644 --- a/stripe/events/_v2_core_health_api_error_resolved_event.py +++ b/stripe/events/_v2_core_health_api_error_resolved_event.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from decimal import Decimal from stripe._api_mode import ApiMode from stripe._stripe_object import StripeObject from stripe._stripe_response import StripeResponse @@ -45,10 +46,13 @@ class TopImpactedAccount(StripeObject): """ The number of impacted requests. """ - impacted_requests_percentage: Optional[str] + impacted_requests_percentage: Optional[Decimal] """ The percentage of impacted requests. """ + _field_encodings = { + "impacted_requests_percentage": "decimal_string", + } canonical_path: str """ @@ -70,7 +74,7 @@ class TopImpactedAccount(StripeObject): """ The number of impacted requests. """ - impacted_requests_percentage: Optional[str] + impacted_requests_percentage: Optional[Decimal] """ The percentage of impacted requests. """ @@ -79,6 +83,9 @@ class TopImpactedAccount(StripeObject): The top impacted connected accounts (only for platforms). """ _inner_class_types = {"top_impacted_accounts": TopImpactedAccount} + _field_encodings = { + "impacted_requests_percentage": "decimal_string", + } grouping_key: str """ diff --git a/stripe/events/_v2_core_health_api_latency_firing_event.py b/stripe/events/_v2_core_health_api_latency_firing_event.py index f98e971da..cf0df138d 100644 --- a/stripe/events/_v2_core_health_api_latency_firing_event.py +++ b/stripe/events/_v2_core_health_api_latency_firing_event.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from decimal import Decimal from stripe._api_mode import ApiMode from stripe._stripe_object import StripeObject from stripe._stripe_response import StripeResponse @@ -45,10 +46,13 @@ class TopImpactedAccount(StripeObject): """ The number of impacted requests. """ - impacted_requests_percentage: Optional[str] + impacted_requests_percentage: Optional[Decimal] """ The percentage of impacted requests. """ + _field_encodings = { + "impacted_requests_percentage": "decimal_string", + } canonical_path: str """ @@ -66,7 +70,7 @@ class TopImpactedAccount(StripeObject): """ The number of impacted requests. """ - impacted_requests_percentage: Optional[str] + impacted_requests_percentage: Optional[Decimal] """ The percentage of impacted requests. """ @@ -75,6 +79,9 @@ class TopImpactedAccount(StripeObject): The top impacted connected accounts (only for platforms). """ _inner_class_types = {"top_impacted_accounts": TopImpactedAccount} + _field_encodings = { + "impacted_requests_percentage": "decimal_string", + } alert_id: str """ diff --git a/stripe/events/_v2_core_health_api_latency_resolved_event.py b/stripe/events/_v2_core_health_api_latency_resolved_event.py index d4f371df3..8174779c7 100644 --- a/stripe/events/_v2_core_health_api_latency_resolved_event.py +++ b/stripe/events/_v2_core_health_api_latency_resolved_event.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from decimal import Decimal from stripe._api_mode import ApiMode from stripe._stripe_object import StripeObject from stripe._stripe_response import StripeResponse @@ -45,10 +46,13 @@ class TopImpactedAccount(StripeObject): """ The number of impacted requests. """ - impacted_requests_percentage: Optional[str] + impacted_requests_percentage: Optional[Decimal] """ The percentage of impacted requests. """ + _field_encodings = { + "impacted_requests_percentage": "decimal_string", + } canonical_path: str """ @@ -66,7 +70,7 @@ class TopImpactedAccount(StripeObject): """ The number of impacted requests. """ - impacted_requests_percentage: Optional[str] + impacted_requests_percentage: Optional[Decimal] """ The percentage of impacted requests. """ @@ -75,6 +79,9 @@ class TopImpactedAccount(StripeObject): The top impacted connected accounts (only for platforms). """ _inner_class_types = {"top_impacted_accounts": TopImpactedAccount} + _field_encodings = { + "impacted_requests_percentage": "decimal_string", + } grouping_key: str """ diff --git a/stripe/events/_v2_core_health_authorization_rate_drop_firing_event.py b/stripe/events/_v2_core_health_authorization_rate_drop_firing_event.py index 34c5dcb9e..92a6d0ea8 100644 --- a/stripe/events/_v2_core_health_authorization_rate_drop_firing_event.py +++ b/stripe/events/_v2_core_health_authorization_rate_drop_firing_event.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from decimal import Decimal from stripe._api_mode import ApiMode from stripe._stripe_object import StripeObject from stripe._stripe_response import StripeResponse @@ -54,7 +55,7 @@ class Dimension(StripeObject): """ The type of the charge. """ - current_percentage: str + current_percentage: Decimal """ The current authorization rate percentage. """ @@ -136,11 +137,15 @@ class Dimension(StripeObject): """ The type of the payment method. """ - previous_percentage: str + previous_percentage: Decimal """ The previous authorization rate percentage. """ _inner_class_types = {"dimensions": Dimension} + _field_encodings = { + "current_percentage": "decimal_string", + "previous_percentage": "decimal_string", + } alert_id: str """ diff --git a/stripe/events/_v2_core_health_authorization_rate_drop_resolved_event.py b/stripe/events/_v2_core_health_authorization_rate_drop_resolved_event.py index c7b823470..653d05385 100644 --- a/stripe/events/_v2_core_health_authorization_rate_drop_resolved_event.py +++ b/stripe/events/_v2_core_health_authorization_rate_drop_resolved_event.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from decimal import Decimal from stripe._api_mode import ApiMode from stripe._stripe_object import StripeObject from stripe._stripe_response import StripeResponse @@ -54,7 +55,7 @@ class Dimension(StripeObject): """ The type of the charge. """ - current_percentage: str + current_percentage: Decimal """ The current authorization rate percentage. """ @@ -136,11 +137,15 @@ class Dimension(StripeObject): """ The type of the payment method. """ - previous_percentage: str + previous_percentage: Decimal """ The previous authorization rate percentage. """ _inner_class_types = {"dimensions": Dimension} + _field_encodings = { + "current_percentage": "decimal_string", + "previous_percentage": "decimal_string", + } grouping_key: str """ diff --git a/stripe/events/_v2_core_health_fraud_rate_increased_event.py b/stripe/events/_v2_core_health_fraud_rate_increased_event.py index 2f46db71e..a742707a7 100644 --- a/stripe/events/_v2_core_health_fraud_rate_increased_event.py +++ b/stripe/events/_v2_core_health_fraud_rate_increased_event.py @@ -3,6 +3,7 @@ from stripe._api_mode import ApiMode from stripe._stripe_object import StripeObject from stripe._stripe_response import StripeResponse +from stripe.v2._amount import Amount from stripe.v2.core._event import Event, EventNotification from typing import Any, Dict, Optional, cast from typing_extensions import Literal, TYPE_CHECKING, override @@ -36,16 +37,6 @@ class V2CoreHealthFraudRateIncreasedEvent(Event): class V2CoreHealthFraudRateIncreasedEventData(StripeObject): class Impact(StripeObject): - class RealizedFraudAmount(StripeObject): - 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). - """ - value: int - """ - A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). - """ - attack_type: Literal["spike", "sustained_attack"] """ Fraud attack type. @@ -54,11 +45,10 @@ class RealizedFraudAmount(StripeObject): """ The number of impacted requests which are detected. """ - realized_fraud_amount: RealizedFraudAmount + realized_fraud_amount: Amount """ Estimated aggregated amount for the impacted requests. """ - _inner_class_types = {"realized_fraud_amount": RealizedFraudAmount} alert_id: str """ diff --git a/stripe/events/_v2_core_health_issuing_authorization_request_errors_firing_event.py b/stripe/events/_v2_core_health_issuing_authorization_request_errors_firing_event.py index 6562961d5..886d50373 100644 --- a/stripe/events/_v2_core_health_issuing_authorization_request_errors_firing_event.py +++ b/stripe/events/_v2_core_health_issuing_authorization_request_errors_firing_event.py @@ -3,6 +3,7 @@ from stripe._api_mode import ApiMode from stripe._stripe_object import StripeObject from stripe._stripe_response import StripeResponse +from stripe.v2._amount import Amount from stripe.v2.core._event import Event, EventNotification from typing import Any, Dict, Optional, cast from typing_extensions import Literal, TYPE_CHECKING, override @@ -44,27 +45,7 @@ class V2CoreHealthIssuingAuthorizationRequestErrorsFiringEventData( StripeObject, ): class Impact(StripeObject): - class ApprovedAmount(StripeObject): - 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). - """ - value: int - """ - A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). - """ - - class DeclinedAmount(StripeObject): - 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). - """ - value: int - """ - A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). - """ - - approved_amount: Optional[ApprovedAmount] + approved_amount: Optional[Amount] """ Estimated aggregated amount for the approved requests. """ @@ -72,7 +53,7 @@ class DeclinedAmount(StripeObject): """ The number of approved requests which are impacted. """ - declined_amount: Optional[DeclinedAmount] + declined_amount: Optional[Amount] """ Estimated aggregated amount for the declined requests. """ @@ -80,10 +61,6 @@ class DeclinedAmount(StripeObject): """ The number of declined requests which are impacted. """ - _inner_class_types = { - "approved_amount": ApprovedAmount, - "declined_amount": DeclinedAmount, - } grouping_key: str """ diff --git a/stripe/events/_v2_core_health_issuing_authorization_request_errors_resolved_event.py b/stripe/events/_v2_core_health_issuing_authorization_request_errors_resolved_event.py index b02abb8ce..f3c1c4f74 100644 --- a/stripe/events/_v2_core_health_issuing_authorization_request_errors_resolved_event.py +++ b/stripe/events/_v2_core_health_issuing_authorization_request_errors_resolved_event.py @@ -3,6 +3,7 @@ from stripe._api_mode import ApiMode from stripe._stripe_object import StripeObject from stripe._stripe_response import StripeResponse +from stripe.v2._amount import Amount from stripe.v2.core._event import Event, EventNotification from typing import Any, Dict, Optional, cast from typing_extensions import Literal, TYPE_CHECKING, override @@ -52,27 +53,7 @@ class V2CoreHealthIssuingAuthorizationRequestErrorsResolvedEventData( StripeObject, ): class Impact(StripeObject): - class ApprovedAmount(StripeObject): - 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). - """ - value: int - """ - A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). - """ - - class DeclinedAmount(StripeObject): - 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). - """ - value: int - """ - A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). - """ - - approved_amount: Optional[ApprovedAmount] + approved_amount: Optional[Amount] """ Estimated aggregated amount for the approved requests. """ @@ -80,7 +61,7 @@ class DeclinedAmount(StripeObject): """ The number of approved requests which are impacted. """ - declined_amount: Optional[DeclinedAmount] + declined_amount: Optional[Amount] """ Estimated aggregated amount for the declined requests. """ @@ -88,10 +69,6 @@ class DeclinedAmount(StripeObject): """ The number of declined requests which are impacted. """ - _inner_class_types = { - "approved_amount": ApprovedAmount, - "declined_amount": DeclinedAmount, - } grouping_key: str """ diff --git a/stripe/events/_v2_core_health_issuing_authorization_request_timeout_firing_event.py b/stripe/events/_v2_core_health_issuing_authorization_request_timeout_firing_event.py index d810d67e1..b42787484 100644 --- a/stripe/events/_v2_core_health_issuing_authorization_request_timeout_firing_event.py +++ b/stripe/events/_v2_core_health_issuing_authorization_request_timeout_firing_event.py @@ -3,6 +3,7 @@ from stripe._api_mode import ApiMode from stripe._stripe_object import StripeObject from stripe._stripe_response import StripeResponse +from stripe.v2._amount import Amount from stripe.v2.core._event import Event, EventNotification from typing import Any, Dict, Optional, cast from typing_extensions import Literal, TYPE_CHECKING, override @@ -48,27 +49,7 @@ class V2CoreHealthIssuingAuthorizationRequestTimeoutFiringEventData( StripeObject, ): class Impact(StripeObject): - class ApprovedAmount(StripeObject): - 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). - """ - value: int - """ - A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). - """ - - class DeclinedAmount(StripeObject): - 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). - """ - value: int - """ - A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). - """ - - approved_amount: Optional[ApprovedAmount] + approved_amount: Optional[Amount] """ Estimated aggregated amount for the approved requests. """ @@ -76,7 +57,7 @@ class DeclinedAmount(StripeObject): """ The number of approved requests which are impacted. """ - declined_amount: Optional[DeclinedAmount] + declined_amount: Optional[Amount] """ Estimated aggregated amount for the declined requests. """ @@ -84,10 +65,6 @@ class DeclinedAmount(StripeObject): """ The number of declined requests which are impacted. """ - _inner_class_types = { - "approved_amount": ApprovedAmount, - "declined_amount": DeclinedAmount, - } alert_id: str """ diff --git a/stripe/events/_v2_core_health_issuing_authorization_request_timeout_resolved_event.py b/stripe/events/_v2_core_health_issuing_authorization_request_timeout_resolved_event.py index aa4d286f1..0ba247ccf 100644 --- a/stripe/events/_v2_core_health_issuing_authorization_request_timeout_resolved_event.py +++ b/stripe/events/_v2_core_health_issuing_authorization_request_timeout_resolved_event.py @@ -3,6 +3,7 @@ from stripe._api_mode import ApiMode from stripe._stripe_object import StripeObject from stripe._stripe_response import StripeResponse +from stripe.v2._amount import Amount from stripe.v2.core._event import Event, EventNotification from typing import Any, Dict, Optional, cast from typing_extensions import Literal, TYPE_CHECKING, override @@ -52,27 +53,7 @@ class V2CoreHealthIssuingAuthorizationRequestTimeoutResolvedEventData( StripeObject, ): class Impact(StripeObject): - class ApprovedAmount(StripeObject): - 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). - """ - value: int - """ - A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). - """ - - class DeclinedAmount(StripeObject): - 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). - """ - value: int - """ - A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). - """ - - approved_amount: Optional[ApprovedAmount] + approved_amount: Optional[Amount] """ Estimated aggregated amount for the approved requests. """ @@ -80,7 +61,7 @@ class DeclinedAmount(StripeObject): """ The number of approved requests which are impacted. """ - declined_amount: Optional[DeclinedAmount] + declined_amount: Optional[Amount] """ Estimated aggregated amount for the declined requests. """ @@ -88,10 +69,6 @@ class DeclinedAmount(StripeObject): """ The number of declined requests which are impacted. """ - _inner_class_types = { - "approved_amount": ApprovedAmount, - "declined_amount": DeclinedAmount, - } grouping_key: str """ diff --git a/stripe/events/_v2_core_health_payment_method_error_firing_event.py b/stripe/events/_v2_core_health_payment_method_error_firing_event.py index 095c86be7..f4d0bf916 100644 --- a/stripe/events/_v2_core_health_payment_method_error_firing_event.py +++ b/stripe/events/_v2_core_health_payment_method_error_firing_event.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from decimal import Decimal from stripe._api_mode import ApiMode from stripe._stripe_object import StripeObject from stripe._stripe_response import StripeResponse @@ -47,10 +48,13 @@ class TopImpactedAccount(StripeObject): """ The number of impacted requests. """ - impacted_requests_percentage: Optional[str] + impacted_requests_percentage: Optional[Decimal] """ The percentage of impacted requests. """ + _field_encodings = { + "impacted_requests_percentage": "decimal_string", + } error_code: Optional[str] """ @@ -60,7 +64,7 @@ class TopImpactedAccount(StripeObject): """ The number of impacted requests. """ - impacted_requests_percentage: Optional[str] + impacted_requests_percentage: Optional[Decimal] """ The percentage of impacted requests. """ @@ -143,6 +147,9 @@ class TopImpactedAccount(StripeObject): The top impacted connected accounts (only for platforms). """ _inner_class_types = {"top_impacted_accounts": TopImpactedAccount} + _field_encodings = { + "impacted_requests_percentage": "decimal_string", + } alert_id: str """ diff --git a/stripe/events/_v2_core_health_payment_method_error_resolved_event.py b/stripe/events/_v2_core_health_payment_method_error_resolved_event.py index 91fc9f2a6..4a8cfa5f5 100644 --- a/stripe/events/_v2_core_health_payment_method_error_resolved_event.py +++ b/stripe/events/_v2_core_health_payment_method_error_resolved_event.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from decimal import Decimal from stripe._api_mode import ApiMode from stripe._stripe_object import StripeObject from stripe._stripe_response import StripeResponse @@ -49,10 +50,13 @@ class TopImpactedAccount(StripeObject): """ The number of impacted requests. """ - impacted_requests_percentage: Optional[str] + impacted_requests_percentage: Optional[Decimal] """ The percentage of impacted requests. """ + _field_encodings = { + "impacted_requests_percentage": "decimal_string", + } error_code: Optional[str] """ @@ -62,7 +66,7 @@ class TopImpactedAccount(StripeObject): """ The number of impacted requests. """ - impacted_requests_percentage: Optional[str] + impacted_requests_percentage: Optional[Decimal] """ The percentage of impacted requests. """ @@ -145,6 +149,9 @@ class TopImpactedAccount(StripeObject): The top impacted connected accounts (only for platforms). """ _inner_class_types = {"top_impacted_accounts": TopImpactedAccount} + _field_encodings = { + "impacted_requests_percentage": "decimal_string", + } grouping_key: str """ diff --git a/stripe/events/_v2_core_health_sepa_debit_delayed_firing_event.py b/stripe/events/_v2_core_health_sepa_debit_delayed_firing_event.py index db8dfdb96..72e5c402c 100644 --- a/stripe/events/_v2_core_health_sepa_debit_delayed_firing_event.py +++ b/stripe/events/_v2_core_health_sepa_debit_delayed_firing_event.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from decimal import Decimal from stripe._api_mode import ApiMode from stripe._stripe_object import StripeObject from stripe._stripe_response import StripeResponse @@ -42,10 +43,13 @@ class Impact(StripeObject): """ The number of impacted payments. """ - impacted_payments_percentage: str + impacted_payments_percentage: Decimal """ The percentage of impacted payments. """ + _field_encodings = { + "impacted_payments_percentage": "decimal_string", + } grouping_key: str """ diff --git a/stripe/events/_v2_core_health_sepa_debit_delayed_resolved_event.py b/stripe/events/_v2_core_health_sepa_debit_delayed_resolved_event.py index 280fd207d..06a1b51d7 100644 --- a/stripe/events/_v2_core_health_sepa_debit_delayed_resolved_event.py +++ b/stripe/events/_v2_core_health_sepa_debit_delayed_resolved_event.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from decimal import Decimal from stripe._api_mode import ApiMode from stripe._stripe_object import StripeObject from stripe._stripe_response import StripeResponse @@ -42,10 +43,13 @@ class Impact(StripeObject): """ The number of impacted payments. """ - impacted_payments_percentage: str + impacted_payments_percentage: Decimal """ The percentage of impacted payments. """ + _field_encodings = { + "impacted_payments_percentage": "decimal_string", + } grouping_key: str """ diff --git a/stripe/events/_v2_signals_account_signal_fraudulent_merchant_ready_event.py b/stripe/events/_v2_signals_account_signal_fraudulent_merchant_ready_event.py new file mode 100644 index 000000000..831363e7b --- /dev/null +++ b/stripe/events/_v2_signals_account_signal_fraudulent_merchant_ready_event.py @@ -0,0 +1,144 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from decimal import Decimal +from stripe._api_mode import ApiMode +from stripe._stripe_object import StripeObject +from stripe._stripe_response import StripeResponse +from stripe.v2.core._event import Event, EventNotification +from typing import Any, Dict, List, Optional, cast +from typing_extensions import Literal, TYPE_CHECKING, override + +if TYPE_CHECKING: + from stripe._api_requestor import _APIRequestor + + +class V2SignalsAccountSignalFraudulentMerchantReadyEventNotification( + EventNotification, +): + LOOKUP_TYPE = "v2.signals.account_signal.fraudulent_merchant_ready" + type: Literal["v2.signals.account_signal.fraudulent_merchant_ready"] + + @override + def fetch_event( + self, + ) -> "V2SignalsAccountSignalFraudulentMerchantReadyEvent": + return cast( + "V2SignalsAccountSignalFraudulentMerchantReadyEvent", + super().fetch_event(), + ) + + @override + async def fetch_event_async( + self, + ) -> "V2SignalsAccountSignalFraudulentMerchantReadyEvent": + return cast( + "V2SignalsAccountSignalFraudulentMerchantReadyEvent", + await super().fetch_event_async(), + ) + + +class V2SignalsAccountSignalFraudulentMerchantReadyEvent(Event): + LOOKUP_TYPE = "v2.signals.account_signal.fraudulent_merchant_ready" + type: Literal["v2.signals.account_signal.fraudulent_merchant_ready"] + + class V2SignalsAccountSignalFraudulentMerchantReadyEventData(StripeObject): + class FraudulentMerchant(StripeObject): + class Indicator(StripeObject): + description: str + """ + A brief explanation of how this indicator contributed to the fraudulent merchant probability. + """ + impact: Literal[ + "decrease", "neutral", "slight_increase", "strong_increase" + ] + """ + The effect this indicator had on the overall risk level. + """ + indicator: Literal[ + "bank_account", + "business_information_and_account_activity", + "disputes", + "failures", + "geolocation", + "other", + "other_related_accounts", + "other_transaction_activity", + "owner_email", + "web_presence", + ] + """ + The name of the specific indicator used in the risk assessment. + """ + + indicators: List[Indicator] + """ + Array of objects representing individual factors that contributed to the calculated probability. Maximum of 3. + """ + probability: Optional[Decimal] + """ + The probability of the merchant being fraudulent. Can be between 0.00 and 100.00. May be empty if the risk_level is UNKNOWN or NOT_ASSESSED. + """ + risk_level: Literal[ + "elevated", + "highest", + "low", + "normal", + "not_assessed", + "unknown", + ] + """ + Categorical assessment of the fraudulent merchant risk based on probability. + """ + _inner_class_types = {"indicators": Indicator} + _field_encodings = {"probability": "decimal_string"} + + account: str + """ + Account ID that this signal is associated with. + """ + evaluated_at: str + """ + Timestamp when the signal was evaluated. + """ + fraudulent_merchant: Optional[FraudulentMerchant] + """ + Fraudulent merchant signal data. Present when type is fraudulent_merchant. + """ + id: str + """ + Unique identifier for this account signal. + """ + type: Literal["fraudulent_merchant"] + """ + The type of account signal. Currently only fraudulent_merchant is supported. + """ + _inner_class_types = {"fraudulent_merchant": FraudulentMerchant} + + data: V2SignalsAccountSignalFraudulentMerchantReadyEventData + """ + Data for the v2.signals.account_signal.fraudulent_merchant_ready event + """ + + @classmethod + def _construct_from( + cls, + *, + values: Dict[str, Any], + last_response: Optional[StripeResponse] = None, + requestor: "_APIRequestor", + api_mode: ApiMode, + ) -> "V2SignalsAccountSignalFraudulentMerchantReadyEvent": + evt = super()._construct_from( + values=values, + last_response=last_response, + requestor=requestor, + api_mode=api_mode, + ) + if hasattr(evt, "data"): + evt.data = V2SignalsAccountSignalFraudulentMerchantReadyEvent.V2SignalsAccountSignalFraudulentMerchantReadyEventData._construct_from( + values=evt.data, + last_response=last_response, + requestor=requestor, + api_mode=api_mode, + ) + return evt diff --git a/stripe/issuing/_authorization.py b/stripe/issuing/_authorization.py index 045ce8358..4f1b2bae4 100644 --- a/stripe/issuing/_authorization.py +++ b/stripe/issuing/_authorization.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from decimal import Decimal from stripe._expandable_field import ExpandableField from stripe._list_object import ListObject from stripe._listable_api_resource import ListableAPIResource @@ -109,26 +110,32 @@ class CardholderPromptData(StripeObject): class ReportedBreakdown(StripeObject): class Fuel(StripeObject): - gross_amount_decimal: Optional[str] + gross_amount_decimal: Optional[Decimal] """ Gross fuel amount that should equal Fuel Quantity multiplied by Fuel Unit Cost, inclusive of taxes. """ + _field_encodings = {"gross_amount_decimal": "decimal_string"} class NonFuel(StripeObject): - gross_amount_decimal: Optional[str] + gross_amount_decimal: Optional[Decimal] """ Gross non-fuel amount that should equal the sum of the line items, inclusive of taxes. """ + _field_encodings = {"gross_amount_decimal": "decimal_string"} class Tax(StripeObject): - local_amount_decimal: Optional[str] + local_amount_decimal: Optional[Decimal] """ Amount of state or provincial Sales Tax included in the transaction amount. `null` if not reported by merchant or not subject to tax. """ - national_amount_decimal: Optional[str] + national_amount_decimal: Optional[Decimal] """ Amount of national Sales Tax or VAT included in the transaction amount. `null` if not reported by merchant or not subject to tax. """ + _field_encodings = { + "local_amount_decimal": "decimal_string", + "national_amount_decimal": "decimal_string", + } fuel: Optional[Fuel] """ @@ -200,7 +207,7 @@ class Fuel(StripeObject): """ [Conexxus Payment System Product Code](https://www.conexxus.org/conexxus-payment-system-product-codes) identifying the primary fuel product purchased. """ - quantity_decimal: Optional[str] + quantity_decimal: Optional[Decimal] """ The quantity of `unit`s of fuel that was dispensed, represented as a decimal string with at most 12 decimal places. """ @@ -231,10 +238,14 @@ class Fuel(StripeObject): """ The units for `quantity_decimal`. """ - unit_cost_decimal: Optional[str] + unit_cost_decimal: Optional[Decimal] """ The cost in cents per each unit of fuel, represented as a decimal string with at most 12 decimal places. """ + _field_encodings = { + "quantity_decimal": "decimal_string", + "unit_cost_decimal": "decimal_string", + } class MerchantData(StripeObject): category: str diff --git a/stripe/issuing/_transaction.py b/stripe/issuing/_transaction.py index 286b92d14..7383efa57 100644 --- a/stripe/issuing/_transaction.py +++ b/stripe/issuing/_transaction.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from decimal import Decimal from stripe._expandable_field import ExpandableField from stripe._list_object import ListObject from stripe._listable_api_resource import ListableAPIResource @@ -150,26 +151,36 @@ class CardholderPromptData(StripeObject): class ReportedBreakdown(StripeObject): class Fuel(StripeObject): - gross_amount_decimal: Optional[str] + gross_amount_decimal: Optional[Decimal] """ Gross fuel amount that should equal Fuel Volume multipled by Fuel Unit Cost, inclusive of taxes. """ + _field_encodings = { + "gross_amount_decimal": "decimal_string", + } class NonFuel(StripeObject): - gross_amount_decimal: Optional[str] + gross_amount_decimal: Optional[Decimal] """ Gross non-fuel amount that should equal the sum of the line items, inclusive of taxes. """ + _field_encodings = { + "gross_amount_decimal": "decimal_string", + } class Tax(StripeObject): - local_amount_decimal: Optional[str] + local_amount_decimal: Optional[Decimal] """ Amount of state or provincial Sales Tax included in the transaction amount. Null if not reported by merchant or not subject to tax. """ - national_amount_decimal: Optional[str] + national_amount_decimal: Optional[Decimal] """ Amount of national Sales Tax or VAT included in the transaction amount. Null if not reported by merchant or not subject to tax. """ + _field_encodings = { + "local_amount_decimal": "decimal_string", + "national_amount_decimal": "decimal_string", + } fuel: Optional[Fuel] """ @@ -264,7 +275,7 @@ class Fuel(StripeObject): """ [Conexxus Payment System Product Code](https://www.conexxus.org/conexxus-payment-system-product-codes) identifying the primary fuel product purchased. """ - quantity_decimal: Optional[str] + quantity_decimal: Optional[Decimal] """ The quantity of `unit`s of fuel that was dispensed, represented as a decimal string with at most 12 decimal places. """ @@ -276,10 +287,14 @@ class Fuel(StripeObject): """ The units for `quantity_decimal`. One of `charging_minute`, `imperial_gallon`, `kilogram`, `kilowatt_hour`, `liter`, `pound`, `us_gallon`, or `other`. """ - unit_cost_decimal: str + unit_cost_decimal: Decimal """ The cost in cents per each unit of fuel, represented as a decimal string with at most 12 decimal places. """ + _field_encodings = { + "quantity_decimal": "decimal_string", + "unit_cost_decimal": "decimal_string", + } class Lodging(StripeObject): check_in_at: Optional[int] diff --git a/stripe/params/_credit_note_create_params.py b/stripe/params/_credit_note_create_params.py index 2714e0e6b..7e299c730 100644 --- a/stripe/params/_credit_note_create_params.py +++ b/stripe/params/_credit_note_create_params.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from decimal import Decimal from stripe._request_options import RequestOptions from typing import Dict, List from typing_extensions import Literal, NotRequired, TypedDict @@ -103,7 +104,7 @@ class CreditNoteCreateParamsLine(TypedDict): """ The integer unit amount in cents (or local equivalent) of the credit note line item. This `unit_amount` will be multiplied by the quantity to get the full amount to credit for this line item. Only valid when `type` is `custom_line_item`. """ - unit_amount_decimal: NotRequired[str] + unit_amount_decimal: NotRequired[Decimal] """ Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set. """ diff --git a/stripe/params/_credit_note_preview_lines_list_params.py b/stripe/params/_credit_note_preview_lines_list_params.py index dc81f33c1..9cc882268 100644 --- a/stripe/params/_credit_note_preview_lines_list_params.py +++ b/stripe/params/_credit_note_preview_lines_list_params.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from decimal import Decimal from typing import Dict, List from typing_extensions import Literal, NotRequired, TypedDict @@ -114,7 +115,7 @@ class CreditNotePreviewLinesListParamsLine(TypedDict): """ The integer unit amount in cents (or local equivalent) of the credit note line item. This `unit_amount` will be multiplied by the quantity to get the full amount to credit for this line item. Only valid when `type` is `custom_line_item`. """ - unit_amount_decimal: NotRequired[str] + unit_amount_decimal: NotRequired[Decimal] """ Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set. """ diff --git a/stripe/params/_credit_note_preview_lines_params.py b/stripe/params/_credit_note_preview_lines_params.py index 8434b10d8..15a03cc22 100644 --- a/stripe/params/_credit_note_preview_lines_params.py +++ b/stripe/params/_credit_note_preview_lines_params.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from decimal import Decimal from stripe._request_options import RequestOptions from typing import Dict, List from typing_extensions import Literal, NotRequired, TypedDict @@ -115,7 +116,7 @@ class CreditNotePreviewLinesParamsLine(TypedDict): """ The integer unit amount in cents (or local equivalent) of the credit note line item. This `unit_amount` will be multiplied by the quantity to get the full amount to credit for this line item. Only valid when `type` is `custom_line_item`. """ - unit_amount_decimal: NotRequired[str] + unit_amount_decimal: NotRequired[Decimal] """ Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set. """ diff --git a/stripe/params/_credit_note_preview_params.py b/stripe/params/_credit_note_preview_params.py index a88442f97..0aeb4618d 100644 --- a/stripe/params/_credit_note_preview_params.py +++ b/stripe/params/_credit_note_preview_params.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from decimal import Decimal from stripe._request_options import RequestOptions from typing import Dict, List from typing_extensions import Literal, NotRequired, TypedDict @@ -103,7 +104,7 @@ class CreditNotePreviewParamsLine(TypedDict): """ The integer unit amount in cents (or local equivalent) of the credit note line item. This `unit_amount` will be multiplied by the quantity to get the full amount to credit for this line item. Only valid when `type` is `custom_line_item`. """ - unit_amount_decimal: NotRequired[str] + unit_amount_decimal: NotRequired[Decimal] """ Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set. """ diff --git a/stripe/params/_invoice_add_lines_params.py b/stripe/params/_invoice_add_lines_params.py index c451fed06..94e319994 100644 --- a/stripe/params/_invoice_add_lines_params.py +++ b/stripe/params/_invoice_add_lines_params.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from decimal import Decimal from stripe._request_options import RequestOptions from typing import Dict, List from typing_extensions import Literal, NotRequired, TypedDict @@ -158,7 +159,7 @@ class InvoiceAddLinesParamsLinePriceData(TypedDict): """ A non-negative integer in cents (or local equivalent) representing how much to charge. One of `unit_amount` or `unit_amount_decimal` is required. """ - unit_amount_decimal: NotRequired[str] + unit_amount_decimal: NotRequired[Decimal] """ Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set. """ diff --git a/stripe/params/_invoice_create_preview_params.py b/stripe/params/_invoice_create_preview_params.py index a7f1dbeb8..15a4b6c83 100644 --- a/stripe/params/_invoice_create_preview_params.py +++ b/stripe/params/_invoice_create_preview_params.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from decimal import Decimal from stripe._request_options import RequestOptions from typing import Dict, List from typing_extensions import Literal, NotRequired, TypedDict @@ -496,7 +497,7 @@ class InvoiceCreatePreviewParamsInvoiceItem(TypedDict): """ The integer unit amount in cents (or local equivalent) of the charge to be applied to the upcoming invoice. This unit_amount will be multiplied by the quantity to get the full amount. If you want to apply a credit to the customer's account, pass a negative unit_amount. """ - unit_amount_decimal: NotRequired[str] + unit_amount_decimal: NotRequired[Decimal] """ Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set. """ @@ -581,7 +582,7 @@ class InvoiceCreatePreviewParamsInvoiceItemPriceData(TypedDict): """ A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge. """ - unit_amount_decimal: NotRequired[str] + unit_amount_decimal: NotRequired[Decimal] """ Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set. """ @@ -1913,7 +1914,7 @@ class InvoiceCreatePreviewParamsScheduleDetailsPhaseAddInvoiceItemPriceData( """ A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge or a negative integer representing the amount to credit to the customer. """ - unit_amount_decimal: NotRequired[str] + unit_amount_decimal: NotRequired[Decimal] """ Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set. """ @@ -2314,7 +2315,7 @@ class InvoiceCreatePreviewParamsScheduleDetailsPhaseItemPriceData(TypedDict): """ A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge. """ - unit_amount_decimal: NotRequired[str] + unit_amount_decimal: NotRequired[Decimal] """ Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set. """ @@ -2815,7 +2816,7 @@ class InvoiceCreatePreviewParamsSubscriptionDetailsItemPriceData(TypedDict): """ A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge. """ - unit_amount_decimal: NotRequired[str] + unit_amount_decimal: NotRequired[Decimal] """ Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set. """ diff --git a/stripe/params/_invoice_item_create_params.py b/stripe/params/_invoice_item_create_params.py index 8973bd53a..8ac2d29c7 100644 --- a/stripe/params/_invoice_item_create_params.py +++ b/stripe/params/_invoice_item_create_params.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from decimal import Decimal from stripe._request_options import RequestOptions from typing import Dict, List from typing_extensions import Literal, NotRequired, TypedDict @@ -82,7 +83,7 @@ class InvoiceItemCreateParams(RequestOptions): """ The tax rates which apply to the invoice item. When set, the `default_tax_rates` on the invoice do not apply to this invoice item. """ - unit_amount_decimal: NotRequired[str] + unit_amount_decimal: NotRequired[Decimal] """ The decimal unit amount in cents (or local equivalent) of the charge to be applied to the upcoming invoice. This `unit_amount_decimal` will be multiplied by the quantity to get the full amount. Passing in a negative `unit_amount_decimal` will reduce the `amount_due` on the invoice. Accepts at most 12 decimal places. """ @@ -161,7 +162,7 @@ class InvoiceItemCreateParamsPriceData(TypedDict): """ A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge. """ - unit_amount_decimal: NotRequired[str] + unit_amount_decimal: NotRequired[Decimal] """ Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set. """ diff --git a/stripe/params/_invoice_item_modify_params.py b/stripe/params/_invoice_item_modify_params.py index 6a6623db4..e0f86c942 100644 --- a/stripe/params/_invoice_item_modify_params.py +++ b/stripe/params/_invoice_item_modify_params.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from decimal import Decimal from stripe._request_options import RequestOptions from typing import Dict, List from typing_extensions import Literal, NotRequired, TypedDict @@ -62,7 +63,7 @@ class InvoiceItemModifyParams(RequestOptions): """ The tax rates which apply to the invoice item. When set, the `default_tax_rates` on the invoice do not apply to this invoice item. Pass an empty string to remove previously-defined tax rates. """ - unit_amount_decimal: NotRequired[str] + unit_amount_decimal: NotRequired[Decimal] """ The decimal unit amount in cents (or local equivalent) of the charge to be applied to the upcoming invoice. This `unit_amount_decimal` will be multiplied by the quantity to get the full amount. Passing in a negative `unit_amount_decimal` will reduce the `amount_due` on the invoice. Accepts at most 12 decimal places. """ @@ -141,7 +142,7 @@ class InvoiceItemModifyParamsPriceData(TypedDict): """ A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge. """ - unit_amount_decimal: NotRequired[str] + unit_amount_decimal: NotRequired[Decimal] """ Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set. """ diff --git a/stripe/params/_invoice_item_update_params.py b/stripe/params/_invoice_item_update_params.py index f10d2bef8..120aaf835 100644 --- a/stripe/params/_invoice_item_update_params.py +++ b/stripe/params/_invoice_item_update_params.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from decimal import Decimal from typing import Dict, List from typing_extensions import Literal, NotRequired, TypedDict @@ -61,7 +62,7 @@ class InvoiceItemUpdateParams(TypedDict): """ The tax rates which apply to the invoice item. When set, the `default_tax_rates` on the invoice do not apply to this invoice item. Pass an empty string to remove previously-defined tax rates. """ - unit_amount_decimal: NotRequired[str] + unit_amount_decimal: NotRequired[Decimal] """ The decimal unit amount in cents (or local equivalent) of the charge to be applied to the upcoming invoice. This `unit_amount_decimal` will be multiplied by the quantity to get the full amount. Passing in a negative `unit_amount_decimal` will reduce the `amount_due` on the invoice. Accepts at most 12 decimal places. """ @@ -140,7 +141,7 @@ class InvoiceItemUpdateParamsPriceData(TypedDict): """ A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge. """ - unit_amount_decimal: NotRequired[str] + unit_amount_decimal: NotRequired[Decimal] """ Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set. """ diff --git a/stripe/params/_invoice_line_item_update_params.py b/stripe/params/_invoice_line_item_update_params.py index 495c7a58f..72d8abad9 100644 --- a/stripe/params/_invoice_line_item_update_params.py +++ b/stripe/params/_invoice_line_item_update_params.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from decimal import Decimal from typing import Dict, List from typing_extensions import Literal, NotRequired, TypedDict @@ -144,7 +145,7 @@ class InvoiceLineItemUpdateParamsPriceData(TypedDict): """ A non-negative integer in cents (or local equivalent) representing how much to charge. One of `unit_amount` or `unit_amount_decimal` is required. """ - unit_amount_decimal: NotRequired[str] + unit_amount_decimal: NotRequired[Decimal] """ Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set. """ diff --git a/stripe/params/_invoice_update_lines_params.py b/stripe/params/_invoice_update_lines_params.py index b4f640de6..01984205a 100644 --- a/stripe/params/_invoice_update_lines_params.py +++ b/stripe/params/_invoice_update_lines_params.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from decimal import Decimal from stripe._request_options import RequestOptions from typing import Dict, List from typing_extensions import Literal, NotRequired, TypedDict @@ -162,7 +163,7 @@ class InvoiceUpdateLinesParamsLinePriceData(TypedDict): """ A non-negative integer in cents (or local equivalent) representing how much to charge. One of `unit_amount` or `unit_amount_decimal` is required. """ - unit_amount_decimal: NotRequired[str] + unit_amount_decimal: NotRequired[Decimal] """ Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set. """ diff --git a/stripe/params/_order_create_params.py b/stripe/params/_order_create_params.py index 73bdf1c8f..0dc2c5936 100644 --- a/stripe/params/_order_create_params.py +++ b/stripe/params/_order_create_params.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from decimal import Decimal from stripe._request_options import RequestOptions from typing import Dict, List from typing_extensions import Literal, NotRequired, TypedDict @@ -213,7 +214,7 @@ class OrderCreateParamsLineItemPriceData(TypedDict): """ A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge. """ - unit_amount_decimal: NotRequired[str] + unit_amount_decimal: NotRequired[Decimal] """ Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set. """ diff --git a/stripe/params/_order_modify_params.py b/stripe/params/_order_modify_params.py index dcc5b42d9..99ba3a951 100644 --- a/stripe/params/_order_modify_params.py +++ b/stripe/params/_order_modify_params.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from decimal import Decimal from stripe._request_options import RequestOptions from typing import Dict, List from typing_extensions import Literal, NotRequired, TypedDict @@ -217,7 +218,7 @@ class OrderModifyParamsLineItemPriceData(TypedDict): """ A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge. """ - unit_amount_decimal: NotRequired[str] + unit_amount_decimal: NotRequired[Decimal] """ Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set. """ diff --git a/stripe/params/_order_update_params.py b/stripe/params/_order_update_params.py index 83dae8735..644648166 100644 --- a/stripe/params/_order_update_params.py +++ b/stripe/params/_order_update_params.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from decimal import Decimal from typing import Dict, List from typing_extensions import Literal, NotRequired, TypedDict @@ -216,7 +217,7 @@ class OrderUpdateParamsLineItemPriceData(TypedDict): """ A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge. """ - unit_amount_decimal: NotRequired[str] + unit_amount_decimal: NotRequired[Decimal] """ Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set. """ diff --git a/stripe/params/_payment_intent_confirm_params.py b/stripe/params/_payment_intent_confirm_params.py index cbf1bec5d..ae437f7b8 100644 --- a/stripe/params/_payment_intent_confirm_params.py +++ b/stripe/params/_payment_intent_confirm_params.py @@ -6451,12 +6451,6 @@ class PaymentIntentConfirmParamsPaymentMethodOptionsUsBankAccount(TypedDict): """ Bank account verification method. """ - preferred_settlement_speed: NotRequired[ - "Literal['']|Literal['fastest', 'standard']" - ] - """ - Preferred transaction settlement speed - """ class PaymentIntentConfirmParamsPaymentMethodOptionsUsBankAccountFinancialConnections( diff --git a/stripe/params/_payment_intent_create_params.py b/stripe/params/_payment_intent_create_params.py index e31a0b96c..19333a8b3 100644 --- a/stripe/params/_payment_intent_create_params.py +++ b/stripe/params/_payment_intent_create_params.py @@ -6574,12 +6574,6 @@ class PaymentIntentCreateParamsPaymentMethodOptionsUsBankAccount(TypedDict): """ Bank account verification method. """ - preferred_settlement_speed: NotRequired[ - "Literal['']|Literal['fastest', 'standard']" - ] - """ - Preferred transaction settlement speed - """ class PaymentIntentCreateParamsPaymentMethodOptionsUsBankAccountFinancialConnections( diff --git a/stripe/params/_payment_intent_modify_params.py b/stripe/params/_payment_intent_modify_params.py index 14077857a..e0070eb61 100644 --- a/stripe/params/_payment_intent_modify_params.py +++ b/stripe/params/_payment_intent_modify_params.py @@ -6422,12 +6422,6 @@ class PaymentIntentModifyParamsPaymentMethodOptionsUsBankAccount(TypedDict): """ Bank account verification method. """ - preferred_settlement_speed: NotRequired[ - "Literal['']|Literal['fastest', 'standard']" - ] - """ - Preferred transaction settlement speed - """ class PaymentIntentModifyParamsPaymentMethodOptionsUsBankAccountFinancialConnections( diff --git a/stripe/params/_payment_intent_update_params.py b/stripe/params/_payment_intent_update_params.py index 5cb04cc9e..aa67e610f 100644 --- a/stripe/params/_payment_intent_update_params.py +++ b/stripe/params/_payment_intent_update_params.py @@ -6421,12 +6421,6 @@ class PaymentIntentUpdateParamsPaymentMethodOptionsUsBankAccount(TypedDict): """ Bank account verification method. """ - preferred_settlement_speed: NotRequired[ - "Literal['']|Literal['fastest', 'standard']" - ] - """ - Preferred transaction settlement speed - """ class PaymentIntentUpdateParamsPaymentMethodOptionsUsBankAccountFinancialConnections( diff --git a/stripe/params/_payment_link_create_params.py b/stripe/params/_payment_link_create_params.py index 9797d8022..cf4930034 100644 --- a/stripe/params/_payment_link_create_params.py +++ b/stripe/params/_payment_link_create_params.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from decimal import Decimal from stripe._request_options import RequestOptions from typing import Dict, List from typing_extensions import Literal, NotRequired, TypedDict @@ -577,7 +578,7 @@ class PaymentLinkCreateParamsLineItemPriceData(TypedDict): """ A non-negative integer in cents (or local equivalent) representing how much to charge. One of `unit_amount` or `unit_amount_decimal` is required. """ - unit_amount_decimal: NotRequired[str] + unit_amount_decimal: NotRequired[Decimal] """ Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set. """ diff --git a/stripe/params/_plan_create_params.py b/stripe/params/_plan_create_params.py index 5c912c4bc..3ac48cafa 100644 --- a/stripe/params/_plan_create_params.py +++ b/stripe/params/_plan_create_params.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from decimal import Decimal from stripe._request_options import RequestOptions from typing import Dict, List, Union from typing_extensions import Literal, NotRequired, TypedDict @@ -14,7 +15,7 @@ class PlanCreateParams(RequestOptions): """ A positive integer in cents (or local equivalent) (or 0 for a free plan) representing how much to charge on a recurring basis. """ - amount_decimal: NotRequired[str] + amount_decimal: NotRequired[Decimal] """ Same as `amount`, but accepts a decimal value with at most 12 decimal places. Only one of `amount` and `amount_decimal` can be set. """ @@ -130,7 +131,7 @@ class PlanCreateParamsTier(TypedDict): """ The flat billing amount for an entire tier, regardless of the number of units in the tier. """ - flat_amount_decimal: NotRequired[str] + flat_amount_decimal: NotRequired[Decimal] """ Same as `flat_amount`, but accepts a decimal value representing an integer in the minor units of the currency. Only one of `flat_amount` and `flat_amount_decimal` can be set. """ @@ -138,7 +139,7 @@ class PlanCreateParamsTier(TypedDict): """ The per unit billing amount for each individual unit for which this tier applies. """ - unit_amount_decimal: NotRequired[str] + unit_amount_decimal: NotRequired[Decimal] """ Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set. """ diff --git a/stripe/params/_price_create_params.py b/stripe/params/_price_create_params.py index eb5417c77..f9c6cd5e4 100644 --- a/stripe/params/_price_create_params.py +++ b/stripe/params/_price_create_params.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from decimal import Decimal from stripe._request_options import RequestOptions from typing import Dict, List, Union from typing_extensions import Literal, NotRequired, TypedDict @@ -80,7 +81,7 @@ class PriceCreateParams(RequestOptions): """ A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge. One of `unit_amount`, `unit_amount_decimal`, or `custom_unit_amount` is required, unless `billing_scheme=tiered`. """ - unit_amount_decimal: NotRequired[str] + unit_amount_decimal: NotRequired[Decimal] """ Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set. """ @@ -105,7 +106,7 @@ class PriceCreateParamsCurrencyOptions(TypedDict): """ A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge. """ - unit_amount_decimal: NotRequired[str] + unit_amount_decimal: NotRequired[Decimal] """ Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set. """ @@ -135,7 +136,7 @@ class PriceCreateParamsCurrencyOptionsTier(TypedDict): """ The flat billing amount for an entire tier, regardless of the number of units in the tier. """ - flat_amount_decimal: NotRequired[str] + flat_amount_decimal: NotRequired[Decimal] """ Same as `flat_amount`, but accepts a decimal value representing an integer in the minor units of the currency. Only one of `flat_amount` and `flat_amount_decimal` can be set. """ @@ -143,7 +144,7 @@ class PriceCreateParamsCurrencyOptionsTier(TypedDict): """ The per unit billing amount for each individual unit for which this tier applies. """ - unit_amount_decimal: NotRequired[str] + unit_amount_decimal: NotRequired[Decimal] """ Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set. """ @@ -248,7 +249,7 @@ class PriceCreateParamsTier(TypedDict): """ The flat billing amount for an entire tier, regardless of the number of units in the tier. """ - flat_amount_decimal: NotRequired[str] + flat_amount_decimal: NotRequired[Decimal] """ Same as `flat_amount`, but accepts a decimal value representing an integer in the minor units of the currency. Only one of `flat_amount` and `flat_amount_decimal` can be set. """ @@ -256,7 +257,7 @@ class PriceCreateParamsTier(TypedDict): """ The per unit billing amount for each individual unit for which this tier applies. """ - unit_amount_decimal: NotRequired[str] + unit_amount_decimal: NotRequired[Decimal] """ Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set. """ diff --git a/stripe/params/_price_modify_params.py b/stripe/params/_price_modify_params.py index 1e062bdf3..3e5a157e7 100644 --- a/stripe/params/_price_modify_params.py +++ b/stripe/params/_price_modify_params.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from decimal import Decimal from stripe._request_options import RequestOptions from typing import Dict, List, Union from typing_extensions import Literal, NotRequired, TypedDict @@ -65,7 +66,7 @@ class PriceModifyParamsCurrencyOptions(TypedDict): """ A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge. """ - unit_amount_decimal: NotRequired[str] + unit_amount_decimal: NotRequired[Decimal] """ Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set. """ @@ -95,7 +96,7 @@ class PriceModifyParamsCurrencyOptionsTier(TypedDict): """ The flat billing amount for an entire tier, regardless of the number of units in the tier. """ - flat_amount_decimal: NotRequired[str] + flat_amount_decimal: NotRequired[Decimal] """ Same as `flat_amount`, but accepts a decimal value representing an integer in the minor units of the currency. Only one of `flat_amount` and `flat_amount_decimal` can be set. """ @@ -103,7 +104,7 @@ class PriceModifyParamsCurrencyOptionsTier(TypedDict): """ The per unit billing amount for each individual unit for which this tier applies. """ - unit_amount_decimal: NotRequired[str] + unit_amount_decimal: NotRequired[Decimal] """ Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set. """ diff --git a/stripe/params/_price_update_params.py b/stripe/params/_price_update_params.py index 2929385a1..d9ab1408c 100644 --- a/stripe/params/_price_update_params.py +++ b/stripe/params/_price_update_params.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from decimal import Decimal from typing import Dict, List, Union from typing_extensions import Literal, NotRequired, TypedDict @@ -64,7 +65,7 @@ class PriceUpdateParamsCurrencyOptions(TypedDict): """ A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge. """ - unit_amount_decimal: NotRequired[str] + unit_amount_decimal: NotRequired[Decimal] """ Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set. """ @@ -94,7 +95,7 @@ class PriceUpdateParamsCurrencyOptionsTier(TypedDict): """ The flat billing amount for an entire tier, regardless of the number of units in the tier. """ - flat_amount_decimal: NotRequired[str] + flat_amount_decimal: NotRequired[Decimal] """ Same as `flat_amount`, but accepts a decimal value representing an integer in the minor units of the currency. Only one of `flat_amount` and `flat_amount_decimal` can be set. """ @@ -102,7 +103,7 @@ class PriceUpdateParamsCurrencyOptionsTier(TypedDict): """ The per unit billing amount for each individual unit for which this tier applies. """ - unit_amount_decimal: NotRequired[str] + unit_amount_decimal: NotRequired[Decimal] """ Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set. """ diff --git a/stripe/params/_product_create_params.py b/stripe/params/_product_create_params.py index e0fc1ec9b..f6fd4adb2 100644 --- a/stripe/params/_product_create_params.py +++ b/stripe/params/_product_create_params.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from decimal import Decimal from stripe._request_options import RequestOptions from typing import Dict, List, Union from typing_extensions import Literal, NotRequired, TypedDict @@ -114,7 +115,7 @@ class ProductCreateParamsDefaultPriceData(TypedDict): """ A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge. One of `unit_amount`, `unit_amount_decimal`, or `custom_unit_amount` is required. """ - unit_amount_decimal: NotRequired[str] + unit_amount_decimal: NotRequired[Decimal] """ Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set. """ @@ -141,7 +142,7 @@ class ProductCreateParamsDefaultPriceDataCurrencyOptions(TypedDict): """ A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge. """ - unit_amount_decimal: NotRequired[str] + unit_amount_decimal: NotRequired[Decimal] """ Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set. """ @@ -173,7 +174,7 @@ class ProductCreateParamsDefaultPriceDataCurrencyOptionsTier(TypedDict): """ The flat billing amount for an entire tier, regardless of the number of units in the tier. """ - flat_amount_decimal: NotRequired[str] + flat_amount_decimal: NotRequired[Decimal] """ Same as `flat_amount`, but accepts a decimal value representing an integer in the minor units of the currency. Only one of `flat_amount` and `flat_amount_decimal` can be set. """ @@ -181,7 +182,7 @@ class ProductCreateParamsDefaultPriceDataCurrencyOptionsTier(TypedDict): """ The per unit billing amount for each individual unit for which this tier applies. """ - unit_amount_decimal: NotRequired[str] + unit_amount_decimal: NotRequired[Decimal] """ Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set. """ diff --git a/stripe/params/_quote_create_params.py b/stripe/params/_quote_create_params.py index daf676a3f..9e3b61126 100644 --- a/stripe/params/_quote_create_params.py +++ b/stripe/params/_quote_create_params.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from decimal import Decimal from stripe._request_options import RequestOptions from typing import Dict, List from typing_extensions import Literal, NotRequired, TypedDict @@ -301,7 +302,7 @@ class QuoteCreateParamsLineItemPriceData(TypedDict): """ A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge. """ - unit_amount_decimal: NotRequired[str] + unit_amount_decimal: NotRequired[Decimal] """ Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set. """ diff --git a/stripe/params/_quote_modify_params.py b/stripe/params/_quote_modify_params.py index 645234729..333dbef1a 100644 --- a/stripe/params/_quote_modify_params.py +++ b/stripe/params/_quote_modify_params.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from decimal import Decimal from stripe._request_options import RequestOptions from typing import Dict, List from typing_extensions import Literal, NotRequired, TypedDict @@ -286,7 +287,7 @@ class QuoteModifyParamsLineItemPriceData(TypedDict): """ A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge. """ - unit_amount_decimal: NotRequired[str] + unit_amount_decimal: NotRequired[Decimal] """ Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set. """ diff --git a/stripe/params/_quote_update_params.py b/stripe/params/_quote_update_params.py index 72d014fe8..64aa29e47 100644 --- a/stripe/params/_quote_update_params.py +++ b/stripe/params/_quote_update_params.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from decimal import Decimal from typing import Dict, List from typing_extensions import Literal, NotRequired, TypedDict @@ -285,7 +286,7 @@ class QuoteUpdateParamsLineItemPriceData(TypedDict): """ A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge. """ - unit_amount_decimal: NotRequired[str] + unit_amount_decimal: NotRequired[Decimal] """ Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set. """ diff --git a/stripe/params/_subscription_create_params.py b/stripe/params/_subscription_create_params.py index 8030474af..2f0827e04 100644 --- a/stripe/params/_subscription_create_params.py +++ b/stripe/params/_subscription_create_params.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from decimal import Decimal from stripe._request_options import RequestOptions from typing import Dict, List from typing_extensions import Literal, NotRequired, TypedDict @@ -327,7 +328,7 @@ class SubscriptionCreateParamsAddInvoiceItemPriceData(TypedDict): """ A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge or a negative integer representing the amount to credit to the customer. """ - unit_amount_decimal: NotRequired[str] + unit_amount_decimal: NotRequired[Decimal] """ Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set. """ @@ -785,7 +786,7 @@ class SubscriptionCreateParamsItemPriceData(TypedDict): """ A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge. """ - unit_amount_decimal: NotRequired[str] + unit_amount_decimal: NotRequired[Decimal] """ Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set. """ diff --git a/stripe/params/_subscription_item_create_params.py b/stripe/params/_subscription_item_create_params.py index 2725d27b6..85116aebb 100644 --- a/stripe/params/_subscription_item_create_params.py +++ b/stripe/params/_subscription_item_create_params.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from decimal import Decimal from stripe._request_options import RequestOptions from typing import Dict, List from typing_extensions import Literal, NotRequired, TypedDict @@ -234,7 +235,7 @@ class SubscriptionItemCreateParamsPriceData(TypedDict): """ A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge. """ - unit_amount_decimal: NotRequired[str] + unit_amount_decimal: NotRequired[Decimal] """ Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set. """ diff --git a/stripe/params/_subscription_item_modify_params.py b/stripe/params/_subscription_item_modify_params.py index db43a8a25..aad0d9d2c 100644 --- a/stripe/params/_subscription_item_modify_params.py +++ b/stripe/params/_subscription_item_modify_params.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from decimal import Decimal from stripe._request_options import RequestOptions from typing import Dict, List from typing_extensions import Literal, NotRequired, TypedDict @@ -230,7 +231,7 @@ class SubscriptionItemModifyParamsPriceData(TypedDict): """ A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge. """ - unit_amount_decimal: NotRequired[str] + unit_amount_decimal: NotRequired[Decimal] """ Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set. """ diff --git a/stripe/params/_subscription_item_update_params.py b/stripe/params/_subscription_item_update_params.py index e10e50c88..69152b004 100644 --- a/stripe/params/_subscription_item_update_params.py +++ b/stripe/params/_subscription_item_update_params.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from decimal import Decimal from typing import Dict, List from typing_extensions import Literal, NotRequired, TypedDict @@ -229,7 +230,7 @@ class SubscriptionItemUpdateParamsPriceData(TypedDict): """ A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge. """ - unit_amount_decimal: NotRequired[str] + unit_amount_decimal: NotRequired[Decimal] """ Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set. """ diff --git a/stripe/params/_subscription_modify_params.py b/stripe/params/_subscription_modify_params.py index ebea0bf1d..b7ac5a262 100644 --- a/stripe/params/_subscription_modify_params.py +++ b/stripe/params/_subscription_modify_params.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from decimal import Decimal from stripe._request_options import RequestOptions from typing import Dict, List from typing_extensions import Literal, NotRequired, TypedDict @@ -313,7 +314,7 @@ class SubscriptionModifyParamsAddInvoiceItemPriceData(TypedDict): """ A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge or a negative integer representing the amount to credit to the customer. """ - unit_amount_decimal: NotRequired[str] + unit_amount_decimal: NotRequired[Decimal] """ Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set. """ @@ -751,7 +752,7 @@ class SubscriptionModifyParamsItemPriceData(TypedDict): """ A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge. """ - unit_amount_decimal: NotRequired[str] + unit_amount_decimal: NotRequired[Decimal] """ Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set. """ diff --git a/stripe/params/_subscription_schedule_create_params.py b/stripe/params/_subscription_schedule_create_params.py index de6c818fd..02bcb3862 100644 --- a/stripe/params/_subscription_schedule_create_params.py +++ b/stripe/params/_subscription_schedule_create_params.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from decimal import Decimal from stripe._request_options import RequestOptions from typing import Dict, List from typing_extensions import Literal, NotRequired, TypedDict @@ -550,7 +551,7 @@ class SubscriptionScheduleCreateParamsPhaseAddInvoiceItemPriceData(TypedDict): """ A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge or a negative integer representing the amount to credit to the customer. """ - unit_amount_decimal: NotRequired[str] + unit_amount_decimal: NotRequired[Decimal] """ Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set. """ @@ -931,7 +932,7 @@ class SubscriptionScheduleCreateParamsPhaseItemPriceData(TypedDict): """ A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge. """ - unit_amount_decimal: NotRequired[str] + unit_amount_decimal: NotRequired[Decimal] """ Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set. """ diff --git a/stripe/params/_subscription_schedule_modify_params.py b/stripe/params/_subscription_schedule_modify_params.py index dbfe5ee7d..29349c8d1 100644 --- a/stripe/params/_subscription_schedule_modify_params.py +++ b/stripe/params/_subscription_schedule_modify_params.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from decimal import Decimal from stripe._request_options import RequestOptions from typing import Dict, List from typing_extensions import Literal, NotRequired, TypedDict @@ -522,7 +523,7 @@ class SubscriptionScheduleModifyParamsPhaseAddInvoiceItemPriceData(TypedDict): """ A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge or a negative integer representing the amount to credit to the customer. """ - unit_amount_decimal: NotRequired[str] + unit_amount_decimal: NotRequired[Decimal] """ Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set. """ @@ -903,7 +904,7 @@ class SubscriptionScheduleModifyParamsPhaseItemPriceData(TypedDict): """ A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge. """ - unit_amount_decimal: NotRequired[str] + unit_amount_decimal: NotRequired[Decimal] """ Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set. """ diff --git a/stripe/params/_subscription_schedule_update_params.py b/stripe/params/_subscription_schedule_update_params.py index a211eeadb..a24bf3bb5 100644 --- a/stripe/params/_subscription_schedule_update_params.py +++ b/stripe/params/_subscription_schedule_update_params.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from decimal import Decimal from typing import Dict, List from typing_extensions import Literal, NotRequired, TypedDict @@ -521,7 +522,7 @@ class SubscriptionScheduleUpdateParamsPhaseAddInvoiceItemPriceData(TypedDict): """ A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge or a negative integer representing the amount to credit to the customer. """ - unit_amount_decimal: NotRequired[str] + unit_amount_decimal: NotRequired[Decimal] """ Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set. """ @@ -902,7 +903,7 @@ class SubscriptionScheduleUpdateParamsPhaseItemPriceData(TypedDict): """ A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge. """ - unit_amount_decimal: NotRequired[str] + unit_amount_decimal: NotRequired[Decimal] """ Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set. """ diff --git a/stripe/params/_subscription_update_params.py b/stripe/params/_subscription_update_params.py index 1103cb036..726e34d2c 100644 --- a/stripe/params/_subscription_update_params.py +++ b/stripe/params/_subscription_update_params.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from decimal import Decimal from typing import Dict, List from typing_extensions import Literal, NotRequired, TypedDict @@ -312,7 +313,7 @@ class SubscriptionUpdateParamsAddInvoiceItemPriceData(TypedDict): """ A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge or a negative integer representing the amount to credit to the customer. """ - unit_amount_decimal: NotRequired[str] + unit_amount_decimal: NotRequired[Decimal] """ Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set. """ @@ -750,7 +751,7 @@ class SubscriptionUpdateParamsItemPriceData(TypedDict): """ A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge. """ - unit_amount_decimal: NotRequired[str] + unit_amount_decimal: NotRequired[Decimal] """ Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set. """ diff --git a/stripe/params/billing/_alert_create_params.py b/stripe/params/billing/_alert_create_params.py index ebd4f5c06..c227ab743 100644 --- a/stripe/params/billing/_alert_create_params.py +++ b/stripe/params/billing/_alert_create_params.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from decimal import Decimal from stripe._request_options import RequestOptions from typing import List from typing_extensions import Literal, NotRequired, TypedDict @@ -145,7 +146,7 @@ class AlertCreateParamsCreditBalanceThresholdLteCustomPricingUnit(TypedDict): """ The ID of the custom pricing unit. """ - value: str + value: Decimal """ A positive decimal string representing the amount of the custom pricing unit threshold. """ @@ -233,7 +234,7 @@ class AlertCreateParamsSpendThresholdGteCustomPricingUnit(TypedDict): """ The ID of the custom pricing unit. """ - value: str + value: Decimal """ A positive decimal string representing the amount of the custom pricing unit threshold. """ diff --git a/stripe/params/billing/_credit_grant_create_params.py b/stripe/params/billing/_credit_grant_create_params.py index 6d1c64de9..fb2ccc949 100644 --- a/stripe/params/billing/_credit_grant_create_params.py +++ b/stripe/params/billing/_credit_grant_create_params.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from decimal import Decimal from stripe._request_options import RequestOptions from typing import Dict, List from typing_extensions import Literal, NotRequired, TypedDict @@ -74,7 +75,7 @@ class CreditGrantCreateParamsAmountCustomPricingUnit(TypedDict): """ The ID of the custom pricing unit. """ - value: str + value: Decimal """ A positive integer representing the amount of the credit grant. """ diff --git a/stripe/params/checkout/_session_create_params.py b/stripe/params/checkout/_session_create_params.py index 891e6e1a9..9aa8398fe 100644 --- a/stripe/params/checkout/_session_create_params.py +++ b/stripe/params/checkout/_session_create_params.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from decimal import Decimal from stripe._request_options import RequestOptions from typing import Dict, List from typing_extensions import Literal, NotRequired, TypedDict @@ -974,7 +975,7 @@ class SessionCreateParamsLineItemPriceData(TypedDict): """ A non-negative integer in cents (or local equivalent) representing how much to charge. One of `unit_amount` or `unit_amount_decimal` is required. """ - unit_amount_decimal: NotRequired[str] + unit_amount_decimal: NotRequired[Decimal] """ Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set. """ diff --git a/stripe/params/checkout/_session_modify_params.py b/stripe/params/checkout/_session_modify_params.py index 107f58f70..dee4f0196 100644 --- a/stripe/params/checkout/_session_modify_params.py +++ b/stripe/params/checkout/_session_modify_params.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from decimal import Decimal from stripe._request_options import RequestOptions from typing import Dict, List from typing_extensions import Literal, NotRequired, TypedDict @@ -265,7 +266,7 @@ class SessionModifyParamsLineItemPriceData(TypedDict): """ A non-negative integer in cents (or local equivalent) representing how much to charge. One of `unit_amount` or `unit_amount_decimal` is required. """ - unit_amount_decimal: NotRequired[str] + unit_amount_decimal: NotRequired[Decimal] """ Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set. """ diff --git a/stripe/params/checkout/_session_update_params.py b/stripe/params/checkout/_session_update_params.py index a71ee1722..75088c8e6 100644 --- a/stripe/params/checkout/_session_update_params.py +++ b/stripe/params/checkout/_session_update_params.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from decimal import Decimal from typing import Dict, List from typing_extensions import Literal, NotRequired, TypedDict @@ -264,7 +265,7 @@ class SessionUpdateParamsLineItemPriceData(TypedDict): """ A non-negative integer in cents (or local equivalent) representing how much to charge. One of `unit_amount` or `unit_amount_decimal` is required. """ - unit_amount_decimal: NotRequired[str] + unit_amount_decimal: NotRequired[Decimal] """ Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set. """ diff --git a/stripe/params/climate/_order_create_params.py b/stripe/params/climate/_order_create_params.py index 7f0785799..7ffb35bea 100644 --- a/stripe/params/climate/_order_create_params.py +++ b/stripe/params/climate/_order_create_params.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from decimal import Decimal from stripe._request_options import RequestOptions from typing import Dict, List from typing_extensions import NotRequired, TypedDict @@ -26,7 +27,7 @@ class OrderCreateParams(RequestOptions): """ Set of [key-value pairs](https://docs.stripe.com/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`. """ - metric_tons: NotRequired[str] + metric_tons: NotRequired[Decimal] """ Requested number of tons for the order. Either this or `amount` must be specified. """ diff --git a/stripe/params/issuing/_authorization_capture_params.py b/stripe/params/issuing/_authorization_capture_params.py index ceb709ffc..d1370b317 100644 --- a/stripe/params/issuing/_authorization_capture_params.py +++ b/stripe/params/issuing/_authorization_capture_params.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from decimal import Decimal from stripe._request_options import RequestOptions from typing import List from typing_extensions import Literal, NotRequired, TypedDict @@ -133,7 +134,7 @@ class AuthorizationCaptureParamsPurchaseDetailsFleetReportedBreakdown( class AuthorizationCaptureParamsPurchaseDetailsFleetReportedBreakdownFuel( TypedDict, ): - gross_amount_decimal: NotRequired[str] + gross_amount_decimal: NotRequired[Decimal] """ Gross fuel amount that should equal Fuel Volume multipled by Fuel Unit Cost, inclusive of taxes. """ @@ -142,7 +143,7 @@ class AuthorizationCaptureParamsPurchaseDetailsFleetReportedBreakdownFuel( class AuthorizationCaptureParamsPurchaseDetailsFleetReportedBreakdownNonFuel( TypedDict, ): - gross_amount_decimal: NotRequired[str] + gross_amount_decimal: NotRequired[Decimal] """ Gross non-fuel amount that should equal the sum of the line items, inclusive of taxes. """ @@ -151,11 +152,11 @@ class AuthorizationCaptureParamsPurchaseDetailsFleetReportedBreakdownNonFuel( class AuthorizationCaptureParamsPurchaseDetailsFleetReportedBreakdownTax( TypedDict, ): - local_amount_decimal: NotRequired[str] + local_amount_decimal: NotRequired[Decimal] """ Amount of state or provincial Sales Tax included in the transaction amount. Null if not reported by merchant or not subject to tax. """ - national_amount_decimal: NotRequired[str] + national_amount_decimal: NotRequired[Decimal] """ Amount of national Sales Tax or VAT included in the transaction amount. Null if not reported by merchant or not subject to tax. """ @@ -218,7 +219,7 @@ class AuthorizationCaptureParamsPurchaseDetailsFuel(TypedDict): """ [Conexxus Payment System Product Code](https://www.conexxus.org/conexxus-payment-system-product-codes) identifying the primary fuel product purchased. """ - quantity_decimal: NotRequired[str] + quantity_decimal: NotRequired[Decimal] """ The quantity of `unit`s of fuel that was dispensed, represented as a decimal string with at most 12 decimal places. """ @@ -249,7 +250,7 @@ class AuthorizationCaptureParamsPurchaseDetailsFuel(TypedDict): """ The units for `quantity_decimal`. One of `charging_minute`, `imperial_gallon`, `kilogram`, `kilowatt_hour`, `liter`, `pound`, `us_gallon`, or `other`. """ - unit_cost_decimal: NotRequired[str] + unit_cost_decimal: NotRequired[Decimal] """ The cost in cents per each unit of fuel, represented as a decimal string with at most 12 decimal places. """ @@ -268,6 +269,6 @@ class AuthorizationCaptureParamsPurchaseDetailsLodging(TypedDict): class AuthorizationCaptureParamsPurchaseDetailsReceipt(TypedDict): description: NotRequired[str] - quantity: NotRequired[str] + quantity: NotRequired[Decimal] total: NotRequired[int] unit_cost: NotRequired[int] diff --git a/stripe/params/issuing/_authorization_create_params.py b/stripe/params/issuing/_authorization_create_params.py index c20825cd5..c1ec1b239 100644 --- a/stripe/params/issuing/_authorization_create_params.py +++ b/stripe/params/issuing/_authorization_create_params.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from decimal import Decimal from stripe._request_options import RequestOptions from typing import List from typing_extensions import Literal, NotRequired, TypedDict @@ -161,25 +162,25 @@ class AuthorizationCreateParamsFleetReportedBreakdown(TypedDict): class AuthorizationCreateParamsFleetReportedBreakdownFuel(TypedDict): - gross_amount_decimal: NotRequired[str] + gross_amount_decimal: NotRequired[Decimal] """ Gross fuel amount that should equal Fuel Volume multipled by Fuel Unit Cost, inclusive of taxes. """ class AuthorizationCreateParamsFleetReportedBreakdownNonFuel(TypedDict): - gross_amount_decimal: NotRequired[str] + gross_amount_decimal: NotRequired[Decimal] """ Gross non-fuel amount that should equal the sum of the line items, inclusive of taxes. """ class AuthorizationCreateParamsFleetReportedBreakdownTax(TypedDict): - local_amount_decimal: NotRequired[str] + local_amount_decimal: NotRequired[Decimal] """ Amount of state or provincial Sales Tax included in the transaction amount. Null if not reported by merchant or not subject to tax. """ - national_amount_decimal: NotRequired[str] + national_amount_decimal: NotRequired[Decimal] """ Amount of national Sales Tax or VAT included in the transaction amount. Null if not reported by merchant or not subject to tax. """ @@ -190,7 +191,7 @@ class AuthorizationCreateParamsFuel(TypedDict): """ [Conexxus Payment System Product Code](https://www.conexxus.org/conexxus-payment-system-product-codes) identifying the primary fuel product purchased. """ - quantity_decimal: NotRequired[str] + quantity_decimal: NotRequired[Decimal] """ The quantity of `unit`s of fuel that was dispensed, represented as a decimal string with at most 12 decimal places. """ @@ -221,7 +222,7 @@ class AuthorizationCreateParamsFuel(TypedDict): """ The units for `quantity_decimal`. One of `charging_minute`, `imperial_gallon`, `kilogram`, `kilowatt_hour`, `liter`, `pound`, `us_gallon`, or `other`. """ - unit_cost_decimal: NotRequired[str] + unit_cost_decimal: NotRequired[Decimal] """ The cost in cents per each unit of fuel, represented as a decimal string with at most 12 decimal places. """ diff --git a/stripe/params/issuing/_authorization_finalize_amount_params.py b/stripe/params/issuing/_authorization_finalize_amount_params.py index 64b9053a9..3ffab70e7 100644 --- a/stripe/params/issuing/_authorization_finalize_amount_params.py +++ b/stripe/params/issuing/_authorization_finalize_amount_params.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from decimal import Decimal from stripe._request_options import RequestOptions from typing import List from typing_extensions import Literal, NotRequired, TypedDict @@ -98,7 +99,7 @@ class AuthorizationFinalizeAmountParamsFleetReportedBreakdown(TypedDict): class AuthorizationFinalizeAmountParamsFleetReportedBreakdownFuel(TypedDict): - gross_amount_decimal: NotRequired[str] + gross_amount_decimal: NotRequired[Decimal] """ Gross fuel amount that should equal Fuel Volume multipled by Fuel Unit Cost, inclusive of taxes. """ @@ -107,18 +108,18 @@ class AuthorizationFinalizeAmountParamsFleetReportedBreakdownFuel(TypedDict): class AuthorizationFinalizeAmountParamsFleetReportedBreakdownNonFuel( TypedDict ): - gross_amount_decimal: NotRequired[str] + gross_amount_decimal: NotRequired[Decimal] """ Gross non-fuel amount that should equal the sum of the line items, inclusive of taxes. """ class AuthorizationFinalizeAmountParamsFleetReportedBreakdownTax(TypedDict): - local_amount_decimal: NotRequired[str] + local_amount_decimal: NotRequired[Decimal] """ Amount of state or provincial Sales Tax included in the transaction amount. Null if not reported by merchant or not subject to tax. """ - national_amount_decimal: NotRequired[str] + national_amount_decimal: NotRequired[Decimal] """ Amount of national Sales Tax or VAT included in the transaction amount. Null if not reported by merchant or not subject to tax. """ @@ -129,7 +130,7 @@ class AuthorizationFinalizeAmountParamsFuel(TypedDict): """ [Conexxus Payment System Product Code](https://www.conexxus.org/conexxus-payment-system-product-codes) identifying the primary fuel product purchased. """ - quantity_decimal: NotRequired[str] + quantity_decimal: NotRequired[Decimal] """ The quantity of `unit`s of fuel that was dispensed, represented as a decimal string with at most 12 decimal places. """ @@ -160,7 +161,7 @@ class AuthorizationFinalizeAmountParamsFuel(TypedDict): """ The units for `quantity_decimal`. One of `charging_minute`, `imperial_gallon`, `kilogram`, `kilowatt_hour`, `liter`, `pound`, `us_gallon`, or `other`. """ - unit_cost_decimal: NotRequired[str] + unit_cost_decimal: NotRequired[Decimal] """ The cost in cents per each unit of fuel, represented as a decimal string with at most 12 decimal places. """ diff --git a/stripe/params/issuing/_transaction_create_force_capture_params.py b/stripe/params/issuing/_transaction_create_force_capture_params.py index c71bcfca7..1f5356492 100644 --- a/stripe/params/issuing/_transaction_create_force_capture_params.py +++ b/stripe/params/issuing/_transaction_create_force_capture_params.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from decimal import Decimal from stripe._request_options import RequestOptions from typing import List from typing_extensions import Literal, NotRequired, TypedDict @@ -487,7 +488,7 @@ class TransactionCreateForceCaptureParamsPurchaseDetailsFleetReportedBreakdown( class TransactionCreateForceCaptureParamsPurchaseDetailsFleetReportedBreakdownFuel( TypedDict, ): - gross_amount_decimal: NotRequired[str] + gross_amount_decimal: NotRequired[Decimal] """ Gross fuel amount that should equal Fuel Volume multipled by Fuel Unit Cost, inclusive of taxes. """ @@ -496,7 +497,7 @@ class TransactionCreateForceCaptureParamsPurchaseDetailsFleetReportedBreakdownFu class TransactionCreateForceCaptureParamsPurchaseDetailsFleetReportedBreakdownNonFuel( TypedDict, ): - gross_amount_decimal: NotRequired[str] + gross_amount_decimal: NotRequired[Decimal] """ Gross non-fuel amount that should equal the sum of the line items, inclusive of taxes. """ @@ -505,11 +506,11 @@ class TransactionCreateForceCaptureParamsPurchaseDetailsFleetReportedBreakdownNo class TransactionCreateForceCaptureParamsPurchaseDetailsFleetReportedBreakdownTax( TypedDict, ): - local_amount_decimal: NotRequired[str] + local_amount_decimal: NotRequired[Decimal] """ Amount of state or provincial Sales Tax included in the transaction amount. Null if not reported by merchant or not subject to tax. """ - national_amount_decimal: NotRequired[str] + national_amount_decimal: NotRequired[Decimal] """ Amount of national Sales Tax or VAT included in the transaction amount. Null if not reported by merchant or not subject to tax. """ @@ -574,7 +575,7 @@ class TransactionCreateForceCaptureParamsPurchaseDetailsFuel(TypedDict): """ [Conexxus Payment System Product Code](https://www.conexxus.org/conexxus-payment-system-product-codes) identifying the primary fuel product purchased. """ - quantity_decimal: NotRequired[str] + quantity_decimal: NotRequired[Decimal] """ The quantity of `unit`s of fuel that was dispensed, represented as a decimal string with at most 12 decimal places. """ @@ -605,7 +606,7 @@ class TransactionCreateForceCaptureParamsPurchaseDetailsFuel(TypedDict): """ The units for `quantity_decimal`. One of `charging_minute`, `imperial_gallon`, `kilogram`, `kilowatt_hour`, `liter`, `pound`, `us_gallon`, or `other`. """ - unit_cost_decimal: NotRequired[str] + unit_cost_decimal: NotRequired[Decimal] """ The cost in cents per each unit of fuel, represented as a decimal string with at most 12 decimal places. """ @@ -624,6 +625,6 @@ class TransactionCreateForceCaptureParamsPurchaseDetailsLodging(TypedDict): class TransactionCreateForceCaptureParamsPurchaseDetailsReceipt(TypedDict): description: NotRequired[str] - quantity: NotRequired[str] + quantity: NotRequired[Decimal] total: NotRequired[int] unit_cost: NotRequired[int] diff --git a/stripe/params/issuing/_transaction_create_unlinked_refund_params.py b/stripe/params/issuing/_transaction_create_unlinked_refund_params.py index d8d6ef226..e2685327b 100644 --- a/stripe/params/issuing/_transaction_create_unlinked_refund_params.py +++ b/stripe/params/issuing/_transaction_create_unlinked_refund_params.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from decimal import Decimal from stripe._request_options import RequestOptions from typing import List from typing_extensions import Literal, NotRequired, TypedDict @@ -489,7 +490,7 @@ class TransactionCreateUnlinkedRefundParamsPurchaseDetailsFleetReportedBreakdown class TransactionCreateUnlinkedRefundParamsPurchaseDetailsFleetReportedBreakdownFuel( TypedDict, ): - gross_amount_decimal: NotRequired[str] + gross_amount_decimal: NotRequired[Decimal] """ Gross fuel amount that should equal Fuel Volume multipled by Fuel Unit Cost, inclusive of taxes. """ @@ -498,7 +499,7 @@ class TransactionCreateUnlinkedRefundParamsPurchaseDetailsFleetReportedBreakdown class TransactionCreateUnlinkedRefundParamsPurchaseDetailsFleetReportedBreakdownNonFuel( TypedDict, ): - gross_amount_decimal: NotRequired[str] + gross_amount_decimal: NotRequired[Decimal] """ Gross non-fuel amount that should equal the sum of the line items, inclusive of taxes. """ @@ -507,11 +508,11 @@ class TransactionCreateUnlinkedRefundParamsPurchaseDetailsFleetReportedBreakdown class TransactionCreateUnlinkedRefundParamsPurchaseDetailsFleetReportedBreakdownTax( TypedDict, ): - local_amount_decimal: NotRequired[str] + local_amount_decimal: NotRequired[Decimal] """ Amount of state or provincial Sales Tax included in the transaction amount. Null if not reported by merchant or not subject to tax. """ - national_amount_decimal: NotRequired[str] + national_amount_decimal: NotRequired[Decimal] """ Amount of national Sales Tax or VAT included in the transaction amount. Null if not reported by merchant or not subject to tax. """ @@ -578,7 +579,7 @@ class TransactionCreateUnlinkedRefundParamsPurchaseDetailsFuel(TypedDict): """ [Conexxus Payment System Product Code](https://www.conexxus.org/conexxus-payment-system-product-codes) identifying the primary fuel product purchased. """ - quantity_decimal: NotRequired[str] + quantity_decimal: NotRequired[Decimal] """ The quantity of `unit`s of fuel that was dispensed, represented as a decimal string with at most 12 decimal places. """ @@ -609,7 +610,7 @@ class TransactionCreateUnlinkedRefundParamsPurchaseDetailsFuel(TypedDict): """ The units for `quantity_decimal`. One of `charging_minute`, `imperial_gallon`, `kilogram`, `kilowatt_hour`, `liter`, `pound`, `us_gallon`, or `other`. """ - unit_cost_decimal: NotRequired[str] + unit_cost_decimal: NotRequired[Decimal] """ The cost in cents per each unit of fuel, represented as a decimal string with at most 12 decimal places. """ @@ -628,6 +629,6 @@ class TransactionCreateUnlinkedRefundParamsPurchaseDetailsLodging(TypedDict): class TransactionCreateUnlinkedRefundParamsPurchaseDetailsReceipt(TypedDict): description: NotRequired[str] - quantity: NotRequired[str] + quantity: NotRequired[Decimal] total: NotRequired[int] unit_cost: NotRequired[int] diff --git a/stripe/params/test_helpers/issuing/_authorization_capture_params.py b/stripe/params/test_helpers/issuing/_authorization_capture_params.py index 8902e15aa..6cc4c1fb7 100644 --- a/stripe/params/test_helpers/issuing/_authorization_capture_params.py +++ b/stripe/params/test_helpers/issuing/_authorization_capture_params.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from decimal import Decimal from typing import List from typing_extensions import Literal, NotRequired, TypedDict @@ -132,7 +133,7 @@ class AuthorizationCaptureParamsPurchaseDetailsFleetReportedBreakdown( class AuthorizationCaptureParamsPurchaseDetailsFleetReportedBreakdownFuel( TypedDict, ): - gross_amount_decimal: NotRequired[str] + gross_amount_decimal: NotRequired[Decimal] """ Gross fuel amount that should equal Fuel Volume multipled by Fuel Unit Cost, inclusive of taxes. """ @@ -141,7 +142,7 @@ class AuthorizationCaptureParamsPurchaseDetailsFleetReportedBreakdownFuel( class AuthorizationCaptureParamsPurchaseDetailsFleetReportedBreakdownNonFuel( TypedDict, ): - gross_amount_decimal: NotRequired[str] + gross_amount_decimal: NotRequired[Decimal] """ Gross non-fuel amount that should equal the sum of the line items, inclusive of taxes. """ @@ -150,11 +151,11 @@ class AuthorizationCaptureParamsPurchaseDetailsFleetReportedBreakdownNonFuel( class AuthorizationCaptureParamsPurchaseDetailsFleetReportedBreakdownTax( TypedDict, ): - local_amount_decimal: NotRequired[str] + local_amount_decimal: NotRequired[Decimal] """ Amount of state or provincial Sales Tax included in the transaction amount. Null if not reported by merchant or not subject to tax. """ - national_amount_decimal: NotRequired[str] + national_amount_decimal: NotRequired[Decimal] """ Amount of national Sales Tax or VAT included in the transaction amount. Null if not reported by merchant or not subject to tax. """ @@ -217,7 +218,7 @@ class AuthorizationCaptureParamsPurchaseDetailsFuel(TypedDict): """ [Conexxus Payment System Product Code](https://www.conexxus.org/conexxus-payment-system-product-codes) identifying the primary fuel product purchased. """ - quantity_decimal: NotRequired[str] + quantity_decimal: NotRequired[Decimal] """ The quantity of `unit`s of fuel that was dispensed, represented as a decimal string with at most 12 decimal places. """ @@ -248,7 +249,7 @@ class AuthorizationCaptureParamsPurchaseDetailsFuel(TypedDict): """ The units for `quantity_decimal`. One of `charging_minute`, `imperial_gallon`, `kilogram`, `kilowatt_hour`, `liter`, `pound`, `us_gallon`, or `other`. """ - unit_cost_decimal: NotRequired[str] + unit_cost_decimal: NotRequired[Decimal] """ The cost in cents per each unit of fuel, represented as a decimal string with at most 12 decimal places. """ @@ -267,6 +268,6 @@ class AuthorizationCaptureParamsPurchaseDetailsLodging(TypedDict): class AuthorizationCaptureParamsPurchaseDetailsReceipt(TypedDict): description: NotRequired[str] - quantity: NotRequired[str] + quantity: NotRequired[Decimal] total: NotRequired[int] unit_cost: NotRequired[int] diff --git a/stripe/params/test_helpers/issuing/_authorization_create_params.py b/stripe/params/test_helpers/issuing/_authorization_create_params.py index 92a39a655..31109682d 100644 --- a/stripe/params/test_helpers/issuing/_authorization_create_params.py +++ b/stripe/params/test_helpers/issuing/_authorization_create_params.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from decimal import Decimal from typing import List from typing_extensions import Literal, NotRequired, TypedDict @@ -160,25 +161,25 @@ class AuthorizationCreateParamsFleetReportedBreakdown(TypedDict): class AuthorizationCreateParamsFleetReportedBreakdownFuel(TypedDict): - gross_amount_decimal: NotRequired[str] + gross_amount_decimal: NotRequired[Decimal] """ Gross fuel amount that should equal Fuel Volume multipled by Fuel Unit Cost, inclusive of taxes. """ class AuthorizationCreateParamsFleetReportedBreakdownNonFuel(TypedDict): - gross_amount_decimal: NotRequired[str] + gross_amount_decimal: NotRequired[Decimal] """ Gross non-fuel amount that should equal the sum of the line items, inclusive of taxes. """ class AuthorizationCreateParamsFleetReportedBreakdownTax(TypedDict): - local_amount_decimal: NotRequired[str] + local_amount_decimal: NotRequired[Decimal] """ Amount of state or provincial Sales Tax included in the transaction amount. Null if not reported by merchant or not subject to tax. """ - national_amount_decimal: NotRequired[str] + national_amount_decimal: NotRequired[Decimal] """ Amount of national Sales Tax or VAT included in the transaction amount. Null if not reported by merchant or not subject to tax. """ @@ -189,7 +190,7 @@ class AuthorizationCreateParamsFuel(TypedDict): """ [Conexxus Payment System Product Code](https://www.conexxus.org/conexxus-payment-system-product-codes) identifying the primary fuel product purchased. """ - quantity_decimal: NotRequired[str] + quantity_decimal: NotRequired[Decimal] """ The quantity of `unit`s of fuel that was dispensed, represented as a decimal string with at most 12 decimal places. """ @@ -220,7 +221,7 @@ class AuthorizationCreateParamsFuel(TypedDict): """ The units for `quantity_decimal`. One of `charging_minute`, `imperial_gallon`, `kilogram`, `kilowatt_hour`, `liter`, `pound`, `us_gallon`, or `other`. """ - unit_cost_decimal: NotRequired[str] + unit_cost_decimal: NotRequired[Decimal] """ The cost in cents per each unit of fuel, represented as a decimal string with at most 12 decimal places. """ diff --git a/stripe/params/test_helpers/issuing/_authorization_finalize_amount_params.py b/stripe/params/test_helpers/issuing/_authorization_finalize_amount_params.py index af6fd8df6..ead32aab4 100644 --- a/stripe/params/test_helpers/issuing/_authorization_finalize_amount_params.py +++ b/stripe/params/test_helpers/issuing/_authorization_finalize_amount_params.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from decimal import Decimal from typing import List from typing_extensions import Literal, NotRequired, TypedDict @@ -97,7 +98,7 @@ class AuthorizationFinalizeAmountParamsFleetReportedBreakdown(TypedDict): class AuthorizationFinalizeAmountParamsFleetReportedBreakdownFuel(TypedDict): - gross_amount_decimal: NotRequired[str] + gross_amount_decimal: NotRequired[Decimal] """ Gross fuel amount that should equal Fuel Volume multipled by Fuel Unit Cost, inclusive of taxes. """ @@ -106,18 +107,18 @@ class AuthorizationFinalizeAmountParamsFleetReportedBreakdownFuel(TypedDict): class AuthorizationFinalizeAmountParamsFleetReportedBreakdownNonFuel( TypedDict ): - gross_amount_decimal: NotRequired[str] + gross_amount_decimal: NotRequired[Decimal] """ Gross non-fuel amount that should equal the sum of the line items, inclusive of taxes. """ class AuthorizationFinalizeAmountParamsFleetReportedBreakdownTax(TypedDict): - local_amount_decimal: NotRequired[str] + local_amount_decimal: NotRequired[Decimal] """ Amount of state or provincial Sales Tax included in the transaction amount. Null if not reported by merchant or not subject to tax. """ - national_amount_decimal: NotRequired[str] + national_amount_decimal: NotRequired[Decimal] """ Amount of national Sales Tax or VAT included in the transaction amount. Null if not reported by merchant or not subject to tax. """ @@ -128,7 +129,7 @@ class AuthorizationFinalizeAmountParamsFuel(TypedDict): """ [Conexxus Payment System Product Code](https://www.conexxus.org/conexxus-payment-system-product-codes) identifying the primary fuel product purchased. """ - quantity_decimal: NotRequired[str] + quantity_decimal: NotRequired[Decimal] """ The quantity of `unit`s of fuel that was dispensed, represented as a decimal string with at most 12 decimal places. """ @@ -159,7 +160,7 @@ class AuthorizationFinalizeAmountParamsFuel(TypedDict): """ The units for `quantity_decimal`. One of `charging_minute`, `imperial_gallon`, `kilogram`, `kilowatt_hour`, `liter`, `pound`, `us_gallon`, or `other`. """ - unit_cost_decimal: NotRequired[str] + unit_cost_decimal: NotRequired[Decimal] """ The cost in cents per each unit of fuel, represented as a decimal string with at most 12 decimal places. """ diff --git a/stripe/params/test_helpers/issuing/_transaction_create_force_capture_params.py b/stripe/params/test_helpers/issuing/_transaction_create_force_capture_params.py index 193a40e0a..95cefa462 100644 --- a/stripe/params/test_helpers/issuing/_transaction_create_force_capture_params.py +++ b/stripe/params/test_helpers/issuing/_transaction_create_force_capture_params.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from decimal import Decimal from typing import List from typing_extensions import Literal, NotRequired, TypedDict @@ -486,7 +487,7 @@ class TransactionCreateForceCaptureParamsPurchaseDetailsFleetReportedBreakdown( class TransactionCreateForceCaptureParamsPurchaseDetailsFleetReportedBreakdownFuel( TypedDict, ): - gross_amount_decimal: NotRequired[str] + gross_amount_decimal: NotRequired[Decimal] """ Gross fuel amount that should equal Fuel Volume multipled by Fuel Unit Cost, inclusive of taxes. """ @@ -495,7 +496,7 @@ class TransactionCreateForceCaptureParamsPurchaseDetailsFleetReportedBreakdownFu class TransactionCreateForceCaptureParamsPurchaseDetailsFleetReportedBreakdownNonFuel( TypedDict, ): - gross_amount_decimal: NotRequired[str] + gross_amount_decimal: NotRequired[Decimal] """ Gross non-fuel amount that should equal the sum of the line items, inclusive of taxes. """ @@ -504,11 +505,11 @@ class TransactionCreateForceCaptureParamsPurchaseDetailsFleetReportedBreakdownNo class TransactionCreateForceCaptureParamsPurchaseDetailsFleetReportedBreakdownTax( TypedDict, ): - local_amount_decimal: NotRequired[str] + local_amount_decimal: NotRequired[Decimal] """ Amount of state or provincial Sales Tax included in the transaction amount. Null if not reported by merchant or not subject to tax. """ - national_amount_decimal: NotRequired[str] + national_amount_decimal: NotRequired[Decimal] """ Amount of national Sales Tax or VAT included in the transaction amount. Null if not reported by merchant or not subject to tax. """ @@ -573,7 +574,7 @@ class TransactionCreateForceCaptureParamsPurchaseDetailsFuel(TypedDict): """ [Conexxus Payment System Product Code](https://www.conexxus.org/conexxus-payment-system-product-codes) identifying the primary fuel product purchased. """ - quantity_decimal: NotRequired[str] + quantity_decimal: NotRequired[Decimal] """ The quantity of `unit`s of fuel that was dispensed, represented as a decimal string with at most 12 decimal places. """ @@ -604,7 +605,7 @@ class TransactionCreateForceCaptureParamsPurchaseDetailsFuel(TypedDict): """ The units for `quantity_decimal`. One of `charging_minute`, `imperial_gallon`, `kilogram`, `kilowatt_hour`, `liter`, `pound`, `us_gallon`, or `other`. """ - unit_cost_decimal: NotRequired[str] + unit_cost_decimal: NotRequired[Decimal] """ The cost in cents per each unit of fuel, represented as a decimal string with at most 12 decimal places. """ @@ -623,6 +624,6 @@ class TransactionCreateForceCaptureParamsPurchaseDetailsLodging(TypedDict): class TransactionCreateForceCaptureParamsPurchaseDetailsReceipt(TypedDict): description: NotRequired[str] - quantity: NotRequired[str] + quantity: NotRequired[Decimal] total: NotRequired[int] unit_cost: NotRequired[int] diff --git a/stripe/params/test_helpers/issuing/_transaction_create_unlinked_refund_params.py b/stripe/params/test_helpers/issuing/_transaction_create_unlinked_refund_params.py index 4ab81df69..e5fcb265f 100644 --- a/stripe/params/test_helpers/issuing/_transaction_create_unlinked_refund_params.py +++ b/stripe/params/test_helpers/issuing/_transaction_create_unlinked_refund_params.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from decimal import Decimal from typing import List from typing_extensions import Literal, NotRequired, TypedDict @@ -488,7 +489,7 @@ class TransactionCreateUnlinkedRefundParamsPurchaseDetailsFleetReportedBreakdown class TransactionCreateUnlinkedRefundParamsPurchaseDetailsFleetReportedBreakdownFuel( TypedDict, ): - gross_amount_decimal: NotRequired[str] + gross_amount_decimal: NotRequired[Decimal] """ Gross fuel amount that should equal Fuel Volume multipled by Fuel Unit Cost, inclusive of taxes. """ @@ -497,7 +498,7 @@ class TransactionCreateUnlinkedRefundParamsPurchaseDetailsFleetReportedBreakdown class TransactionCreateUnlinkedRefundParamsPurchaseDetailsFleetReportedBreakdownNonFuel( TypedDict, ): - gross_amount_decimal: NotRequired[str] + gross_amount_decimal: NotRequired[Decimal] """ Gross non-fuel amount that should equal the sum of the line items, inclusive of taxes. """ @@ -506,11 +507,11 @@ class TransactionCreateUnlinkedRefundParamsPurchaseDetailsFleetReportedBreakdown class TransactionCreateUnlinkedRefundParamsPurchaseDetailsFleetReportedBreakdownTax( TypedDict, ): - local_amount_decimal: NotRequired[str] + local_amount_decimal: NotRequired[Decimal] """ Amount of state or provincial Sales Tax included in the transaction amount. Null if not reported by merchant or not subject to tax. """ - national_amount_decimal: NotRequired[str] + national_amount_decimal: NotRequired[Decimal] """ Amount of national Sales Tax or VAT included in the transaction amount. Null if not reported by merchant or not subject to tax. """ @@ -577,7 +578,7 @@ class TransactionCreateUnlinkedRefundParamsPurchaseDetailsFuel(TypedDict): """ [Conexxus Payment System Product Code](https://www.conexxus.org/conexxus-payment-system-product-codes) identifying the primary fuel product purchased. """ - quantity_decimal: NotRequired[str] + quantity_decimal: NotRequired[Decimal] """ The quantity of `unit`s of fuel that was dispensed, represented as a decimal string with at most 12 decimal places. """ @@ -608,7 +609,7 @@ class TransactionCreateUnlinkedRefundParamsPurchaseDetailsFuel(TypedDict): """ The units for `quantity_decimal`. One of `charging_minute`, `imperial_gallon`, `kilogram`, `kilowatt_hour`, `liter`, `pound`, `us_gallon`, or `other`. """ - unit_cost_decimal: NotRequired[str] + unit_cost_decimal: NotRequired[Decimal] """ The cost in cents per each unit of fuel, represented as a decimal string with at most 12 decimal places. """ @@ -627,6 +628,6 @@ class TransactionCreateUnlinkedRefundParamsPurchaseDetailsLodging(TypedDict): class TransactionCreateUnlinkedRefundParamsPurchaseDetailsReceipt(TypedDict): description: NotRequired[str] - quantity: NotRequired[str] + quantity: NotRequired[Decimal] total: NotRequired[int] unit_cost: NotRequired[int] diff --git a/stripe/params/v2/billing/__init__.py b/stripe/params/v2/billing/__init__.py index d8965556e..9ee5826d7 100644 --- a/stripe/params/v2/billing/__init__.py +++ b/stripe/params/v2/billing/__init__.py @@ -10,7 +10,6 @@ collection_settings as collection_settings, intents as intents, license_fees as license_fees, - pricing_plan_subscriptions as pricing_plan_subscriptions, pricing_plans as pricing_plans, rate_cards as rate_cards, ) @@ -129,6 +128,7 @@ IntentCreateParams as IntentCreateParams, IntentCreateParamsAction as IntentCreateParamsAction, IntentCreateParamsActionApply as IntentCreateParamsActionApply, + IntentCreateParamsActionApplyDiscount as IntentCreateParamsActionApplyDiscount, IntentCreateParamsActionApplyEffectiveAt as IntentCreateParamsActionApplyEffectiveAt, IntentCreateParamsActionApplyInvoiceDiscountRule as IntentCreateParamsActionApplyInvoiceDiscountRule, IntentCreateParamsActionApplyInvoiceDiscountRulePercentOff as IntentCreateParamsActionApplyInvoiceDiscountRulePercentOff, @@ -202,9 +202,6 @@ from stripe.params.v2.billing._license_fee_retrieve_params import ( LicenseFeeRetrieveParams as LicenseFeeRetrieveParams, ) - from stripe.params.v2.billing._license_fee_subscription_retrieve_params import ( - LicenseFeeSubscriptionRetrieveParams as LicenseFeeSubscriptionRetrieveParams, - ) from stripe.params.v2.billing._license_fee_update_params import ( LicenseFeeUpdateParams as LicenseFeeUpdateParams, LicenseFeeUpdateParamsTier as LicenseFeeUpdateParamsTier, @@ -280,6 +277,9 @@ PricingPlanSubscriptionListParams as PricingPlanSubscriptionListParams, PricingPlanSubscriptionListParamsPayer as PricingPlanSubscriptionListParamsPayer, ) + from stripe.params.v2.billing._pricing_plan_subscription_remove_discounts_params import ( + PricingPlanSubscriptionRemoveDiscountsParams as PricingPlanSubscriptionRemoveDiscountsParams, + ) from stripe.params.v2.billing._pricing_plan_subscription_retrieve_params import ( PricingPlanSubscriptionRetrieveParams as PricingPlanSubscriptionRetrieveParams, ) @@ -307,6 +307,15 @@ from stripe.params.v2.billing._rate_card_list_params import ( RateCardListParams as RateCardListParams, ) + from stripe.params.v2.billing._rate_card_modify_rates_params import ( + RateCardModifyRatesParams as RateCardModifyRatesParams, + RateCardModifyRatesParamsRatesToCreate as RateCardModifyRatesParamsRatesToCreate, + RateCardModifyRatesParamsRatesToCreateMeteredItemData as RateCardModifyRatesParamsRatesToCreateMeteredItemData, + RateCardModifyRatesParamsRatesToCreateMeteredItemDataMeterSegmentCondition as RateCardModifyRatesParamsRatesToCreateMeteredItemDataMeterSegmentCondition, + RateCardModifyRatesParamsRatesToCreateTier as RateCardModifyRatesParamsRatesToCreateTier, + RateCardModifyRatesParamsRatesToCreateTransformQuantity as RateCardModifyRatesParamsRatesToCreateTransformQuantity, + RateCardModifyRatesParamsRatesToDelete as RateCardModifyRatesParamsRatesToDelete, + ) from stripe.params.v2.billing._rate_card_retrieve_params import ( RateCardRetrieveParams as RateCardRetrieveParams, ) @@ -334,14 +343,12 @@ ServiceActionCreateParamsCreditGrant as ServiceActionCreateParamsCreditGrant, ServiceActionCreateParamsCreditGrantAmount as ServiceActionCreateParamsCreditGrantAmount, ServiceActionCreateParamsCreditGrantAmountCustomPricingUnit as ServiceActionCreateParamsCreditGrantAmountCustomPricingUnit, - ServiceActionCreateParamsCreditGrantAmountMonetary as ServiceActionCreateParamsCreditGrantAmountMonetary, ServiceActionCreateParamsCreditGrantApplicabilityConfig as ServiceActionCreateParamsCreditGrantApplicabilityConfig, ServiceActionCreateParamsCreditGrantApplicabilityConfigScope as ServiceActionCreateParamsCreditGrantApplicabilityConfigScope, ServiceActionCreateParamsCreditGrantExpiryConfig as ServiceActionCreateParamsCreditGrantExpiryConfig, ServiceActionCreateParamsCreditGrantPerTenant as ServiceActionCreateParamsCreditGrantPerTenant, ServiceActionCreateParamsCreditGrantPerTenantAmount as ServiceActionCreateParamsCreditGrantPerTenantAmount, ServiceActionCreateParamsCreditGrantPerTenantAmountCustomPricingUnit as ServiceActionCreateParamsCreditGrantPerTenantAmountCustomPricingUnit, - ServiceActionCreateParamsCreditGrantPerTenantAmountMonetary as ServiceActionCreateParamsCreditGrantPerTenantAmountMonetary, ServiceActionCreateParamsCreditGrantPerTenantApplicabilityConfig as ServiceActionCreateParamsCreditGrantPerTenantApplicabilityConfig, ServiceActionCreateParamsCreditGrantPerTenantApplicabilityConfigScope as ServiceActionCreateParamsCreditGrantPerTenantApplicabilityConfigScope, ServiceActionCreateParamsCreditGrantPerTenantExpiryConfig as ServiceActionCreateParamsCreditGrantPerTenantExpiryConfig, @@ -369,10 +376,6 @@ ), "intents": ("stripe.params.v2.billing.intents", True), "license_fees": ("stripe.params.v2.billing.license_fees", True), - "pricing_plan_subscriptions": ( - "stripe.params.v2.billing.pricing_plan_subscriptions", - True, - ), "pricing_plans": ("stripe.params.v2.billing.pricing_plans", True), "rate_cards": ("stripe.params.v2.billing.rate_cards", True), "BillSettingCreateParams": ( @@ -679,6 +682,10 @@ "stripe.params.v2.billing._intent_create_params", False, ), + "IntentCreateParamsActionApplyDiscount": ( + "stripe.params.v2.billing._intent_create_params", + False, + ), "IntentCreateParamsActionApplyEffectiveAt": ( "stripe.params.v2.billing._intent_create_params", False, @@ -911,10 +918,6 @@ "stripe.params.v2.billing._license_fee_retrieve_params", False, ), - "LicenseFeeSubscriptionRetrieveParams": ( - "stripe.params.v2.billing._license_fee_subscription_retrieve_params", - False, - ), "LicenseFeeUpdateParams": ( "stripe.params.v2.billing._license_fee_update_params", False, @@ -1047,6 +1050,10 @@ "stripe.params.v2.billing._pricing_plan_subscription_list_params", False, ), + "PricingPlanSubscriptionRemoveDiscountsParams": ( + "stripe.params.v2.billing._pricing_plan_subscription_remove_discounts_params", + False, + ), "PricingPlanSubscriptionRetrieveParams": ( "stripe.params.v2.billing._pricing_plan_subscription_retrieve_params", False, @@ -1083,6 +1090,34 @@ "stripe.params.v2.billing._rate_card_list_params", False, ), + "RateCardModifyRatesParams": ( + "stripe.params.v2.billing._rate_card_modify_rates_params", + False, + ), + "RateCardModifyRatesParamsRatesToCreate": ( + "stripe.params.v2.billing._rate_card_modify_rates_params", + False, + ), + "RateCardModifyRatesParamsRatesToCreateMeteredItemData": ( + "stripe.params.v2.billing._rate_card_modify_rates_params", + False, + ), + "RateCardModifyRatesParamsRatesToCreateMeteredItemDataMeterSegmentCondition": ( + "stripe.params.v2.billing._rate_card_modify_rates_params", + False, + ), + "RateCardModifyRatesParamsRatesToCreateTier": ( + "stripe.params.v2.billing._rate_card_modify_rates_params", + False, + ), + "RateCardModifyRatesParamsRatesToCreateTransformQuantity": ( + "stripe.params.v2.billing._rate_card_modify_rates_params", + False, + ), + "RateCardModifyRatesParamsRatesToDelete": ( + "stripe.params.v2.billing._rate_card_modify_rates_params", + False, + ), "RateCardRetrieveParams": ( "stripe.params.v2.billing._rate_card_retrieve_params", False, @@ -1131,10 +1166,6 @@ "stripe.params.v2.billing._service_action_create_params", False, ), - "ServiceActionCreateParamsCreditGrantAmountMonetary": ( - "stripe.params.v2.billing._service_action_create_params", - False, - ), "ServiceActionCreateParamsCreditGrantApplicabilityConfig": ( "stripe.params.v2.billing._service_action_create_params", False, @@ -1159,10 +1190,6 @@ "stripe.params.v2.billing._service_action_create_params", False, ), - "ServiceActionCreateParamsCreditGrantPerTenantAmountMonetary": ( - "stripe.params.v2.billing._service_action_create_params", - False, - ), "ServiceActionCreateParamsCreditGrantPerTenantApplicabilityConfig": ( "stripe.params.v2.billing._service_action_create_params", False, diff --git a/stripe/params/v2/billing/_intent_create_params.py b/stripe/params/v2/billing/_intent_create_params.py index be70c7a70..8094c3558 100644 --- a/stripe/params/v2/billing/_intent_create_params.py +++ b/stripe/params/v2/billing/_intent_create_params.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from decimal import Decimal from typing import Dict, List from typing_extensions import Literal, NotRequired, TypedDict @@ -13,6 +14,10 @@ class IntentCreateParams(TypedDict): """ Three-letter ISO currency code, in lowercase. Must be a supported currency. """ + include: NotRequired[List[Literal["invoice_resources.preview_invoice"]]] + """ + Select additional fields to include in the response. + """ cadence: NotRequired[str] """ ID of an existing Cadence to use. @@ -53,12 +58,16 @@ class IntentCreateParamsAction(TypedDict): class IntentCreateParamsActionApply(TypedDict): effective_at: NotRequired["IntentCreateParamsActionApplyEffectiveAt"] """ - When the apply action will take effect. Defaults to on_reserve if not specified. + When the apply action will take effect. If not specified, defaults to on_reserve. """ - type: Literal["invoice_discount_rule", "spend_modifier_rule"] + type: Literal["discount", "invoice_discount_rule", "spend_modifier_rule"] """ Type of the apply action details. """ + discount: NotRequired["IntentCreateParamsActionApplyDiscount"] + """ + Details for applying a discount. + """ invoice_discount_rule: NotRequired[ "IntentCreateParamsActionApplyInvoiceDiscountRule" ] @@ -74,14 +83,37 @@ class IntentCreateParamsActionApply(TypedDict): class IntentCreateParamsActionApplyEffectiveAt(TypedDict): + timestamp: NotRequired[str] + """ + The timestamp at which the apply action will take effect. Only present if type is timestamp. Only allowed for discount actions. + """ type: Literal[ - "current_billing_period_end", "next_billing_period_start", "on_reserve" + "current_billing_period_end", + "current_billing_period_start", + "next_billing_period_start", + "on_reserve", + "timestamp", ] """ When the apply action will take effect. """ +class IntentCreateParamsActionApplyDiscount(TypedDict): + coupon: NotRequired[str] + """ + The ID of the Coupon to apply. + """ + promotion_code: NotRequired[str] + """ + The ID of the PromotionCode to apply. + """ + type: Literal["coupon", "promotion_code"] + """ + Type of the discount. + """ + + class IntentCreateParamsActionApplyInvoiceDiscountRule(TypedDict): applies_to: Literal["cadence"] """ @@ -104,7 +136,7 @@ class IntentCreateParamsActionApplyInvoiceDiscountRulePercentOff(TypedDict): """ The maximum number of times this discount can be applied for this cadence. """ - percent_off: str + percent_off: Decimal """ Percent that will be taken off of the amount. For example, percent_off of 50.0 will make $100 amount $50 instead. """ @@ -145,7 +177,7 @@ class IntentCreateParamsActionApplySpendModifierRuleMaxBillingPeriodSpend( """ custom_pricing_unit_overage_rate: "IntentCreateParamsActionApplySpendModifierRuleMaxBillingPeriodSpendCustomPricingUnitOverageRate" """ - The configration for the overage rate for the custom pricing unit. + The configuration for the overage rate for the custom pricing unit. """ @@ -278,7 +310,7 @@ class IntentCreateParamsActionDeactivatePricingPlanSubscriptionDetailsOverrides( class IntentCreateParamsActionDeactivatePricingPlanSubscriptionDetailsOverridesPartialPeriodBehavior( TypedDict, ): - type: Literal["license_fee"] + type: Literal["license_fee", "recurring_credit_grant"] """ The type of behavior to override. """ @@ -393,7 +425,7 @@ class IntentCreateParamsActionModifyPricingPlanSubscriptionDetailsOverrides( class IntentCreateParamsActionModifyPricingPlanSubscriptionDetailsOverridesPartialPeriodBehavior( TypedDict, ): - type: Literal["license_fee"] + type: Literal["license_fee", "recurring_credit_grant"] """ The type of behavior to override. """ @@ -421,7 +453,7 @@ class IntentCreateParamsActionModifyPricingPlanSubscriptionDetailsOverridesParti class IntentCreateParamsActionRemove(TypedDict): effective_at: NotRequired["IntentCreateParamsActionRemoveEffectiveAt"] """ - When the remove action will take effect. Defaults to on_reserve if not specified. + When the remove action will take effect. If not specified, defaults to on_reserve. """ type: Literal["invoice_discount_rule", "spend_modifier_rule"] """ @@ -546,7 +578,7 @@ class IntentCreateParamsActionSubscribePricingPlanSubscriptionDetailsOverrides( class IntentCreateParamsActionSubscribePricingPlanSubscriptionDetailsOverridesPartialPeriodBehavior( TypedDict, ): - type: Literal["license_fee"] + type: Literal["license_fee", "recurring_credit_grant"] """ The type of behavior to override. """ @@ -594,7 +626,7 @@ class IntentCreateParamsActionSubscribeV1SubscriptionDetailsItem(TypedDict): """ quantity: NotRequired[int] """ - Quantity for this item. If not provided, will default to 1. + Quantity for this item. If not provided, defaults to 1. """ diff --git a/stripe/params/v2/billing/_intent_reserve_params.py b/stripe/params/v2/billing/_intent_reserve_params.py index f7f6f5f24..793892a18 100644 --- a/stripe/params/v2/billing/_intent_reserve_params.py +++ b/stripe/params/v2/billing/_intent_reserve_params.py @@ -1,7 +1,11 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec -from typing_extensions import TypedDict +from typing import List +from typing_extensions import Literal, NotRequired, TypedDict class IntentReserveParams(TypedDict): - pass + include: NotRequired[List[Literal["invoice_resources.preview_invoice"]]] + """ + Select additional fields to include in the response. + """ diff --git a/stripe/params/v2/billing/_license_fee_create_params.py b/stripe/params/v2/billing/_license_fee_create_params.py index fd06d8feb..1cfb18eaa 100644 --- a/stripe/params/v2/billing/_license_fee_create_params.py +++ b/stripe/params/v2/billing/_license_fee_create_params.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from decimal import Decimal from typing import Dict, List from typing_extensions import Literal, NotRequired, TypedDict @@ -74,7 +75,7 @@ class LicenseFeeCreateParamsTier(TypedDict): Per-unit price for units included in this tier, represented as a decimal string in minor currency units with at most 12 decimal places. """ - up_to_decimal: NotRequired[str] + up_to_decimal: NotRequired[Decimal] """ Up to and including this quantity will be contained in the tier. Only one of `up_to_decimal` and `up_to_inf` may be set. diff --git a/stripe/params/v2/billing/_license_fee_update_params.py b/stripe/params/v2/billing/_license_fee_update_params.py index c374536da..ed59bf99d 100644 --- a/stripe/params/v2/billing/_license_fee_update_params.py +++ b/stripe/params/v2/billing/_license_fee_update_params.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from decimal import Decimal from typing import Dict, List, Optional from typing_extensions import Literal, NotRequired, TypedDict @@ -55,7 +56,7 @@ class LicenseFeeUpdateParamsTier(TypedDict): Per-unit price for units included in this tier, represented as a decimal string in minor currency units with at most 12 decimal places. """ - up_to_decimal: NotRequired[str] + up_to_decimal: NotRequired[Decimal] """ Up to and including this quantity will be contained in the tier. Only one of `up_to_decimal` and `up_to_inf` may be set. diff --git a/stripe/params/v2/billing/_licensed_item_create_params.py b/stripe/params/v2/billing/_licensed_item_create_params.py index 80307e900..a25b70ccb 100644 --- a/stripe/params/v2/billing/_licensed_item_create_params.py +++ b/stripe/params/v2/billing/_licensed_item_create_params.py @@ -12,8 +12,8 @@ class LicensedItemCreateParams(TypedDict): """ lookup_key: NotRequired[str] """ - An internal key you can use to search for a particular billable item. - Must be unique among billable items. + An internal key you can use to search for a particular licensed item. + Must be unique among licensed items. Maximum length of 200 characters. """ metadata: NotRequired[Dict[str, str]] diff --git a/stripe/params/v2/billing/_licensed_item_update_params.py b/stripe/params/v2/billing/_licensed_item_update_params.py index ea3a5d17a..e45a3ad22 100644 --- a/stripe/params/v2/billing/_licensed_item_update_params.py +++ b/stripe/params/v2/billing/_licensed_item_update_params.py @@ -12,7 +12,7 @@ class LicensedItemUpdateParams(TypedDict): """ lookup_key: NotRequired[str] """ - An internal key you can use to search for a particular billable item. + An internal key you can use to search for a particular licensed item. Maximum length of 200 characters. To remove the lookup_key from the object, set it to null in the request. """ diff --git a/stripe/params/v2/billing/_metered_item_create_params.py b/stripe/params/v2/billing/_metered_item_create_params.py index 91b819d27..7987f4cac 100644 --- a/stripe/params/v2/billing/_metered_item_create_params.py +++ b/stripe/params/v2/billing/_metered_item_create_params.py @@ -16,8 +16,8 @@ class MeteredItemCreateParams(TypedDict): """ lookup_key: NotRequired[str] """ - An internal key you can use to search for a particular billable item. - Must be unique among billable items. + An internal key you can use to search for a particular metered item. + Must be unique among metered items. Maximum length of 200 characters. """ metadata: NotRequired[Dict[str, str]] diff --git a/stripe/params/v2/billing/_metered_item_update_params.py b/stripe/params/v2/billing/_metered_item_update_params.py index 862d5ab4d..4e175e634 100644 --- a/stripe/params/v2/billing/_metered_item_update_params.py +++ b/stripe/params/v2/billing/_metered_item_update_params.py @@ -12,7 +12,7 @@ class MeteredItemUpdateParams(TypedDict): """ lookup_key: NotRequired[str] """ - An internal key you can use to search for a particular billable item. + An internal key you can use to search for a particular metered item. Maximum length of 200 characters. To remove the lookup_key from the object, set it to null in the request. """ diff --git a/stripe/params/v2/billing/_one_time_item_create_params.py b/stripe/params/v2/billing/_one_time_item_create_params.py index 80186b1f8..52681013c 100644 --- a/stripe/params/v2/billing/_one_time_item_create_params.py +++ b/stripe/params/v2/billing/_one_time_item_create_params.py @@ -13,7 +13,7 @@ class OneTimeItemCreateParams(TypedDict): lookup_key: NotRequired[str] """ An internal key you can use to search for a particular one-time item. - Must be unique among billable items. + Must be unique among one-time items. Maximum length of 200 characters. """ metadata: NotRequired[Dict[str, str]] diff --git a/stripe/params/v2/billing/_pricing_plan_subscription_list_params.py b/stripe/params/v2/billing/_pricing_plan_subscription_list_params.py index efe0ee391..b9830a285 100644 --- a/stripe/params/v2/billing/_pricing_plan_subscription_list_params.py +++ b/stripe/params/v2/billing/_pricing_plan_subscription_list_params.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from typing import List from typing_extensions import Literal, NotRequired, TypedDict @@ -8,6 +9,12 @@ class PricingPlanSubscriptionListParams(TypedDict): """ Filter by Billing Cadence ID. Mutually exclusive with `payer`, `pricing_plan`, and `pricing_plan_version`. """ + include: NotRequired[ + List[Literal["discount_details", "pricing_plan_component_details"]] + ] + """ + Expand to include additional data such as discount_details, billing_cadence_details, or pricing_plan_component_details. + """ limit: NotRequired[int] """ Optionally set the maximum number of results per page. Defaults to 20. @@ -18,11 +25,11 @@ class PricingPlanSubscriptionListParams(TypedDict): """ pricing_plan: NotRequired[str] """ - Filter by PricingPlan ID. Mutually exlcusive with `billing_cadence`, `payer`, and `pricing_plan_version`. + Filter by PricingPlan ID. Mutually exclusive with `billing_cadence`, `payer`, and `pricing_plan_version`. """ pricing_plan_version: NotRequired[str] """ - Filter by Pricing Plan Version ID. Mutually exlcusive with `billing_cadence`, `payer`, and `pricing_plan`. + Filter by Pricing Plan Version ID. Mutually exclusive with `billing_cadence`, `payer`, and `pricing_plan`. """ servicing_status: NotRequired[ Literal["active", "canceled", "paused", "pending"] diff --git a/stripe/params/v2/billing/_pricing_plan_subscription_remove_discounts_params.py b/stripe/params/v2/billing/_pricing_plan_subscription_remove_discounts_params.py new file mode 100644 index 000000000..2809406c4 --- /dev/null +++ b/stripe/params/v2/billing/_pricing_plan_subscription_remove_discounts_params.py @@ -0,0 +1,13 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from typing import List +from typing_extensions import Literal, NotRequired, TypedDict + + +class PricingPlanSubscriptionRemoveDiscountsParams(TypedDict): + include: NotRequired[ + List[Literal["discount_details", "pricing_plan_component_details"]] + ] + """ + Expand to include additional data such as discount_details. + """ diff --git a/stripe/params/v2/billing/_pricing_plan_subscription_retrieve_params.py b/stripe/params/v2/billing/_pricing_plan_subscription_retrieve_params.py index a72b497be..4e0b16164 100644 --- a/stripe/params/v2/billing/_pricing_plan_subscription_retrieve_params.py +++ b/stripe/params/v2/billing/_pricing_plan_subscription_retrieve_params.py @@ -1,7 +1,13 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec -from typing_extensions import TypedDict +from typing import List +from typing_extensions import Literal, NotRequired, TypedDict class PricingPlanSubscriptionRetrieveParams(TypedDict): - pass + include: NotRequired[ + List[Literal["discount_details", "pricing_plan_component_details"]] + ] + """ + Expand to include additional data such as discount_details. + """ diff --git a/stripe/params/v2/billing/_rate_card_modify_rates_params.py b/stripe/params/v2/billing/_rate_card_modify_rates_params.py new file mode 100644 index 000000000..fe41f88c6 --- /dev/null +++ b/stripe/params/v2/billing/_rate_card_modify_rates_params.py @@ -0,0 +1,137 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from decimal import Decimal +from typing import Dict, List +from typing_extensions import Literal, NotRequired, TypedDict + + +class RateCardModifyRatesParams(TypedDict): + rates_to_create: List["RateCardModifyRatesParamsRatesToCreate"] + """ + The list of RateCard rates to create or update. Maximum of 100 rates. + """ + rates_to_delete: List["RateCardModifyRatesParamsRatesToDelete"] + """ + The list of RateCard rates to delete. Maximum of 100 rates. + """ + + +class RateCardModifyRatesParamsRatesToCreate(TypedDict): + metadata: NotRequired[Dict[str, str]] + """ + Set of [key-value pairs](https://docs.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. + """ + metered_item: NotRequired[str] + """ + The Metered Item that this rate binds to. Cannot be set if `metered_item_data` is provided, and must be set if it isn't. + """ + metered_item_data: NotRequired[ + "RateCardModifyRatesParamsRatesToCreateMeteredItemData" + ] + """ + The data to create a metered item that binds to this rate. Cannot be set if `metered_item` is provided, and must be set if it isn't. + """ + tiering_mode: NotRequired[Literal["graduated", "volume"]] + """ + Defines whether the tiered price should be graduated or volume-based. In volume-based tiering, the maximum + quantity within a period determines the per-unit price. In graduated tiering, the pricing changes as the quantity + grows into new tiers. Can only be set if `tiers` is set. + """ + tiers: NotRequired[List["RateCardModifyRatesParamsRatesToCreateTier"]] + """ + Each element represents a pricing tier. Cannot be set if `unit_amount` is provided. + """ + transform_quantity: NotRequired[ + "RateCardModifyRatesParamsRatesToCreateTransformQuantity" + ] + """ + Apply a transformation to the reported usage or set quantity before computing the amount billed. + """ + unit_amount: NotRequired[str] + """ + The per-unit amount to be charged, represented as a decimal string in minor currency units with at most 12 decimal + places. Cannot be set if `tiers` is provided. + """ + + +class RateCardModifyRatesParamsRatesToCreateMeteredItemData(TypedDict): + display_name: str + """ + Description that customers will see in the invoice line item. + Maximum length of 250 characters. + """ + lookup_key: NotRequired[str] + """ + An internal key you can use to search for a particular metered item. + Must be unique among metered items. + Maximum length of 200 characters. + """ + meter: str + """ + ID of the Meter that measures usage for this Metered Item. + """ + meter_segment_conditions: List[ + "RateCardModifyRatesParamsRatesToCreateMeteredItemDataMeterSegmentCondition" + ] + """ + Optional array of Meter segments to filter event dimension keys for billing. + """ + unit_label: NotRequired[str] + """ + The unit to use when displaying prices for this billable item in places like Checkout. For example, set this field + to "CPU-hour" for Checkout to display "(price) per CPU-hour", or "1 million events" to display "(price) per 1 + million events". + Maximum length of 100 characters. + """ + + +class RateCardModifyRatesParamsRatesToCreateMeteredItemDataMeterSegmentCondition( + TypedDict, +): + dimension: str + """ + A Meter dimension. + """ + value: str + """ + To count usage towards this metered item, the dimension must have this value. + """ + + +class RateCardModifyRatesParamsRatesToCreateTier(TypedDict): + flat_amount: NotRequired[str] + """ + Price for the entire tier, represented as a decimal string in minor currency units with at most 12 decimal places. + """ + unit_amount: NotRequired[str] + """ + Per-unit price for units included in this tier, represented as a decimal string in minor currency units with at + most 12 decimal places. + """ + up_to_decimal: NotRequired[Decimal] + """ + Up to and including this quantity will be contained in the tier. Only one of `up_to_decimal` and `up_to_inf` may + be set. + """ + up_to_inf: NotRequired[Literal["inf"]] + """ + No upper bound to this tier. Only one of `up_to_decimal` and `up_to_inf` may be set. + """ + + +class RateCardModifyRatesParamsRatesToCreateTransformQuantity(TypedDict): + divide_by: int + """ + Divide usage by this number. + """ + round: Literal["down", "up"] + """ + After division, round the result up or down. + """ + + +class RateCardModifyRatesParamsRatesToDelete(TypedDict): + id: str + """ + The ID of the RateCard rate to delete. + """ diff --git a/stripe/params/v2/billing/_rate_card_subscription_list_params.py b/stripe/params/v2/billing/_rate_card_subscription_list_params.py index 5338d8f6f..ddf330ac4 100644 --- a/stripe/params/v2/billing/_rate_card_subscription_list_params.py +++ b/stripe/params/v2/billing/_rate_card_subscription_list_params.py @@ -10,7 +10,7 @@ class RateCardSubscriptionListParams(TypedDict): """ limit: NotRequired[int] """ - The page size limit, if not provided the default is 20. + The page size limit. Defaults to 20. """ payer: NotRequired["RateCardSubscriptionListParamsPayer"] """ diff --git a/stripe/params/v2/billing/_service_action_create_params.py b/stripe/params/v2/billing/_service_action_create_params.py index b20d3f6cf..61e7941a5 100644 --- a/stripe/params/v2/billing/_service_action_create_params.py +++ b/stripe/params/v2/billing/_service_action_create_params.py @@ -1,5 +1,7 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from decimal import Decimal +from stripe.v2._amount import AmountParam from typing import List from typing_extensions import Literal, NotRequired, TypedDict @@ -73,7 +75,7 @@ class ServiceActionCreateParamsCreditGrantAmount(TypedDict): """ The custom pricing unit amount of the credit grant. Required if `type` is `custom_pricing_unit`. """ - monetary: NotRequired["ServiceActionCreateParamsCreditGrantAmountMonetary"] + monetary: NotRequired[AmountParam] """ The monetary amount of the credit grant. Required if `type` is `monetary`. """ @@ -84,23 +86,12 @@ class ServiceActionCreateParamsCreditGrantAmountCustomPricingUnit(TypedDict): """ The id of the custom pricing unit. """ - value: str + value: Decimal """ The value of the credit grant, decimal value represented as a string. """ -class ServiceActionCreateParamsCreditGrantAmountMonetary(TypedDict): - value: int - """ - A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). - """ - 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). - """ - - class ServiceActionCreateParamsCreditGrantApplicabilityConfig(TypedDict): scope: "ServiceActionCreateParamsCreditGrantApplicabilityConfigScope" """ @@ -172,9 +163,7 @@ class ServiceActionCreateParamsCreditGrantPerTenantAmount(TypedDict): """ The custom pricing unit amount of the credit grant. Required if `type` is `custom_pricing_unit`. """ - monetary: NotRequired[ - "ServiceActionCreateParamsCreditGrantPerTenantAmountMonetary" - ] + monetary: NotRequired[AmountParam] """ The monetary amount of the credit grant. Required if `type` is `monetary`. """ @@ -187,23 +176,12 @@ class ServiceActionCreateParamsCreditGrantPerTenantAmountCustomPricingUnit( """ The id of the custom pricing unit. """ - value: str + value: Decimal """ The value of the credit grant, decimal value represented as a string. """ -class ServiceActionCreateParamsCreditGrantPerTenantAmountMonetary(TypedDict): - value: int - """ - A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). - """ - 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). - """ - - class ServiceActionCreateParamsCreditGrantPerTenantApplicabilityConfig( TypedDict, ): diff --git a/stripe/params/v2/billing/pricing_plan_subscriptions/__init__.py b/stripe/params/v2/billing/pricing_plan_subscriptions/__init__.py deleted file mode 100644 index 45a99a19f..000000000 --- a/stripe/params/v2/billing/pricing_plan_subscriptions/__init__.py +++ /dev/null @@ -1,32 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from importlib import import_module -from typing_extensions import TYPE_CHECKING - -if TYPE_CHECKING: - from stripe.params.v2.billing.pricing_plan_subscriptions._component_retrieve_params import ( - ComponentRetrieveParams as ComponentRetrieveParams, - ) - -# name -> (import_target, is_submodule) -_import_map = { - "ComponentRetrieveParams": ( - "stripe.params.v2.billing.pricing_plan_subscriptions._component_retrieve_params", - False, - ), -} -if not TYPE_CHECKING: - - def __getattr__(name): - try: - target, is_submodule = _import_map[name] - module = import_module(target) - if is_submodule: - return module - - return getattr( - module, - name, - ) - except KeyError: - raise AttributeError() diff --git a/stripe/params/v2/billing/pricing_plans/_component_create_params.py b/stripe/params/v2/billing/pricing_plans/_component_create_params.py index 77704145b..7a07348ba 100644 --- a/stripe/params/v2/billing/pricing_plans/_component_create_params.py +++ b/stripe/params/v2/billing/pricing_plans/_component_create_params.py @@ -38,7 +38,7 @@ class ComponentCreateParamsLicenseFee(TypedDict): """ version: NotRequired[str] """ - The version of the LicenseFee. Defaults to 'latest', if not specified. + The ID of the License Fee Version. If not specified, defaults to 'latest'. """ @@ -49,7 +49,7 @@ class ComponentCreateParamsRateCard(TypedDict): """ version: NotRequired[str] """ - The version of the RateCard. Defaults to 'latest', if not specified. + The ID of the Rate Card Version. If not specified, defaults to 'latest'. """ diff --git a/stripe/params/v2/billing/rate_cards/_rate_create_params.py b/stripe/params/v2/billing/rate_cards/_rate_create_params.py index a93f48074..834230b6b 100644 --- a/stripe/params/v2/billing/rate_cards/_rate_create_params.py +++ b/stripe/params/v2/billing/rate_cards/_rate_create_params.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from decimal import Decimal from typing import Dict, List from typing_extensions import Literal, NotRequired, TypedDict @@ -61,7 +62,7 @@ class RateCreateParamsTier(TypedDict): Per-unit price for units included in this tier, represented as a decimal string in minor currency units with at most 12 decimal places. """ - up_to_decimal: NotRequired[str] + up_to_decimal: NotRequired[Decimal] """ Up to and including this quantity will be contained in the tier. Only one of `up_to_decimal` and `up_to_inf` may be set. diff --git a/stripe/params/v2/core/__init__.py b/stripe/params/v2/core/__init__.py index 80b91c4ae..5cc276ada 100644 --- a/stripe/params/v2/core/__init__.py +++ b/stripe/params/v2/core/__init__.py @@ -212,7 +212,6 @@ AccountCreateParamsIdentityBusinessDetails as AccountCreateParamsIdentityBusinessDetails, AccountCreateParamsIdentityBusinessDetailsAddress as AccountCreateParamsIdentityBusinessDetailsAddress, AccountCreateParamsIdentityBusinessDetailsAnnualRevenue as AccountCreateParamsIdentityBusinessDetailsAnnualRevenue, - AccountCreateParamsIdentityBusinessDetailsAnnualRevenueAmount as AccountCreateParamsIdentityBusinessDetailsAnnualRevenueAmount, AccountCreateParamsIdentityBusinessDetailsDocuments as AccountCreateParamsIdentityBusinessDetailsDocuments, AccountCreateParamsIdentityBusinessDetailsDocumentsBankAccountOwnershipVerification as AccountCreateParamsIdentityBusinessDetailsDocumentsBankAccountOwnershipVerification, AccountCreateParamsIdentityBusinessDetailsDocumentsCompanyLicense as AccountCreateParamsIdentityBusinessDetailsDocumentsCompanyLicense, @@ -227,7 +226,6 @@ AccountCreateParamsIdentityBusinessDetailsDocumentsProofOfUltimateBeneficialOwnership as AccountCreateParamsIdentityBusinessDetailsDocumentsProofOfUltimateBeneficialOwnership, AccountCreateParamsIdentityBusinessDetailsIdNumber as AccountCreateParamsIdentityBusinessDetailsIdNumber, AccountCreateParamsIdentityBusinessDetailsMonthlyEstimatedRevenue as AccountCreateParamsIdentityBusinessDetailsMonthlyEstimatedRevenue, - AccountCreateParamsIdentityBusinessDetailsMonthlyEstimatedRevenueAmount as AccountCreateParamsIdentityBusinessDetailsMonthlyEstimatedRevenueAmount, AccountCreateParamsIdentityBusinessDetailsRegistrationDate as AccountCreateParamsIdentityBusinessDetailsRegistrationDate, AccountCreateParamsIdentityBusinessDetailsScriptAddresses as AccountCreateParamsIdentityBusinessDetailsScriptAddresses, AccountCreateParamsIdentityBusinessDetailsScriptAddressesKana as AccountCreateParamsIdentityBusinessDetailsScriptAddressesKana, @@ -257,6 +255,14 @@ AccountCreateParamsIdentityIndividualScriptNamesKana as AccountCreateParamsIdentityIndividualScriptNamesKana, AccountCreateParamsIdentityIndividualScriptNamesKanji as AccountCreateParamsIdentityIndividualScriptNamesKanji, ) + from stripe.params.v2.core._account_evaluation_create_params import ( + AccountEvaluationCreateParams as AccountEvaluationCreateParams, + AccountEvaluationCreateParamsAccountData as AccountEvaluationCreateParamsAccountData, + AccountEvaluationCreateParamsAccountDataDefaults as AccountEvaluationCreateParamsAccountDataDefaults, + AccountEvaluationCreateParamsAccountDataDefaultsProfile as AccountEvaluationCreateParamsAccountDataDefaultsProfile, + AccountEvaluationCreateParamsAccountDataIdentity as AccountEvaluationCreateParamsAccountDataIdentity, + AccountEvaluationCreateParamsAccountDataIdentityBusinessDetails as AccountEvaluationCreateParamsAccountDataIdentityBusinessDetails, + ) from stripe.params.v2.core._account_link_create_params import ( AccountLinkCreateParams as AccountLinkCreateParams, AccountLinkCreateParamsUseCase as AccountLinkCreateParamsUseCase, @@ -311,7 +317,6 @@ AccountTokenCreateParamsIdentityBusinessDetails as AccountTokenCreateParamsIdentityBusinessDetails, AccountTokenCreateParamsIdentityBusinessDetailsAddress as AccountTokenCreateParamsIdentityBusinessDetailsAddress, AccountTokenCreateParamsIdentityBusinessDetailsAnnualRevenue as AccountTokenCreateParamsIdentityBusinessDetailsAnnualRevenue, - AccountTokenCreateParamsIdentityBusinessDetailsAnnualRevenueAmount as AccountTokenCreateParamsIdentityBusinessDetailsAnnualRevenueAmount, AccountTokenCreateParamsIdentityBusinessDetailsDocuments as AccountTokenCreateParamsIdentityBusinessDetailsDocuments, AccountTokenCreateParamsIdentityBusinessDetailsDocumentsBankAccountOwnershipVerification as AccountTokenCreateParamsIdentityBusinessDetailsDocumentsBankAccountOwnershipVerification, AccountTokenCreateParamsIdentityBusinessDetailsDocumentsCompanyLicense as AccountTokenCreateParamsIdentityBusinessDetailsDocumentsCompanyLicense, @@ -326,7 +331,6 @@ AccountTokenCreateParamsIdentityBusinessDetailsDocumentsProofOfUltimateBeneficialOwnership as AccountTokenCreateParamsIdentityBusinessDetailsDocumentsProofOfUltimateBeneficialOwnership, AccountTokenCreateParamsIdentityBusinessDetailsIdNumber as AccountTokenCreateParamsIdentityBusinessDetailsIdNumber, AccountTokenCreateParamsIdentityBusinessDetailsMonthlyEstimatedRevenue as AccountTokenCreateParamsIdentityBusinessDetailsMonthlyEstimatedRevenue, - AccountTokenCreateParamsIdentityBusinessDetailsMonthlyEstimatedRevenueAmount as AccountTokenCreateParamsIdentityBusinessDetailsMonthlyEstimatedRevenueAmount, AccountTokenCreateParamsIdentityBusinessDetailsRegistrationDate as AccountTokenCreateParamsIdentityBusinessDetailsRegistrationDate, AccountTokenCreateParamsIdentityBusinessDetailsScriptAddresses as AccountTokenCreateParamsIdentityBusinessDetailsScriptAddresses, AccountTokenCreateParamsIdentityBusinessDetailsScriptAddressesKana as AccountTokenCreateParamsIdentityBusinessDetailsScriptAddressesKana, @@ -563,7 +567,6 @@ AccountUpdateParamsIdentityBusinessDetails as AccountUpdateParamsIdentityBusinessDetails, AccountUpdateParamsIdentityBusinessDetailsAddress as AccountUpdateParamsIdentityBusinessDetailsAddress, AccountUpdateParamsIdentityBusinessDetailsAnnualRevenue as AccountUpdateParamsIdentityBusinessDetailsAnnualRevenue, - AccountUpdateParamsIdentityBusinessDetailsAnnualRevenueAmount as AccountUpdateParamsIdentityBusinessDetailsAnnualRevenueAmount, AccountUpdateParamsIdentityBusinessDetailsDocuments as AccountUpdateParamsIdentityBusinessDetailsDocuments, AccountUpdateParamsIdentityBusinessDetailsDocumentsBankAccountOwnershipVerification as AccountUpdateParamsIdentityBusinessDetailsDocumentsBankAccountOwnershipVerification, AccountUpdateParamsIdentityBusinessDetailsDocumentsCompanyLicense as AccountUpdateParamsIdentityBusinessDetailsDocumentsCompanyLicense, @@ -578,7 +581,6 @@ AccountUpdateParamsIdentityBusinessDetailsDocumentsProofOfUltimateBeneficialOwnership as AccountUpdateParamsIdentityBusinessDetailsDocumentsProofOfUltimateBeneficialOwnership, AccountUpdateParamsIdentityBusinessDetailsIdNumber as AccountUpdateParamsIdentityBusinessDetailsIdNumber, AccountUpdateParamsIdentityBusinessDetailsMonthlyEstimatedRevenue as AccountUpdateParamsIdentityBusinessDetailsMonthlyEstimatedRevenue, - AccountUpdateParamsIdentityBusinessDetailsMonthlyEstimatedRevenueAmount as AccountUpdateParamsIdentityBusinessDetailsMonthlyEstimatedRevenueAmount, AccountUpdateParamsIdentityBusinessDetailsRegistrationDate as AccountUpdateParamsIdentityBusinessDetailsRegistrationDate, AccountUpdateParamsIdentityBusinessDetailsScriptAddresses as AccountUpdateParamsIdentityBusinessDetailsScriptAddresses, AccountUpdateParamsIdentityBusinessDetailsScriptAddressesKana as AccountUpdateParamsIdentityBusinessDetailsScriptAddressesKana, @@ -608,6 +610,17 @@ AccountUpdateParamsIdentityIndividualScriptNamesKana as AccountUpdateParamsIdentityIndividualScriptNamesKana, AccountUpdateParamsIdentityIndividualScriptNamesKanji as AccountUpdateParamsIdentityIndividualScriptNamesKanji, ) + from stripe.params.v2.core._batch_job_cancel_params import ( + BatchJobCancelParams as BatchJobCancelParams, + ) + from stripe.params.v2.core._batch_job_create_params import ( + BatchJobCreateParams as BatchJobCreateParams, + BatchJobCreateParamsEndpoint as BatchJobCreateParamsEndpoint, + BatchJobCreateParamsNotificationSuppression as BatchJobCreateParamsNotificationSuppression, + ) + from stripe.params.v2.core._batch_job_retrieve_params import ( + BatchJobRetrieveParams as BatchJobRetrieveParams, + ) from stripe.params.v2.core._claimable_sandbox_create_params import ( ClaimableSandboxCreateParams as ClaimableSandboxCreateParams, ClaimableSandboxCreateParamsPrefill as ClaimableSandboxCreateParamsPrefill, @@ -624,6 +637,7 @@ from stripe.params.v2.core._event_destination_create_params import ( EventDestinationCreateParams as EventDestinationCreateParams, EventDestinationCreateParamsAmazonEventbridge as EventDestinationCreateParamsAmazonEventbridge, + EventDestinationCreateParamsAzureEventGrid as EventDestinationCreateParamsAzureEventGrid, EventDestinationCreateParamsWebhookEndpoint as EventDestinationCreateParamsWebhookEndpoint, ) from stripe.params.v2.core._event_destination_delete_params import ( @@ -1476,10 +1490,6 @@ "stripe.params.v2.core._account_create_params", False, ), - "AccountCreateParamsIdentityBusinessDetailsAnnualRevenueAmount": ( - "stripe.params.v2.core._account_create_params", - False, - ), "AccountCreateParamsIdentityBusinessDetailsDocuments": ( "stripe.params.v2.core._account_create_params", False, @@ -1536,10 +1546,6 @@ "stripe.params.v2.core._account_create_params", False, ), - "AccountCreateParamsIdentityBusinessDetailsMonthlyEstimatedRevenueAmount": ( - "stripe.params.v2.core._account_create_params", - False, - ), "AccountCreateParamsIdentityBusinessDetailsRegistrationDate": ( "stripe.params.v2.core._account_create_params", False, @@ -1652,6 +1658,30 @@ "stripe.params.v2.core._account_create_params", False, ), + "AccountEvaluationCreateParams": ( + "stripe.params.v2.core._account_evaluation_create_params", + False, + ), + "AccountEvaluationCreateParamsAccountData": ( + "stripe.params.v2.core._account_evaluation_create_params", + False, + ), + "AccountEvaluationCreateParamsAccountDataDefaults": ( + "stripe.params.v2.core._account_evaluation_create_params", + False, + ), + "AccountEvaluationCreateParamsAccountDataDefaultsProfile": ( + "stripe.params.v2.core._account_evaluation_create_params", + False, + ), + "AccountEvaluationCreateParamsAccountDataIdentity": ( + "stripe.params.v2.core._account_evaluation_create_params", + False, + ), + "AccountEvaluationCreateParamsAccountDataIdentityBusinessDetails": ( + "stripe.params.v2.core._account_evaluation_create_params", + False, + ), "AccountLinkCreateParams": ( "stripe.params.v2.core._account_link_create_params", False, @@ -1837,10 +1867,6 @@ "stripe.params.v2.core._account_token_create_params", False, ), - "AccountTokenCreateParamsIdentityBusinessDetailsAnnualRevenueAmount": ( - "stripe.params.v2.core._account_token_create_params", - False, - ), "AccountTokenCreateParamsIdentityBusinessDetailsDocuments": ( "stripe.params.v2.core._account_token_create_params", False, @@ -1897,10 +1923,6 @@ "stripe.params.v2.core._account_token_create_params", False, ), - "AccountTokenCreateParamsIdentityBusinessDetailsMonthlyEstimatedRevenueAmount": ( - "stripe.params.v2.core._account_token_create_params", - False, - ), "AccountTokenCreateParamsIdentityBusinessDetailsRegistrationDate": ( "stripe.params.v2.core._account_token_create_params", False, @@ -2829,10 +2851,6 @@ "stripe.params.v2.core._account_update_params", False, ), - "AccountUpdateParamsIdentityBusinessDetailsAnnualRevenueAmount": ( - "stripe.params.v2.core._account_update_params", - False, - ), "AccountUpdateParamsIdentityBusinessDetailsDocuments": ( "stripe.params.v2.core._account_update_params", False, @@ -2889,10 +2907,6 @@ "stripe.params.v2.core._account_update_params", False, ), - "AccountUpdateParamsIdentityBusinessDetailsMonthlyEstimatedRevenueAmount": ( - "stripe.params.v2.core._account_update_params", - False, - ), "AccountUpdateParamsIdentityBusinessDetailsRegistrationDate": ( "stripe.params.v2.core._account_update_params", False, @@ -3005,6 +3019,26 @@ "stripe.params.v2.core._account_update_params", False, ), + "BatchJobCancelParams": ( + "stripe.params.v2.core._batch_job_cancel_params", + False, + ), + "BatchJobCreateParams": ( + "stripe.params.v2.core._batch_job_create_params", + False, + ), + "BatchJobCreateParamsEndpoint": ( + "stripe.params.v2.core._batch_job_create_params", + False, + ), + "BatchJobCreateParamsNotificationSuppression": ( + "stripe.params.v2.core._batch_job_create_params", + False, + ), + "BatchJobRetrieveParams": ( + "stripe.params.v2.core._batch_job_retrieve_params", + False, + ), "ClaimableSandboxCreateParams": ( "stripe.params.v2.core._claimable_sandbox_create_params", False, @@ -3033,6 +3067,10 @@ "stripe.params.v2.core._event_destination_create_params", False, ), + "EventDestinationCreateParamsAzureEventGrid": ( + "stripe.params.v2.core._event_destination_create_params", + False, + ), "EventDestinationCreateParamsWebhookEndpoint": ( "stripe.params.v2.core._event_destination_create_params", False, diff --git a/stripe/params/v2/core/_account_create_params.py b/stripe/params/v2/core/_account_create_params.py index 71e1dff35..42cc77b7a 100644 --- a/stripe/params/v2/core/_account_create_params.py +++ b/stripe/params/v2/core/_account_create_params.py @@ -1,5 +1,7 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from decimal import Decimal +from stripe.v2._amount import AmountParam from typing import Dict, List from typing_extensions import Literal, NotRequired, TypedDict @@ -2148,6 +2150,10 @@ class AccountCreateParamsDefaults(TypedDict): """ Default responsibilities held by either Stripe or the platform. """ + timezone: NotRequired[str] + """ + The Account's local timezone. A list of possible time zone values is maintained at the [IANA Time Zone Database](https://www.iana.org/time-zones). + """ class AccountCreateParamsDefaultsProfile(TypedDict): @@ -3533,9 +3539,7 @@ class AccountCreateParamsIdentityBusinessDetailsAddress(TypedDict): class AccountCreateParamsIdentityBusinessDetailsAnnualRevenue(TypedDict): - amount: NotRequired[ - "AccountCreateParamsIdentityBusinessDetailsAnnualRevenueAmount" - ] + amount: NotRequired[AmountParam] """ A non-negative integer representing the amount in the smallest currency unit. """ @@ -3545,17 +3549,6 @@ class AccountCreateParamsIdentityBusinessDetailsAnnualRevenue(TypedDict): """ -class AccountCreateParamsIdentityBusinessDetailsAnnualRevenueAmount(TypedDict): - value: int - """ - A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). - """ - 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). - """ - - class AccountCreateParamsIdentityBusinessDetailsDocuments(TypedDict): bank_account_ownership_verification: NotRequired[ "AccountCreateParamsIdentityBusinessDetailsDocumentsBankAccountOwnershipVerification" @@ -3896,27 +3889,12 @@ class AccountCreateParamsIdentityBusinessDetailsIdNumber(TypedDict): class AccountCreateParamsIdentityBusinessDetailsMonthlyEstimatedRevenue( TypedDict, ): - amount: NotRequired[ - "AccountCreateParamsIdentityBusinessDetailsMonthlyEstimatedRevenueAmount" - ] + amount: NotRequired[AmountParam] """ A non-negative integer representing the amount in the smallest currency unit. """ -class AccountCreateParamsIdentityBusinessDetailsMonthlyEstimatedRevenueAmount( - TypedDict, -): - value: int - """ - A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). - """ - 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). - """ - - class AccountCreateParamsIdentityBusinessDetailsRegistrationDate(TypedDict): day: int """ @@ -4445,7 +4423,7 @@ class AccountCreateParamsIdentityIndividualRelationship(TypedDict): """ Whether the person is an owner of the account's identity. """ - percent_ownership: NotRequired[str] + percent_ownership: NotRequired[Decimal] """ The percent owned by the person of the account's legal entity. """ diff --git a/stripe/params/v2/core/_account_evaluation_create_params.py b/stripe/params/v2/core/_account_evaluation_create_params.py new file mode 100644 index 000000000..f0b530ffe --- /dev/null +++ b/stripe/params/v2/core/_account_evaluation_create_params.py @@ -0,0 +1,70 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from typing import List +from typing_extensions import Literal, NotRequired, TypedDict + + +class AccountEvaluationCreateParams(TypedDict): + account: NotRequired[str] + """ + The account ID to evaluate. Exactly one of account or account_data must be provided. + """ + account_data: NotRequired["AccountEvaluationCreateParamsAccountData"] + """ + Account data for entity-less evaluation. Exactly one of account or account_data must be provided. + """ + signals: List[Literal["fraudulent_website"]] + """ + List of signals to evaluate. + """ + + +class AccountEvaluationCreateParamsAccountData(TypedDict): + defaults: NotRequired["AccountEvaluationCreateParamsAccountDataDefaults"] + """ + Default account settings. + """ + identity: NotRequired["AccountEvaluationCreateParamsAccountDataIdentity"] + """ + Identity data. + """ + + +class AccountEvaluationCreateParamsAccountDataDefaults(TypedDict): + profile: "AccountEvaluationCreateParamsAccountDataDefaultsProfile" + """ + Account profile data. + """ + + +class AccountEvaluationCreateParamsAccountDataDefaultsProfile(TypedDict): + business_url: str + """ + The business URL. + """ + doing_business_as: NotRequired[str] + """ + Doing business as (DBA) name. + """ + product_description: NotRequired[str] + """ + Description of the account's product or service. + """ + + +class AccountEvaluationCreateParamsAccountDataIdentity(TypedDict): + business_details: ( + "AccountEvaluationCreateParamsAccountDataIdentityBusinessDetails" + ) + """ + Business details for identity data. + """ + + +class AccountEvaluationCreateParamsAccountDataIdentityBusinessDetails( + TypedDict, +): + registered_name: NotRequired[str] + """ + Registered business name. + """ diff --git a/stripe/params/v2/core/_account_token_create_params.py b/stripe/params/v2/core/_account_token_create_params.py index e84ffb528..109c8f699 100644 --- a/stripe/params/v2/core/_account_token_create_params.py +++ b/stripe/params/v2/core/_account_token_create_params.py @@ -1,5 +1,7 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from decimal import Decimal +from stripe.v2._amount import AmountParam from typing import Dict, List, Optional from typing_extensions import Literal, NotRequired, TypedDict @@ -594,9 +596,7 @@ class AccountTokenCreateParamsIdentityBusinessDetailsAddress(TypedDict): class AccountTokenCreateParamsIdentityBusinessDetailsAnnualRevenue(TypedDict): - amount: NotRequired[ - "AccountTokenCreateParamsIdentityBusinessDetailsAnnualRevenueAmount" - ] + amount: NotRequired[AmountParam] """ A non-negative integer representing the amount in the smallest currency unit. """ @@ -606,19 +606,6 @@ class AccountTokenCreateParamsIdentityBusinessDetailsAnnualRevenue(TypedDict): """ -class AccountTokenCreateParamsIdentityBusinessDetailsAnnualRevenueAmount( - TypedDict, -): - value: int - """ - A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). - """ - 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). - """ - - class AccountTokenCreateParamsIdentityBusinessDetailsDocuments(TypedDict): bank_account_ownership_verification: NotRequired[ "AccountTokenCreateParamsIdentityBusinessDetailsDocumentsBankAccountOwnershipVerification" @@ -959,27 +946,12 @@ class AccountTokenCreateParamsIdentityBusinessDetailsIdNumber(TypedDict): class AccountTokenCreateParamsIdentityBusinessDetailsMonthlyEstimatedRevenue( TypedDict, ): - amount: NotRequired[ - "AccountTokenCreateParamsIdentityBusinessDetailsMonthlyEstimatedRevenueAmount" - ] + amount: NotRequired[AmountParam] """ A non-negative integer representing the amount in the smallest currency unit. """ -class AccountTokenCreateParamsIdentityBusinessDetailsMonthlyEstimatedRevenueAmount( - TypedDict, -): - value: int - """ - A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). - """ - 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). - """ - - class AccountTokenCreateParamsIdentityBusinessDetailsRegistrationDate( TypedDict, ): @@ -1522,7 +1494,7 @@ class AccountTokenCreateParamsIdentityIndividualRelationship(TypedDict): """ Whether the person is an owner of the account's identity. """ - percent_ownership: NotRequired[str] + percent_ownership: NotRequired[Decimal] """ The percent owned by the person of the account's legal entity. """ diff --git a/stripe/params/v2/core/_account_update_params.py b/stripe/params/v2/core/_account_update_params.py index 23644a8c0..ae7228acd 100644 --- a/stripe/params/v2/core/_account_update_params.py +++ b/stripe/params/v2/core/_account_update_params.py @@ -1,5 +1,7 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from decimal import Decimal +from stripe.v2._amount import AmountParam from typing import Dict, List, Optional from typing_extensions import Literal, NotRequired, TypedDict @@ -2180,6 +2182,10 @@ class AccountUpdateParamsDefaults(TypedDict): """ Default responsibilities held by either Stripe or the platform. """ + timezone: NotRequired[str] + """ + The Account's local timezone. A list of possible time zone values is maintained at the [IANA Time Zone Database](https://www.iana.org/time-zones). + """ class AccountUpdateParamsDefaultsProfile(TypedDict): @@ -3565,9 +3571,7 @@ class AccountUpdateParamsIdentityBusinessDetailsAddress(TypedDict): class AccountUpdateParamsIdentityBusinessDetailsAnnualRevenue(TypedDict): - amount: NotRequired[ - "AccountUpdateParamsIdentityBusinessDetailsAnnualRevenueAmount" - ] + amount: NotRequired[AmountParam] """ A non-negative integer representing the amount in the smallest currency unit. """ @@ -3577,17 +3581,6 @@ class AccountUpdateParamsIdentityBusinessDetailsAnnualRevenue(TypedDict): """ -class AccountUpdateParamsIdentityBusinessDetailsAnnualRevenueAmount(TypedDict): - value: int - """ - A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). - """ - 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). - """ - - class AccountUpdateParamsIdentityBusinessDetailsDocuments(TypedDict): bank_account_ownership_verification: NotRequired[ "AccountUpdateParamsIdentityBusinessDetailsDocumentsBankAccountOwnershipVerification" @@ -3928,27 +3921,12 @@ class AccountUpdateParamsIdentityBusinessDetailsIdNumber(TypedDict): class AccountUpdateParamsIdentityBusinessDetailsMonthlyEstimatedRevenue( TypedDict, ): - amount: NotRequired[ - "AccountUpdateParamsIdentityBusinessDetailsMonthlyEstimatedRevenueAmount" - ] + amount: NotRequired[AmountParam] """ A non-negative integer representing the amount in the smallest currency unit. """ -class AccountUpdateParamsIdentityBusinessDetailsMonthlyEstimatedRevenueAmount( - TypedDict, -): - value: int - """ - A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). - """ - 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). - """ - - class AccountUpdateParamsIdentityBusinessDetailsRegistrationDate(TypedDict): day: int """ @@ -4477,7 +4455,7 @@ class AccountUpdateParamsIdentityIndividualRelationship(TypedDict): """ Whether the person is an owner of the account's identity. """ - percent_ownership: NotRequired[str] + percent_ownership: NotRequired[Decimal] """ The percent owned by the person of the account's legal entity. """ diff --git a/stripe/params/v2/billing/pricing_plan_subscriptions/_component_retrieve_params.py b/stripe/params/v2/core/_batch_job_cancel_params.py similarity index 73% rename from stripe/params/v2/billing/pricing_plan_subscriptions/_component_retrieve_params.py rename to stripe/params/v2/core/_batch_job_cancel_params.py index 8b2ee5530..2d03ba46c 100644 --- a/stripe/params/v2/billing/pricing_plan_subscriptions/_component_retrieve_params.py +++ b/stripe/params/v2/core/_batch_job_cancel_params.py @@ -3,5 +3,5 @@ from typing_extensions import TypedDict -class ComponentRetrieveParams(TypedDict): +class BatchJobCancelParams(TypedDict): pass diff --git a/stripe/params/v2/core/_batch_job_create_params.py b/stripe/params/v2/core/_batch_job_create_params.py new file mode 100644 index 000000000..551ec73c3 --- /dev/null +++ b/stripe/params/v2/core/_batch_job_create_params.py @@ -0,0 +1,63 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from typing import Dict +from typing_extensions import Literal, NotRequired, TypedDict + + +class BatchJobCreateParams(TypedDict): + endpoint: "BatchJobCreateParamsEndpoint" + """ + The endpoint configuration for the batch job. + """ + maximum_rps: NotRequired[int] + """ + Optional field that allows the user to control how fast they want this batch job to run. + Gives them a control over the number of webhooks they receive. + """ + metadata: Dict[str, str] + """ + The metadata of the `BatchJob` object. + """ + notification_suppression: NotRequired[ + "BatchJobCreateParamsNotificationSuppression" + ] + """ + Notification suppression settings for the batch job. + """ + skip_validation: bool + """ + Allows the user to skip validation. + """ + + +class BatchJobCreateParamsEndpoint(TypedDict): + http_method: Literal["post"] + """ + The HTTP method to use when calling the endpoint. + """ + path: Literal[ + "/v1/accounts/:account", + "/v1/credit_notes", + "/v1/customers/:customer", + "/v1/invoices/:invoice", + "/v1/invoices/:invoice/pay", + "/v1/promotion_codes", + "/v1/promotion_codes/:promotion_code", + "/v1/subscriptions/:subscription_exposed_id", + "/v1/subscriptions/:subscription/migrate", + "/v1/subscription_schedules", + "/v1/subscription_schedules/:schedule", + "/v1/subscription_schedules/:schedule/cancel", + ] + """ + The path of the endpoint to run this batch job against. + In the form used in the documentation. For instance, for + subscription migration this would be `/v1/subscriptions/:id/migrate`. + """ + + +class BatchJobCreateParamsNotificationSuppression(TypedDict): + scope: Literal["all", "none"] + """ + The scope of notification suppression. + """ diff --git a/stripe/params/v2/billing/_license_fee_subscription_retrieve_params.py b/stripe/params/v2/core/_batch_job_retrieve_params.py similarity index 67% rename from stripe/params/v2/billing/_license_fee_subscription_retrieve_params.py rename to stripe/params/v2/core/_batch_job_retrieve_params.py index b80857680..a569ad464 100644 --- a/stripe/params/v2/billing/_license_fee_subscription_retrieve_params.py +++ b/stripe/params/v2/core/_batch_job_retrieve_params.py @@ -3,5 +3,5 @@ from typing_extensions import TypedDict -class LicenseFeeSubscriptionRetrieveParams(TypedDict): +class BatchJobRetrieveParams(TypedDict): pass diff --git a/stripe/params/v2/core/_event_destination_create_params.py b/stripe/params/v2/core/_event_destination_create_params.py index 63aee13ee..d74a2d187 100644 --- a/stripe/params/v2/core/_event_destination_create_params.py +++ b/stripe/params/v2/core/_event_destination_create_params.py @@ -17,9 +17,13 @@ class EventDestinationCreateParams(TypedDict): """ Payload type of events being subscribed to. """ - events_from: NotRequired[List[Literal["other_accounts", "self"]]] + events_from: NotRequired[List[str]] """ - Where events should be routed from. + Specifies which accounts' events route to this destination. + `@self`: Receive events from the account that owns the event destination. + `@accounts`: Receive events emitted from other accounts you manage which includes your v1 and v2 accounts. + `@organization_members`: Receive events from accounts directly linked to the organization. + `@organization_members/@accounts`: Receive events from all accounts connected to any platform accounts in the organization. """ include: NotRequired[ List[ @@ -41,7 +45,7 @@ class EventDestinationCreateParams(TypedDict): """ If using the snapshot event payload, the API version events are rendered as. """ - type: Literal["amazon_eventbridge", "webhook_endpoint"] + type: Literal["amazon_eventbridge", "azure_event_grid", "webhook_endpoint"] """ Event destination type. """ @@ -51,6 +55,10 @@ class EventDestinationCreateParams(TypedDict): """ Amazon EventBridge configuration. """ + azure_event_grid: NotRequired["EventDestinationCreateParamsAzureEventGrid"] + """ + Azure Event Grid configuration. + """ webhook_endpoint: NotRequired[ "EventDestinationCreateParamsWebhookEndpoint" ] @@ -70,6 +78,21 @@ class EventDestinationCreateParamsAmazonEventbridge(TypedDict): """ +class EventDestinationCreateParamsAzureEventGrid(TypedDict): + azure_region: str + """ + The Azure region. + """ + azure_resource_group_name: str + """ + The name of the Azure resource group. + """ + azure_subscription_id: str + """ + The Azure subscription ID. + """ + + class EventDestinationCreateParamsWebhookEndpoint(TypedDict): url: str """ diff --git a/stripe/params/v2/core/accounts/_person_create_params.py b/stripe/params/v2/core/accounts/_person_create_params.py index 2c8bd0cda..a3661bdce 100644 --- a/stripe/params/v2/core/accounts/_person_create_params.py +++ b/stripe/params/v2/core/accounts/_person_create_params.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from decimal import Decimal from typing import Dict, List from typing_extensions import Literal, NotRequired, TypedDict @@ -425,7 +426,7 @@ class PersonCreateParamsRelationship(TypedDict): """ Indicates whether the person is an owner of the associated legal entity. """ - percent_ownership: NotRequired[str] + percent_ownership: NotRequired[Decimal] """ The percentage of ownership the person has in the associated legal entity. """ diff --git a/stripe/params/v2/core/accounts/_person_token_create_params.py b/stripe/params/v2/core/accounts/_person_token_create_params.py index 846020361..bf51ad18e 100644 --- a/stripe/params/v2/core/accounts/_person_token_create_params.py +++ b/stripe/params/v2/core/accounts/_person_token_create_params.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from decimal import Decimal from typing import Dict, List, Optional from typing_extensions import Literal, NotRequired, TypedDict @@ -421,7 +422,7 @@ class PersonTokenCreateParamsRelationship(TypedDict): """ Indicates whether the person is an owner of the associated legal entity. """ - percent_ownership: NotRequired[str] + percent_ownership: NotRequired[Decimal] """ The percentage of ownership the person has in the associated legal entity. """ diff --git a/stripe/params/v2/core/accounts/_person_update_params.py b/stripe/params/v2/core/accounts/_person_update_params.py index a56cca6f8..f398ac6c3 100644 --- a/stripe/params/v2/core/accounts/_person_update_params.py +++ b/stripe/params/v2/core/accounts/_person_update_params.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from decimal import Decimal from typing import Dict, List, Optional from typing_extensions import Literal, NotRequired, TypedDict @@ -425,7 +426,7 @@ class PersonUpdateParamsRelationship(TypedDict): """ Indicates whether the person is an owner of the associated legal entity. """ - percent_ownership: NotRequired[str] + percent_ownership: NotRequired[Decimal] """ The percentage of ownership the person has in the associated legal entity. """ diff --git a/stripe/params/v2/core/vault/_gb_bank_account_create_params.py b/stripe/params/v2/core/vault/_gb_bank_account_create_params.py index 9fc659bc2..da013f908 100644 --- a/stripe/params/v2/core/vault/_gb_bank_account_create_params.py +++ b/stripe/params/v2/core/vault/_gb_bank_account_create_params.py @@ -4,7 +4,7 @@ class GbBankAccountCreateParams(TypedDict): - account_number: str + account_number: NotRequired[str] """ The Account Number of the bank account. """ @@ -20,7 +20,15 @@ class GbBankAccountCreateParams(TypedDict): against what was provided by the bank. Doing so is required for all bank accounts not owned by you before making domestic UK OutboundPayments. """ - sort_code: str + currency: str + """ + The currency of the bank account. + """ + iban: NotRequired[str] + """ + The IBAN of the bank account. + """ + sort_code: NotRequired[str] """ The Sort Code of the bank account. """ diff --git a/stripe/params/v2/core/vault/_us_bank_account_create_params.py b/stripe/params/v2/core/vault/_us_bank_account_create_params.py index b319c3f32..2f9137510 100644 --- a/stripe/params/v2/core/vault/_us_bank_account_create_params.py +++ b/stripe/params/v2/core/vault/_us_bank_account_create_params.py @@ -12,6 +12,10 @@ class UsBankAccountCreateParams(TypedDict): """ Closed Enum. The type of the bank account (checking or savings). """ + currency: str + """ + The currency of the bank account. + """ fedwire_routing_number: NotRequired[str] """ The fedwire routing number of the bank account. Note that certain banks have the same ACH and wire routing number. diff --git a/stripe/params/v2/money_management/__init__.py b/stripe/params/v2/money_management/__init__.py index 5f1a99f3f..51ca08681 100644 --- a/stripe/params/v2/money_management/__init__.py +++ b/stripe/params/v2/money_management/__init__.py @@ -13,9 +13,7 @@ from stripe.params.v2.money_management._currency_conversion_create_params import ( CurrencyConversionCreateParams as CurrencyConversionCreateParams, CurrencyConversionCreateParamsFrom as CurrencyConversionCreateParamsFrom, - CurrencyConversionCreateParamsFromAmount as CurrencyConversionCreateParamsFromAmount, CurrencyConversionCreateParamsTo as CurrencyConversionCreateParamsTo, - CurrencyConversionCreateParamsToAmount as CurrencyConversionCreateParamsToAmount, ) from stripe.params.v2.money_management._currency_conversion_list_params import ( CurrencyConversionListParams as CurrencyConversionListParams, @@ -52,7 +50,6 @@ ) from stripe.params.v2.money_management._inbound_transfer_create_params import ( InboundTransferCreateParams as InboundTransferCreateParams, - InboundTransferCreateParamsAmount as InboundTransferCreateParamsAmount, InboundTransferCreateParamsFrom as InboundTransferCreateParamsFrom, InboundTransferCreateParamsTo as InboundTransferCreateParamsTo, ) @@ -67,7 +64,6 @@ ) from stripe.params.v2.money_management._outbound_payment_create_params import ( OutboundPaymentCreateParams as OutboundPaymentCreateParams, - OutboundPaymentCreateParamsAmount as OutboundPaymentCreateParamsAmount, OutboundPaymentCreateParamsDeliveryOptions as OutboundPaymentCreateParamsDeliveryOptions, OutboundPaymentCreateParamsDeliveryOptionsPaperCheck as OutboundPaymentCreateParamsDeliveryOptionsPaperCheck, OutboundPaymentCreateParamsFrom as OutboundPaymentCreateParamsFrom, @@ -79,7 +75,6 @@ ) from stripe.params.v2.money_management._outbound_payment_quote_create_params import ( OutboundPaymentQuoteCreateParams as OutboundPaymentQuoteCreateParams, - OutboundPaymentQuoteCreateParamsAmount as OutboundPaymentQuoteCreateParamsAmount, OutboundPaymentQuoteCreateParamsDeliveryOptions as OutboundPaymentQuoteCreateParamsDeliveryOptions, OutboundPaymentQuoteCreateParamsFrom as OutboundPaymentQuoteCreateParamsFrom, OutboundPaymentQuoteCreateParamsTo as OutboundPaymentQuoteCreateParamsTo, @@ -117,7 +112,6 @@ ) from stripe.params.v2.money_management._outbound_transfer_create_params import ( OutboundTransferCreateParams as OutboundTransferCreateParams, - OutboundTransferCreateParamsAmount as OutboundTransferCreateParamsAmount, OutboundTransferCreateParamsDeliveryOptions as OutboundTransferCreateParamsDeliveryOptions, OutboundTransferCreateParamsFrom as OutboundTransferCreateParamsFrom, OutboundTransferCreateParamsTo as OutboundTransferCreateParamsTo, @@ -196,18 +190,10 @@ "stripe.params.v2.money_management._currency_conversion_create_params", False, ), - "CurrencyConversionCreateParamsFromAmount": ( - "stripe.params.v2.money_management._currency_conversion_create_params", - False, - ), "CurrencyConversionCreateParamsTo": ( "stripe.params.v2.money_management._currency_conversion_create_params", False, ), - "CurrencyConversionCreateParamsToAmount": ( - "stripe.params.v2.money_management._currency_conversion_create_params", - False, - ), "CurrencyConversionListParams": ( "stripe.params.v2.money_management._currency_conversion_list_params", False, @@ -264,10 +250,6 @@ "stripe.params.v2.money_management._inbound_transfer_create_params", False, ), - "InboundTransferCreateParamsAmount": ( - "stripe.params.v2.money_management._inbound_transfer_create_params", - False, - ), "InboundTransferCreateParamsFrom": ( "stripe.params.v2.money_management._inbound_transfer_create_params", False, @@ -292,10 +274,6 @@ "stripe.params.v2.money_management._outbound_payment_create_params", False, ), - "OutboundPaymentCreateParamsAmount": ( - "stripe.params.v2.money_management._outbound_payment_create_params", - False, - ), "OutboundPaymentCreateParamsDeliveryOptions": ( "stripe.params.v2.money_management._outbound_payment_create_params", False, @@ -324,10 +302,6 @@ "stripe.params.v2.money_management._outbound_payment_quote_create_params", False, ), - "OutboundPaymentQuoteCreateParamsAmount": ( - "stripe.params.v2.money_management._outbound_payment_quote_create_params", - False, - ), "OutboundPaymentQuoteCreateParamsDeliveryOptions": ( "stripe.params.v2.money_management._outbound_payment_quote_create_params", False, @@ -404,10 +378,6 @@ "stripe.params.v2.money_management._outbound_transfer_create_params", False, ), - "OutboundTransferCreateParamsAmount": ( - "stripe.params.v2.money_management._outbound_transfer_create_params", - False, - ), "OutboundTransferCreateParamsDeliveryOptions": ( "stripe.params.v2.money_management._outbound_transfer_create_params", False, diff --git a/stripe/params/v2/money_management/_currency_conversion_create_params.py b/stripe/params/v2/money_management/_currency_conversion_create_params.py index a94347fab..393d25cf4 100644 --- a/stripe/params/v2/money_management/_currency_conversion_create_params.py +++ b/stripe/params/v2/money_management/_currency_conversion_create_params.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from stripe.v2._amount import AmountParam from typing_extensions import NotRequired, TypedDict _CurrencyConversionCreateParamsBase = TypedDict( @@ -20,7 +21,7 @@ class CurrencyConversionCreateParams(_CurrencyConversionCreateParamsBase): class CurrencyConversionCreateParamsFrom(TypedDict): - amount: NotRequired["CurrencyConversionCreateParamsFromAmount"] + amount: NotRequired[AmountParam] """ Amount object. """ @@ -30,19 +31,8 @@ class CurrencyConversionCreateParamsFrom(TypedDict): """ -class CurrencyConversionCreateParamsFromAmount(TypedDict): - value: int - """ - A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). - """ - 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). - """ - - class CurrencyConversionCreateParamsTo(TypedDict): - amount: NotRequired["CurrencyConversionCreateParamsToAmount"] + amount: NotRequired[AmountParam] """ Amount object. """ @@ -50,14 +40,3 @@ class CurrencyConversionCreateParamsTo(TypedDict): """ A lowercase alpha3 currency code like "usd". """ - - -class CurrencyConversionCreateParamsToAmount(TypedDict): - value: int - """ - A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). - """ - 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). - """ diff --git a/stripe/params/v2/money_management/_financial_account_list_params.py b/stripe/params/v2/money_management/_financial_account_list_params.py index c0a9cea32..fc0263845 100644 --- a/stripe/params/v2/money_management/_financial_account_list_params.py +++ b/stripe/params/v2/money_management/_financial_account_list_params.py @@ -5,6 +5,10 @@ class FinancialAccountListParams(TypedDict): + include: NotRequired[List[Literal["payments.balance_by_funds_type"]]] + """ + Additional fields to include in the response. + """ limit: NotRequired[int] """ The page limit. diff --git a/stripe/params/v2/money_management/_financial_account_retrieve_params.py b/stripe/params/v2/money_management/_financial_account_retrieve_params.py index 40b1615fb..054b26236 100644 --- a/stripe/params/v2/money_management/_financial_account_retrieve_params.py +++ b/stripe/params/v2/money_management/_financial_account_retrieve_params.py @@ -1,7 +1,11 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec -from typing_extensions import TypedDict +from typing import List +from typing_extensions import Literal, NotRequired, TypedDict class FinancialAccountRetrieveParams(TypedDict): - pass + include: NotRequired[List[Literal["payments.balance_by_funds_type"]]] + """ + Additional fields to include in the response. + """ diff --git a/stripe/params/v2/money_management/_inbound_transfer_create_params.py b/stripe/params/v2/money_management/_inbound_transfer_create_params.py index 715086b0e..db5250ed2 100644 --- a/stripe/params/v2/money_management/_inbound_transfer_create_params.py +++ b/stripe/params/v2/money_management/_inbound_transfer_create_params.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from stripe.v2._amount import AmountParam from typing_extensions import NotRequired, TypedDict _InboundTransferCreateParamsBase = TypedDict( @@ -9,7 +10,7 @@ class InboundTransferCreateParams(_InboundTransferCreateParamsBase): - amount: "InboundTransferCreateParamsAmount" + amount: AmountParam """ The amount, in specified currency, by which the FinancialAccount balance will increase due to the InboundTransfer. """ @@ -23,17 +24,6 @@ class InboundTransferCreateParams(_InboundTransferCreateParamsBase): """ -class InboundTransferCreateParamsAmount(TypedDict): - value: int - """ - A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). - """ - 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). - """ - - class InboundTransferCreateParamsFrom(TypedDict): currency: NotRequired[str] """ diff --git a/stripe/params/v2/money_management/_outbound_payment_create_params.py b/stripe/params/v2/money_management/_outbound_payment_create_params.py index d95e0b448..b44113357 100644 --- a/stripe/params/v2/money_management/_outbound_payment_create_params.py +++ b/stripe/params/v2/money_management/_outbound_payment_create_params.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from stripe.v2._amount import AmountParam from typing import Dict from typing_extensions import Literal, NotRequired, TypedDict @@ -10,7 +11,7 @@ class OutboundPaymentCreateParams(_OutboundPaymentCreateParamsBase): - amount: "OutboundPaymentCreateParamsAmount" + amount: AmountParam """ The "presentment amount" to be sent to the recipient. """ @@ -44,20 +45,13 @@ class OutboundPaymentCreateParams(_OutboundPaymentCreateParamsBase): """ The recipient verification id for this OutboundPayment. Only required for countries with regulatory mandates to verify recipient names before OutboundPayment creation. """ - to: "OutboundPaymentCreateParamsTo" - """ - To which payout method to send the OutboundPayment. + statement_descriptor: NotRequired[str] """ - - -class OutboundPaymentCreateParamsAmount(TypedDict): - value: int + The description that appears on the receiving end for an OutboundPayment (for example, on a bank statement). Must be between 3 and 22 characters long, and not contain profanity. """ - A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). - """ - currency: str + to: "OutboundPaymentCreateParamsTo" """ - 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). + To which payout method to send the OutboundPayment. """ diff --git a/stripe/params/v2/money_management/_outbound_payment_quote_create_params.py b/stripe/params/v2/money_management/_outbound_payment_quote_create_params.py index ea20f2ca0..ec40e4404 100644 --- a/stripe/params/v2/money_management/_outbound_payment_quote_create_params.py +++ b/stripe/params/v2/money_management/_outbound_payment_quote_create_params.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from stripe.v2._amount import AmountParam from typing_extensions import Literal, NotRequired, TypedDict _OutboundPaymentQuoteCreateParamsBase = TypedDict( @@ -9,7 +10,7 @@ class OutboundPaymentQuoteCreateParams(_OutboundPaymentQuoteCreateParamsBase): - amount: "OutboundPaymentQuoteCreateParamsAmount" + amount: AmountParam """ The "presentment amount" to be sent to the recipient. """ @@ -25,17 +26,6 @@ class OutboundPaymentQuoteCreateParams(_OutboundPaymentQuoteCreateParamsBase): """ -class OutboundPaymentQuoteCreateParamsAmount(TypedDict): - value: int - """ - A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). - """ - 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). - """ - - class OutboundPaymentQuoteCreateParamsDeliveryOptions(TypedDict): speed: NotRequired[Literal["instant", "next_business_day", "standard"]] """ diff --git a/stripe/params/v2/money_management/_outbound_setup_intent_create_params.py b/stripe/params/v2/money_management/_outbound_setup_intent_create_params.py index f8db2551c..1286d4b36 100644 --- a/stripe/params/v2/money_management/_outbound_setup_intent_create_params.py +++ b/stripe/params/v2/money_management/_outbound_setup_intent_create_params.py @@ -63,6 +63,10 @@ class OutboundSetupIntentCreateParamsPayoutMethodDataBankAccount(TypedDict): """ The country code of the bank account. """ + currency: str + """ + The currency of the bank account. + """ routing_number: NotRequired[str] """ The routing number of the bank account, if present. @@ -74,6 +78,10 @@ class OutboundSetupIntentCreateParamsPayoutMethodDataBankAccount(TypedDict): class OutboundSetupIntentCreateParamsPayoutMethodDataCard(TypedDict): + currency: str + """ + The currency of the card. + """ exp_month: str """ The expiration month of the card. diff --git a/stripe/params/v2/money_management/_outbound_setup_intent_update_params.py b/stripe/params/v2/money_management/_outbound_setup_intent_update_params.py index ab465e10f..395351972 100644 --- a/stripe/params/v2/money_management/_outbound_setup_intent_update_params.py +++ b/stripe/params/v2/money_management/_outbound_setup_intent_update_params.py @@ -51,6 +51,10 @@ class OutboundSetupIntentUpdateParamsPayoutMethodDataBankAccount(TypedDict): """ The country code of the bank account. """ + currency: str + """ + The currency of the bank account. + """ routing_number: NotRequired[str] """ The routing number of the bank account, if present. @@ -62,6 +66,10 @@ class OutboundSetupIntentUpdateParamsPayoutMethodDataBankAccount(TypedDict): class OutboundSetupIntentUpdateParamsPayoutMethodDataCard(TypedDict): + currency: NotRequired[str] + """ + The currency of the card. + """ exp_month: NotRequired[str] """ The expiration month of the card. diff --git a/stripe/params/v2/money_management/_outbound_transfer_create_params.py b/stripe/params/v2/money_management/_outbound_transfer_create_params.py index 846aacbe3..c79e5927c 100644 --- a/stripe/params/v2/money_management/_outbound_transfer_create_params.py +++ b/stripe/params/v2/money_management/_outbound_transfer_create_params.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from stripe.v2._amount import AmountParam from typing import Dict from typing_extensions import Literal, NotRequired, TypedDict @@ -10,7 +11,7 @@ class OutboundTransferCreateParams(_OutboundTransferCreateParamsBase): - amount: "OutboundTransferCreateParamsAmount" + amount: AmountParam """ The "presentment amount" for the OutboundPayment. """ @@ -32,20 +33,13 @@ class OutboundTransferCreateParams(_OutboundTransferCreateParamsBase): """ The recipient verification id for this OutboundTransfer. Only required for countries with regulatory mandates to verify recipient names before OutboundTransfer creation. """ - to: "OutboundTransferCreateParamsTo" - """ - To which payout method to send the OutboundTransfer. + statement_descriptor: NotRequired[str] """ - - -class OutboundTransferCreateParamsAmount(TypedDict): - value: int + The description that appears on the receiving end for an OutboundTransfer (for example, on a bank statement). Must be between 3 and 22 characters long, and not contain profanity. """ - A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). - """ - currency: str + to: "OutboundTransferCreateParamsTo" """ - 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). + To which payout method to send the OutboundTransfer. """ diff --git a/stripe/params/v2/payments/__init__.py b/stripe/params/v2/payments/__init__.py index a0cbbdbd4..e36178b6a 100644 --- a/stripe/params/v2/payments/__init__.py +++ b/stripe/params/v2/payments/__init__.py @@ -16,7 +16,6 @@ ) from stripe.params.v2.payments._off_session_payment_create_params import ( OffSessionPaymentCreateParams as OffSessionPaymentCreateParams, - OffSessionPaymentCreateParamsAmount as OffSessionPaymentCreateParamsAmount, OffSessionPaymentCreateParamsCapture as OffSessionPaymentCreateParamsCapture, OffSessionPaymentCreateParamsPaymentMethodData as OffSessionPaymentCreateParamsPaymentMethodData, OffSessionPaymentCreateParamsPaymentMethodDataBillingDetails as OffSessionPaymentCreateParamsPaymentMethodDataBillingDetails, @@ -39,7 +38,6 @@ ) from stripe.params.v2.payments._settlement_allocation_intent_create_params import ( SettlementAllocationIntentCreateParams as SettlementAllocationIntentCreateParams, - SettlementAllocationIntentCreateParamsAmount as SettlementAllocationIntentCreateParamsAmount, ) from stripe.params.v2.payments._settlement_allocation_intent_list_params import ( SettlementAllocationIntentListParams as SettlementAllocationIntentListParams, @@ -52,7 +50,6 @@ ) from stripe.params.v2.payments._settlement_allocation_intent_update_params import ( SettlementAllocationIntentUpdateParams as SettlementAllocationIntentUpdateParams, - SettlementAllocationIntentUpdateParamsAmount as SettlementAllocationIntentUpdateParamsAmount, ) # name -> (import_target, is_submodule) @@ -77,10 +74,6 @@ "stripe.params.v2.payments._off_session_payment_create_params", False, ), - "OffSessionPaymentCreateParamsAmount": ( - "stripe.params.v2.payments._off_session_payment_create_params", - False, - ), "OffSessionPaymentCreateParamsCapture": ( "stripe.params.v2.payments._off_session_payment_create_params", False, @@ -137,10 +130,6 @@ "stripe.params.v2.payments._settlement_allocation_intent_create_params", False, ), - "SettlementAllocationIntentCreateParamsAmount": ( - "stripe.params.v2.payments._settlement_allocation_intent_create_params", - False, - ), "SettlementAllocationIntentListParams": ( "stripe.params.v2.payments._settlement_allocation_intent_list_params", False, @@ -157,10 +146,6 @@ "stripe.params.v2.payments._settlement_allocation_intent_update_params", False, ), - "SettlementAllocationIntentUpdateParamsAmount": ( - "stripe.params.v2.payments._settlement_allocation_intent_update_params", - False, - ), } if not TYPE_CHECKING: diff --git a/stripe/params/v2/payments/_off_session_payment_create_params.py b/stripe/params/v2/payments/_off_session_payment_create_params.py index 3cb29576b..56ef48c2a 100644 --- a/stripe/params/v2/payments/_off_session_payment_create_params.py +++ b/stripe/params/v2/payments/_off_session_payment_create_params.py @@ -1,11 +1,12 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from stripe.v2._amount import AmountParam from typing import Dict from typing_extensions import Literal, NotRequired, TypedDict class OffSessionPaymentCreateParams(TypedDict): - amount: "OffSessionPaymentCreateParamsAmount" + amount: AmountParam """ The “presentment amount” to be collected from the customer. """ @@ -81,17 +82,6 @@ class OffSessionPaymentCreateParams(TypedDict): """ -class OffSessionPaymentCreateParamsAmount(TypedDict): - value: int - """ - A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). - """ - 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). - """ - - class OffSessionPaymentCreateParamsCapture(TypedDict): capture_method: Literal["automatic", "manual"] """ diff --git a/stripe/params/v2/payments/_settlement_allocation_intent_create_params.py b/stripe/params/v2/payments/_settlement_allocation_intent_create_params.py index 1a4b2be27..cd57a11ab 100644 --- a/stripe/params/v2/payments/_settlement_allocation_intent_create_params.py +++ b/stripe/params/v2/payments/_settlement_allocation_intent_create_params.py @@ -1,11 +1,12 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from stripe.v2._amount import AmountParam from typing import Dict from typing_extensions import NotRequired, TypedDict class SettlementAllocationIntentCreateParams(TypedDict): - amount: "SettlementAllocationIntentCreateParamsAmount" + amount: AmountParam """ The amount and currency of the SettlementAllocationIntent. Allowed Currencies are `gbp` | `eur`. """ @@ -25,14 +26,3 @@ class SettlementAllocationIntentCreateParams(TypedDict): """ Reference for the SettlementAllocationIntent. This should be same as the transaction reference used by payments processor to send funds to Stripe. Must have length between 5 and 255 characters and it must be unique among existing SettlementAllocationIntents that have a non-terminal status (`pending`, `submitted`, `matched`, `errored`). """ - - -class SettlementAllocationIntentCreateParamsAmount(TypedDict): - value: int - """ - A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). - """ - 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). - """ diff --git a/stripe/params/v2/payments/_settlement_allocation_intent_update_params.py b/stripe/params/v2/payments/_settlement_allocation_intent_update_params.py index 83ad0180c..7249cbcac 100644 --- a/stripe/params/v2/payments/_settlement_allocation_intent_update_params.py +++ b/stripe/params/v2/payments/_settlement_allocation_intent_update_params.py @@ -1,10 +1,11 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from stripe.v2._amount import AmountParam from typing_extensions import NotRequired, TypedDict class SettlementAllocationIntentUpdateParams(TypedDict): - amount: NotRequired["SettlementAllocationIntentUpdateParamsAmount"] + amount: NotRequired[AmountParam] """ The new amount for the SettlementAllocationIntent. Only amount.value can be updated and currency must remain same. """ @@ -12,14 +13,3 @@ class SettlementAllocationIntentUpdateParams(TypedDict): """ The new reference for the SettlementAllocationIntent. """ - - -class SettlementAllocationIntentUpdateParamsAmount(TypedDict): - value: int - """ - A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). - """ - 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). - """ diff --git a/stripe/params/v2/payments/settlement_allocation_intents/__init__.py b/stripe/params/v2/payments/settlement_allocation_intents/__init__.py index f38eb74a8..41f8f910a 100644 --- a/stripe/params/v2/payments/settlement_allocation_intents/__init__.py +++ b/stripe/params/v2/payments/settlement_allocation_intents/__init__.py @@ -9,7 +9,6 @@ ) from stripe.params.v2.payments.settlement_allocation_intents._split_create_params import ( SplitCreateParams as SplitCreateParams, - SplitCreateParamsAmount as SplitCreateParamsAmount, ) from stripe.params.v2.payments.settlement_allocation_intents._split_list_params import ( SplitListParams as SplitListParams, @@ -28,10 +27,6 @@ "stripe.params.v2.payments.settlement_allocation_intents._split_create_params", False, ), - "SplitCreateParamsAmount": ( - "stripe.params.v2.payments.settlement_allocation_intents._split_create_params", - False, - ), "SplitListParams": ( "stripe.params.v2.payments.settlement_allocation_intents._split_list_params", False, diff --git a/stripe/params/v2/payments/settlement_allocation_intents/_split_create_params.py b/stripe/params/v2/payments/settlement_allocation_intents/_split_create_params.py index 4458a60cd..72cba8848 100644 --- a/stripe/params/v2/payments/settlement_allocation_intents/_split_create_params.py +++ b/stripe/params/v2/payments/settlement_allocation_intents/_split_create_params.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from stripe.v2._amount import AmountParam from typing import Dict from typing_extensions import Literal, NotRequired, TypedDict @@ -9,7 +10,7 @@ class SplitCreateParams(TypedDict): """ The target account for settling the SettlementAllocationIntentSplit. """ - amount: "SplitCreateParamsAmount" + amount: AmountParam """ The amount and currency of the SettlementAllocationIntentSplit. """ @@ -21,14 +22,3 @@ class SplitCreateParams(TypedDict): """ The type of the fund transfer. """ - - -class SplitCreateParamsAmount(TypedDict): - value: int - """ - A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). - """ - 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). - """ diff --git a/stripe/params/v2/tax/_manual_rule_create_params.py b/stripe/params/v2/tax/_manual_rule_create_params.py index 7e2176ed1..0ce906eb0 100644 --- a/stripe/params/v2/tax/_manual_rule_create_params.py +++ b/stripe/params/v2/tax/_manual_rule_create_params.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from decimal import Decimal from typing import List from typing_extensions import Literal, NotRequired, TypedDict @@ -77,7 +78,7 @@ class ManualRuleCreateParamsScheduledTaxRateRate(TypedDict): """ Jurisdiction of the tax rate should apply as it will be shown on the invoice. """ - percentage: str + percentage: Decimal """ Percentage of the tax rate. Must be positive and maximum of 4 decimal points. """ diff --git a/stripe/params/v2/tax/_manual_rule_update_params.py b/stripe/params/v2/tax/_manual_rule_update_params.py index a676778b6..65fb7cb62 100644 --- a/stripe/params/v2/tax/_manual_rule_update_params.py +++ b/stripe/params/v2/tax/_manual_rule_update_params.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from decimal import Decimal from typing import List from typing_extensions import Literal, NotRequired, TypedDict @@ -77,7 +78,7 @@ class ManualRuleUpdateParamsScheduledTaxRateRate(TypedDict): """ Jurisdiction of the tax rate should apply as it will be shown on the invoice. """ - percentage: str + percentage: Decimal """ Percentage of the tax rate. Must be positive and maximum of 4 decimal points. """ diff --git a/stripe/params/v2/test_helpers/__init__.py b/stripe/params/v2/test_helpers/__init__.py index 2e5c7778a..ac9619333 100644 --- a/stripe/params/v2/test_helpers/__init__.py +++ b/stripe/params/v2/test_helpers/__init__.py @@ -6,7 +6,6 @@ if TYPE_CHECKING: from stripe.params.v2.test_helpers._financial_address_credit_params import ( FinancialAddressCreditParams as FinancialAddressCreditParams, - FinancialAddressCreditParamsAmount as FinancialAddressCreditParamsAmount, ) from stripe.params.v2.test_helpers._financial_address_generate_microdeposits_params import ( FinancialAddressGenerateMicrodepositsParams as FinancialAddressGenerateMicrodepositsParams, @@ -21,10 +20,6 @@ "stripe.params.v2.test_helpers._financial_address_credit_params", False, ), - "FinancialAddressCreditParamsAmount": ( - "stripe.params.v2.test_helpers._financial_address_credit_params", - False, - ), "FinancialAddressGenerateMicrodepositsParams": ( "stripe.params.v2.test_helpers._financial_address_generate_microdeposits_params", False, diff --git a/stripe/params/v2/test_helpers/_financial_address_credit_params.py b/stripe/params/v2/test_helpers/_financial_address_credit_params.py index 5ff7bbc34..72931ad01 100644 --- a/stripe/params/v2/test_helpers/_financial_address_credit_params.py +++ b/stripe/params/v2/test_helpers/_financial_address_credit_params.py @@ -1,10 +1,11 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from stripe.v2._amount import AmountParam from typing_extensions import Literal, NotRequired, TypedDict class FinancialAddressCreditParams(TypedDict): - amount: "FinancialAddressCreditParamsAmount" + amount: AmountParam """ Object containing the amount value and currency to credit. """ @@ -16,14 +17,3 @@ class FinancialAddressCreditParams(TypedDict): """ String explaining funds flow. Use this field to populate the statement descriptor of the ReceivedCredit created as an eventual result of this simulation. """ - - -class FinancialAddressCreditParamsAmount(TypedDict): - value: int - """ - A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). - """ - 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). - """ diff --git a/stripe/v2/_billing_service.py b/stripe/v2/_billing_service.py index ed65ba398..5faa24495 100644 --- a/stripe/v2/_billing_service.py +++ b/stripe/v2/_billing_service.py @@ -15,9 +15,6 @@ ) from stripe.v2.billing._intent_service import IntentService from stripe.v2.billing._license_fee_service import LicenseFeeService - from stripe.v2.billing._license_fee_subscription_service import ( - LicenseFeeSubscriptionService, - ) from stripe.v2.billing._licensed_item_service import LicensedItemService from stripe.v2.billing._meter_event_adjustment_service import ( MeterEventAdjustmentService, @@ -61,10 +58,6 @@ "stripe.v2.billing._license_fee_service", "LicenseFeeService", ], - "license_fee_subscriptions": [ - "stripe.v2.billing._license_fee_subscription_service", - "LicenseFeeSubscriptionService", - ], "licensed_items": [ "stripe.v2.billing._licensed_item_service", "LicensedItemService", @@ -121,7 +114,6 @@ class BillingService(StripeService): custom_pricing_units: "CustomPricingUnitService" intents: "IntentService" license_fees: "LicenseFeeService" - license_fee_subscriptions: "LicenseFeeSubscriptionService" licensed_items: "LicensedItemService" meter_events: "MeterEventService" meter_event_adjustments: "MeterEventAdjustmentService" diff --git a/stripe/v2/_core_service.py b/stripe/v2/_core_service.py index 454db1304..c4abb02a9 100644 --- a/stripe/v2/_core_service.py +++ b/stripe/v2/_core_service.py @@ -5,9 +5,13 @@ from typing_extensions import TYPE_CHECKING if TYPE_CHECKING: + from stripe.v2.core._account_evaluation_service import ( + AccountEvaluationService, + ) from stripe.v2.core._account_link_service import AccountLinkService from stripe.v2.core._account_service import AccountService from stripe.v2.core._account_token_service import AccountTokenService + from stripe.v2.core._batch_job_service import BatchJobService from stripe.v2.core._claimable_sandbox_service import ( ClaimableSandboxService, ) @@ -22,6 +26,10 @@ _subservices = { "accounts": ["stripe.v2.core._account_service", "AccountService"], + "account_evaluations": [ + "stripe.v2.core._account_evaluation_service", + "AccountEvaluationService", + ], "account_links": [ "stripe.v2.core._account_link_service", "AccountLinkService", @@ -30,6 +38,7 @@ "stripe.v2.core._account_token_service", "AccountTokenService", ], + "batch_jobs": ["stripe.v2.core._batch_job_service", "BatchJobService"], "claimable_sandboxes": [ "stripe.v2.core._claimable_sandbox_service", "ClaimableSandboxService", @@ -49,8 +58,10 @@ class CoreService(StripeService): accounts: "AccountService" + account_evaluations: "AccountEvaluationService" account_links: "AccountLinkService" account_tokens: "AccountTokenService" + batch_jobs: "BatchJobService" claimable_sandboxes: "ClaimableSandboxService" connection_sessions: "ConnectionSessionService" events: "EventService" diff --git a/stripe/v2/_financial_address_generated_microdeposits.py b/stripe/v2/_financial_address_generated_microdeposits.py index f53dfcf52..f1c345be7 100644 --- a/stripe/v2/_financial_address_generated_microdeposits.py +++ b/stripe/v2/_financial_address_generated_microdeposits.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec from stripe._stripe_object import StripeObject +from stripe.v2._amount import Amount from typing import ClassVar, List from typing_extensions import Literal @@ -13,17 +14,6 @@ class FinancialAddressGeneratedMicrodeposits(StripeObject): OBJECT_NAME: ClassVar[ Literal["financial_address_generated_microdeposits"] ] = "financial_address_generated_microdeposits" - - class Amount(StripeObject): - 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). - """ - value: int - """ - A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). - """ - amounts: List[Amount] """ The amounts of the microdeposits that were generated. @@ -40,4 +30,3 @@ class Amount(StripeObject): """ Closed Enum. The status of the request. """ - _inner_class_types = {"amounts": Amount} diff --git a/stripe/v2/billing/__init__.py b/stripe/v2/billing/__init__.py index 92abc1912..17c73ebf2 100644 --- a/stripe/v2/billing/__init__.py +++ b/stripe/v2/billing/__init__.py @@ -10,7 +10,6 @@ collection_settings as collection_settings, intents as intents, license_fees as license_fees, - pricing_plan_subscriptions as pricing_plan_subscriptions, pricing_plans as pricing_plans, rate_cards as rate_cards, ) @@ -52,12 +51,6 @@ from stripe.v2.billing._license_fee_service import ( LicenseFeeService as LicenseFeeService, ) - from stripe.v2.billing._license_fee_subscription import ( - LicenseFeeSubscription as LicenseFeeSubscription, - ) - from stripe.v2.billing._license_fee_subscription_service import ( - LicenseFeeSubscriptionService as LicenseFeeSubscriptionService, - ) from stripe.v2.billing._license_fee_version import ( LicenseFeeVersion as LicenseFeeVersion, ) @@ -102,9 +95,6 @@ from stripe.v2.billing._pricing_plan_subscription import ( PricingPlanSubscription as PricingPlanSubscription, ) - from stripe.v2.billing._pricing_plan_subscription_components import ( - PricingPlanSubscriptionComponents as PricingPlanSubscriptionComponents, - ) from stripe.v2.billing._pricing_plan_subscription_service import ( PricingPlanSubscriptionService as PricingPlanSubscriptionService, ) @@ -146,10 +136,6 @@ "collection_settings": ("stripe.v2.billing.collection_settings", True), "intents": ("stripe.v2.billing.intents", True), "license_fees": ("stripe.v2.billing.license_fees", True), - "pricing_plan_subscriptions": ( - "stripe.v2.billing.pricing_plan_subscriptions", - True, - ), "pricing_plans": ("stripe.v2.billing.pricing_plans", True), "rate_cards": ("stripe.v2.billing.rate_cards", True), "BillSetting": ("stripe.v2.billing._bill_setting", False), @@ -180,14 +166,6 @@ "IntentService": ("stripe.v2.billing._intent_service", False), "LicenseFee": ("stripe.v2.billing._license_fee", False), "LicenseFeeService": ("stripe.v2.billing._license_fee_service", False), - "LicenseFeeSubscription": ( - "stripe.v2.billing._license_fee_subscription", - False, - ), - "LicenseFeeSubscriptionService": ( - "stripe.v2.billing._license_fee_subscription_service", - False, - ), "LicenseFeeVersion": ("stripe.v2.billing._license_fee_version", False), "LicensedItem": ("stripe.v2.billing._licensed_item", False), "LicensedItemService": ("stripe.v2.billing._licensed_item_service", False), @@ -224,10 +202,6 @@ "stripe.v2.billing._pricing_plan_subscription", False, ), - "PricingPlanSubscriptionComponents": ( - "stripe.v2.billing._pricing_plan_subscription_components", - False, - ), "PricingPlanSubscriptionService": ( "stripe.v2.billing._pricing_plan_subscription_service", False, diff --git a/stripe/v2/billing/_cadence.py b/stripe/v2/billing/_cadence.py index 9d50a4332..33f02bc36 100644 --- a/stripe/v2/billing/_cadence.py +++ b/stripe/v2/billing/_cadence.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from decimal import Decimal from stripe._stripe_object import StripeObject from typing import Any, ClassVar, Dict, List, Optional from typing_extensions import Literal @@ -182,11 +183,12 @@ class MaximumApplications(StripeObject): """ The maximum applications configuration for this discount. """ - percent_off: str + percent_off: Decimal """ Percent that will be taken off of the amount. For example, percent_off of 50.0 will make $100 amount $50 instead. """ _inner_class_types = {"maximum_applications": MaximumApplications} + _field_encodings = {"percent_off": "decimal_string"} id: str """ @@ -359,6 +361,7 @@ class MandateOptions(StripeObject): """ A description of the mandate that is meant to be displayed to the customer. """ + _field_encodings = {"amount": "int64_string"} mandate_options: Optional[MandateOptions] """ diff --git a/stripe/v2/billing/_collection_setting.py b/stripe/v2/billing/_collection_setting.py index 3a9a369f7..6f5c66f4b 100644 --- a/stripe/v2/billing/_collection_setting.py +++ b/stripe/v2/billing/_collection_setting.py @@ -71,6 +71,7 @@ class MandateOptions(StripeObject): """ A description of the mandate that is meant to be displayed to the customer. """ + _field_encodings = {"amount": "int64_string"} mandate_options: Optional[MandateOptions] """ diff --git a/stripe/v2/billing/_collection_setting_service.py b/stripe/v2/billing/_collection_setting_service.py index 96ff1556a..e546c5651 100644 --- a/stripe/v2/billing/_collection_setting_service.py +++ b/stripe/v2/billing/_collection_setting_service.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from stripe._encode import _coerce_v2_params from stripe._stripe_service import StripeService from stripe._util import sanitize_id from typing import Optional, cast @@ -108,7 +109,16 @@ def create( "post", "/v2/billing/collection_settings", base_address="api", - params=params, + params=_coerce_v2_params( + params, + { + "payment_method_options": { + "card": { + "mandate_options": {"amount": "int64_string"}, + }, + }, + }, + ), options=options, ), ) @@ -127,7 +137,16 @@ async def create_async( "post", "/v2/billing/collection_settings", base_address="api", - params=params, + params=_coerce_v2_params( + params, + { + "payment_method_options": { + "card": { + "mandate_options": {"amount": "int64_string"}, + }, + }, + }, + ), options=options, ), ) @@ -193,7 +212,16 @@ def update( id=sanitize_id(id), ), base_address="api", - params=params, + params=_coerce_v2_params( + params, + { + "payment_method_options": { + "card": { + "mandate_options": {"amount": "int64_string"}, + }, + }, + }, + ), options=options, ), ) @@ -215,7 +243,16 @@ async def update_async( id=sanitize_id(id), ), base_address="api", - params=params, + params=_coerce_v2_params( + params, + { + "payment_method_options": { + "card": { + "mandate_options": {"amount": "int64_string"}, + }, + }, + }, + ), options=options, ), ) diff --git a/stripe/v2/billing/_collection_setting_version.py b/stripe/v2/billing/_collection_setting_version.py index cfa05ea80..62c58c2e1 100644 --- a/stripe/v2/billing/_collection_setting_version.py +++ b/stripe/v2/billing/_collection_setting_version.py @@ -71,6 +71,7 @@ class MandateOptions(StripeObject): """ A description of the mandate that is meant to be displayed to the customer. """ + _field_encodings = {"amount": "int64_string"} mandate_options: Optional[MandateOptions] """ diff --git a/stripe/v2/billing/_intent.py b/stripe/v2/billing/_intent.py index f7edb0d32..c6e1581fa 100644 --- a/stripe/v2/billing/_intent.py +++ b/stripe/v2/billing/_intent.py @@ -15,10 +15,18 @@ class Intent(StripeObject): OBJECT_NAME: ClassVar[Literal["v2.billing.intent"]] = "v2.billing.intent" class AmountDetails(StripeObject): + amount_due: str + """ + The outstanding amount after discount, tax, and customer balance application. + """ currency: str """ Three-letter ISO currency code, in lowercase. Must be a supported currency. """ + customer_balance_applied: str + """ + The customer's account balance applied to the amount. + """ discount: str """ Amount of discount applied. @@ -270,6 +278,12 @@ class Collection(StripeObject): "settings": Settings, } + class InvoiceResources(StripeObject): + preview_invoice: Optional[str] + """ + ID of a preview invoice showing the breakdown of line items. Null if the billing intent will not create an invoice. Only present when "invoice_resources.preview_invoice" is included. + """ + class StatusTransitions(StripeObject): canceled_at: Optional[str] """ @@ -283,6 +297,10 @@ class StatusTransitions(StripeObject): """ Time at which the Billing Intent was drafted. """ + expires_at: str + """ + Time at which the Billing Intent will expire. + """ reserved_at: Optional[str] """ Time at which the Billing Intent was reserved. @@ -312,6 +330,10 @@ class StatusTransitions(StripeObject): """ Unique identifier for the object. """ + invoice_resources: Optional[InvoiceResources] + """ + Invoice resources associated with this Billing Intent. Populated when include parameters are specified. + """ livemode: bool """ Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. @@ -331,5 +353,6 @@ class StatusTransitions(StripeObject): _inner_class_types = { "amount_details": AmountDetails, "cadence_data": CadenceData, + "invoice_resources": InvoiceResources, "status_transitions": StatusTransitions, } diff --git a/stripe/v2/billing/_intent_action.py b/stripe/v2/billing/_intent_action.py index 143f00e8a..cd47cf021 100644 --- a/stripe/v2/billing/_intent_action.py +++ b/stripe/v2/billing/_intent_action.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from decimal import Decimal from stripe._stripe_object import StripeObject from typing import ClassVar, Dict, List, Optional from typing_extensions import Literal @@ -17,11 +18,35 @@ class IntentAction(StripeObject): ) class Apply(StripeObject): + class Discount(StripeObject): + coupon: Optional[str] + """ + The ID of the Coupon applied. + """ + discount: Optional[str] + """ + The ID of the created Discount. + """ + promotion_code: Optional[str] + """ + The ID of the PromotionCode applied. + """ + type: Literal["coupon", "promotion_code"] + """ + Type of the discount. + """ + class EffectiveAt(StripeObject): + timestamp: Optional[str] + """ + The timestamp at which the apply action will take effect. Only present if type is timestamp. Only allowed for discount actions. + """ type: Literal[ "current_billing_period_end", + "current_billing_period_start", "next_billing_period_start", "on_reserve", + "timestamp", ] """ When the apply action will take effect. @@ -39,13 +64,14 @@ class MaximumApplications(StripeObject): """ The maximum number of times this discount can be applied for this Billing Cadence. """ - percent_off: str + percent_off: Decimal """ Percent that will be taken off of the amount. For example, percent_off of 50.0 will make $100 amount $50 instead. """ _inner_class_types = { "maximum_applications": MaximumApplications, } + _field_encodings = {"percent_off": "decimal_string"} applies_to: Literal["cadence"] """ @@ -98,7 +124,7 @@ class CustomPricingUnitOverageRate(StripeObject): """ custom_pricing_unit_overage_rate: CustomPricingUnitOverageRate """ - The configration for the overage rate for the custom pricing unit. + The configuration for the overage rate for the custom pricing unit. """ _inner_class_types = { "amount": Amount, @@ -125,9 +151,13 @@ class CustomPricingUnitOverageRate(StripeObject): "max_billing_period_spend": MaxBillingPeriodSpend, } + discount: Optional[Discount] + """ + Details for applying a discount. + """ effective_at: Optional[EffectiveAt] """ - When the apply action will take effect. Defaults to on_reserve if not specified. + When the apply action will take effect. If not specified, defaults to on_reserve. """ invoice_discount_rule: Optional[InvoiceDiscountRule] """ @@ -137,11 +167,14 @@ class CustomPricingUnitOverageRate(StripeObject): """ Details for applying a spend modifier rule. Only present if type is spend_modifier_rule. """ - type: Literal["invoice_discount_rule", "spend_modifier_rule"] + type: Literal[ + "discount", "invoice_discount_rule", "spend_modifier_rule" + ] """ Type of the apply action details. """ _inner_class_types = { + "discount": Discount, "effective_at": EffectiveAt, "invoice_discount_rule": InvoiceDiscountRule, "spend_modifier_rule": SpendModifierRule, @@ -197,7 +230,7 @@ class LicenseFee(StripeObject): """ Overrides the behavior for license fee components when the action takes effect during the service period. """ - type: Literal["license_fee"] + type: Literal["license_fee", "recurring_credit_grant"] """ The type of behavior to override. """ @@ -295,7 +328,7 @@ class LicenseFee(StripeObject): """ Overrides the behavior for license fee components when the action takes effect during the service period. """ - type: Literal["license_fee"] + type: Literal["license_fee", "recurring_credit_grant"] """ The type of behavior to override. """ @@ -368,7 +401,7 @@ class EffectiveAt(StripeObject): effective_at: Optional[EffectiveAt] """ - When the remove action will take effect. Defaults to on_reserve if not specified. + When the remove action will take effect. If not specified, defaults to on_reserve. """ invoice_discount_rule: Optional[str] """ @@ -424,7 +457,7 @@ class LicenseFee(StripeObject): """ Overrides the behavior for license fee components when the action takes effect during the service period. """ - type: Literal["license_fee"] + type: Literal["license_fee", "recurring_credit_grant"] """ The type of behavior to override. """ @@ -479,7 +512,7 @@ class Item(StripeObject): """ quantity: Optional[int] """ - Quantity for this item. If not provided, will default to 1. + Quantity for this item. If not provided, defaults to 1. """ description: Optional[str] diff --git a/stripe/v2/billing/_license_fee.py b/stripe/v2/billing/_license_fee.py index b5d1d9a39..85a9d4453 100644 --- a/stripe/v2/billing/_license_fee.py +++ b/stripe/v2/billing/_license_fee.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from decimal import Decimal from stripe._stripe_object import StripeObject from typing import ClassVar, Dict, List, Optional from typing_extensions import Literal, TYPE_CHECKING @@ -19,6 +20,17 @@ class LicenseFee(StripeObject): "v2.billing.license_fee" ) + class ServiceCycle(StripeObject): + interval: Literal["day", "month", "week", "year"] + """ + The interval for assessing service. + """ + interval_count: int + """ + The length of the interval for assessing service. For example, set this to 3 and `interval` to `"month"` in + order to specify quarterly service. + """ + class Tier(StripeObject): flat_amount: Optional[str] """ @@ -29,7 +41,7 @@ class Tier(StripeObject): Per-unit price for units included in this tier, represented as a decimal string in minor currency units with at most 12 decimal places. """ - up_to_decimal: Optional[str] + up_to_decimal: Optional[Decimal] """ Up to and including this quantity will be contained in the tier. Only one of `up_to_decimal` and `up_to_inf` may be set. @@ -38,6 +50,7 @@ class Tier(StripeObject): """ No upper bound to this tier. Only one of `up_to_decimal` and `up_to_inf` may be set. """ + _field_encodings = {"up_to_decimal": "decimal_string"} class TransformQuantity(StripeObject): divide_by: int @@ -48,6 +61,7 @@ class TransformQuantity(StripeObject): """ After division, round the result up or down. """ + _field_encodings = {"divide_by": "int64_string"} active: bool """ @@ -71,10 +85,6 @@ class TransformQuantity(StripeObject): """ Unique identifier for the object. """ - latest_version: str - """ - The ID of the license fee's most recently created version. - """ licensed_item: "LicensedItem" """ A Licensed Item represents a billable item whose pricing is based on license fees. You can use license fees @@ -100,14 +110,9 @@ class TransformQuantity(StripeObject): """ String representing the object's type. Objects of the same type share the same value of the object field. """ - service_interval: Literal["day", "month", "week", "year"] - """ - The interval for assessing service. - """ - service_interval_count: int + service_cycle: ServiceCycle """ - The length of the interval for assessing service. For example, set this to 3 and `service_interval` to `"month"` in - order to specify quarterly service. + The service cycle configuration for this License Fee. """ tax_behavior: Literal["exclusive", "inclusive"] """ @@ -133,6 +138,7 @@ class TransformQuantity(StripeObject): places. Cannot be set if `tiers` is provided. """ _inner_class_types = { + "service_cycle": ServiceCycle, "tiers": Tier, "transform_quantity": TransformQuantity, } diff --git a/stripe/v2/billing/_license_fee_service.py b/stripe/v2/billing/_license_fee_service.py index fa5049035..5b617f579 100644 --- a/stripe/v2/billing/_license_fee_service.py +++ b/stripe/v2/billing/_license_fee_service.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from stripe._encode import _coerce_v2_params from stripe._stripe_service import StripeService from stripe._util import sanitize_id from typing import Optional, cast @@ -106,7 +107,10 @@ def create( "post", "/v2/billing/license_fees", base_address="api", - params=params, + params=_coerce_v2_params( + params, + {"transform_quantity": {"divide_by": "int64_string"}}, + ), options=options, ), ) @@ -125,7 +129,10 @@ async def create_async( "post", "/v2/billing/license_fees", base_address="api", - params=params, + params=_coerce_v2_params( + params, + {"transform_quantity": {"divide_by": "int64_string"}}, + ), options=options, ), ) @@ -185,7 +192,10 @@ def update( "post", "/v2/billing/license_fees/{id}".format(id=sanitize_id(id)), base_address="api", - params=params, + params=_coerce_v2_params( + params, + {"transform_quantity": {"divide_by": "int64_string"}}, + ), options=options, ), ) @@ -205,7 +215,10 @@ async def update_async( "post", "/v2/billing/license_fees/{id}".format(id=sanitize_id(id)), base_address="api", - params=params, + params=_coerce_v2_params( + params, + {"transform_quantity": {"divide_by": "int64_string"}}, + ), options=options, ), ) diff --git a/stripe/v2/billing/_license_fee_subscription.py b/stripe/v2/billing/_license_fee_subscription.py deleted file mode 100644 index 74d1c3303..000000000 --- a/stripe/v2/billing/_license_fee_subscription.py +++ /dev/null @@ -1,57 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from stripe._stripe_object import StripeObject -from typing import ClassVar, Dict, Optional -from typing_extensions import Literal - - -class LicenseFeeSubscription(StripeObject): - """ - A License Fee Subscription represents a customer's subscription to a License Fee at a specified quantity. It tracks - the number of units (such as seats or licenses) the customer has subscribed to and bills them according to the service - interval defined in the License Fee and the Billing Cadence. - """ - - OBJECT_NAME: ClassVar[Literal["v2.billing.license_fee_subscription"]] = ( - "v2.billing.license_fee_subscription" - ) - billing_cadence: str - """ - The ID of the Billing Cadence. - """ - created: str - """ - Timestamp of when the object was created. - """ - id: str - """ - Unique identifier for the object. - """ - license_fee: str - """ - The ID of the License Fee. - """ - license_fee_version: str - """ - The ID of the License Fee Version. - """ - 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 that you can attach to an object. This can be useful for storing additional information about the object in a structured format. - """ - object: Literal["v2.billing.license_fee_subscription"] - """ - String representing the object's type. Objects of the same type share the same value of the object field. - """ - quantity: int - """ - Quantity of the License Fee subscribed to. - """ - test_clock: Optional[str] - """ - The ID of the Test Clock, if any. - """ diff --git a/stripe/v2/billing/_license_fee_subscription_service.py b/stripe/v2/billing/_license_fee_subscription_service.py deleted file mode 100644 index 34e54c24c..000000000 --- a/stripe/v2/billing/_license_fee_subscription_service.py +++ /dev/null @@ -1,61 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from stripe._stripe_service import StripeService -from stripe._util import sanitize_id -from typing import Optional, cast -from typing_extensions import TYPE_CHECKING - -if TYPE_CHECKING: - from stripe._request_options import RequestOptions - from stripe.params.v2.billing._license_fee_subscription_retrieve_params import ( - LicenseFeeSubscriptionRetrieveParams, - ) - from stripe.v2.billing._license_fee_subscription import ( - LicenseFeeSubscription, - ) - - -class LicenseFeeSubscriptionService(StripeService): - def retrieve( - self, - id: str, - params: Optional["LicenseFeeSubscriptionRetrieveParams"] = None, - options: Optional["RequestOptions"] = None, - ) -> "LicenseFeeSubscription": - """ - Retrieve a License Fee Subscription object. - """ - return cast( - "LicenseFeeSubscription", - self._request( - "get", - "/v2/billing/license_fee_subscriptions/{id}".format( - id=sanitize_id(id), - ), - base_address="api", - params=params, - options=options, - ), - ) - - async def retrieve_async( - self, - id: str, - params: Optional["LicenseFeeSubscriptionRetrieveParams"] = None, - options: Optional["RequestOptions"] = None, - ) -> "LicenseFeeSubscription": - """ - Retrieve a License Fee Subscription object. - """ - return cast( - "LicenseFeeSubscription", - await self._request_async( - "get", - "/v2/billing/license_fee_subscriptions/{id}".format( - id=sanitize_id(id), - ), - base_address="api", - params=params, - options=options, - ), - ) diff --git a/stripe/v2/billing/_license_fee_version.py b/stripe/v2/billing/_license_fee_version.py index 8fd8b37d9..72eb5ffc5 100644 --- a/stripe/v2/billing/_license_fee_version.py +++ b/stripe/v2/billing/_license_fee_version.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from decimal import Decimal from stripe._stripe_object import StripeObject from typing import ClassVar, List, Optional from typing_extensions import Literal @@ -26,7 +27,7 @@ class Tier(StripeObject): Per-unit price for units included in this tier, represented as a decimal string in minor currency units with at most 12 decimal places. """ - up_to_decimal: Optional[str] + up_to_decimal: Optional[Decimal] """ Up to and including this quantity will be contained in the tier. Only one of `up_to_decimal` and `up_to_inf` may be set. @@ -35,6 +36,7 @@ class Tier(StripeObject): """ No upper bound to this tier. Only one of `up_to_decimal` and `up_to_inf` may be set. """ + _field_encodings = {"up_to_decimal": "decimal_string"} class TransformQuantity(StripeObject): divide_by: int @@ -45,6 +47,7 @@ class TransformQuantity(StripeObject): """ After division, round the result up or down. """ + _field_encodings = {"divide_by": "int64_string"} created: str """ diff --git a/stripe/v2/billing/_licensed_item.py b/stripe/v2/billing/_licensed_item.py index 94d82a9bf..55866a2b3 100644 --- a/stripe/v2/billing/_licensed_item.py +++ b/stripe/v2/billing/_licensed_item.py @@ -40,7 +40,7 @@ class TaxDetails(StripeObject): """ lookup_key: Optional[str] """ - An internal key you can use to search for a particular billable item. + An internal key you can use to search for a particular licensed item. Maximum length of 200 characters. """ metadata: Optional[Dict[str, str]] diff --git a/stripe/v2/billing/_metered_item.py b/stripe/v2/billing/_metered_item.py index d40e6c260..63ca6cb49 100644 --- a/stripe/v2/billing/_metered_item.py +++ b/stripe/v2/billing/_metered_item.py @@ -54,7 +54,7 @@ class TaxDetails(StripeObject): """ lookup_key: Optional[str] """ - An internal key you can use to search for a particular billable item. + An internal key you can use to search for a particular metered item. Maximum length of 200 characters. """ metadata: Optional[Dict[str, str]] diff --git a/stripe/v2/billing/_pricing_plan.py b/stripe/v2/billing/_pricing_plan.py index c3767da00..978970e41 100644 --- a/stripe/v2/billing/_pricing_plan.py +++ b/stripe/v2/billing/_pricing_plan.py @@ -40,10 +40,6 @@ class PricingPlan(StripeObject): """ Unique identifier for the object. """ - latest_version: str - """ - The ID of the latest version of the PricingPlan. - """ live_version: Optional[str] """ The ID of the live version of the PricingPlan. diff --git a/stripe/v2/billing/_pricing_plan_component.py b/stripe/v2/billing/_pricing_plan_component.py index 7cf5428df..cb102e886 100644 --- a/stripe/v2/billing/_pricing_plan_component.py +++ b/stripe/v2/billing/_pricing_plan_component.py @@ -23,7 +23,7 @@ class LicenseFee(StripeObject): """ version: Optional[str] """ - The version of the LicenseFee. Defaults to 'latest', if not specified. + The ID of the License Fee Version. If not specified, defaults to 'latest'. """ class RateCard(StripeObject): @@ -33,7 +33,7 @@ class RateCard(StripeObject): """ version: Optional[str] """ - The version of the RateCard. Defaults to 'latest', if not specified. + The ID of the Rate Card Version. If not specified, defaults to 'latest'. """ class ServiceAction(StripeObject): diff --git a/stripe/v2/billing/_pricing_plan_subscription.py b/stripe/v2/billing/_pricing_plan_subscription.py index 2e5a4b0df..40146e974 100644 --- a/stripe/v2/billing/_pricing_plan_subscription.py +++ b/stripe/v2/billing/_pricing_plan_subscription.py @@ -1,8 +1,15 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from decimal import Decimal from stripe._stripe_object import StripeObject -from typing import ClassVar, Dict, Optional -from typing_extensions import Literal +from stripe.v2._amount import Amount as V2AmountResource +from typing import ClassVar, Dict, List, Optional +from typing_extensions import Literal, TYPE_CHECKING + +if TYPE_CHECKING: + from stripe.v2.billing._custom_pricing_unit import ( + CustomPricingUnit as V2BillingCustomPricingUnitResource, + ) class PricingPlanSubscription(StripeObject): @@ -63,6 +70,394 @@ class CollectionStatusTransitions(StripeObject): When the collection status transitioned to unpaid. """ + class DiscountDetail(StripeObject): + class Source(StripeObject): + coupon: Optional[str] + """ + The ID of the Coupon. + """ + type: Literal["coupon"] + """ + Type of the Discount source. + """ + + discount: str + """ + The ID of the Discount. + """ + end: Optional[str] + """ + The time at which the Discount ends, if applicable. + """ + promotion_code: Optional[str] + """ + The ID of the PromotionCode, if applicable. + """ + source: Source + """ + The source of the Discount. + """ + start: str + """ + The time at which the Discount starts. + """ + _inner_class_types = {"source": Source} + + class PricingPlanComponentDetail(StripeObject): + class LicenseFeeDetails(StripeObject): + class ServiceCycle(StripeObject): + interval: Literal["day", "month", "week", "year"] + """ + The interval for assessing service. + """ + interval_count: int + """ + The length of the interval for assessing service. For example, set this to 3 and `interval` to `"month"` in + order to specify quarterly service. + """ + + class Tier(StripeObject): + flat_amount: Optional[str] + """ + Price for the entire tier, represented as a decimal string in minor currency units with at most 12 decimal places. + """ + unit_amount: Optional[str] + """ + Per-unit price for units included in this tier, represented as a decimal string in minor currency units with at + most 12 decimal places. + """ + up_to_decimal: Optional[Decimal] + """ + Up to and including this quantity will be contained in the tier. Only one of `up_to_decimal` and `up_to_inf` may + be set. + """ + up_to_inf: Optional[Literal["inf"]] + """ + No upper bound to this tier. Only one of `up_to_decimal` and `up_to_inf` may be set. + """ + _field_encodings = {"up_to_decimal": "decimal_string"} + + class TransformQuantity(StripeObject): + divide_by: int + """ + Divide usage by this number. + """ + round: Literal["down", "up"] + """ + After division, round the result up or down. + """ + _field_encodings = {"divide_by": "int64_string"} + + currency: str + """ + Three-letter ISO currency code, in lowercase. + """ + display_name: str + """ + A customer-facing name for the license fee. + """ + license_fee: str + """ + The ID of the License Fee. + """ + license_fee_version: str + """ + The ID of the License Fee Version. + """ + quantity: int + """ + Quantity of the license fee on the subscription. + """ + service_cycle: ServiceCycle + """ + The service cycle configuration. + """ + tiering_mode: Optional[Literal["graduated", "volume"]] + """ + Defines whether the tiering price should be graduated or volume-based. + """ + tiers: List[Tier] + """ + Each element represents a pricing tier. + """ + transform_quantity: Optional[TransformQuantity] + """ + Apply a transformation to the reported usage or set quantity before computing the amount billed. + """ + unit_amount: Optional[str] + """ + The per-unit amount to be charged, represented as a decimal string in minor currency units with at most 12 decimal places. + """ + unit_label: Optional[str] + """ + The unit label from the licensed item, used for display purposes (e.g. "seat", "environment"). + """ + _inner_class_types = { + "service_cycle": ServiceCycle, + "tiers": Tier, + "transform_quantity": TransformQuantity, + } + + class RateCardDetails(StripeObject): + class ServiceCycle(StripeObject): + interval: Literal["day", "month", "week", "year"] + """ + The interval for assessing service. + """ + interval_count: int + """ + The length of the interval for assessing service. For example, set this to 3 and `interval` to `"month"` in + order to specify quarterly service. + """ + + currency: str + """ + Three-letter ISO currency code, in lowercase. + """ + display_name: str + """ + A customer-facing name for the rate card. + """ + rate_card: str + """ + The ID of the Rate Card. + """ + rate_card_version: str + """ + The ID of the Rate Card Version. + """ + service_cycle: ServiceCycle + """ + The service cycle configuration. + """ + tax_behavior: Literal["exclusive", "inclusive"] + """ + Whether the rates are inclusive or exclusive of tax. + """ + _inner_class_types = {"service_cycle": ServiceCycle} + + class RecurringCreditGrantDetails(StripeObject): + class CreditGrantDetails(StripeObject): + class Amount(StripeObject): + class CustomPricingUnit(StripeObject): + custom_pricing_unit_details: Optional[ + "V2BillingCustomPricingUnitResource" + ] + """ + The Custom Pricing Unit object. + """ + id: str + """ + The id of the custom pricing unit. + """ + value: Decimal + """ + The value of the credit grant, decimal value represented as a string. + """ + _field_encodings = {"value": "decimal_string"} + + custom_pricing_unit: Optional[CustomPricingUnit] + """ + The custom pricing unit amount of the credit grant. Required if `type` is `custom_pricing_unit`. + """ + monetary: Optional[V2AmountResource] + """ + The monetary amount of the credit grant. Required if `type` is `monetary`. + """ + type: Literal["custom_pricing_unit", "monetary"] + """ + The type of the credit grant amount. We currently support `monetary` and `custom_pricing_unit` billing credits. + """ + _inner_class_types = { + "custom_pricing_unit": CustomPricingUnit, + } + + class ApplicabilityConfig(StripeObject): + class Scope(StripeObject): + billable_items: Optional[List[str]] + """ + The billable items to apply the credit grant to. + """ + price_type: Optional[Literal["metered"]] + """ + The price type that credit grants can apply to. We currently only support the `metered` price type. This will apply to metered prices and rate cards. Cannot be used in combination with `billable_items`. + """ + + scope: Scope + """ + The applicability scope of the credit grant. + """ + _inner_class_types = {"scope": Scope} + + class ExpiryConfig(StripeObject): + type: Literal["end_of_service_period"] + """ + The type of the expiry configuration. We currently support `end_of_service_period`. + """ + + amount: Amount + """ + The amount of the credit grant. + """ + applicability_config: ApplicabilityConfig + """ + Defines the scope where the credit grant is applicable. + """ + expiry_config: ExpiryConfig + """ + The expiry configuration for the credit grant. + """ + _inner_class_types = { + "amount": Amount, + "applicability_config": ApplicabilityConfig, + "expiry_config": ExpiryConfig, + } + + class CreditGrantPerTenantDetails(StripeObject): + class Amount(StripeObject): + class CustomPricingUnit(StripeObject): + custom_pricing_unit_details: Optional[ + "V2BillingCustomPricingUnitResource" + ] + """ + The Custom Pricing Unit object. + """ + id: str + """ + The id of the custom pricing unit. + """ + value: Decimal + """ + The value of the credit grant, decimal value represented as a string. + """ + _field_encodings = {"value": "decimal_string"} + + custom_pricing_unit: Optional[CustomPricingUnit] + """ + The custom pricing unit amount of the credit grant. Required if `type` is `custom_pricing_unit`. + """ + monetary: Optional[V2AmountResource] + """ + The monetary amount of the credit grant. Required if `type` is `monetary`. + """ + type: Literal["custom_pricing_unit", "monetary"] + """ + The type of the credit grant amount. We currently support `monetary` and `custom_pricing_unit` billing credits. + """ + _inner_class_types = { + "custom_pricing_unit": CustomPricingUnit, + } + + class ApplicabilityConfig(StripeObject): + class Scope(StripeObject): + billable_items: Optional[List[str]] + """ + The billable items to apply the credit grant to. + """ + price_type: Optional[Literal["metered"]] + """ + The price type that credit grants can apply to. We currently only support the `metered` price type. This will apply to metered prices and rate cards. Cannot be used in combination with `billable_items`. + """ + + scope: Scope + """ + The applicability scope of the credit grant. + """ + _inner_class_types = {"scope": Scope} + + class ExpiryConfig(StripeObject): + type: Literal["end_of_service_period"] + """ + The type of the expiry configuration. We currently support `end_of_service_period`. + """ + + amount: Amount + """ + The amount of the credit grant. + """ + applicability_config: ApplicabilityConfig + """ + Defines the scope where the credit grant is applicable. + """ + expiry_config: ExpiryConfig + """ + The expiry configuration for the credit grant. + """ + _inner_class_types = { + "amount": Amount, + "applicability_config": ApplicabilityConfig, + "expiry_config": ExpiryConfig, + } + + class ServiceCycle(StripeObject): + interval: Literal["day", "month", "week", "year"] + """ + The interval for assessing service. + """ + interval_count: int + """ + The length of the interval for assessing service. For example, set this to 3 and `interval` to `"month"` in + order to specify quarterly service. + """ + + credit_grant_details: Optional[CreditGrantDetails] + """ + Credit grant details, present when type is CREDIT_GRANT. + """ + credit_grant_per_tenant_details: Optional[ + CreditGrantPerTenantDetails + ] + """ + Credit grant per tenant details, present when type is CREDIT_GRANT_PER_TENANT. + """ + recurring_credit_grant: str + """ + The ID of the Recurring Credit Grant. + """ + service_cycle: ServiceCycle + """ + The service cycle configuration. + """ + type: Literal["credit_grant", "credit_grant_per_tenant"] + """ + The type of the recurring credit grant. + """ + _inner_class_types = { + "credit_grant_details": CreditGrantDetails, + "credit_grant_per_tenant_details": CreditGrantPerTenantDetails, + "service_cycle": ServiceCycle, + } + + license_fee_details: Optional[LicenseFeeDetails] + """ + License fee details, present when type is license_fee_details. + """ + pricing_plan_component: str + """ + The ID of the Pricing Plan Component. + """ + rate_card_details: Optional[RateCardDetails] + """ + Rate card details, present when type is rate_card_details. + """ + recurring_credit_grant_details: Optional[RecurringCreditGrantDetails] + """ + Recurring credit grant details, present when type is recurring_credit_grant_details. + """ + type: Literal[ + "license_fee_details", + "rate_card_details", + "recurring_credit_grant_details", + ] + """ + The type of component details included. + """ + _inner_class_types = { + "license_fee_details": LicenseFeeDetails, + "rate_card_details": RateCardDetails, + "recurring_credit_grant_details": RecurringCreditGrantDetails, + } + class ServicingStatusTransitions(StripeObject): activated_at: Optional[str] """ @@ -107,6 +502,10 @@ class ServicingStatusTransitions(StripeObject): """ Time at which the object was created. """ + discount_details: Optional[List[DiscountDetail]] + """ + Details about Discounts applied to this subscription. + """ id: str """ Unique identifier for the object. @@ -127,6 +526,10 @@ class ServicingStatusTransitions(StripeObject): """ The ID of the Pricing Plan for this subscription. """ + pricing_plan_component_details: Optional[List[PricingPlanComponentDetail]] + """ + Pricing plan component details for the subscription, populated when pricing_plan_component_details is included. + """ pricing_plan_version: str """ The ID of the Pricing Plan Version for this subscription. @@ -146,5 +549,7 @@ class ServicingStatusTransitions(StripeObject): _inner_class_types = { "cancellation_details": CancellationDetails, "collection_status_transitions": CollectionStatusTransitions, + "discount_details": DiscountDetail, + "pricing_plan_component_details": PricingPlanComponentDetail, "servicing_status_transitions": ServicingStatusTransitions, } diff --git a/stripe/v2/billing/_pricing_plan_subscription_components.py b/stripe/v2/billing/_pricing_plan_subscription_components.py deleted file mode 100644 index 9ddc8ba69..000000000 --- a/stripe/v2/billing/_pricing_plan_subscription_components.py +++ /dev/null @@ -1,47 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from stripe._stripe_object import StripeObject -from typing import ClassVar, List, Optional -from typing_extensions import Literal - - -class PricingPlanSubscriptionComponents(StripeObject): - """ - A set of component subscriptions for a Pricing Plan Subscription. - """ - - OBJECT_NAME: ClassVar[ - Literal["v2.billing.pricing_plan_subscription_components"] - ] = "v2.billing.pricing_plan_subscription_components" - - class Component(StripeObject): - license_fee_subscription: Optional[str] - """ - The ID of the License Fee Subscription. - """ - pricing_plan_component: str - """ - The Pricing Plan Component associated with this component subscription. - """ - rate_card_subscription: Optional[str] - """ - The ID of the Rate Card Subscription. - """ - type: Literal["license_fee_subscription", "rate_card_subscription"] - """ - The type of subscription. - """ - - components: List[Component] - """ - The component subscriptions of the Pricing Plan Subscription. - """ - livemode: bool - """ - Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. - """ - object: Literal["v2.billing.pricing_plan_subscription_components"] - """ - String representing the object's type. Objects of the same type share the same value of the object field. - """ - _inner_class_types = {"components": Component} diff --git a/stripe/v2/billing/_pricing_plan_subscription_service.py b/stripe/v2/billing/_pricing_plan_subscription_service.py index a35205fd7..9d61362eb 100644 --- a/stripe/v2/billing/_pricing_plan_subscription_service.py +++ b/stripe/v2/billing/_pricing_plan_subscription_service.py @@ -3,7 +3,6 @@ from stripe._stripe_service import StripeService from stripe._util import sanitize_id from typing import Optional, cast -from importlib import import_module from typing_extensions import TYPE_CHECKING if TYPE_CHECKING: @@ -11,6 +10,9 @@ from stripe.params.v2.billing._pricing_plan_subscription_list_params import ( PricingPlanSubscriptionListParams, ) + from stripe.params.v2.billing._pricing_plan_subscription_remove_discounts_params import ( + PricingPlanSubscriptionRemoveDiscountsParams, + ) from stripe.params.v2.billing._pricing_plan_subscription_retrieve_params import ( PricingPlanSubscriptionRetrieveParams, ) @@ -21,40 +23,9 @@ from stripe.v2.billing._pricing_plan_subscription import ( PricingPlanSubscription, ) - from stripe.v2.billing.pricing_plan_subscriptions._component_service import ( - ComponentService, - ) - -_subservices = { - "components": [ - "stripe.v2.billing.pricing_plan_subscriptions._component_service", - "ComponentService", - ], -} class PricingPlanSubscriptionService(StripeService): - components: "ComponentService" - - def __init__(self, requestor): - super().__init__(requestor) - - def __getattr__(self, name): - try: - import_from, service = _subservices[name] - service_class = getattr( - import_module(import_from), - service, - ) - setattr( - self, - name, - service_class(self._requestor), - ) - return getattr(self, name) - except KeyError: - raise AttributeError() - def list( self, params: Optional["PricingPlanSubscriptionListParams"] = None, @@ -180,3 +151,51 @@ async def update_async( options=options, ), ) + + def remove_discounts( + self, + id: str, + params: Optional[ + "PricingPlanSubscriptionRemoveDiscountsParams" + ] = None, + options: Optional["RequestOptions"] = None, + ) -> "PricingPlanSubscription": + """ + Remove Discounts from a Pricing Plan Subscription. + """ + return cast( + "PricingPlanSubscription", + self._request( + "post", + "/v2/billing/pricing_plan_subscriptions/{id}/remove_discounts".format( + id=sanitize_id(id), + ), + base_address="api", + params=params, + options=options, + ), + ) + + async def remove_discounts_async( + self, + id: str, + params: Optional[ + "PricingPlanSubscriptionRemoveDiscountsParams" + ] = None, + options: Optional["RequestOptions"] = None, + ) -> "PricingPlanSubscription": + """ + Remove Discounts from a Pricing Plan Subscription. + """ + return cast( + "PricingPlanSubscription", + await self._request_async( + "post", + "/v2/billing/pricing_plan_subscriptions/{id}/remove_discounts".format( + id=sanitize_id(id), + ), + base_address="api", + params=params, + options=options, + ), + ) diff --git a/stripe/v2/billing/_rate_card.py b/stripe/v2/billing/_rate_card.py index 6b976c3ca..b0df315f5 100644 --- a/stripe/v2/billing/_rate_card.py +++ b/stripe/v2/billing/_rate_card.py @@ -15,6 +15,18 @@ class RateCard(StripeObject): OBJECT_NAME: ClassVar[Literal["v2.billing.rate_card"]] = ( "v2.billing.rate_card" ) + + class ServiceCycle(StripeObject): + interval: Literal["day", "month", "week", "year"] + """ + The interval for assessing service. + """ + interval_count: int + """ + The length of the interval for assessing service. For example, set this to 3 and `interval` to `"month"` in + order to specify quarterly service. + """ + active: bool """ Whether this RateCard is active. Inactive RateCards cannot be used in new activations or have new rates added. @@ -37,10 +49,6 @@ class RateCard(StripeObject): """ Unique identifier for the object. """ - latest_version: str - """ - The ID of this rate card's most recently created version. - """ live_version: str """ The ID of the Rate Card Version that will be used by all subscriptions when no specific version is specified. @@ -61,19 +69,15 @@ class RateCard(StripeObject): """ String representing the object's type. Objects of the same type share the same value of the object field. """ - service_interval: Literal["day", "month", "week", "year"] - """ - The interval for assessing service. For example, a monthly Rate Card with a rate of $1 for the first 10 "workloads" - and $2 thereafter means "$1 per workload up to 10 workloads during a month of service." This is similar to but - distinct from billing interval; the service interval deals with the rate at which the customer accumulates fees, - while the billing interval in Cadence deals with the rate the customer is billed. - """ - service_interval_count: int + service_cycle: ServiceCycle """ - The length of the interval for assessing service. For example, set this to 3 and `service_interval` to `"month"` in - order to specify quarterly service. + The service cycle configuration for this Rate Card. For example, a monthly Rate Card with a rate of $1 for the + first 10 "workloads" and $2 thereafter means "$1 per workload up to 10 workloads during a month of service." + This is similar to but distinct from billing interval; the service interval deals with the rate at which the + customer accumulates fees, while the billing interval in Cadence deals with the rate the customer is billed. """ tax_behavior: Literal["exclusive", "inclusive"] """ The Stripe Tax tax behavior - whether the rates are inclusive or exclusive of tax. """ + _inner_class_types = {"service_cycle": ServiceCycle} diff --git a/stripe/v2/billing/_rate_card_rate.py b/stripe/v2/billing/_rate_card_rate.py index 682d3abcb..5169bf088 100644 --- a/stripe/v2/billing/_rate_card_rate.py +++ b/stripe/v2/billing/_rate_card_rate.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from decimal import Decimal from stripe._stripe_object import StripeObject from typing import ClassVar, Dict, List, Optional from typing_extensions import Literal, TYPE_CHECKING @@ -44,7 +45,7 @@ class Tier(StripeObject): Per-unit price for units included in this tier, represented as a decimal string in minor currency units with at most 12 decimal places. """ - up_to_decimal: Optional[str] + up_to_decimal: Optional[Decimal] """ Up to and including this quantity will be contained in the tier. Only one of `up_to_decimal` and `up_to_inf` may be set. @@ -53,6 +54,7 @@ class Tier(StripeObject): """ No upper bound to this tier. Only one of `up_to_decimal` and `up_to_inf` may be set. """ + _field_encodings = {"up_to_decimal": "decimal_string"} class TransformQuantity(StripeObject): divide_by: int @@ -63,6 +65,7 @@ class TransformQuantity(StripeObject): """ After division, round the result up or down. """ + _field_encodings = {"divide_by": "int64_string"} created: str """ diff --git a/stripe/v2/billing/_rate_card_service.py b/stripe/v2/billing/_rate_card_service.py index a0033ad69..713db8f79 100644 --- a/stripe/v2/billing/_rate_card_service.py +++ b/stripe/v2/billing/_rate_card_service.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from stripe._encode import _coerce_v2_params from stripe._stripe_service import StripeService from stripe._util import sanitize_id from typing import Optional, cast @@ -14,6 +15,9 @@ from stripe.params.v2.billing._rate_card_list_params import ( RateCardListParams, ) + from stripe.params.v2.billing._rate_card_modify_rates_params import ( + RateCardModifyRatesParams, + ) from stripe.params.v2.billing._rate_card_retrieve_params import ( RateCardRetrieveParams, ) @@ -22,6 +26,7 @@ ) from stripe.v2._list_object import ListObject from stripe.v2.billing._rate_card import RateCard + from stripe.v2.billing._rate_card_version import RateCardVersion from stripe.v2.billing.rate_cards._custom_pricing_unit_overage_rate_service import ( CustomPricingUnitOverageRateService, ) @@ -220,3 +225,65 @@ async def update_async( options=options, ), ) + + def modify_rates( + self, + id: str, + params: "RateCardModifyRatesParams", + options: Optional["RequestOptions"] = None, + ) -> "RateCardVersion": + """ + Creates, updates, and/or deletes multiple Rates on a Rate Card atomically. + """ + return cast( + "RateCardVersion", + self._request( + "post", + "/v2/billing/rate_cards/{id}/modify_rates".format( + id=sanitize_id(id), + ), + base_address="api", + params=_coerce_v2_params( + params, + { + "rates_to_create": { + "transform_quantity": { + "divide_by": "int64_string" + }, + }, + }, + ), + options=options, + ), + ) + + async def modify_rates_async( + self, + id: str, + params: "RateCardModifyRatesParams", + options: Optional["RequestOptions"] = None, + ) -> "RateCardVersion": + """ + Creates, updates, and/or deletes multiple Rates on a Rate Card atomically. + """ + return cast( + "RateCardVersion", + await self._request_async( + "post", + "/v2/billing/rate_cards/{id}/modify_rates".format( + id=sanitize_id(id), + ), + base_address="api", + params=_coerce_v2_params( + params, + { + "rates_to_create": { + "transform_quantity": { + "divide_by": "int64_string" + }, + }, + }, + ), + options=options, + ), + ) diff --git a/stripe/v2/billing/_service_action.py b/stripe/v2/billing/_service_action.py index b87c2748b..2177ace92 100644 --- a/stripe/v2/billing/_service_action.py +++ b/stripe/v2/billing/_service_action.py @@ -1,6 +1,8 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from decimal import Decimal from stripe._stripe_object import StripeObject +from stripe.v2._amount import Amount as V2AmountResource from typing import ClassVar, List, Optional from typing_extensions import Literal, TYPE_CHECKING @@ -32,26 +34,17 @@ class CustomPricingUnit(StripeObject): """ The id of the custom pricing unit. """ - value: str + value: Decimal """ The value of the credit grant, decimal value represented as a string. """ - - class Monetary(StripeObject): - 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). - """ - value: int - """ - A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). - """ + _field_encodings = {"value": "decimal_string"} custom_pricing_unit: Optional[CustomPricingUnit] """ The custom pricing unit amount of the credit grant. Required if `type` is `custom_pricing_unit`. """ - monetary: Optional[Monetary] + monetary: Optional[V2AmountResource] """ The monetary amount of the credit grant. Required if `type` is `monetary`. """ @@ -59,10 +52,7 @@ class Monetary(StripeObject): """ The type of the credit grant amount. We currently support `monetary` and `custom_pricing_unit` billing credits. """ - _inner_class_types = { - "custom_pricing_unit": CustomPricingUnit, - "monetary": Monetary, - } + _inner_class_types = {"custom_pricing_unit": CustomPricingUnit} class ApplicabilityConfig(StripeObject): class Scope(StripeObject): @@ -130,26 +120,17 @@ class CustomPricingUnit(StripeObject): """ The id of the custom pricing unit. """ - value: str + value: Decimal """ The value of the credit grant, decimal value represented as a string. """ - - class Monetary(StripeObject): - 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). - """ - value: int - """ - A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). - """ + _field_encodings = {"value": "decimal_string"} custom_pricing_unit: Optional[CustomPricingUnit] """ The custom pricing unit amount of the credit grant. Required if `type` is `custom_pricing_unit`. """ - monetary: Optional[Monetary] + monetary: Optional[V2AmountResource] """ The monetary amount of the credit grant. Required if `type` is `monetary`. """ @@ -157,10 +138,7 @@ class Monetary(StripeObject): """ The type of the credit grant amount. We currently support `monetary` and `custom_pricing_unit` billing credits. """ - _inner_class_types = { - "custom_pricing_unit": CustomPricingUnit, - "monetary": Monetary, - } + _inner_class_types = {"custom_pricing_unit": CustomPricingUnit} class ApplicabilityConfig(StripeObject): class Scope(StripeObject): diff --git a/stripe/v2/billing/pricing_plan_subscriptions/__init__.py b/stripe/v2/billing/pricing_plan_subscriptions/__init__.py deleted file mode 100644 index 369c338fd..000000000 --- a/stripe/v2/billing/pricing_plan_subscriptions/__init__.py +++ /dev/null @@ -1,32 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from importlib import import_module -from typing_extensions import TYPE_CHECKING - -if TYPE_CHECKING: - from stripe.v2.billing.pricing_plan_subscriptions._component_service import ( - ComponentService as ComponentService, - ) - -# name -> (import_target, is_submodule) -_import_map = { - "ComponentService": ( - "stripe.v2.billing.pricing_plan_subscriptions._component_service", - False, - ), -} -if not TYPE_CHECKING: - - def __getattr__(name): - try: - target, is_submodule = _import_map[name] - module = import_module(target) - if is_submodule: - return module - - return getattr( - module, - name, - ) - except KeyError: - raise AttributeError() diff --git a/stripe/v2/billing/pricing_plan_subscriptions/_component_service.py b/stripe/v2/billing/pricing_plan_subscriptions/_component_service.py deleted file mode 100644 index 688f22bae..000000000 --- a/stripe/v2/billing/pricing_plan_subscriptions/_component_service.py +++ /dev/null @@ -1,61 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from stripe._stripe_service import StripeService -from stripe._util import sanitize_id -from typing import Optional, cast -from typing_extensions import TYPE_CHECKING - -if TYPE_CHECKING: - from stripe._request_options import RequestOptions - from stripe.params.v2.billing.pricing_plan_subscriptions._component_retrieve_params import ( - ComponentRetrieveParams, - ) - from stripe.v2.billing._pricing_plan_subscription_components import ( - PricingPlanSubscriptionComponents, - ) - - -class ComponentService(StripeService): - def retrieve( - self, - id: str, - params: Optional["ComponentRetrieveParams"] = None, - options: Optional["RequestOptions"] = None, - ) -> "PricingPlanSubscriptionComponents": - """ - Retrieve a Pricing Plan Subscription's components. - """ - return cast( - "PricingPlanSubscriptionComponents", - self._request( - "get", - "/v2/billing/pricing_plan_subscriptions/{id}/components".format( - id=sanitize_id(id), - ), - base_address="api", - params=params, - options=options, - ), - ) - - async def retrieve_async( - self, - id: str, - params: Optional["ComponentRetrieveParams"] = None, - options: Optional["RequestOptions"] = None, - ) -> "PricingPlanSubscriptionComponents": - """ - Retrieve a Pricing Plan Subscription's components. - """ - return cast( - "PricingPlanSubscriptionComponents", - await self._request_async( - "get", - "/v2/billing/pricing_plan_subscriptions/{id}/components".format( - id=sanitize_id(id), - ), - base_address="api", - params=params, - options=options, - ), - ) diff --git a/stripe/v2/billing/rate_cards/_rate_service.py b/stripe/v2/billing/rate_cards/_rate_service.py index 1fb0060f8..93ead3459 100644 --- a/stripe/v2/billing/rate_cards/_rate_service.py +++ b/stripe/v2/billing/rate_cards/_rate_service.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from stripe._encode import _coerce_v2_params from stripe._stripe_service import StripeService from stripe._util import sanitize_id from typing import Optional, cast @@ -32,7 +33,7 @@ def list( options: Optional["RequestOptions"] = None, ) -> "ListObject[RateCardRate]": """ - List all Rates associated with a Rate Card for a specific version (defaults to latest). Rates remain active for all subsequent versions until a new rate is created for the same Metered Item. + List all Rates associated with a Rate Card for a specific version. Defaults to latest. Rates remain active for all subsequent versions until a new rate is created for the same Metered Item. """ return cast( "ListObject[RateCardRate]", @@ -54,7 +55,7 @@ async def list_async( options: Optional["RequestOptions"] = None, ) -> "ListObject[RateCardRate]": """ - List all Rates associated with a Rate Card for a specific version (defaults to latest). Rates remain active for all subsequent versions until a new rate is created for the same Metered Item. + List all Rates associated with a Rate Card for a specific version. Defaults to latest. Rates remain active for all subsequent versions until a new rate is created for the same Metered Item. """ return cast( "ListObject[RateCardRate]", @@ -87,7 +88,10 @@ def create( rate_card_id=sanitize_id(rate_card_id), ), base_address="api", - params=params, + params=_coerce_v2_params( + params, + {"transform_quantity": {"divide_by": "int64_string"}}, + ), options=options, ), ) @@ -110,7 +114,10 @@ async def create_async( rate_card_id=sanitize_id(rate_card_id), ), base_address="api", - params=params, + params=_coerce_v2_params( + params, + {"transform_quantity": {"divide_by": "int64_string"}}, + ), options=options, ), ) diff --git a/stripe/v2/core/__init__.py b/stripe/v2/core/__init__.py index 27855f171..74e05cfc0 100644 --- a/stripe/v2/core/__init__.py +++ b/stripe/v2/core/__init__.py @@ -14,6 +14,12 @@ if TYPE_CHECKING: from stripe.v2.core import accounts as accounts, vault as vault from stripe.v2.core._account import Account as Account + from stripe.v2.core._account_evaluation import ( + AccountEvaluation as AccountEvaluation, + ) + from stripe.v2.core._account_evaluation_service import ( + AccountEvaluationService as AccountEvaluationService, + ) from stripe.v2.core._account_link import AccountLink as AccountLink from stripe.v2.core._account_link_service import ( AccountLinkService as AccountLinkService, @@ -29,6 +35,10 @@ from stripe.v2.core._account_token_service import ( AccountTokenService as AccountTokenService, ) + from stripe.v2.core._batch_job import BatchJob as BatchJob + from stripe.v2.core._batch_job_service import ( + BatchJobService as BatchJobService, + ) from stripe.v2.core._claimable_sandbox import ( ClaimableSandbox as ClaimableSandbox, ) @@ -56,6 +66,11 @@ "accounts": ("stripe.v2.core.accounts", True), "vault": ("stripe.v2.core.vault", True), "Account": ("stripe.v2.core._account", False), + "AccountEvaluation": ("stripe.v2.core._account_evaluation", False), + "AccountEvaluationService": ( + "stripe.v2.core._account_evaluation_service", + False, + ), "AccountLink": ("stripe.v2.core._account_link", False), "AccountLinkService": ("stripe.v2.core._account_link_service", False), "AccountPerson": ("stripe.v2.core._account_person", False), @@ -63,6 +78,8 @@ "AccountService": ("stripe.v2.core._account_service", False), "AccountToken": ("stripe.v2.core._account_token", False), "AccountTokenService": ("stripe.v2.core._account_token_service", False), + "BatchJob": ("stripe.v2.core._batch_job", False), + "BatchJobService": ("stripe.v2.core._batch_job_service", False), "ClaimableSandbox": ("stripe.v2.core._claimable_sandbox", False), "ClaimableSandboxService": ( "stripe.v2.core._claimable_sandbox_service", diff --git a/stripe/v2/core/_account.py b/stripe/v2/core/_account.py index bc143dca2..40a671d50 100644 --- a/stripe/v2/core/_account.py +++ b/stripe/v2/core/_account.py @@ -1,6 +1,8 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from decimal import Decimal from stripe._stripe_object import StripeObject +from stripe.v2._amount import Amount from typing import ClassVar, Dict, List, Optional from typing_extensions import Literal @@ -3173,6 +3175,7 @@ class DefaultOutboundDestination(StripeObject): "dz_bank_account", "ec_bank_account", "ee_bank_account", + "eg_bank_account", "es_bank_account", "et_bank_account", "fi_bank_account", @@ -4225,6 +4228,10 @@ class Responsibilities(StripeObject): """ Default responsibilities held by either Stripe or the platform. """ + timezone: Optional[str] + """ + The Account's local timezone. A list of possible time zone values is maintained at the [IANA Time Zone Database](https://www.iana.org/time-zones). + """ _inner_class_types = { "profile": Profile, "responsibilities": Responsibilities, @@ -4382,7 +4389,7 @@ class Deadline(StripeObject): "consumer.cross_river_bank.prepaid_card", "consumer.holds_currencies.usd", "consumer.lead.prepaid_card", - "crypto", + "crypto_wallets", "eps_payments", "financial_addresses.bank_accounts", "fpx_payments", @@ -5700,16 +5707,6 @@ class Address(StripeObject): """ class AnnualRevenue(StripeObject): - class Amount(StripeObject): - 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). - """ - value: int - """ - A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). - """ - amount: Optional[Amount] """ Annual revenue amount in minor currency units (for example, '123' for 1.23 USD). @@ -5718,7 +5715,6 @@ class Amount(StripeObject): """ The close-out date of the preceding fiscal year in ISO 8601 format. E.g. 2023-12-31 for the 31st of December, 2023. """ - _inner_class_types = {"amount": Amount} class Documents(StripeObject): class BankAccountOwnershipVerification(StripeObject): @@ -6020,21 +6016,10 @@ class IdNumber(StripeObject): """ class MonthlyEstimatedRevenue(StripeObject): - class Amount(StripeObject): - 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). - """ - value: int - """ - A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). - """ - amount: Optional[Amount] """ Estimated monthly revenue amount in minor currency units (for example, '123' for 1.23 USD). """ - _inner_class_types = {"amount": Amount} class RegistrationDate(StripeObject): day: int @@ -6561,7 +6546,7 @@ class Relationship(StripeObject): """ Whether the individual is an owner of the Account's identity. """ - percent_ownership: Optional[str] + percent_ownership: Optional[Decimal] """ The percentage of the Account's identity that the individual owns. """ @@ -6573,6 +6558,7 @@ class Relationship(StripeObject): """ The individual's title (e.g., CEO, Support Engineer). """ + _field_encodings = {"percent_ownership": "decimal_string"} class ScriptAddresses(StripeObject): class Kana(StripeObject): @@ -6961,7 +6947,7 @@ class Deadline(StripeObject): "consumer.cross_river_bank.prepaid_card", "consumer.holds_currencies.usd", "consumer.lead.prepaid_card", - "crypto", + "crypto_wallets", "eps_payments", "financial_addresses.bank_accounts", "fpx_payments", diff --git a/stripe/v2/core/_account_evaluation.py b/stripe/v2/core/_account_evaluation.py new file mode 100644 index 000000000..432ce3021 --- /dev/null +++ b/stripe/v2/core/_account_evaluation.py @@ -0,0 +1,90 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from stripe._stripe_object import StripeObject +from typing import ClassVar, List, Optional +from typing_extensions import Literal + + +class AccountEvaluation(StripeObject): + """ + Account Evaluation resource. + """ + + OBJECT_NAME: ClassVar[Literal["v2.core.account_evaluation"]] = ( + "v2.core.account_evaluation" + ) + + class AccountData(StripeObject): + class Defaults(StripeObject): + class Profile(StripeObject): + business_url: str + """ + The business URL. + """ + doing_business_as: Optional[str] + """ + Doing business as (DBA) name. + """ + product_description: Optional[str] + """ + Description of the account's product or service. + """ + + profile: Profile + """ + Account profile data. + """ + _inner_class_types = {"profile": Profile} + + class Identity(StripeObject): + class BusinessDetails(StripeObject): + registered_name: Optional[str] + """ + Registered business name. + """ + + business_details: BusinessDetails + """ + Business details for identity data. + """ + _inner_class_types = {"business_details": BusinessDetails} + + defaults: Optional[Defaults] + """ + Default account settings. + """ + identity: Optional[Identity] + """ + Identity data. + """ + _inner_class_types = {"defaults": Defaults, "identity": Identity} + + account: Optional[str] + """ + The account ID if this evaluation is for an existing account. + """ + account_data: Optional[AccountData] + """ + Account data if this evaluation is for an account without an existing Stripe entity. + """ + created: str + """ + Timestamp at which the evaluation was created. + """ + evaluations_triggered: List[Literal["fraudulent_website"]] + """ + List of signals that were triggered for evaluation. + """ + id: str + """ + Unique identifier for the account evaluation. + """ + livemode: bool + """ + Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. + """ + object: Literal["v2.core.account_evaluation"] + """ + String representing the object's type. Objects of the same type share the same value of the object field. + """ + _inner_class_types = {"account_data": AccountData} diff --git a/stripe/v2/core/_account_evaluation_service.py b/stripe/v2/core/_account_evaluation_service.py new file mode 100644 index 000000000..5b0406d19 --- /dev/null +++ b/stripe/v2/core/_account_evaluation_service.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from stripe._stripe_service import StripeService +from typing import Optional, cast +from typing_extensions import TYPE_CHECKING + +if TYPE_CHECKING: + from stripe._request_options import RequestOptions + from stripe.params.v2.core._account_evaluation_create_params import ( + AccountEvaluationCreateParams, + ) + from stripe.v2.core._account_evaluation import AccountEvaluation + + +class AccountEvaluationService(StripeService): + def create( + self, + params: "AccountEvaluationCreateParams", + options: Optional["RequestOptions"] = None, + ) -> "AccountEvaluation": + """ + Creates a new account evaluation to trigger signal evaluations on an account or account data. + """ + return cast( + "AccountEvaluation", + self._request( + "post", + "/v2/core/account_evaluations", + base_address="api", + params=params, + options=options, + ), + ) + + async def create_async( + self, + params: "AccountEvaluationCreateParams", + options: Optional["RequestOptions"] = None, + ) -> "AccountEvaluation": + """ + Creates a new account evaluation to trigger signal evaluations on an account or account data. + """ + return cast( + "AccountEvaluation", + await self._request_async( + "post", + "/v2/core/account_evaluations", + base_address="api", + params=params, + options=options, + ), + ) diff --git a/stripe/v2/core/_account_person.py b/stripe/v2/core/_account_person.py index 05d51e4b2..e15925f4f 100644 --- a/stripe/v2/core/_account_person.py +++ b/stripe/v2/core/_account_person.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from decimal import Decimal from stripe._stripe_object import StripeObject from typing import ClassVar, Dict, List, Optional from typing_extensions import Literal @@ -337,7 +338,7 @@ class Relationship(StripeObject): """ Whether the individual is an owner of the Account's identity. """ - percent_ownership: Optional[str] + percent_ownership: Optional[Decimal] """ The percentage of the Account's identity that the individual owns. """ @@ -349,6 +350,7 @@ class Relationship(StripeObject): """ The individual's title (e.g., CEO, Support Engineer). """ + _field_encodings = {"percent_ownership": "decimal_string"} class ScriptAddresses(StripeObject): class Kana(StripeObject): diff --git a/stripe/v2/core/_batch_job.py b/stripe/v2/core/_batch_job.py new file mode 100644 index 000000000..aca5add9d --- /dev/null +++ b/stripe/v2/core/_batch_job.py @@ -0,0 +1,331 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from stripe._stripe_object import StripeObject +from typing import ClassVar, Dict, Optional +from typing_extensions import Literal + + +class BatchJob(StripeObject): + """ + BatchJob resource. + """ + + OBJECT_NAME: ClassVar[Literal["v2.core.batch_job"]] = "v2.core.batch_job" + + class StatusDetails(StripeObject): + class BatchFailed(StripeObject): + error: str + """ + Details about the `BatchJob` failure. + """ + + class Canceled(StripeObject): + class OutputFile(StripeObject): + class DownloadUrl(StripeObject): + expires_at: Optional[str] + """ + The time that the URL expires. + """ + url: str + """ + The URL that can be used for accessing the file. + """ + + content_type: str + """ + The content type of the file. + """ + download_url: DownloadUrl + """ + A pre-signed URL that allows secure, time-limited access to download the file. + """ + size: int + """ + The total size of the file in bytes. + """ + _inner_class_types = {"download_url": DownloadUrl} + _field_encodings = {"size": "int64_string"} + + failure_count: int + """ + The total number of records that failed processing. + """ + output_file: OutputFile + """ + The output file details. If BatchJob is cancelled it's provided only if there is already output at this point. + """ + success_count: int + """ + The total number of records that were successfully processed. + """ + _inner_class_types = {"output_file": OutputFile} + _field_encodings = { + "failure_count": "int64_string", + "success_count": "int64_string", + } + + class Complete(StripeObject): + class OutputFile(StripeObject): + class DownloadUrl(StripeObject): + expires_at: Optional[str] + """ + The time that the URL expires. + """ + url: str + """ + The URL that can be used for accessing the file. + """ + + content_type: str + """ + The content type of the file. + """ + download_url: DownloadUrl + """ + A pre-signed URL that allows secure, time-limited access to download the file. + """ + size: int + """ + The total size of the file in bytes. + """ + _inner_class_types = {"download_url": DownloadUrl} + _field_encodings = {"size": "int64_string"} + + failure_count: int + """ + The total number of records that failed processing. + """ + output_file: OutputFile + """ + The output file details. If BatchJob is cancelled it's provided only if there is already output at this point. + """ + success_count: int + """ + The total number of records that were successfully processed. + """ + _inner_class_types = {"output_file": OutputFile} + _field_encodings = { + "failure_count": "int64_string", + "success_count": "int64_string", + } + + class InProgress(StripeObject): + failure_count: int + """ + The number of records that failed processing so far. + """ + success_count: int + """ + The number of records that were successfully processed so far. + """ + _field_encodings = { + "failure_count": "int64_string", + "success_count": "int64_string", + } + + class ReadyForUpload(StripeObject): + class UploadUrl(StripeObject): + expires_at: Optional[str] + """ + The time that the URL expires. + """ + url: str + """ + The URL that can be used for accessing the file. + """ + + upload_url: UploadUrl + """ + The upload file details. + """ + _inner_class_types = {"upload_url": UploadUrl} + + class Timeout(StripeObject): + class OutputFile(StripeObject): + class DownloadUrl(StripeObject): + expires_at: Optional[str] + """ + The time that the URL expires. + """ + url: str + """ + The URL that can be used for accessing the file. + """ + + content_type: str + """ + The content type of the file. + """ + download_url: DownloadUrl + """ + A pre-signed URL that allows secure, time-limited access to download the file. + """ + size: int + """ + The total size of the file in bytes. + """ + _inner_class_types = {"download_url": DownloadUrl} + _field_encodings = {"size": "int64_string"} + + failure_count: int + """ + The total number of records that failed processing. + """ + output_file: OutputFile + """ + The output file details. If BatchJob is cancelled it's provided only if there is already output at this point. + """ + success_count: int + """ + The total number of records that were successfully processed. + """ + _inner_class_types = {"output_file": OutputFile} + _field_encodings = { + "failure_count": "int64_string", + "success_count": "int64_string", + } + + class Validating(StripeObject): + validated_count: int + """ + The number of records that were validated. Note that there is no failure counter here; + once we have any validation failures we give up. + """ + _field_encodings = {"validated_count": "int64_string"} + + class ValidationFailed(StripeObject): + class OutputFile(StripeObject): + class DownloadUrl(StripeObject): + expires_at: Optional[str] + """ + The time that the URL expires. + """ + url: str + """ + The URL that can be used for accessing the file. + """ + + content_type: str + """ + The content type of the file. + """ + download_url: DownloadUrl + """ + A pre-signed URL that allows secure, time-limited access to download the file. + """ + size: int + """ + The total size of the file in bytes. + """ + _inner_class_types = {"download_url": DownloadUrl} + _field_encodings = {"size": "int64_string"} + + failure_count: int + """ + The total number of records that failed processing. + """ + output_file: OutputFile + """ + The output file details. If BatchJob is cancelled it's provided only if there is already output at this point. + """ + success_count: int + """ + The total number of records that were successfully processed. + """ + _inner_class_types = {"output_file": OutputFile} + _field_encodings = { + "failure_count": "int64_string", + "success_count": "int64_string", + } + + batch_failed: Optional[BatchFailed] + """ + Additional details for the `BATCH_FAILED` status of the `BatchJob`. + """ + canceled: Optional[Canceled] + """ + Additional details for the `CANCELED` status of the `BatchJob`. + """ + complete: Optional[Complete] + """ + Additional details for the `COMPLETE` status of the `BatchJob`. + """ + in_progress: Optional[InProgress] + """ + Additional details for the `IN_PROGRESS` status of the `BatchJob`. + """ + ready_for_upload: Optional[ReadyForUpload] + """ + Additional details for the `READY_FOR_UPLOAD` status of the `BatchJob`. + """ + timeout: Optional[Timeout] + """ + Additional details for the `TIMEOUT` status of the `BatchJob`. + """ + validating: Optional[Validating] + """ + Additional details for the `VALIDATING` status of the `BatchJob`. + """ + validation_failed: Optional[ValidationFailed] + """ + Additional details for the `VALIDATION_FAILED` status of the `BatchJob`. + """ + _inner_class_types = { + "batch_failed": BatchFailed, + "canceled": Canceled, + "complete": Complete, + "in_progress": InProgress, + "ready_for_upload": ReadyForUpload, + "timeout": Timeout, + "validating": Validating, + "validation_failed": ValidationFailed, + } + + created: str + """ + Timestamp at which BatchJob was created. + """ + id: str + """ + Unique identifier for the BatchJob. + """ + livemode: bool + """ + Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. + """ + maximum_rps: int + """ + The maximum rps defined for the `BatchJob`. + """ + metadata: Dict[str, str] + """ + The metadata of the `BatchJob` object. + """ + object: Literal["v2.core.batch_job"] + """ + String representing the object's type. Objects of the same type share the same value of the object field. + """ + skip_validation: bool + """ + If the validation will be run previous to the execution of the `BatchJob`. + """ + status: Literal[ + "batch_failed", + "canceled", + "cancelling", + "complete", + "in_progress", + "ready_for_upload", + "timeout", + "upload_timeout", + "validating", + "validation_failed", + ] + """ + The current status of the `BatchJob`. + """ + status_details: Optional[StatusDetails] + """ + Additional details about the current state of the `BatchJob`. + """ + _inner_class_types = {"status_details": StatusDetails} diff --git a/stripe/v2/core/_batch_job_service.py b/stripe/v2/core/_batch_job_service.py new file mode 100644 index 000000000..4028e4d7f --- /dev/null +++ b/stripe/v2/core/_batch_job_service.py @@ -0,0 +1,139 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from stripe._stripe_service import StripeService +from stripe._util import sanitize_id +from typing import Optional, cast +from typing_extensions import TYPE_CHECKING + +if TYPE_CHECKING: + from stripe._request_options import RequestOptions + from stripe.params.v2.core._batch_job_cancel_params import ( + BatchJobCancelParams, + ) + from stripe.params.v2.core._batch_job_create_params import ( + BatchJobCreateParams, + ) + from stripe.params.v2.core._batch_job_retrieve_params import ( + BatchJobRetrieveParams, + ) + from stripe.v2.core._batch_job import BatchJob + + +class BatchJobService(StripeService): + def create( + self, + params: "BatchJobCreateParams", + options: Optional["RequestOptions"] = None, + ) -> "BatchJob": + """ + Creates a new batch job. + """ + return cast( + "BatchJob", + self._request( + "post", + "/v2/core/batch_jobs", + base_address="api", + params=params, + options=options, + ), + ) + + async def create_async( + self, + params: "BatchJobCreateParams", + options: Optional["RequestOptions"] = None, + ) -> "BatchJob": + """ + Creates a new batch job. + """ + return cast( + "BatchJob", + await self._request_async( + "post", + "/v2/core/batch_jobs", + base_address="api", + params=params, + options=options, + ), + ) + + def retrieve( + self, + id: str, + params: Optional["BatchJobRetrieveParams"] = None, + options: Optional["RequestOptions"] = None, + ) -> "BatchJob": + """ + Retrieves an existing batch job. + """ + return cast( + "BatchJob", + self._request( + "get", + "/v2/core/batch_jobs/{id}".format(id=sanitize_id(id)), + base_address="api", + params=params, + options=options, + ), + ) + + async def retrieve_async( + self, + id: str, + params: Optional["BatchJobRetrieveParams"] = None, + options: Optional["RequestOptions"] = None, + ) -> "BatchJob": + """ + Retrieves an existing batch job. + """ + return cast( + "BatchJob", + await self._request_async( + "get", + "/v2/core/batch_jobs/{id}".format(id=sanitize_id(id)), + base_address="api", + params=params, + options=options, + ), + ) + + def cancel( + self, + id: str, + params: Optional["BatchJobCancelParams"] = None, + options: Optional["RequestOptions"] = None, + ) -> "BatchJob": + """ + Cancels an existing batch job. + """ + return cast( + "BatchJob", + self._request( + "post", + "/v2/core/batch_jobs/{id}/cancel".format(id=sanitize_id(id)), + base_address="api", + params=params, + options=options, + ), + ) + + async def cancel_async( + self, + id: str, + params: Optional["BatchJobCancelParams"] = None, + options: Optional["RequestOptions"] = None, + ) -> "BatchJob": + """ + Cancels an existing batch job. + """ + return cast( + "BatchJob", + await self._request_async( + "post", + "/v2/core/batch_jobs/{id}/cancel".format(id=sanitize_id(id)), + base_address="api", + params=params, + options=options, + ), + ) diff --git a/stripe/v2/core/_event.py b/stripe/v2/core/_event.py index f8858dc03..d52f69268 100644 --- a/stripe/v2/core/_event.py +++ b/stripe/v2/core/_event.py @@ -216,10 +216,14 @@ def __init__( def from_json(payload: str, client: "StripeClient") -> "EventNotification": """ Helper for constructing an Event Notification. Doesn't perform signature validation, so you - should use StripeClient.parseEventNotification() instead for initial handling. + should use StripeClient.parse_event_notification() instead for initial handling. This is useful in unit tests and working with EventNotifications that you've already validated the authenticity of. """ parsed_body = json.loads(payload) + if parsed_body.get("object") == "event": + raise ValueError( + "You passed a webhook payload to StripeClient.parse_event_notification, which expects a thin event notification. Use StripeClient.construct_event instead." + ) # circular import busting from stripe.events._event_classes import ( diff --git a/stripe/v2/core/_event_destination.py b/stripe/v2/core/_event_destination.py index 02d4ca172..90cf9482d 100644 --- a/stripe/v2/core/_event_destination.py +++ b/stripe/v2/core/_event_destination.py @@ -30,9 +30,37 @@ class AmazonEventbridge(StripeObject): The state of the AWS event source. """ + class AzureEventGrid(StripeObject): + azure_partner_topic_name: str + """ + The name of the Azure partner topic. + """ + azure_partner_topic_status: Literal[ + "activated", "deleted", "never_activated", "unknown" + ] + """ + The status of the Azure partner topic. + """ + azure_region: str + """ + The Azure region. + """ + azure_resource_group_name: str + """ + The name of the Azure resource group. + """ + azure_subscription_id: str + """ + The Azure subscription ID. + """ + class StatusDetails(StripeObject): class Disabled(StripeObject): - reason: Literal["no_aws_event_source_exists", "user"] + reason: Literal[ + "no_aws_event_source_exists", + "no_azure_partner_topic_exists", + "user", + ] """ Reason event destination has been disabled. """ @@ -57,6 +85,10 @@ class WebhookEndpoint(StripeObject): """ Amazon EventBridge configuration. """ + azure_event_grid: Optional[AzureEventGrid] + """ + Azure Event Grid configuration. + """ created: str """ Time at which the object was created. @@ -73,9 +105,13 @@ class WebhookEndpoint(StripeObject): """ Payload type of events being subscribed to. """ - events_from: Optional[List[Literal["other_accounts", "self"]]] + events_from: Optional[List[str]] """ - Where events should be routed from. + Specifies which accounts' events route to this destination. + `@self`: Receive events from the account that owns the event destination. + `@accounts`: Receive events emitted from other accounts you manage which includes your v1 and v2 accounts. + `@organization_members`: Receive events from accounts directly linked to the organization. + `@organization_members/@accounts`: Receive events from all accounts connected to any platform accounts in the organization. """ id: str """ @@ -109,7 +145,7 @@ class WebhookEndpoint(StripeObject): """ Additional information about event destination status. """ - type: Literal["amazon_eventbridge", "webhook_endpoint"] + type: Literal["amazon_eventbridge", "azure_event_grid", "webhook_endpoint"] """ Event destination type. """ @@ -123,6 +159,7 @@ class WebhookEndpoint(StripeObject): """ _inner_class_types = { "amazon_eventbridge": AmazonEventbridge, + "azure_event_grid": AzureEventGrid, "status_details": StatusDetails, "webhook_endpoint": WebhookEndpoint, } diff --git a/stripe/v2/core/vault/_gb_bank_account.py b/stripe/v2/core/vault/_gb_bank_account.py index 52572adde..36545b39d 100644 --- a/stripe/v2/core/vault/_gb_bank_account.py +++ b/stripe/v2/core/vault/_gb_bank_account.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec from stripe._stripe_object import StripeObject -from typing import ClassVar, Optional +from typing import ClassVar, List, Optional from typing_extensions import Literal @@ -124,10 +124,14 @@ class Provided(StripeObject): """ String representing the object's type. Objects of the same type share the same value of the object field. """ - sort_code: str + sort_code: Optional[str] """ The Sort Code of the bank account. """ + supported_currencies: List[str] + """ + The list of currencies supported by this bank account. + """ _inner_class_types = { "alternative_reference": AlternativeReference, "confirmation_of_payee": ConfirmationOfPayee, diff --git a/stripe/v2/core/vault/_us_bank_account.py b/stripe/v2/core/vault/_us_bank_account.py index b5827050a..00d58cd2c 100644 --- a/stripe/v2/core/vault/_us_bank_account.py +++ b/stripe/v2/core/vault/_us_bank_account.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec from stripe._stripe_object import StripeObject -from typing import ClassVar, Optional +from typing import ClassVar, List, Optional from typing_extensions import Literal @@ -106,6 +106,10 @@ class MicrodepositVerificationDetails(StripeObject): """ The ACH routing number of the bank account. """ + supported_currencies: List[str] + """ + The list of currencies supported by this bank account. + """ verification: Verification """ The bank account verification details. diff --git a/stripe/v2/money_management/_adjustment.py b/stripe/v2/money_management/_adjustment.py index 910857a63..59653e5d8 100644 --- a/stripe/v2/money_management/_adjustment.py +++ b/stripe/v2/money_management/_adjustment.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec from stripe._stripe_object import StripeObject +from stripe.v2._amount import Amount from typing import ClassVar, Optional from typing_extensions import Literal @@ -53,16 +54,6 @@ class AdjustedFlow(StripeObject): Closed Enum. If applicable, the type of flow linked to this Adjustment. The field matching this value will contain the ID of the flow. """ - class Amount(StripeObject): - 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). - """ - value: int - """ - A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). - """ - adjusted_flow: Optional[AdjustedFlow] """ If applicable, contains information about the original flow linked to this Adjustment. @@ -103,4 +94,4 @@ class Amount(StripeObject): """ A reference for the Adjustment that associates it with related records or operations. """ - _inner_class_types = {"adjusted_flow": AdjustedFlow, "amount": Amount} + _inner_class_types = {"adjusted_flow": AdjustedFlow} diff --git a/stripe/v2/money_management/_currency_conversion.py b/stripe/v2/money_management/_currency_conversion.py index 517c74e39..7c8e805c7 100644 --- a/stripe/v2/money_management/_currency_conversion.py +++ b/stripe/v2/money_management/_currency_conversion.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec from stripe._stripe_object import StripeObject +from stripe.v2._amount import Amount from typing import ClassVar from typing_extensions import Literal @@ -15,38 +16,16 @@ class CurrencyConversion(StripeObject): ] = "v2.money_management.currency_conversion" class From(StripeObject): - class Amount(StripeObject): - 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). - """ - value: int - """ - A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). - """ - amount: Amount """ Amount object. """ - _inner_class_types = {"amount": Amount} class To(StripeObject): - class Amount(StripeObject): - 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). - """ - value: int - """ - A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). - """ - amount: Amount """ Amount object. """ - _inner_class_types = {"amount": Amount} created: str """ diff --git a/stripe/v2/money_management/_financial_account.py b/stripe/v2/money_management/_financial_account.py index 70da1c20e..17a356e70 100644 --- a/stripe/v2/money_management/_financial_account.py +++ b/stripe/v2/money_management/_financial_account.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec from stripe._stripe_object import StripeObject +from stripe.v2._amount import Amount from typing import ClassVar, Dict, List, Optional from typing_extensions import Literal @@ -25,58 +26,18 @@ class AccruedFees(StripeObject): """ class Balance(StripeObject): - class Available(StripeObject): - 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). - """ - value: int - """ - A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). - """ - - class InboundPending(StripeObject): - 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). - """ - value: int - """ - A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). - """ - - class OutboundPending(StripeObject): - 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). - """ - value: int - """ - A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). - """ - - available: Dict[str, Available] + available: Dict[str, Amount] """ Balance that can be used for money movement. """ - inbound_pending: Dict[str, InboundPending] + inbound_pending: Dict[str, Amount] """ Balance of inbound funds that will later transition to the `available` balance. """ - outbound_pending: Dict[str, OutboundPending] + outbound_pending: Dict[str, Amount] """ Balance of funds that are being used for a pending outbound money movement. """ - _inner_class_types = { - "available": Available, - "inbound_pending": InboundPending, - "outbound_pending": OutboundPending, - } - _inner_class_dicts = [ - "available", - "inbound_pending", - "outbound_pending", - ] class ManagedBy(StripeObject): type: Literal["multiprocessor_settlement"] @@ -91,28 +52,63 @@ class Other(StripeObject): """ class Payments(StripeObject): - class StartingBalance(StripeObject): - class Available(StripeObject): - currency: str + class BalanceByFundsType(StripeObject): + class PaymentProcessing(StripeObject): + available: Dict[str, Amount] """ - Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies). + Balance that can be used for money movement. """ - value: int + inbound_pending: Dict[str, Amount] """ - A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). + Balance of inbound funds that will later transition to the `available` balance. + """ + outbound_pending: Dict[str, Amount] + """ + Balance of funds that are being used for a pending outbound money movement. """ + class StoredValue(StripeObject): + available: Dict[str, Amount] + """ + Balance that can be used for money movement. + """ + inbound_pending: Dict[str, Amount] + """ + Balance of inbound funds that will later transition to the `available` balance. + """ + outbound_pending: Dict[str, Amount] + """ + Balance of funds that are being used for a pending outbound money movement. + """ + + payment_processing: PaymentProcessing + """ + Payment processing funds are those that are received for goods or services and may only be used for payouts to self. These funds may be converted to stored value funds. + """ + stored_value: StoredValue + """ + Stored value funds may be used for either payouts to self or payments to others. + """ + _inner_class_types = { + "payment_processing": PaymentProcessing, + "stored_value": StoredValue, + } + + class StartingBalance(StripeObject): at: str """ When the balance was projected. """ - available: Dict[str, Available] + available: Dict[str, Amount] """ The available balance at the time when the balance was projected. """ - _inner_class_types = {"available": Available} - _inner_class_dicts = ["available"] + balance_by_funds_type: Optional[BalanceByFundsType] + """ + The balance of the `payments` FinancialAccount is a mix of payment processing and stored value funds, and this field + describes the breakdown between the two. The sum will match the balance of the FinancialAccount. + """ default_currency: str """ The currency that non-settlement currency payments will be converted to. @@ -125,7 +121,10 @@ class Available(StripeObject): """ Describes the available balance when it was projected. """ - _inner_class_types = {"starting_balance": StartingBalance} + _inner_class_types = { + "balance_by_funds_type": BalanceByFundsType, + "starting_balance": StartingBalance, + } class StatusDetails(StripeObject): class Closed(StripeObject): @@ -140,10 +139,19 @@ class ForwardingSettings(StripeObject): """ forwarding_settings: Optional[ForwardingSettings] + """ + The forwarding settings for the closed FinancialAccount. + """ reason: Literal["account_closed", "closed_by_platform", "other"] + """ + The reason the FinancialAccount was closed. + """ _inner_class_types = {"forwarding_settings": ForwardingSettings} closed: Optional[Closed] + """ + Details related to the closed state of the FinancialAccount. + """ _inner_class_types = {"closed": Closed} class Storage(StripeObject): @@ -210,6 +218,9 @@ class Storage(StripeObject): Closed Enum. An enum representing the status of the FinancialAccount. This indicates whether or not the FinancialAccount can be used for any money movement flows. """ status_details: Optional[StatusDetails] + """ + Additional details related to the status of the FinancialAccount. + """ storage: Optional[Storage] """ If this is a `storage` FinancialAccount, this hash includes details specific to `storage` FinancialAccounts. diff --git a/stripe/v2/money_management/_inbound_transfer.py b/stripe/v2/money_management/_inbound_transfer.py index 463523c93..c08bda17a 100644 --- a/stripe/v2/money_management/_inbound_transfer.py +++ b/stripe/v2/money_management/_inbound_transfer.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec from stripe._stripe_object import StripeObject +from stripe.v2._amount import Amount from typing import Any, ClassVar, Dict, List, Optional from typing_extensions import Literal @@ -15,27 +16,7 @@ class InboundTransfer(StripeObject): "v2.money_management.inbound_transfer" ) - class Amount(StripeObject): - 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). - """ - value: int - """ - A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). - """ - class From(StripeObject): - class Debited(StripeObject): - 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). - """ - value: int - """ - A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). - """ - class PaymentMethod(StripeObject): type: str """ @@ -46,7 +27,7 @@ class PaymentMethod(StripeObject): The destination US bank account identifier. eg "usba_***". """ - debited: Debited + debited: Amount """ The amount in specified currency that was debited from the Payment Method. """ @@ -54,23 +35,10 @@ class PaymentMethod(StripeObject): """ The Payment Method object used to create the InboundTransfer. """ - _inner_class_types = { - "debited": Debited, - "payment_method": PaymentMethod, - } + _inner_class_types = {"payment_method": PaymentMethod} class To(StripeObject): - class Credited(StripeObject): - 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). - """ - value: int - """ - A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). - """ - - credited: Credited + credited: Amount """ The amount by which the FinancialAccount balance is credited. """ @@ -78,7 +46,6 @@ class Credited(StripeObject): """ The FinancialAccount that funds will land in. """ - _inner_class_types = {"credited": Credited} class TransferHistory(StripeObject): class BankDebitFailed(StripeObject): @@ -197,7 +164,6 @@ class BankDebitReturned(StripeObject): A list of history objects, representing changes in the state of the InboundTransfer. """ _inner_class_types = { - "amount": Amount, "from": From, "to": To, "transfer_history": TransferHistory, diff --git a/stripe/v2/money_management/_outbound_payment.py b/stripe/v2/money_management/_outbound_payment.py index cf97c47a1..ed833e5d6 100644 --- a/stripe/v2/money_management/_outbound_payment.py +++ b/stripe/v2/money_management/_outbound_payment.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec from stripe._stripe_object import StripeObject +from stripe.v2._amount import Amount from typing import ClassVar, Dict, Optional from typing_extensions import Literal @@ -14,16 +15,6 @@ class OutboundPayment(StripeObject): "v2.money_management.outbound_payment" ) - class Amount(StripeObject): - 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). - """ - value: int - """ - A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). - """ - class DeliveryOptions(StripeObject): class PaperCheck(StripeObject): memo: Optional[str] @@ -54,17 +45,7 @@ class PaperCheck(StripeObject): _inner_class_types = {"paper_check": PaperCheck} class From(StripeObject): - class Debited(StripeObject): - 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). - """ - value: int - """ - A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). - """ - - debited: Debited + debited: Amount """ The monetary amount debited from the sender, only set on responses. """ @@ -72,7 +53,6 @@ class Debited(StripeObject): """ The FinancialAccount that funds were pulled from. """ - _inner_class_types = {"debited": Debited} class RecipientNotification(StripeObject): setting: Literal["configured", "none"] @@ -146,17 +126,7 @@ class StatusTransitions(StripeObject): """ class To(StripeObject): - class Credited(StripeObject): - 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). - """ - value: int - """ - A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). - """ - - credited: Credited + credited: Amount """ The monetary amount being credited to the destination. """ @@ -168,7 +138,6 @@ class Credited(StripeObject): """ To which account the OutboundPayment is sent. """ - _inner_class_types = {"credited": Credited} class TraceId(StripeObject): status: Literal["pending", "supported", "unsupported"] @@ -349,7 +318,6 @@ class MailingAddress(StripeObject): Information to track this OutboundPayment with the recipient bank. """ _inner_class_types = { - "amount": Amount, "delivery_options": DeliveryOptions, "from": From, "recipient_notification": RecipientNotification, diff --git a/stripe/v2/money_management/_outbound_payment_quote.py b/stripe/v2/money_management/_outbound_payment_quote.py index c6b220005..7b0b8b261 100644 --- a/stripe/v2/money_management/_outbound_payment_quote.py +++ b/stripe/v2/money_management/_outbound_payment_quote.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec from stripe._stripe_object import StripeObject +from stripe.v2._amount import Amount from typing import ClassVar, Dict, List, Optional from typing_extensions import Literal @@ -14,16 +15,6 @@ class OutboundPaymentQuote(StripeObject): Literal["v2.money_management.outbound_payment_quote"] ] = "v2.money_management.outbound_payment_quote" - class Amount(StripeObject): - 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). - """ - value: int - """ - A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). - """ - class DeliveryOptions(StripeObject): bank_account: Optional[Literal["automatic", "local", "wire"]] """ @@ -35,16 +26,6 @@ class DeliveryOptions(StripeObject): """ class EstimatedFee(StripeObject): - class Amount(StripeObject): - 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). - """ - value: int - """ - A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). - """ - amount: Amount """ The fee amount for corresponding fee type. @@ -53,6 +34,7 @@ class Amount(StripeObject): "cross_border_payout_fee", "foreign_exchange_fee", "instant_payout_fee", + "next_day_payout_fee", "real_time_payout_fee", "standard_payout_fee", "wire_payout_fee", @@ -60,20 +42,9 @@ class Amount(StripeObject): """ The fee type. """ - _inner_class_types = {"amount": Amount} class From(StripeObject): - class Debited(StripeObject): - 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). - """ - value: int - """ - A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). - """ - - debited: Debited + debited: Amount """ The monetary amount debited from the sender, only set on responses. """ @@ -81,7 +52,6 @@ class Debited(StripeObject): """ The FinancialAccount that funds were pulled from. """ - _inner_class_types = {"debited": Debited} class FxQuote(StripeObject): class Rates(StripeObject): @@ -114,17 +84,7 @@ class Rates(StripeObject): _inner_class_dicts = ["rates"] class To(StripeObject): - class Credited(StripeObject): - 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). - """ - value: int - """ - A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). - """ - - credited: Credited + credited: Amount """ The monetary amount being credited to the destination. """ @@ -136,7 +96,6 @@ class Credited(StripeObject): """ To which account the OutboundPayment is sent. """ - _inner_class_types = {"credited": Credited} amount: Amount """ @@ -180,7 +139,6 @@ class Credited(StripeObject): Details about the recipient of an OutboundPaymentQuote. """ _inner_class_types = { - "amount": Amount, "delivery_options": DeliveryOptions, "estimated_fees": EstimatedFee, "from": From, diff --git a/stripe/v2/money_management/_outbound_transfer.py b/stripe/v2/money_management/_outbound_transfer.py index 9e2cce6d6..a7b5081ba 100644 --- a/stripe/v2/money_management/_outbound_transfer.py +++ b/stripe/v2/money_management/_outbound_transfer.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec from stripe._stripe_object import StripeObject +from stripe.v2._amount import Amount from typing import ClassVar, Dict, Optional from typing_extensions import Literal @@ -14,16 +15,6 @@ class OutboundTransfer(StripeObject): "v2.money_management.outbound_transfer" ) - class Amount(StripeObject): - 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). - """ - value: int - """ - A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). - """ - class DeliveryOptions(StripeObject): bank_account: Optional[Literal["automatic", "local", "wire"]] """ @@ -31,17 +22,7 @@ class DeliveryOptions(StripeObject): """ class From(StripeObject): - class Debited(StripeObject): - 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). - """ - value: int - """ - A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). - """ - - debited: Debited + debited: Amount """ The monetary amount debited from the sender, only set on responses. """ @@ -49,7 +30,6 @@ class Debited(StripeObject): """ The FinancialAccount that funds were pulled from. """ - _inner_class_types = {"debited": Debited} class StatusDetails(StripeObject): class Failed(StripeObject): @@ -116,17 +96,7 @@ class StatusTransitions(StripeObject): """ class To(StripeObject): - class Credited(StripeObject): - 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). - """ - value: int - """ - A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). - """ - - credited: Credited + credited: Amount """ The monetary amount being credited to the destination. """ @@ -134,7 +104,6 @@ class Credited(StripeObject): """ The payout method which the OutboundTransfer uses to send payout. """ - _inner_class_types = {"credited": Credited} class TraceId(StripeObject): status: Literal["pending", "supported", "unsupported"] @@ -231,7 +200,6 @@ class TraceId(StripeObject): A unique identifier that can be used to track this OutboundTransfer with recipient bank. Banks might call this a "reference number" or something similar. """ _inner_class_types = { - "amount": Amount, "delivery_options": DeliveryOptions, "from": From, "status_details": StatusDetails, diff --git a/stripe/v2/money_management/_payout_method.py b/stripe/v2/money_management/_payout_method.py index 9906c75f1..41cdd6808 100644 --- a/stripe/v2/money_management/_payout_method.py +++ b/stripe/v2/money_management/_payout_method.py @@ -96,6 +96,10 @@ class Card(StripeObject): """ The last 4 digits of the card number. """ + supported_currencies: List[str] + """ + The list of currencies supported by this bank account. + """ class CryptoWallet(StripeObject): address: str @@ -176,6 +180,11 @@ class UsageStatus(StripeObject): """ String representing the object's type. Objects of the same type share the same value of the object field. """ + restricted: bool + """ + Whether the Payout Method is currently unusable for money movement, despite potentially being correctly set up. + Please reach out to Stripe Support for more information. + """ type: Literal["bank_account", "card", "crypto_wallet"] """ Closed Enum. The type of payout method. diff --git a/stripe/v2/money_management/_payout_methods_bank_account_spec.py b/stripe/v2/money_management/_payout_methods_bank_account_spec.py index 1042f9223..16ef81889 100644 --- a/stripe/v2/money_management/_payout_methods_bank_account_spec.py +++ b/stripe/v2/money_management/_payout_methods_bank_account_spec.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec from stripe._stripe_object import StripeObject -from typing import ClassVar, Dict, List +from typing import ClassVar, Dict, List, Optional from typing_extensions import Literal @@ -26,6 +26,10 @@ class LocalNameHuman(StripeObject): A unique key representing the instance of this localizable string. """ + currencies: Optional[List[str]] + """ + The currencies supported by the corresponding credentials for bank accounts in the specified country. + """ local_name: str """ The local name of the field. diff --git a/stripe/v2/money_management/_received_credit.py b/stripe/v2/money_management/_received_credit.py index e965d05a2..2acf9a9e0 100644 --- a/stripe/v2/money_management/_received_credit.py +++ b/stripe/v2/money_management/_received_credit.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec from stripe._stripe_object import StripeObject +from stripe.v2._amount import Amount from typing import ClassVar, Optional from typing_extensions import Literal @@ -14,16 +15,6 @@ class ReceivedCredit(StripeObject): "v2.money_management.received_credit" ) - class Amount(StripeObject): - 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). - """ - value: int - """ - A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). - """ - class BalanceTransfer(StripeObject): from_account: Optional[str] """ @@ -178,16 +169,6 @@ class Refund(StripeObject): """ _inner_class_types = {"dispute": Dispute, "refund": Refund} - class ExternalAmount(StripeObject): - 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). - """ - value: int - """ - A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). - """ - class StatusDetails(StripeObject): class Failed(StripeObject): reason: Literal[ @@ -264,7 +245,7 @@ class StripeBalancePayment(StripeObject): """ Freeform string set by originator of the ReceivedCredit. """ - external_amount: Optional[ExternalAmount] + external_amount: Optional[Amount] """ The amount and currency of the original/external credit request. """ @@ -315,11 +296,9 @@ class StripeBalancePayment(StripeObject): Open Enum. The type of flow that caused the ReceivedCredit. """ _inner_class_types = { - "amount": Amount, "balance_transfer": BalanceTransfer, "bank_transfer": BankTransfer, "card_spend": CardSpend, - "external_amount": ExternalAmount, "status_details": StatusDetails, "status_transitions": StatusTransitions, "stripe_balance_payment": StripeBalancePayment, diff --git a/stripe/v2/money_management/_received_debit.py b/stripe/v2/money_management/_received_debit.py index ea51de36a..f7d94e954 100644 --- a/stripe/v2/money_management/_received_debit.py +++ b/stripe/v2/money_management/_received_debit.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec from stripe._stripe_object import StripeObject +from stripe.v2._amount import Amount from typing import ClassVar, List, Optional from typing_extensions import Literal @@ -14,16 +15,6 @@ class ReceivedDebit(StripeObject): "v2.money_management.received_debit" ) - class Amount(StripeObject): - 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). - """ - value: int - """ - A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). - """ - class BalanceTransfer(StripeObject): topup: Optional[str] """ @@ -73,16 +64,6 @@ class UsBankAccount(StripeObject): class CardSpend(StripeObject): class Authorization(StripeObject): - class Amount(StripeObject): - 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). - """ - value: int - """ - A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). - """ - amount: Amount """ Amount associated with this issuing authorization. @@ -91,19 +72,8 @@ class Amount(StripeObject): """ The reference to the v1 issuing authorization ID. """ - _inner_class_types = {"amount": Amount} class CardTransaction(StripeObject): - class Amount(StripeObject): - 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). - """ - value: int - """ - A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). - """ - amount: Amount """ Amount associated with this issuing transaction. @@ -112,7 +82,6 @@ class Amount(StripeObject): """ The reference to the v1 issuing transaction ID. """ - _inner_class_types = {"amount": Amount} authorization: Optional[Authorization] """ @@ -131,16 +100,6 @@ class Amount(StripeObject): "card_transactions": CardTransaction, } - class ExternalAmount(StripeObject): - 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). - """ - value: int - """ - A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). - """ - class StatusDetails(StripeObject): class Failed(StripeObject): reason: Literal[ @@ -211,7 +170,7 @@ class StripeBalancePayment(StripeObject): """ Freeform string sent by the originator of the ReceivedDebit. """ - external_amount: Optional[ExternalAmount] + external_amount: Optional[Amount] """ The amount and currency of the original/external debit request. """ @@ -262,11 +221,9 @@ class StripeBalancePayment(StripeObject): Open Enum. The type of the ReceivedDebit. """ _inner_class_types = { - "amount": Amount, "balance_transfer": BalanceTransfer, "bank_transfer": BankTransfer, "card_spend": CardSpend, - "external_amount": ExternalAmount, "status_details": StatusDetails, "status_transitions": StatusTransitions, "stripe_balance_payment": StripeBalancePayment, diff --git a/stripe/v2/money_management/_transaction.py b/stripe/v2/money_management/_transaction.py index 1cba9de28..1ea980ac0 100644 --- a/stripe/v2/money_management/_transaction.py +++ b/stripe/v2/money_management/_transaction.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec from stripe._stripe_object import StripeObject +from stripe.v2._amount import Amount from typing import ClassVar, Optional from typing_extensions import Literal @@ -14,64 +15,25 @@ class Transaction(StripeObject): "v2.money_management.transaction" ) - class Amount(StripeObject): - 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). - """ - value: int - """ - A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). - """ - class BalanceImpact(StripeObject): - class Available(StripeObject): - 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). - """ - value: int - """ - A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). - """ - - class InboundPending(StripeObject): - 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). - """ - value: int - """ - A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). - """ - - class OutboundPending(StripeObject): - 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). - """ - value: int - """ - A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). - """ - - available: Available + available: Amount """ Impact to the available balance. """ - inbound_pending: InboundPending + inbound_pending: Amount """ Impact to the inbound_pending balance. """ - outbound_pending: OutboundPending + outbound_pending: Amount """ Impact to the outbound_pending balance. """ - _inner_class_types = { - "available": Available, - "inbound_pending": InboundPending, - "outbound_pending": OutboundPending, - } + + class Counterparty(StripeObject): + name: Optional[str] + """ + Name of the counterparty. + """ class Flow(StripeObject): adjustment: Optional[str] @@ -150,6 +112,38 @@ class Flow(StripeObject): """ If applicable, the ID of the Transfer Reversal that created this Transaction. """ + treasury_credit_reversal: Optional[str] + """ + If applicable, the ID of the Treasury CreditReversal that created this Transaction. + """ + treasury_debit_reversal: Optional[str] + """ + If applicable, the ID of the Treasury DebitReversal that created this Transaction. + """ + treasury_inbound_transfer: Optional[str] + """ + If applicable, the ID of the Treasury InboundTransfer that created this Transaction. + """ + treasury_issuing_authorization: Optional[str] + """ + If applicable, the ID of the Treasury IssuingAuthorization that created this Transaction. + """ + treasury_outbound_payment: Optional[str] + """ + If applicable, the ID of the Treasury OutboundPayment that created this Transaction. + """ + treasury_outbound_transfer: Optional[str] + """ + If applicable, the ID of the Treasury OutboundTransfer that created this Transaction. + """ + treasury_received_credit: Optional[str] + """ + If applicable, the ID of the Treasury ReceivedCredit that created this Transaction. + """ + treasury_received_debit: Optional[str] + """ + If applicable, the ID of the Treasury ReceivedDebit that created this Transaction. + """ type: Literal[ "adjustment", "application_fee", @@ -170,6 +164,15 @@ class Flow(StripeObject): "topup", "transfer", "transfer_reversal", + "treasury_credit_reversal", + "treasury_debit_reversal", + "treasury_inbound_transfer", + "treasury_issuing_authorization", + "treasury_other", + "treasury_outbound_payment", + "treasury_outbound_transfer", + "treasury_received_credit", + "treasury_received_debit", ] """ Open Enum. Type of the flow that created the Transaction. The field matching this value will contain the ID of the flow. @@ -250,10 +253,19 @@ class StatusTransitions(StripeObject): """ Open Enum. A descriptive category used to classify the Transaction. """ + counterparty: Optional[Counterparty] + """ + Counterparty to this Transaction. + """ created: str """ Time at which the object was created. Represented as a RFC 3339 date & time UTC value in millisecond precision, for example: 2022-09-18T13:22:18.123Z. """ + description: Optional[str] + """ + Description of this Transaction. When applicable, the description is copied from the Flow object at the time + of transaction creation. + """ financial_account: str """ Indicates the FinancialAccount affected by this Transaction. @@ -286,9 +298,13 @@ class StatusTransitions(StripeObject): """ Timestamps for when the Transaction transitioned to a particular status. """ + treasury_transaction: Optional[str] + """ + The v1 Treasury transaction associated with this transaction. + """ _inner_class_types = { - "amount": Amount, "balance_impact": BalanceImpact, + "counterparty": Counterparty, "flow": Flow, "status_transitions": StatusTransitions, } diff --git a/stripe/v2/money_management/_transaction_entry.py b/stripe/v2/money_management/_transaction_entry.py index 4468f2c5a..3b705a124 100644 --- a/stripe/v2/money_management/_transaction_entry.py +++ b/stripe/v2/money_management/_transaction_entry.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec from stripe._stripe_object import StripeObject +from stripe.v2._amount import Amount from typing import ClassVar, Optional from typing_extensions import Literal @@ -15,53 +16,18 @@ class TransactionEntry(StripeObject): ) class BalanceImpact(StripeObject): - class Available(StripeObject): - 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). - """ - value: int - """ - A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). - """ - - class InboundPending(StripeObject): - 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). - """ - value: int - """ - A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). - """ - - class OutboundPending(StripeObject): - 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). - """ - value: int - """ - A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). - """ - - available: Available + available: Amount """ Impact to the available balance. """ - inbound_pending: InboundPending + inbound_pending: Amount """ Impact to the inbound_pending balance. """ - outbound_pending: OutboundPending + outbound_pending: Amount """ Impact to the outbound_pending balance. """ - _inner_class_types = { - "available": Available, - "inbound_pending": InboundPending, - "outbound_pending": OutboundPending, - } class TransactionDetails(StripeObject): class Flow(StripeObject): @@ -141,6 +107,38 @@ class Flow(StripeObject): """ If applicable, the ID of the Transfer Reversal that created this Transaction. """ + treasury_credit_reversal: Optional[str] + """ + If applicable, the ID of the Treasury CreditReversal that created this Transaction. + """ + treasury_debit_reversal: Optional[str] + """ + If applicable, the ID of the Treasury DebitReversal that created this Transaction. + """ + treasury_inbound_transfer: Optional[str] + """ + If applicable, the ID of the Treasury InboundTransfer that created this Transaction. + """ + treasury_issuing_authorization: Optional[str] + """ + If applicable, the ID of the Treasury IssuingAuthorization that created this Transaction. + """ + treasury_outbound_payment: Optional[str] + """ + If applicable, the ID of the Treasury OutboundPayment that created this Transaction. + """ + treasury_outbound_transfer: Optional[str] + """ + If applicable, the ID of the Treasury OutboundTransfer that created this Transaction. + """ + treasury_received_credit: Optional[str] + """ + If applicable, the ID of the Treasury ReceivedCredit that created this Transaction. + """ + treasury_received_debit: Optional[str] + """ + If applicable, the ID of the Treasury ReceivedDebit that created this Transaction. + """ type: Literal[ "adjustment", "application_fee", @@ -161,6 +159,15 @@ class Flow(StripeObject): "topup", "transfer", "transfer_reversal", + "treasury_credit_reversal", + "treasury_debit_reversal", + "treasury_inbound_transfer", + "treasury_issuing_authorization", + "treasury_other", + "treasury_outbound_payment", + "treasury_outbound_transfer", + "treasury_received_credit", + "treasury_received_debit", ] """ Open Enum. Type of the flow that created the Transaction. The field matching this value will contain the ID of the flow. @@ -264,6 +271,10 @@ class Flow(StripeObject): """ Details copied from the transaction that this TransactionEntry belongs to. """ + treasury_transaction_entry: Optional[str] + """ + The v1 Treasury transaction entry associated with this transaction entry. + """ _inner_class_types = { "balance_impact": BalanceImpact, "transaction_details": TransactionDetails, diff --git a/stripe/v2/payments/_off_session_payment.py b/stripe/v2/payments/_off_session_payment.py index cbdfad51f..c5bbad797 100644 --- a/stripe/v2/payments/_off_session_payment.py +++ b/stripe/v2/payments/_off_session_payment.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec from stripe._stripe_object import StripeObject +from stripe.v2._amount import Amount from typing import ClassVar, Dict, Optional from typing_extensions import Literal @@ -19,26 +20,6 @@ class OffSessionPayment(StripeObject): "v2.payments.off_session_payment" ) - class AmountCapturable(StripeObject): - 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). - """ - value: int - """ - A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). - """ - - class AmountRequested(StripeObject): - 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). - """ - value: int - """ - A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). - """ - class Capture(StripeObject): capture_before: Optional[str] """ @@ -86,11 +67,11 @@ class TransferData(StripeObject): where funds from the payment are transferred to after payment success. """ - amount_capturable: Optional[AmountCapturable] + amount_capturable: Optional[Amount] """ The amount available to be captured. """ - amount_requested: AmountRequested + amount_requested: Amount """ The “presentment amount” to be collected from the customer. """ @@ -117,7 +98,10 @@ class TransferData(StripeObject): """ failure_reason: Optional[ Literal[ - "authorization_expired", "rejected_by_partner", "retries_exhausted" + "authorization_expired", + "no_valid_payment_method", + "rejected_by_partner", + "retries_exhausted", ] ] """ @@ -205,8 +189,6 @@ class TransferData(StripeObject): The data that automatically creates a Transfer after the payment finalizes. Learn more about the use case for [connected accounts](https://docs.stripe.com/payments/connected-accounts). """ _inner_class_types = { - "amount_capturable": AmountCapturable, - "amount_requested": AmountRequested, "capture": Capture, "payments_orchestration": PaymentsOrchestration, "retry_details": RetryDetails, diff --git a/stripe/v2/payments/_settlement_allocation_intent.py b/stripe/v2/payments/_settlement_allocation_intent.py index 1f3a3c171..c31d4c76e 100644 --- a/stripe/v2/payments/_settlement_allocation_intent.py +++ b/stripe/v2/payments/_settlement_allocation_intent.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec from stripe._stripe_object import StripeObject +from stripe.v2._amount import Amount from typing import ClassVar, Dict, List, Optional from typing_extensions import Literal @@ -14,16 +15,6 @@ class SettlementAllocationIntent(StripeObject): Literal["v2.payments.settlement_allocation_intent"] ] = "v2.payments.settlement_allocation_intent" - class Amount(StripeObject): - 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). - """ - value: int - """ - A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). - """ - class StatusDetails(StripeObject): class Errored(StripeObject): doc_url: Optional[str] @@ -95,4 +86,4 @@ class Errored(StripeObject): """ Status details for a SettlementAllocationIntent in `errored` state. """ - _inner_class_types = {"amount": Amount, "status_details": StatusDetails} + _inner_class_types = {"status_details": StatusDetails} diff --git a/stripe/v2/payments/_settlement_allocation_intent_split.py b/stripe/v2/payments/_settlement_allocation_intent_split.py index 576c4b859..96c2fa292 100644 --- a/stripe/v2/payments/_settlement_allocation_intent_split.py +++ b/stripe/v2/payments/_settlement_allocation_intent_split.py @@ -1,7 +1,8 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec from stripe._stripe_object import StripeObject -from typing import ClassVar, Optional +from stripe.v2._amount import Amount +from typing import ClassVar, Dict, Optional from typing_extensions import Literal @@ -14,16 +15,6 @@ class SettlementAllocationIntentSplit(StripeObject): Literal["v2.payments.settlement_allocation_intent_split"] ] = "v2.payments.settlement_allocation_intent_split" - class Amount(StripeObject): - 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). - """ - value: int - """ - A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). - """ - class Flow(StripeObject): outbound_payment: Optional[str] """ @@ -68,13 +59,17 @@ class Flow(StripeObject): """ 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]] + """ + Metadata associated with the SettlementAllocationIntentSplit. + """ object: Literal["v2.payments.settlement_allocation_intent_split"] """ String representing the object's type. Objects of the same type share the same value of the object field. """ settlement_allocation_intent: str """ - The ID of the SettlementAllocationIntent that this split belongs too. + The ID of the SettlementAllocationIntent that this split belongs to. """ status: Literal["canceled", "pending", "settled"] """ @@ -84,4 +79,4 @@ class Flow(StripeObject): """ The type of the SettlementAllocationIntentSplit. """ - _inner_class_types = {"amount": Amount, "flow": Flow} + _inner_class_types = {"flow": Flow} diff --git a/stripe/v2/reporting/_report_run.py b/stripe/v2/reporting/_report_run.py index 9a604d9c0..e7945fdf2 100644 --- a/stripe/v2/reporting/_report_run.py +++ b/stripe/v2/reporting/_report_run.py @@ -41,6 +41,7 @@ class DownloadUrl(StripeObject): The total size of the file in bytes. """ _inner_class_types = {"download_url": DownloadUrl} + _field_encodings = {"size": "int64_string"} file: File """ diff --git a/stripe/v2/tax/_manual_rule.py b/stripe/v2/tax/_manual_rule.py index 749455a9a..7ff62493a 100644 --- a/stripe/v2/tax/_manual_rule.py +++ b/stripe/v2/tax/_manual_rule.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec +from decimal import Decimal from stripe._stripe_object import StripeObject from typing import ClassVar, List, Optional from typing_extensions import Literal @@ -58,7 +59,7 @@ class Rate(StripeObject): """ Jurisdiction of the tax rate should apply as it will be shown on the invoice. """ - percentage: str + percentage: Decimal """ Percentage of the tax rate. Must be positive and maximum of 4 decimal points. """ @@ -66,6 +67,7 @@ class Rate(StripeObject): """ State of the tax rate. """ + _field_encodings = {"percentage": "decimal_string"} rates: List[Rate] """ diff --git a/tests/test_decimal_string.py b/tests/test_decimal_string.py new file mode 100644 index 000000000..8a750a905 --- /dev/null +++ b/tests/test_decimal_string.py @@ -0,0 +1,264 @@ +""" +Tests for V2 decimal_string field encoding and decoding. + +V2 API decimal fields are encoded as strings on the wire but exposed as +native Python Decimal values. These tests verify both directions: +- Request serialization: Decimal/int/float → JSON string +- Response hydration: JSON string → Decimal +""" + +from decimal import Decimal + +from stripe._encode import _coerce_decimal_string, _coerce_v2_params +from stripe._stripe_object import StripeObject + + +class TestCoerceDecimalString: + """Tests for the shared bidirectional coercion helper.""" + + def test_encode_decimal_to_str(self): + assert _coerce_decimal_string(Decimal("1.5"), encode=True) == "1.5" + + def test_encode_int_to_str(self): + assert _coerce_decimal_string(100, encode=True) == "100" + + def test_encode_float_to_str(self): + assert _coerce_decimal_string(1.5, encode=True) == "1.5" + + def test_decode_str_to_decimal(self): + result = _coerce_decimal_string("1.5", encode=False) + assert result == Decimal("1.5") + assert isinstance(result, Decimal) + + def test_encode_list(self): + result = _coerce_decimal_string( + [Decimal("1.1"), Decimal("2.2"), Decimal("3.3")], encode=True + ) + assert result == ["1.1", "2.2", "3.3"] + + def test_decode_list(self): + result = _coerce_decimal_string(["1.1", "2.2", "3.3"], encode=False) + assert result == [Decimal("1.1"), Decimal("2.2"), Decimal("3.3")] + assert all(isinstance(v, Decimal) for v in result) + + def test_none_passthrough(self): + assert _coerce_decimal_string(None, encode=True) is None + assert _coerce_decimal_string(None, encode=False) is None + + def test_bool_not_coerced_encode(self): + """Booleans must not be coerced (bool is subclass of int).""" + assert _coerce_decimal_string(True, encode=True) is True + assert _coerce_decimal_string(False, encode=True) is False + + def test_already_str_passthrough_encode(self): + """A string value passes through on encode (already serialized).""" + assert _coerce_decimal_string("1.5", encode=True) == "1.5" + + def test_non_str_passthrough_decode(self): + """Non-string values pass through on decode.""" + assert _coerce_decimal_string(42, encode=False) == 42 + + +class TestDecimalStringPrecision: + """Precision is preserved through the encode/decode round-trip.""" + + def test_high_precision_encode(self): + value = Decimal("1.23456789012345678901234567890") + result = _coerce_decimal_string(value, encode=True) + assert result == "1.23456789012345678901234567890" + + def test_high_precision_decode(self): + result = _coerce_decimal_string( + "1.23456789012345678901234567890", encode=False + ) + assert result == Decimal("1.23456789012345678901234567890") + + def test_round_trip_preserves_precision(self): + original = Decimal("9999999999999999.9999999999999999") + encoded = _coerce_decimal_string(original, encode=True) + decoded = _coerce_decimal_string(encoded, encode=False) + assert decoded == original + + def test_zero(self): + assert _coerce_decimal_string(Decimal("0"), encode=True) == "0" + assert _coerce_decimal_string("0", encode=False) == Decimal("0") + + def test_negative(self): + assert _coerce_decimal_string(Decimal("-1.5"), encode=True) == "-1.5" + assert _coerce_decimal_string("-1.5", encode=False) == Decimal("-1.5") + + +class TestCoerceV2ParamsDecimalString: + """Tests for outbound request coercion (Decimal → str).""" + + def test_top_level_decimal_string(self): + params = {"price": Decimal("9.99")} + schema = {"price": "decimal_string"} + result = _coerce_v2_params(params, schema) + assert result == {"price": "9.99"} + + def test_nested_decimal_string(self): + params = {"item": {"price": Decimal("1.50")}} + schema = {"item": {"price": "decimal_string"}} + result = _coerce_v2_params(params, schema) + assert result == {"item": {"price": "1.50"}} + + def test_array_of_decimal_string(self): + params = {"prices": [Decimal("1.0"), Decimal("2.0"), Decimal("3.0")]} + schema = {"prices": "decimal_string"} + result = _coerce_v2_params(params, schema) + assert result == {"prices": ["1.0", "2.0", "3.0"]} + + def test_array_of_objects_with_decimal_string(self): + params = { + "items": [{"price": Decimal("1.00")}, {"price": Decimal("2.00")}] + } + schema = {"items": {"price": "decimal_string"}} + result = _coerce_v2_params(params, schema) + assert result == {"items": [{"price": "1.00"}, {"price": "2.00"}]} + + def test_unrelated_fields_unchanged(self): + params = {"name": "test", "count": 42, "price": Decimal("9.99")} + schema = {"price": "decimal_string"} + result = _coerce_v2_params(params, schema) + assert result == {"name": "test", "count": 42, "price": "9.99"} + + def test_none_params_returns_none(self): + schema = {"price": "decimal_string"} + result = _coerce_v2_params(None, schema) + assert result is None + + def test_none_value_preserved(self): + params = {"price": None} + schema = {"price": "decimal_string"} + result = _coerce_v2_params(params, schema) + assert result == {"price": None} + + def test_int_value_coerced(self): + """int values are also accepted as decimal_string inputs.""" + params = {"price": 10} + schema = {"price": "decimal_string"} + result = _coerce_v2_params(params, schema) + assert result == {"price": "10"} + + def test_mixed_decimal_and_int64(self): + params = {"price": Decimal("9.99"), "quantity": 5} + schema = {"price": "decimal_string", "quantity": "int64_string"} + result = _coerce_v2_params(params, schema) + assert result == {"price": "9.99", "quantity": "5"} + + +class TestResponseFieldCoercion: + """Tests for inbound response coercion (str → Decimal) via _field_encodings.""" + + def _make_v2_class(self, field_encodings): + """Create a StripeObject subclass with given field encodings.""" + + class V2Resource(StripeObject): + _field_encodings = field_encodings + + return V2Resource + + def test_top_level_decimal_string_response(self): + cls = self._make_v2_class({"price": "decimal_string"}) + obj = cls.construct_from( + {"id": "test", "price": "9.99"}, + key="sk_test", + api_mode="V2", + ) + assert obj["price"] == Decimal("9.99") + assert isinstance(obj["price"], Decimal) + + def test_array_of_decimal_string_response(self): + cls = self._make_v2_class({"prices": "decimal_string"}) + obj = cls.construct_from( + {"id": "test", "prices": ["1.0", "2.0", "3.0"]}, + key="sk_test", + api_mode="V2", + ) + assert obj["prices"] == [ + Decimal("1.0"), + Decimal("2.0"), + Decimal("3.0"), + ] + assert all(isinstance(v, Decimal) for v in obj["prices"]) + + def test_unrelated_fields_unchanged_response(self): + cls = self._make_v2_class({"price": "decimal_string"}) + obj = cls.construct_from( + {"id": "test", "name": "hello", "price": "9.99"}, + key="sk_test", + api_mode="V2", + ) + assert obj["name"] == "hello" + assert isinstance(obj["name"], str) + assert obj["price"] == Decimal("9.99") + + def test_none_value_preserved_response(self): + cls = self._make_v2_class({"price": "decimal_string"}) + obj = cls.construct_from( + {"id": "test", "price": None}, + key="sk_test", + api_mode="V2", + ) + assert obj["price"] is None + + def test_no_field_encodings_unchanged(self): + """StripeObject without _field_encodings leaves strings as strings.""" + obj = StripeObject.construct_from( + {"id": "test", "price": "9.99"}, + key="sk_test", + api_mode="V2", + ) + assert obj["price"] == "9.99" + assert isinstance(obj["price"], str) + + def test_high_precision_response(self): + cls = self._make_v2_class({"rate": "decimal_string"}) + obj = cls.construct_from( + {"id": "test", "rate": "0.00123456789012345678"}, + key="sk_test", + api_mode="V2", + ) + assert obj["rate"] == Decimal("0.00123456789012345678") + + def test_negative_response(self): + cls = self._make_v2_class({"balance": "decimal_string"}) + obj = cls.construct_from( + {"id": "test", "balance": "-100.50"}, + key="sk_test", + api_mode="V2", + ) + assert obj["balance"] == Decimal("-100.50") + + +class TestV1Unchanged: + """Regression tests: V1 behavior should not be affected.""" + + def test_v1_integer_fields_stay_integers(self): + """V1 objects don't have decimal _field_encodings, so ints stay ints.""" + obj = StripeObject.construct_from( + {"id": "test", "amount": 100}, + key="sk_test", + api_mode="V1", + ) + assert obj["amount"] == 100 + assert isinstance(obj["amount"], int) + + def test_v1_string_fields_stay_strings(self): + obj = StripeObject.construct_from( + {"id": "test", "name": "hello"}, + key="sk_test", + api_mode="V1", + ) + assert obj["name"] == "hello" + assert isinstance(obj["name"], str) + + def test_object_without_field_encodings_unchanged(self): + """Objects without decimal _field_encodings are unaffected.""" + obj = StripeObject.construct_from( + {"id": "test", "price": "9.99", "count": 42}, + key="sk_test", + ) + assert obj["price"] == "9.99" + assert obj["count"] == 42 diff --git a/tests/test_generated_examples.py b/tests/test_generated_examples.py index 59a9de500..3600da4cc 100644 --- a/tests/test_generated_examples.py +++ b/tests/test_generated_examples.py @@ -4,6 +4,7 @@ import stripe from tests.http_client_mock import HTTPClientMock +from decimal import Decimal import io from stripe import StripeClient, _error import pytest @@ -34060,14 +34061,14 @@ def test_test_helpers_issuing_authorizations_capture_post_service_non_namespaced "fuel": { "type": "diesel", "unit": "liter", - "unit_cost_decimal": "3.5", - "quantity_decimal": "10", + "unit_cost_decimal": Decimal("3.5"), + "quantity_decimal": Decimal("10"), }, "lodging": {"check_in_at": 1633651200, "nights": 2}, "receipt": [ { "description": "Room charge", - "quantity": "1", + "quantity": Decimal("1"), "total": 200, "unit_cost": 200, }, @@ -34111,14 +34112,14 @@ def test_test_helpers_issuing_authorizations_capture_post( "fuel": { "type": "diesel", "unit": "liter", - "unit_cost_decimal": "3.5", - "quantity_decimal": "10", + "unit_cost_decimal": Decimal("3.5"), + "quantity_decimal": Decimal("10"), }, "lodging": {"check_in_at": 1633651200, "nights": 2}, "receipt": [ { "description": "Room charge", - "quantity": "1", + "quantity": Decimal("1"), "total": 200, "unit_cost": 200, }, @@ -34170,14 +34171,14 @@ def test_test_helpers_issuing_authorizations_capture_post_service( "fuel": { "type": "diesel", "unit": "liter", - "unit_cost_decimal": "3.5", - "quantity_decimal": "10", + "unit_cost_decimal": Decimal("3.5"), + "quantity_decimal": Decimal("10"), }, "lodging": {"check_in_at": 1633651200, "nights": 2}, "receipt": [ { "description": "Room charge", - "quantity": "1", + "quantity": Decimal("1"), "total": 200, "unit_cost": 200, }, @@ -34222,14 +34223,14 @@ async def test_test_helpers_issuing_authorizations_capture_post_async( "fuel": { "type": "diesel", "unit": "liter", - "unit_cost_decimal": "3.5", - "quantity_decimal": "10", + "unit_cost_decimal": Decimal("3.5"), + "quantity_decimal": Decimal("10"), }, "lodging": {"check_in_at": 1633651200, "nights": 2}, "receipt": [ { "description": "Room charge", - "quantity": "1", + "quantity": Decimal("1"), "total": 200, "unit_cost": 200, }, @@ -34282,14 +34283,14 @@ async def test_test_helpers_issuing_authorizations_capture_post_service_async( "fuel": { "type": "diesel", "unit": "liter", - "unit_cost_decimal": "3.5", - "quantity_decimal": "10", + "unit_cost_decimal": Decimal("3.5"), + "quantity_decimal": Decimal("10"), }, "lodging": {"check_in_at": 1633651200, "nights": 2}, "receipt": [ { "description": "Room charge", - "quantity": "1", + "quantity": Decimal("1"), "total": 200, "unit_cost": 200, }, @@ -35483,14 +35484,14 @@ def test_test_helpers_issuing_transactions_create_force_capture_post_service_non "fuel": { "type": "diesel", "unit": "liter", - "unit_cost_decimal": "3.5", - "quantity_decimal": "10", + "unit_cost_decimal": Decimal("3.5"), + "quantity_decimal": Decimal("10"), }, "lodging": {"check_in_at": 1533651200, "nights": 2}, "receipt": [ { "description": "Room charge", - "quantity": "1", + "quantity": Decimal("1"), "total": 200, "unit_cost": 200, }, @@ -35544,14 +35545,14 @@ def test_test_helpers_issuing_transactions_create_force_capture_post( "fuel": { "type": "diesel", "unit": "liter", - "unit_cost_decimal": "3.5", - "quantity_decimal": "10", + "unit_cost_decimal": Decimal("3.5"), + "quantity_decimal": Decimal("10"), }, "lodging": {"check_in_at": 1533651200, "nights": 2}, "receipt": [ { "description": "Room charge", - "quantity": "1", + "quantity": Decimal("1"), "total": 200, "unit_cost": 200, }, @@ -35613,14 +35614,14 @@ def test_test_helpers_issuing_transactions_create_force_capture_post_service( "fuel": { "type": "diesel", "unit": "liter", - "unit_cost_decimal": "3.5", - "quantity_decimal": "10", + "unit_cost_decimal": Decimal("3.5"), + "quantity_decimal": Decimal("10"), }, "lodging": {"check_in_at": 1533651200, "nights": 2}, "receipt": [ { "description": "Room charge", - "quantity": "1", + "quantity": Decimal("1"), "total": 200, "unit_cost": 200, }, @@ -35676,14 +35677,14 @@ async def test_test_helpers_issuing_transactions_create_force_capture_post_async "fuel": { "type": "diesel", "unit": "liter", - "unit_cost_decimal": "3.5", - "quantity_decimal": "10", + "unit_cost_decimal": Decimal("3.5"), + "quantity_decimal": Decimal("10"), }, "lodging": {"check_in_at": 1533651200, "nights": 2}, "receipt": [ { "description": "Room charge", - "quantity": "1", + "quantity": Decimal("1"), "total": 200, "unit_cost": 200, }, @@ -35747,14 +35748,14 @@ async def test_test_helpers_issuing_transactions_create_force_capture_post_servi "fuel": { "type": "diesel", "unit": "liter", - "unit_cost_decimal": "3.5", - "quantity_decimal": "10", + "unit_cost_decimal": Decimal("3.5"), + "quantity_decimal": Decimal("10"), }, "lodging": {"check_in_at": 1533651200, "nights": 2}, "receipt": [ { "description": "Room charge", - "quantity": "1", + "quantity": Decimal("1"), "total": 200, "unit_cost": 200, }, @@ -35818,14 +35819,14 @@ def test_test_helpers_issuing_transactions_create_unlinked_refund_post_service_n "fuel": { "type": "diesel", "unit": "liter", - "unit_cost_decimal": "3.5", - "quantity_decimal": "10", + "unit_cost_decimal": Decimal("3.5"), + "quantity_decimal": Decimal("10"), }, "lodging": {"check_in_at": 1533651200, "nights": 2}, "receipt": [ { "description": "Room charge", - "quantity": "1", + "quantity": Decimal("1"), "total": 200, "unit_cost": 200, }, @@ -35879,14 +35880,14 @@ def test_test_helpers_issuing_transactions_create_unlinked_refund_post( "fuel": { "type": "diesel", "unit": "liter", - "unit_cost_decimal": "3.5", - "quantity_decimal": "10", + "unit_cost_decimal": Decimal("3.5"), + "quantity_decimal": Decimal("10"), }, "lodging": {"check_in_at": 1533651200, "nights": 2}, "receipt": [ { "description": "Room charge", - "quantity": "1", + "quantity": Decimal("1"), "total": 200, "unit_cost": 200, }, @@ -35948,14 +35949,14 @@ def test_test_helpers_issuing_transactions_create_unlinked_refund_post_service( "fuel": { "type": "diesel", "unit": "liter", - "unit_cost_decimal": "3.5", - "quantity_decimal": "10", + "unit_cost_decimal": Decimal("3.5"), + "quantity_decimal": Decimal("10"), }, "lodging": {"check_in_at": 1533651200, "nights": 2}, "receipt": [ { "description": "Room charge", - "quantity": "1", + "quantity": Decimal("1"), "total": 200, "unit_cost": 200, }, @@ -36010,14 +36011,14 @@ async def test_test_helpers_issuing_transactions_create_unlinked_refund_post_asy "fuel": { "type": "diesel", "unit": "liter", - "unit_cost_decimal": "3.5", - "quantity_decimal": "10", + "unit_cost_decimal": Decimal("3.5"), + "quantity_decimal": Decimal("10"), }, "lodging": {"check_in_at": 1533651200, "nights": 2}, "receipt": [ { "description": "Room charge", - "quantity": "1", + "quantity": Decimal("1"), "total": 200, "unit_cost": 200, }, @@ -36080,14 +36081,14 @@ async def test_test_helpers_issuing_transactions_create_unlinked_refund_post_ser "fuel": { "type": "diesel", "unit": "liter", - "unit_cost_decimal": "3.5", - "quantity_decimal": "10", + "unit_cost_decimal": Decimal("3.5"), + "quantity_decimal": Decimal("10"), }, "lodging": {"check_in_at": 1533651200, "nights": 2}, "receipt": [ { "description": "Room charge", - "quantity": "1", + "quantity": Decimal("1"), "total": 200, "unit_cost": 200, }, @@ -44038,9 +44039,15 @@ def test_v2_billing_intent_post_service( "type": "apply", "apply": { "effective_at": { - "type": "current_billing_period_end" + "timestamp": "1970-01-01T15:18:46.294Z", + "type": "current_billing_period_end", + }, + "type": "discount", + "discount": { + "coupon": "coupon", + "promotion_code": "promotion_code", + "type": "coupon", }, - "type": "invoice_discount_rule", "invoice_discount_rule": { "applies_to": "cadence", "type": "percent_off", @@ -44048,7 +44055,9 @@ def test_v2_billing_intent_post_service( "maximum_applications": { "type": "indefinite" }, - "percent_off": "percent_off", + "percent_off": Decimal( + "991934883.3333334" + ), }, }, "spend_modifier_rule": { @@ -44182,7 +44191,7 @@ def test_v2_billing_intent_post_service( path="/v2/billing/intents", query_string="", api_base="https://api.stripe.com", - post_data='{"actions":[{"type":"apply","apply":{"effective_at":{"type":"current_billing_period_end"},"type":"invoice_discount_rule","invoice_discount_rule":{"applies_to":"cadence","type":"percent_off","percent_off":{"maximum_applications":{"type":"indefinite"},"percent_off":"percent_off"}},"spend_modifier_rule":{"applies_to":"cadence","type":"max_billing_period_spend","max_billing_period_spend":{"amount":{"type":"custom_pricing_unit","custom_pricing_unit":{"value":"value"}},"custom_pricing_unit_overage_rate":{"id":"obj_123"}}}},"deactivate":{"cancellation_details":{"comment":"comment","feedback":"other"},"collect_at":"next_billing_date","effective_at":{"timestamp":"1970-01-01T15:18:46.294Z","type":"on_reserve"},"pricing_plan_subscription_details":{"overrides":{"partial_period_behaviors":[{"type":"license_fee","license_fee":{"credit_proration_behavior":"prorated"}}]},"pricing_plan_subscription":"pricing_plan_subscription"},"type":"pricing_plan_subscription_details"},"modify":{"collect_at":"next_billing_date","effective_at":{"timestamp":"1970-01-01T15:18:46.294Z","type":"current_billing_period_start"},"pricing_plan_subscription_details":{"component_configurations":[{"quantity":1285004149,"lookup_key":"lookup_key","pricing_plan_component":"pricing_plan_component"}],"new_pricing_plan":"new_pricing_plan","new_pricing_plan_version":"new_pricing_plan_version","overrides":{"partial_period_behaviors":[{"type":"license_fee","license_fee":{"credit_proration_behavior":"prorated","debit_proration_behavior":"none"}}]},"pricing_plan_subscription":"pricing_plan_subscription"},"type":"pricing_plan_subscription_details"},"remove":{"effective_at":{"type":"current_billing_period_end"},"type":"invoice_discount_rule","invoice_discount_rule":"invoice_discount_rule","spend_modifier_rule":"spend_modifier_rule"},"subscribe":{"collect_at":"next_billing_date","effective_at":{"timestamp":"1970-01-01T15:18:46.294Z","type":"current_billing_period_start"},"type":"pricing_plan_subscription_details","pricing_plan_subscription_details":{"component_configurations":[{"quantity":1285004149,"lookup_key":"lookup_key","pricing_plan_component":"pricing_plan_component"}],"metadata":{"key":"metadata"},"overrides":{"partial_period_behaviors":[{"type":"license_fee","license_fee":{"debit_proration_behavior":"none"}}]},"pricing_plan":"pricing_plan","pricing_plan_version":"pricing_plan_version"},"v1_subscription_details":{"description":"description","items":[{"metadata":{"key":"metadata"},"price":"price","quantity":1285004149}],"metadata":{"key":"metadata"}}}}],"currency":"usd"}', + post_data='{"actions":[{"type":"apply","apply":{"effective_at":{"timestamp":"1970-01-01T15:18:46.294Z","type":"current_billing_period_end"},"type":"discount","discount":{"coupon":"coupon","promotion_code":"promotion_code","type":"coupon"},"invoice_discount_rule":{"applies_to":"cadence","type":"percent_off","percent_off":{"maximum_applications":{"type":"indefinite"},"percent_off":"991934883.3333334"}},"spend_modifier_rule":{"applies_to":"cadence","type":"max_billing_period_spend","max_billing_period_spend":{"amount":{"type":"custom_pricing_unit","custom_pricing_unit":{"value":"value"}},"custom_pricing_unit_overage_rate":{"id":"obj_123"}}}},"deactivate":{"cancellation_details":{"comment":"comment","feedback":"other"},"collect_at":"next_billing_date","effective_at":{"timestamp":"1970-01-01T15:18:46.294Z","type":"on_reserve"},"pricing_plan_subscription_details":{"overrides":{"partial_period_behaviors":[{"type":"license_fee","license_fee":{"credit_proration_behavior":"prorated"}}]},"pricing_plan_subscription":"pricing_plan_subscription"},"type":"pricing_plan_subscription_details"},"modify":{"collect_at":"next_billing_date","effective_at":{"timestamp":"1970-01-01T15:18:46.294Z","type":"current_billing_period_start"},"pricing_plan_subscription_details":{"component_configurations":[{"quantity":1285004149,"lookup_key":"lookup_key","pricing_plan_component":"pricing_plan_component"}],"new_pricing_plan":"new_pricing_plan","new_pricing_plan_version":"new_pricing_plan_version","overrides":{"partial_period_behaviors":[{"type":"license_fee","license_fee":{"credit_proration_behavior":"prorated","debit_proration_behavior":"none"}}]},"pricing_plan_subscription":"pricing_plan_subscription"},"type":"pricing_plan_subscription_details"},"remove":{"effective_at":{"type":"current_billing_period_end"},"type":"invoice_discount_rule","invoice_discount_rule":"invoice_discount_rule","spend_modifier_rule":"spend_modifier_rule"},"subscribe":{"collect_at":"next_billing_date","effective_at":{"timestamp":"1970-01-01T15:18:46.294Z","type":"current_billing_period_start"},"type":"pricing_plan_subscription_details","pricing_plan_subscription_details":{"component_configurations":[{"quantity":1285004149,"lookup_key":"lookup_key","pricing_plan_component":"pricing_plan_component"}],"metadata":{"key":"metadata"},"overrides":{"partial_period_behaviors":[{"type":"license_fee","license_fee":{"debit_proration_behavior":"none"}}]},"pricing_plan":"pricing_plan","pricing_plan_version":"pricing_plan_version"},"v1_subscription_details":{"description":"description","items":[{"metadata":{"key":"metadata"},"price":"price","quantity":1285004149}],"metadata":{"key":"metadata"}}}}],"currency":"usd"}', is_json=True, ) @@ -44474,26 +44483,6 @@ def test_v2_billing_license_fees_version_get_2_service( api_base="https://api.stripe.com", ) - def test_v2_billing_license_fee_subscription_get_service( - self, http_client_mock: HTTPClientMock - ) -> None: - http_client_mock.stub_request( - "get", - "/v2/billing/license_fee_subscriptions/id_123", - ) - client = StripeClient( - "sk_test_123", - http_client=http_client_mock.get_mock_http_client(), - ) - - client.v2.billing.license_fee_subscriptions.retrieve("id_123") - http_client_mock.assert_requested( - "get", - path="/v2/billing/license_fee_subscriptions/id_123", - query_string="", - api_base="https://api.stripe.com", - ) - def test_v2_billing_licensed_item_get_service( self, http_client_mock: HTTPClientMock ) -> None: @@ -45180,26 +45169,26 @@ def test_v2_billing_pricing_plan_subscription_post_service( is_json=True, ) - def test_v2_billing_pricing_plan_subscriptions_component_get_service( + def test_v2_billing_pricing_plan_subscription_post_2_service( self, http_client_mock: HTTPClientMock ) -> None: http_client_mock.stub_request( - "get", - "/v2/billing/pricing_plan_subscriptions/id_123/components", + "post", + "/v2/billing/pricing_plan_subscriptions/id_123/remove_discounts", ) client = StripeClient( "sk_test_123", http_client=http_client_mock.get_mock_http_client(), ) - client.v2.billing.pricing_plan_subscriptions.components.retrieve( - "id_123", - ) + client.v2.billing.pricing_plan_subscriptions.remove_discounts("id_123") http_client_mock.assert_requested( - "get", - path="/v2/billing/pricing_plan_subscriptions/id_123/components", + "post", + path="/v2/billing/pricing_plan_subscriptions/id_123/remove_discounts", query_string="", api_base="https://api.stripe.com", + post_data="{}", + is_json=True, ) def test_v2_billing_profile_get_service( @@ -45379,6 +45368,62 @@ def test_v2_billing_rate_card_post_2_service( is_json=True, ) + def test_v2_billing_rate_card_post_3_service( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v2/billing/rate_cards/id_123/modify_rates", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.v2.billing.rate_cards.modify_rates( + "id_123", + { + "rates_to_create": [ + { + "metadata": {"key": "metadata"}, + "metered_item": "metered_item", + "metered_item_data": { + "display_name": "display_name", + "lookup_key": "lookup_key", + "meter": "meter", + "meter_segment_conditions": [ + {"dimension": "dimension", "value": "value"}, + ], + "unit_label": "unit_label", + }, + "tiering_mode": "graduated", + "tiers": [ + { + "flat_amount": "flat_amount", + "unit_amount": "unit_amount", + "up_to_decimal": Decimal("1387931359.3333333"), + "up_to_inf": "inf", + }, + ], + "transform_quantity": { + "divide_by": 1592560163, + "round": "down", + }, + "unit_amount": "unit_amount", + }, + ], + "rates_to_delete": [{"id": "obj_123"}], + }, + ) + http_client_mock.assert_requested( + "post", + path="/v2/billing/rate_cards/id_123/modify_rates", + query_string="", + api_base="https://api.stripe.com", + post_data='{"rates_to_create":[{"metadata":{"key":"metadata"},"metered_item":"metered_item","metered_item_data":{"display_name":"display_name","lookup_key":"lookup_key","meter":"meter","meter_segment_conditions":[{"dimension":"dimension","value":"value"}],"unit_label":"unit_label"},"tiering_mode":"graduated","tiers":[{"flat_amount":"flat_amount","unit_amount":"unit_amount","up_to_decimal":"1387931359.3333333","up_to_inf":"inf"}],"transform_quantity":{"divide_by":"1592560163","round":"down"},"unit_amount":"unit_amount"}],"rates_to_delete":[{"id":"obj_123"}]}', + is_json=True, + ) + def test_v2_billing_rate_cards_custom_pricing_unit_overage_rate_get_service( self, http_client_mock: HTTPClientMock ) -> None: @@ -46055,6 +46100,32 @@ def test_v2_core_accounts_person_token_get_service( api_base="https://api.stripe.com", ) + def test_v2_core_account_evaluation_post_service( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v2/core/account_evaluations", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.v2.core.account_evaluations.create( + { + "signals": ["fraudulent_website"], + } + ) + http_client_mock.assert_requested( + "post", + path="/v2/core/account_evaluations", + query_string="", + api_base="https://api.stripe.com", + post_data='{"signals":["fraudulent_website"]}', + is_json=True, + ) + def test_v2_core_account_link_post_service( self, http_client_mock: HTTPClientMock ) -> None: @@ -46162,6 +46233,79 @@ def test_v2_core_account_token_get_service( api_base="https://api.stripe.com", ) + def test_v2_core_batch_job_post_service( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v2/core/batch_jobs", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.v2.core.batch_jobs.create( + { + "endpoint": { + "http_method": "post", + "path": "/v1/subscription_schedules", + }, + "metadata": {"key": "metadata"}, + "skip_validation": True, + } + ) + http_client_mock.assert_requested( + "post", + path="/v2/core/batch_jobs", + query_string="", + api_base="https://api.stripe.com", + post_data='{"endpoint":{"http_method":"post","path":"/v1/subscription_schedules"},"metadata":{"key":"metadata"},"skip_validation":true}', + is_json=True, + ) + + def test_v2_core_batch_job_get_service( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v2/core/batch_jobs/id_123", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.v2.core.batch_jobs.retrieve("id_123") + http_client_mock.assert_requested( + "get", + path="/v2/core/batch_jobs/id_123", + query_string="", + api_base="https://api.stripe.com", + ) + + def test_v2_core_batch_job_post_2_service( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v2/core/batch_jobs/id_123/cancel", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.v2.core.batch_jobs.cancel("id_123") + http_client_mock.assert_requested( + "post", + path="/v2/core/batch_jobs/id_123/cancel", + query_string="", + api_base="https://api.stripe.com", + post_data="{}", + is_json=True, + ) + def test_v2_core_claimable_sandbox_post_service( self, http_client_mock: HTTPClientMock ) -> None: @@ -46504,18 +46648,13 @@ def test_v2_core_vault_gb_bank_account_post_service( http_client=http_client_mock.get_mock_http_client(), ) - client.v2.core.vault.gb_bank_accounts.create( - { - "account_number": "account_number", - "sort_code": "sort_code", - } - ) + client.v2.core.vault.gb_bank_accounts.create({"currency": "usd"}) http_client_mock.assert_requested( "post", path="/v2/core/vault/gb_bank_accounts", query_string="", api_base="https://api.stripe.com", - post_data='{"account_number":"account_number","sort_code":"sort_code"}', + post_data='{"currency":"usd"}', is_json=True, ) @@ -46644,6 +46783,7 @@ def test_v2_core_vault_us_bank_account_post_service( client.v2.core.vault.us_bank_accounts.create( { "account_number": "account_number", + "currency": "usd", } ) http_client_mock.assert_requested( @@ -46651,7 +46791,7 @@ def test_v2_core_vault_us_bank_account_post_service( path="/v2/core/vault/us_bank_accounts", query_string="", api_base="https://api.stripe.com", - post_data='{"account_number":"account_number"}', + post_data='{"account_number":"account_number","currency":"usd"}', is_json=True, ) @@ -46967,11 +47107,11 @@ def test_v2_money_management_currency_conversion_post_service( { "financial_account": "financial_account", "from": { - "amount": {"value": 111972721, "currency": "usd"}, + "amount": {"currency": "USD", "value": 96}, "currency": "usd", }, "to": { - "amount": {"value": 111972721, "currency": "usd"}, + "amount": {"currency": "USD", "value": 96}, "currency": "usd", }, } @@ -46981,7 +47121,7 @@ def test_v2_money_management_currency_conversion_post_service( path="/v2/money_management/currency_conversions", query_string="", api_base="https://api.stripe.com", - post_data='{"financial_account":"financial_account","from":{"amount":{"value":111972721,"currency":"usd"},"currency":"usd"},"to":{"amount":{"value":111972721,"currency":"usd"},"currency":"usd"}}', + post_data='{"financial_account":"financial_account","from":{"amount":{"currency":"USD","value":96},"currency":"usd"},"to":{"amount":{"currency":"USD","value":96},"currency":"usd"}}', is_json=True, ) @@ -47216,7 +47356,7 @@ def test_v2_money_management_inbound_transfer_post_service( client.v2.money_management.inbound_transfers.create( { - "amount": {"value": 111972721, "currency": "usd"}, + "amount": {"currency": "USD", "value": 96}, "from": { "currency": "usd", "payment_method": "payment_method", @@ -47232,7 +47372,7 @@ def test_v2_money_management_inbound_transfer_post_service( path="/v2/money_management/inbound_transfers", query_string="", api_base="https://api.stripe.com", - post_data='{"amount":{"value":111972721,"currency":"usd"},"from":{"currency":"usd","payment_method":"payment_method"},"to":{"currency":"usd","financial_account":"financial_account"}}', + post_data='{"amount":{"currency":"USD","value":96},"from":{"currency":"usd","payment_method":"payment_method"},"to":{"currency":"usd","financial_account":"financial_account"}}', is_json=True, ) @@ -47290,7 +47430,7 @@ def test_v2_money_management_outbound_payment_post_service( client.v2.money_management.outbound_payments.create( { - "amount": {"value": 111972721, "currency": "usd"}, + "amount": {"currency": "USD", "value": 96}, "from": { "currency": "usd", "financial_account": "financial_account", @@ -47307,7 +47447,7 @@ def test_v2_money_management_outbound_payment_post_service( path="/v2/money_management/outbound_payments", query_string="", api_base="https://api.stripe.com", - post_data='{"amount":{"value":111972721,"currency":"usd"},"from":{"currency":"usd","financial_account":"financial_account"},"to":{"currency":"usd","payout_method":"payout_method","recipient":"recipient"}}', + post_data='{"amount":{"currency":"USD","value":96},"from":{"currency":"usd","financial_account":"financial_account"},"to":{"currency":"usd","payout_method":"payout_method","recipient":"recipient"}}', is_json=True, ) @@ -47367,7 +47507,7 @@ def test_v2_money_management_outbound_payment_quote_post_service( client.v2.money_management.outbound_payment_quotes.create( { - "amount": {"value": 111972721, "currency": "usd"}, + "amount": {"currency": "USD", "value": 96}, "from": { "currency": "usd", "financial_account": "financial_account", @@ -47384,7 +47524,7 @@ def test_v2_money_management_outbound_payment_quote_post_service( path="/v2/money_management/outbound_payment_quotes", query_string="", api_base="https://api.stripe.com", - post_data='{"amount":{"value":111972721,"currency":"usd"},"from":{"currency":"usd","financial_account":"financial_account"},"to":{"currency":"usd","payout_method":"payout_method","recipient":"recipient"}}', + post_data='{"amount":{"currency":"USD","value":96},"from":{"currency":"usd","financial_account":"financial_account"},"to":{"currency":"usd","payout_method":"payout_method","recipient":"recipient"}}', is_json=True, ) @@ -47548,7 +47688,7 @@ def test_v2_money_management_outbound_transfer_post_service( client.v2.money_management.outbound_transfers.create( { - "amount": {"value": 111972721, "currency": "usd"}, + "amount": {"currency": "USD", "value": 96}, "from": { "currency": "usd", "financial_account": "financial_account", @@ -47561,7 +47701,7 @@ def test_v2_money_management_outbound_transfer_post_service( path="/v2/money_management/outbound_transfers", query_string="", api_base="https://api.stripe.com", - post_data='{"amount":{"value":111972721,"currency":"usd"},"from":{"currency":"usd","financial_account":"financial_account"},"to":{"currency":"usd","payout_method":"payout_method"}}', + post_data='{"amount":{"currency":"USD","value":96},"from":{"currency":"usd","financial_account":"financial_account"},"to":{"currency":"usd","payout_method":"payout_method"}}', is_json=True, ) @@ -47975,7 +48115,7 @@ def test_v2_payments_off_session_payment_post_service( client.v2.payments.off_session_payments.create( { - "amount": {"value": 111972721, "currency": "usd"}, + "amount": {"currency": "USD", "value": 96}, "cadence": "unscheduled", "customer": "customer", "metadata": {"key": "metadata"}, @@ -47986,7 +48126,7 @@ def test_v2_payments_off_session_payment_post_service( path="/v2/payments/off_session_payments", query_string="", api_base="https://api.stripe.com", - post_data='{"amount":{"value":111972721,"currency":"usd"},"cadence":"unscheduled","customer":"customer","metadata":{"key":"metadata"}}', + post_data='{"amount":{"currency":"USD","value":96},"cadence":"unscheduled","customer":"customer","metadata":{"key":"metadata"}}', is_json=True, ) @@ -48091,7 +48231,7 @@ def test_v2_payments_settlement_allocation_intent_post_service( client.v2.payments.settlement_allocation_intents.create( { - "amount": {"value": 111972721, "currency": "usd"}, + "amount": {"currency": "USD", "value": 96}, "expected_settlement_date": "1970-01-22T14:14:13.629Z", "financial_account": "financial_account", "reference": "reference", @@ -48102,7 +48242,7 @@ def test_v2_payments_settlement_allocation_intent_post_service( path="/v2/payments/settlement_allocation_intents", query_string="", api_base="https://api.stripe.com", - post_data='{"amount":{"value":111972721,"currency":"usd"},"expected_settlement_date":"1970-01-22T14:14:13.629Z","financial_account":"financial_account","reference":"reference"}', + post_data='{"amount":{"currency":"USD","value":96},"expected_settlement_date":"1970-01-22T14:14:13.629Z","financial_account":"financial_account","reference":"reference"}', is_json=True, ) @@ -48230,7 +48370,7 @@ def test_v2_payments_settlement_allocation_intents_split_post_service( "settlement_allocation_intent_id_123", { "account": "account", - "amount": {"value": 111972721, "currency": "usd"}, + "amount": {"currency": "USD", "value": 96}, "type": "credit", }, ) @@ -48239,7 +48379,7 @@ def test_v2_payments_settlement_allocation_intents_split_post_service( path="/v2/payments/settlement_allocation_intents/settlement_allocation_intent_id_123/splits", query_string="", api_base="https://api.stripe.com", - post_data='{"account":"account","amount":{"value":111972721,"currency":"usd"},"type":"credit"}', + post_data='{"account":"account","amount":{"currency":"USD","value":96},"type":"credit"}', is_json=True, ) @@ -48410,7 +48550,7 @@ def test_v2_tax_manual_rule_post_service( "description": "description", "display_name": "display_name", "jurisdiction": "jurisdiction", - "percentage": "percentage", + "percentage": Decimal("614555204"), "state": "state", }, ], @@ -48424,7 +48564,7 @@ def test_v2_tax_manual_rule_post_service( path="/v2/tax/manual_rules", query_string="", api_base="https://api.stripe.com", - post_data='{"scheduled_tax_rates":[{"rates":[{"country":"country","description":"description","display_name":"display_name","jurisdiction":"jurisdiction","percentage":"percentage","state":"state"}],"starts_at":"1970-01-25T15:13:01.215Z"}]}', + post_data='{"scheduled_tax_rates":[{"rates":[{"country":"country","description":"description","display_name":"display_name","jurisdiction":"jurisdiction","percentage":"614555204","state":"state"}],"starts_at":"1970-01-25T15:13:01.215Z"}]}', is_json=True, ) @@ -48471,7 +48611,7 @@ def test_v2_tax_manual_rule_post_2_service( "description": "description", "display_name": "display_name", "jurisdiction": "jurisdiction", - "percentage": "percentage", + "percentage": Decimal("614555204"), "state": "state", }, ], @@ -48485,7 +48625,7 @@ def test_v2_tax_manual_rule_post_2_service( path="/v2/tax/manual_rules/id_123", query_string="", api_base="https://api.stripe.com", - post_data='{"scheduled_tax_rates":[{"rates":[{"country":"country","description":"description","display_name":"display_name","jurisdiction":"jurisdiction","percentage":"percentage","state":"state"}],"starts_at":"1970-01-25T15:13:01.215Z"}]}', + post_data='{"scheduled_tax_rates":[{"rates":[{"country":"country","description":"description","display_name":"display_name","jurisdiction":"jurisdiction","percentage":"614555204","state":"state"}],"starts_at":"1970-01-25T15:13:01.215Z"}]}', is_json=True, ) @@ -48525,17 +48665,14 @@ def test_v2_test_helpers_financial_address_post_service( client.v2.test_helpers.financial_addresses.credit( "id_123", - { - "amount": {"value": 111972721, "currency": "usd"}, - "network": "ach", - }, + {"amount": {"currency": "USD", "value": 96}, "network": "ach"}, ) http_client_mock.assert_requested( "post", path="/v2/test_helpers/financial_addresses/id_123/credit", query_string="", api_base="https://api.stripe.com", - post_data='{"amount":{"value":111972721,"currency":"usd"},"network":"ach"}', + post_data='{"amount":{"currency":"USD","value":96},"network":"ach"}', is_json=True, ) @@ -48666,6 +48803,7 @@ def test_blocked_by_stripe_error_service( client.v2.core.vault.us_bank_accounts.create( { "account_number": "account_number", + "currency": "usd", } ) except _error.BlockedByStripeError: @@ -48675,7 +48813,7 @@ def test_blocked_by_stripe_error_service( path="/v2/core/vault/us_bank_accounts", query_string="", api_base="https://api.stripe.com", - post_data='{"account_number":"account_number"}', + post_data='{"account_number":"account_number","currency":"usd"}', is_json=True, ) @@ -48815,7 +48953,7 @@ def test_insufficient_funds_error_service( try: client.v2.money_management.outbound_payments.create( { - "amount": {"value": 111972721, "currency": "usd"}, + "amount": {"currency": "USD", "value": 96}, "from": { "currency": "usd", "financial_account": "financial_account", @@ -48830,7 +48968,7 @@ def test_insufficient_funds_error_service( path="/v2/money_management/outbound_payments", query_string="", api_base="https://api.stripe.com", - post_data='{"amount":{"value":111972721,"currency":"usd"},"from":{"currency":"usd","financial_account":"financial_account"},"to":{"recipient":"recipient"}}', + post_data='{"amount":{"currency":"USD","value":96},"from":{"currency":"usd","financial_account":"financial_account"},"to":{"recipient":"recipient"}}', is_json=True, ) @@ -48852,6 +48990,7 @@ def test_invalid_payment_method_error_service( client.v2.core.vault.us_bank_accounts.create( { "account_number": "account_number", + "currency": "usd", } ) except _error.InvalidPaymentMethodError: @@ -48861,7 +49000,7 @@ def test_invalid_payment_method_error_service( path="/v2/core/vault/us_bank_accounts", query_string="", api_base="https://api.stripe.com", - post_data='{"account_number":"account_number"}', + post_data='{"account_number":"account_number","currency":"usd"}', is_json=True, ) @@ -48964,6 +49103,7 @@ def test_quota_exceeded_error_service( client.v2.core.vault.us_bank_accounts.create( { "account_number": "account_number", + "currency": "usd", } ) except _error.QuotaExceededError: @@ -48973,7 +49113,7 @@ def test_quota_exceeded_error_service( path="/v2/core/vault/us_bank_accounts", query_string="", api_base="https://api.stripe.com", - post_data='{"account_number":"account_number"}', + post_data='{"account_number":"account_number","currency":"usd"}', is_json=True, ) @@ -49019,7 +49159,7 @@ def test_recipient_not_notifiable_error_service( try: client.v2.money_management.outbound_payments.create( { - "amount": {"value": 111972721, "currency": "usd"}, + "amount": {"currency": "USD", "value": 96}, "from": { "currency": "usd", "financial_account": "financial_account", @@ -49034,7 +49174,7 @@ def test_recipient_not_notifiable_error_service( path="/v2/money_management/outbound_payments", query_string="", api_base="https://api.stripe.com", - post_data='{"amount":{"value":111972721,"currency":"usd"},"from":{"currency":"usd","financial_account":"financial_account"},"to":{"recipient":"recipient"}}', + post_data='{"amount":{"currency":"USD","value":96},"from":{"currency":"usd","financial_account":"financial_account"},"to":{"recipient":"recipient"}}', is_json=True, ) diff --git a/tests/test_v2_event.py b/tests/test_v2_event.py index 290efb3b4..55ee13ee2 100644 --- a/tests/test_v2_event.py +++ b/tests/test_v2_event.py @@ -141,6 +141,20 @@ def test_parses_unknown_event_notif(self, parse_event_notif: EventParser): assert type(event) is UnknownEventNotification assert event.related_object + def test_raise_on_v1_payload(self, parse_event_notif: EventParser): + v1_payload = json.dumps( + { + "id": "evt_test_webhook", + "object": "event", + "data": { + "object": {"id": "rdr_123", "object": "terminal.reader"} + }, + } + ) + with pytest.raises(ValueError) as e: + parse_event_notif(v1_payload) + assert "StripeClient.construct_event" in str(e.value) + def test_validates_signature( self, stripe_client: StripeClient, v2_payload_no_data ): diff --git a/tests/test_webhook.py b/tests/test_webhook.py index cd648faa2..5d3856e9b 100644 --- a/tests/test_webhook.py +++ b/tests/test_webhook.py @@ -12,6 +12,14 @@ "data": { "object": { "id": "rdr_123", "object": "terminal.reader" } } }""" +DUMMY_V2_WEBHOOK_PAYLOAD = """{ + "id": "evt_234", + "object": "v2.core.event", + "type": "v1.billing.meter.error_report_triggered", + "livemode": true, + "created": "2022-02-15T00:27:45.330Z" +}""" + DUMMY_WEBHOOK_SECRET = "whsec_test_secret" @@ -69,6 +77,14 @@ def test_construct_event_from_bytes(self): ) assert isinstance(event, stripe.Event) + def test_raise_on_v2_payload(self): + header = generate_header(payload=DUMMY_V2_WEBHOOK_PAYLOAD) + with pytest.raises(ValueError) as e: + stripe.Webhook.construct_event( + DUMMY_V2_WEBHOOK_PAYLOAD, header, DUMMY_WEBHOOK_SECRET + ) + assert "StripeClient.parse_event_notification" in str(e.value) + class TestWebhookSignature(object): def test_raise_on_malformed_header(self): @@ -172,6 +188,14 @@ def test_construct_event_from_bytes(self, stripe_mock_stripe_client): ) assert isinstance(event, stripe.Event) + def test_raise_on_v2_payload(self, stripe_mock_stripe_client): + header = generate_header(payload=DUMMY_V2_WEBHOOK_PAYLOAD) + with pytest.raises(ValueError) as e: + stripe_mock_stripe_client.construct_event( + DUMMY_V2_WEBHOOK_PAYLOAD, header, DUMMY_WEBHOOK_SECRET + ) + assert "parse_event_notification" in str(e.value) + def test_construct_event_inherits_requestor(self, http_client_mock): http_client_mock.stub_request("delete", "/v1/terminal/readers/rdr_123")