diff --git a/CODEGEN_VERSION b/CODEGEN_VERSION index eabc6731b..49cddf8d8 100644 --- a/CODEGEN_VERSION +++ b/CODEGEN_VERSION @@ -1 +1 @@ -74913070eb5bc81c058d07ad167346b6d68d8b0b \ No newline at end of file +fce63eb87846dfb612efc9be0e529a67d81b4525 \ No newline at end of file diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index 195c486d2..f8ca2f439 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v2164 \ No newline at end of file +v2169 \ No newline at end of file diff --git a/README.md b/README.md index 6c40d685d..75b2f0fd9 100644 --- a/README.md +++ b/README.md @@ -415,6 +415,12 @@ just format # or: venv/bin/ruff format . --quiet ``` +Update bundled CA certificates from the [Mozilla cURL release][curl]: + +```sh +just update-certs +``` + [api-keys]: https://dashboard.stripe.com/account/apikeys [ruff]: https://github.com/astral-sh/ruff [connect]: https://stripe.com/connect diff --git a/stripe/_application_fee.py b/stripe/_application_fee.py index 9b2169924..10f4bb40a 100644 --- a/stripe/_application_fee.py +++ b/stripe/_application_fee.py @@ -120,6 +120,10 @@ class FeeSource(StripeObject): """ A list of refunds that have been applied to the fee. """ + settlement_type: Optional[Literal["gross_settled", "net_settled"]] + """ + Type of settlement for the application fee. One of `net_settled` or `gross_settled`. + """ @classmethod def list( diff --git a/stripe/_coupon.py b/stripe/_coupon.py index 91a615a30..8a438b852 100644 --- a/stripe/_coupon.py +++ b/stripe/_coupon.py @@ -7,7 +7,7 @@ from stripe._stripe_object import StripeObject from stripe._updateable_api_resource import UpdateableAPIResource from stripe._util import class_method_variant, sanitize_id -from typing import ClassVar, Dict, List, Optional, cast, overload +from typing import Any, ClassVar, Dict, List, Optional, cast, overload from typing_extensions import Literal, Unpack, TYPE_CHECKING if TYPE_CHECKING: @@ -16,7 +16,6 @@ from stripe.params._coupon_list_params import CouponListParams from stripe.params._coupon_modify_params import CouponModifyParams from stripe.params._coupon_retrieve_params import CouponRetrieveParams - from typing import Any class Coupon( @@ -46,7 +45,7 @@ class CurrencyOptions(StripeObject): """ class Script(StripeObject): - configuration: Dict[str, "Any"] + configuration: Dict[str, Any] """ The configuration values of the script. The keys and values are specific to the script implementation. """ diff --git a/stripe/_event.py b/stripe/_event.py index bc6549553..72b22d6d5 100644 --- a/stripe/_event.py +++ b/stripe/_event.py @@ -3,13 +3,12 @@ from stripe._list_object import ListObject from stripe._listable_api_resource import ListableAPIResource from stripe._stripe_object import StripeObject -from typing import ClassVar, Dict, Optional +from typing import Any, ClassVar, Dict, Optional from typing_extensions import Literal, Unpack, TYPE_CHECKING if TYPE_CHECKING: from stripe.params._event_list_params import EventListParams from stripe.params._event_retrieve_params import EventRetrieveParams - from typing import Any class Event(ListableAPIResource["Event"]): @@ -37,11 +36,11 @@ class Event(ListableAPIResource["Event"]): OBJECT_NAME: ClassVar[Literal["event"]] = "event" class Data(StripeObject): - object: Dict[str, "Any"] + object: Dict[str, Any] """ Object containing the API resource relevant to the event. For example, an `invoice.created` event will have a full [invoice object](https://api.stripe.com#invoice_object) as the value of the object key. """ - previous_attributes: Optional[Dict[str, "Any"]] + previous_attributes: Optional[Dict[str, Any]] """ Object containing the names of the updated attributes and their values prior to the event (only included in events of type `*.updated`). If an array attribute has any updated elements, this object contains the entire array. In Stripe API versions 2017-04-06 or earlier, an updated array attribute in this object includes only the updated array elements. """ diff --git a/stripe/_fr_meal_vouchers_onboarding.py b/stripe/_fr_meal_vouchers_onboarding.py index 6c00be462..fc0c65178 100644 --- a/stripe/_fr_meal_vouchers_onboarding.py +++ b/stripe/_fr_meal_vouchers_onboarding.py @@ -30,8 +30,14 @@ class FrMealVouchersOnboarding( UpdateableAPIResource["FrMealVouchersOnboarding"], ): """ - The French Meal Vouchers Onboarding resource encapsulates the onboarding status and other related information + The `French Meal Vouchers Onboarding` resource encapsulates the onboarding status and other related information for a single restaurant (SIRET number) in the context of the French Meal Vouchers program. + + To onboard a restaurant for the French Meal Vouchers program, you create a `French Meal Vouchers Onboarding` object. + You can retrieve individual objects, list all such objects, or update objects to correct the postal code of the restaurant. + We identify `French Meal Vouchers Onboarding` objects with a unique, random ID. + + Related guide: [Set up a restaurant for titres-restaurant payments](https://docs.stripe.com/payments/meal-vouchers/fr-meal-vouchers/set-up-restaurant) """ OBJECT_NAME: ClassVar[Literal["fr_meal_vouchers_onboarding"]] = ( @@ -166,7 +172,7 @@ def list( cls, **params: Unpack["FrMealVouchersOnboardingListParams"] ) -> ListObject["FrMealVouchersOnboarding"]: """ - Lists French Meal Vouchers Onboarding objects + Lists French Meal Vouchers Onboarding objects. The objects are returned in sorted order, with the most recently created objects appearing first. """ result = cls._static_request( "get", @@ -186,7 +192,7 @@ async def list_async( cls, **params: Unpack["FrMealVouchersOnboardingListParams"] ) -> ListObject["FrMealVouchersOnboarding"]: """ - Lists French Meal Vouchers Onboarding objects + Lists French Meal Vouchers Onboarding objects. The objects are returned in sorted order, with the most recently created objects appearing first. """ result = await cls._static_request_async( "get", @@ -206,7 +212,11 @@ def modify( cls, id: str, **params: Unpack["FrMealVouchersOnboardingModifyParams"] ) -> "FrMealVouchersOnboarding": """ - Updates the details of a restaurant's French Meal Vouchers Onboarding object + Updates the details of a restaurant's French Meal Vouchers Onboarding object by + setting the values of the parameters passed. Any parameters not provided are left unchanged. + After you update the object, the onboarding process automatically restarts. + + You can only update French Meal Vouchers Onboarding objects with the postal_code field requirement in past_due. """ url = "%s/%s" % (cls.class_url(), sanitize_id(id)) return cast( @@ -223,7 +233,11 @@ async def modify_async( cls, id: str, **params: Unpack["FrMealVouchersOnboardingModifyParams"] ) -> "FrMealVouchersOnboarding": """ - Updates the details of a restaurant's French Meal Vouchers Onboarding object + Updates the details of a restaurant's French Meal Vouchers Onboarding object by + setting the values of the parameters passed. Any parameters not provided are left unchanged. + After you update the object, the onboarding process automatically restarts. + + You can only update French Meal Vouchers Onboarding objects with the postal_code field requirement in past_due. """ url = "%s/%s" % (cls.class_url(), sanitize_id(id)) return cast( @@ -242,7 +256,10 @@ def retrieve( **params: Unpack["FrMealVouchersOnboardingRetrieveParams"], ) -> "FrMealVouchersOnboarding": """ - Retrieves the details of a French Meal Vouchers Onboarding object + Retrieves the details of a previously created French Meal Vouchers Onboarding object. + + Supply the unique French Meal Vouchers Onboarding ID that was returned from your previous request, + and Stripe returns the corresponding onboarding information. """ instance = cls(id, **params) instance.refresh() @@ -255,7 +272,10 @@ async def retrieve_async( **params: Unpack["FrMealVouchersOnboardingRetrieveParams"], ) -> "FrMealVouchersOnboarding": """ - Retrieves the details of a French Meal Vouchers Onboarding object + Retrieves the details of a previously created French Meal Vouchers Onboarding object. + + Supply the unique French Meal Vouchers Onboarding ID that was returned from your previous request, + and Stripe returns the corresponding onboarding information. """ instance = cls(id, **params) await instance.refresh_async() diff --git a/stripe/_fr_meal_vouchers_onboarding_service.py b/stripe/_fr_meal_vouchers_onboarding_service.py index bab25fa17..bec1ef2e8 100644 --- a/stripe/_fr_meal_vouchers_onboarding_service.py +++ b/stripe/_fr_meal_vouchers_onboarding_service.py @@ -30,7 +30,7 @@ def list( options: Optional["RequestOptions"] = None, ) -> "ListObject[FrMealVouchersOnboarding]": """ - Lists French Meal Vouchers Onboarding objects + Lists French Meal Vouchers Onboarding objects. The objects are returned in sorted order, with the most recently created objects appearing first. """ return cast( "ListObject[FrMealVouchersOnboarding]", @@ -49,7 +49,7 @@ async def list_async( options: Optional["RequestOptions"] = None, ) -> "ListObject[FrMealVouchersOnboarding]": """ - Lists French Meal Vouchers Onboarding objects + Lists French Meal Vouchers Onboarding objects. The objects are returned in sorted order, with the most recently created objects appearing first. """ return cast( "ListObject[FrMealVouchersOnboarding]", @@ -107,7 +107,10 @@ def retrieve( options: Optional["RequestOptions"] = None, ) -> "FrMealVouchersOnboarding": """ - Retrieves the details of a French Meal Vouchers Onboarding object + Retrieves the details of a previously created French Meal Vouchers Onboarding object. + + Supply the unique French Meal Vouchers Onboarding ID that was returned from your previous request, + and Stripe returns the corresponding onboarding information. """ return cast( "FrMealVouchersOnboarding", @@ -129,7 +132,10 @@ async def retrieve_async( options: Optional["RequestOptions"] = None, ) -> "FrMealVouchersOnboarding": """ - Retrieves the details of a French Meal Vouchers Onboarding object + Retrieves the details of a previously created French Meal Vouchers Onboarding object. + + Supply the unique French Meal Vouchers Onboarding ID that was returned from your previous request, + and Stripe returns the corresponding onboarding information. """ return cast( "FrMealVouchersOnboarding", @@ -151,7 +157,11 @@ def update( options: Optional["RequestOptions"] = None, ) -> "FrMealVouchersOnboarding": """ - Updates the details of a restaurant's French Meal Vouchers Onboarding object + Updates the details of a restaurant's French Meal Vouchers Onboarding object by + setting the values of the parameters passed. Any parameters not provided are left unchanged. + After you update the object, the onboarding process automatically restarts. + + You can only update French Meal Vouchers Onboarding objects with the postal_code field requirement in past_due. """ return cast( "FrMealVouchersOnboarding", @@ -173,7 +183,11 @@ async def update_async( options: Optional["RequestOptions"] = None, ) -> "FrMealVouchersOnboarding": """ - Updates the details of a restaurant's French Meal Vouchers Onboarding object + Updates the details of a restaurant's French Meal Vouchers Onboarding object by + setting the values of the parameters passed. Any parameters not provided are left unchanged. + After you update the object, the onboarding process automatically restarts. + + You can only update French Meal Vouchers Onboarding objects with the postal_code field requirement in past_due. """ return cast( "FrMealVouchersOnboarding", diff --git a/stripe/_invoice_item.py b/stripe/_invoice_item.py index b96fac871..c34c150d1 100644 --- a/stripe/_invoice_item.py +++ b/stripe/_invoice_item.py @@ -175,6 +175,24 @@ class PriceDetails(StripeObject): The ID of the product this item is associated with. """ + class RateCardCustomPricingUnitOverageRateDetails(StripeObject): + custom_pricing_unit: str + """ + The ID of the custom pricing unit this item is associated with + """ + custom_pricing_unit_overage_rate: str + """ + The ID of the custom pricing unit overage rate this item is associated with + """ + one_time_item: str + """ + The ID of the one-time item this custom pricing unit overage rate is associated with + """ + rate_card: str + """ + The ID of the rate card this item is associated with + """ + class RateCardRateDetails(StripeObject): metered_item: str """ @@ -191,9 +209,15 @@ class RateCardRateDetails(StripeObject): license_fee_details: Optional[LicenseFeeDetails] price_details: Optional[PriceDetails] + rate_card_custom_pricing_unit_overage_rate_details: Optional[ + RateCardCustomPricingUnitOverageRateDetails + ] rate_card_rate_details: Optional[RateCardRateDetails] type: Literal[ - "license_fee_details", "price_details", "rate_card_rate_details" + "license_fee_details", + "price_details", + "rate_card_custom_pricing_unit_overage_rate_details", + "rate_card_rate_details", ] """ The type of the pricing details. @@ -205,6 +229,7 @@ class RateCardRateDetails(StripeObject): _inner_class_types = { "license_fee_details": LicenseFeeDetails, "price_details": PriceDetails, + "rate_card_custom_pricing_unit_overage_rate_details": RateCardCustomPricingUnitOverageRateDetails, "rate_card_rate_details": RateCardRateDetails, } diff --git a/stripe/_invoice_line_item.py b/stripe/_invoice_line_item.py index 44662acdd..a680758ae 100644 --- a/stripe/_invoice_line_item.py +++ b/stripe/_invoice_line_item.py @@ -272,6 +272,24 @@ class PriceDetails(StripeObject): The ID of the product this item is associated with. """ + class RateCardCustomPricingUnitOverageRateDetails(StripeObject): + custom_pricing_unit: str + """ + The ID of the custom pricing unit this item is associated with + """ + custom_pricing_unit_overage_rate: str + """ + The ID of the custom pricing unit overage rate this item is associated with + """ + one_time_item: str + """ + The ID of the one-time item this custom pricing unit overage rate is associated with + """ + rate_card: str + """ + The ID of the rate card this item is associated with + """ + class RateCardRateDetails(StripeObject): metered_item: str """ @@ -288,9 +306,15 @@ class RateCardRateDetails(StripeObject): license_fee_details: Optional[LicenseFeeDetails] price_details: Optional[PriceDetails] + rate_card_custom_pricing_unit_overage_rate_details: Optional[ + RateCardCustomPricingUnitOverageRateDetails + ] rate_card_rate_details: Optional[RateCardRateDetails] type: Literal[ - "license_fee_details", "price_details", "rate_card_rate_details" + "license_fee_details", + "price_details", + "rate_card_custom_pricing_unit_overage_rate_details", + "rate_card_rate_details", ] """ The type of the pricing details. @@ -302,6 +326,7 @@ class RateCardRateDetails(StripeObject): _inner_class_types = { "license_fee_details": LicenseFeeDetails, "price_details": PriceDetails, + "rate_card_custom_pricing_unit_overage_rate_details": RateCardCustomPricingUnitOverageRateDetails, "rate_card_rate_details": RateCardRateDetails, } diff --git a/stripe/_object_classes.py b/stripe/_object_classes.py index 7d469e746..16c4c4b9c 100644 --- a/stripe/_object_classes.py +++ b/stripe/_object_classes.py @@ -436,6 +436,10 @@ "BillSettingVersion", ), "v2.billing.cadence": ("stripe.v2.billing._cadence", "Cadence"), + "v2.billing.cadence_spend_modifier": ( + "stripe.v2.billing._cadence_spend_modifier", + "CadenceSpendModifier", + ), "v2.billing.collection_setting": ( "stripe.v2.billing._collection_setting", "CollectionSetting", @@ -479,6 +483,10 @@ "stripe.v2.billing._meter_event_session", "MeterEventSession", ), + "v2.billing.one_time_item": ( + "stripe.v2.billing._one_time_item", + "OneTimeItem", + ), "v2.billing.pricing_plan": ( "stripe.v2.billing._pricing_plan", "PricingPlan", @@ -501,6 +509,10 @@ ), "v2.billing.profile": ("stripe.v2.billing._profile", "Profile"), "v2.billing.rate_card": ("stripe.v2.billing._rate_card", "RateCard"), + "v2.billing.rate_card_custom_pricing_unit_overage_rate": ( + "stripe.v2.billing._rate_card_custom_pricing_unit_overage_rate", + "RateCardCustomPricingUnitOverageRate", + ), "v2.billing.rate_card_rate": ( "stripe.v2.billing._rate_card_rate", "RateCardRate", diff --git a/stripe/_payment_intent.py b/stripe/_payment_intent.py index 595e961fc..8cb5b4297 100644 --- a/stripe/_payment_intent.py +++ b/stripe/_payment_intent.py @@ -11,6 +11,7 @@ from stripe._updateable_api_resource import UpdateableAPIResource from stripe._util import class_method_variant, sanitize_id from typing import ( + Any, AsyncIterator, ClassVar, Dict, @@ -79,7 +80,6 @@ from stripe.params._payment_intent_verify_microdeposits_params import ( PaymentIntentVerifyMicrodepositsParams, ) - from typing import Any @nested_resource_class_methods("amount_details_line_item") @@ -1443,7 +1443,7 @@ class WechatPayRedirectToIosApp(StripeObject): """ Type of the next action to perform. Refer to the other child attributes under `next_action` for available values. Examples include: `redirect_to_url`, `use_stripe_sdk`, `alipay_handle_redirect`, `oxxo_display_details`, or `verify_with_microdeposits`. """ - use_stripe_sdk: Optional[Dict[str, "Any"]] + use_stripe_sdk: Optional[Dict[str, Any]] """ When confirming a PaymentIntent with Stripe.js, Stripe.js depends on the contents of this dictionary to invoke authentication flows. The shape of the contents is subject to change and is only intended to be used by Stripe.js. """ diff --git a/stripe/_setup_intent.py b/stripe/_setup_intent.py index 95865d978..09939c93a 100644 --- a/stripe/_setup_intent.py +++ b/stripe/_setup_intent.py @@ -7,7 +7,7 @@ from stripe._stripe_object import StripeObject from stripe._updateable_api_resource import UpdateableAPIResource from stripe._util import class_method_variant, sanitize_id -from typing import ClassVar, Dict, List, Optional, Union, cast, overload +from typing import Any, ClassVar, Dict, List, Optional, Union, cast, overload from typing_extensions import Literal, Unpack, TYPE_CHECKING if TYPE_CHECKING: @@ -40,7 +40,6 @@ from stripe.params._setup_intent_verify_microdeposits_params import ( SetupIntentVerifyMicrodepositsParams, ) - from typing import Any class SetupIntent( @@ -463,7 +462,7 @@ class VerifyWithMicrodeposits(StripeObject): """ Type of the next action to perform. Refer to the other child attributes under `next_action` for available values. Examples include: `redirect_to_url`, `use_stripe_sdk`, `alipay_handle_redirect`, `oxxo_display_details`, or `verify_with_microdeposits`. """ - use_stripe_sdk: Optional[Dict[str, "Any"]] + use_stripe_sdk: Optional[Dict[str, Any]] """ When confirming a SetupIntent with Stripe.js, Stripe.js depends on the contents of this dictionary to invoke authentication flows. The shape of the contents is subject to change and is only intended to be used by Stripe.js. """ 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 5cf867eac..2f46db71e 100644 --- a/stripe/events/_v2_core_health_fraud_rate_increased_event.py +++ b/stripe/events/_v2_core_health_fraud_rate_increased_event.py @@ -37,11 +37,11 @@ class V2CoreHealthFraudRateIncreasedEvent(Event): class V2CoreHealthFraudRateIncreasedEventData(StripeObject): class Impact(StripeObject): class RealizedFraudAmount(StripeObject): - currency: Optional[str] + 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: Optional[int] + value: int """ A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). """ 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 f0b6c57ee..6562961d5 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 @@ -45,21 +45,21 @@ class V2CoreHealthIssuingAuthorizationRequestErrorsFiringEventData( ): class Impact(StripeObject): class ApprovedAmount(StripeObject): - currency: Optional[str] + 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: Optional[int] + 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: Optional[str] + 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: Optional[int] + value: int """ A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). """ 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 d32294cf0..b02abb8ce 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 @@ -53,21 +53,21 @@ class V2CoreHealthIssuingAuthorizationRequestErrorsResolvedEventData( ): class Impact(StripeObject): class ApprovedAmount(StripeObject): - currency: Optional[str] + 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: Optional[int] + 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: Optional[str] + 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: Optional[int] + value: int """ A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). """ 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 d5350f40f..d810d67e1 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 @@ -49,21 +49,21 @@ class V2CoreHealthIssuingAuthorizationRequestTimeoutFiringEventData( ): class Impact(StripeObject): class ApprovedAmount(StripeObject): - currency: Optional[str] + 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: Optional[int] + 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: Optional[str] + 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: Optional[int] + value: int """ A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). """ 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 43739b198..aa4d286f1 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 @@ -53,21 +53,21 @@ class V2CoreHealthIssuingAuthorizationRequestTimeoutResolvedEventData( ): class Impact(StripeObject): class ApprovedAmount(StripeObject): - currency: Optional[str] + 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: Optional[int] + 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: Optional[str] + 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: Optional[int] + value: int """ A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). """ diff --git a/stripe/params/__init__.py b/stripe/params/__init__.py index 1cf084d05..76ca3dcc8 100644 --- a/stripe/params/__init__.py +++ b/stripe/params/__init__.py @@ -1573,6 +1573,7 @@ InvoiceCreatePreviewParamsScheduleDetailsBillingScheduleAppliesTo as InvoiceCreatePreviewParamsScheduleDetailsBillingScheduleAppliesTo, InvoiceCreatePreviewParamsScheduleDetailsBillingScheduleBillUntil as InvoiceCreatePreviewParamsScheduleDetailsBillingScheduleBillUntil, InvoiceCreatePreviewParamsScheduleDetailsBillingScheduleBillUntilDuration as InvoiceCreatePreviewParamsScheduleDetailsBillingScheduleBillUntilDuration, + InvoiceCreatePreviewParamsScheduleDetailsDefaultSettings as InvoiceCreatePreviewParamsScheduleDetailsDefaultSettings, InvoiceCreatePreviewParamsScheduleDetailsPhase as InvoiceCreatePreviewParamsScheduleDetailsPhase, InvoiceCreatePreviewParamsScheduleDetailsPhaseAddInvoiceItem as InvoiceCreatePreviewParamsScheduleDetailsPhaseAddInvoiceItem, InvoiceCreatePreviewParamsScheduleDetailsPhaseAddInvoiceItemDiscount as InvoiceCreatePreviewParamsScheduleDetailsPhaseAddInvoiceItemDiscount, @@ -10386,6 +10387,10 @@ "stripe.params._invoice_create_preview_params", False, ), + "InvoiceCreatePreviewParamsScheduleDetailsDefaultSettings": ( + "stripe.params._invoice_create_preview_params", + False, + ), "InvoiceCreatePreviewParamsScheduleDetailsPhase": ( "stripe.params._invoice_create_preview_params", False, diff --git a/stripe/params/_coupon_create_params.py b/stripe/params/_coupon_create_params.py index 40acd38f0..872f4ee17 100644 --- a/stripe/params/_coupon_create_params.py +++ b/stripe/params/_coupon_create_params.py @@ -87,7 +87,7 @@ class CouponCreateParamsCurrencyOptions(TypedDict): class CouponCreateParamsScript(TypedDict): - configuration: Dict[str, "Any"] + configuration: Dict[str, Any] """ The configuration values of the script. The keys and values are specific to the script implementation. """ diff --git a/stripe/params/_file_create_params.py b/stripe/params/_file_create_params.py index a65648464..d61c852f6 100644 --- a/stripe/params/_file_create_params.py +++ b/stripe/params/_file_create_params.py @@ -10,7 +10,7 @@ class FileCreateParams(RequestOptions): """ Specifies which fields in the response should be expanded. """ - file: "Any" + file: Any """ A file to upload. Make sure that the specifications follow RFC 2388, which defines file transfers for the `multipart/form-data` protocol. """ diff --git a/stripe/params/_invoice_create_preview_params.py b/stripe/params/_invoice_create_preview_params.py index ce33dd8c2..8f42bb576 100644 --- a/stripe/params/_invoice_create_preview_params.py +++ b/stripe/params/_invoice_create_preview_params.py @@ -642,6 +642,12 @@ class InvoiceCreatePreviewParamsScheduleDetails(TypedDict): """ In cases where the `schedule_details` params update the currently active phase, specifies if and how to prorate at the time of the request. """ + default_settings: NotRequired[ + "InvoiceCreatePreviewParamsScheduleDetailsDefaultSettings" + ] + """ + Object representing the subscription schedule's default settings. + """ class InvoiceCreatePreviewParamsScheduleDetailsAmendment(TypedDict): @@ -2422,6 +2428,15 @@ class InvoiceCreatePreviewParamsScheduleDetailsPrebillingBillUntilDuration( """ +class InvoiceCreatePreviewParamsScheduleDetailsDefaultSettings(TypedDict): + phase_effective_at: NotRequired[ + Literal["billing_period_start", "phase_start"] + ] + """ + Configures how the subscription schedule handles billing for phase transitions. + """ + + class InvoiceCreatePreviewParamsSubscriptionDetails(TypedDict): billing_cycle_anchor: NotRequired["Literal['now', 'unchanged']|int"] """ diff --git a/stripe/params/_quote_modify_params.py b/stripe/params/_quote_modify_params.py index 08fe63120..d07fa53bd 100644 --- a/stripe/params/_quote_modify_params.py +++ b/stripe/params/_quote_modify_params.py @@ -1383,7 +1383,7 @@ class QuoteModifyParamsSubscriptionDataOverride(TypedDict): Configures when the subscription schedule generates prorations for phase transitions. Possible values are `prorate_on_next_phase` or `prorate_up_front` with the default being `prorate_on_next_phase`. `prorate_on_next_phase` will apply phase changes and generate prorations at transition time. `prorate_up_front` will bill for all phases within the current billing cycle up front. """ billing_schedules: NotRequired[ - "Literal['']|List[QuoteModifyParamsSubscriptionDataOverrideBillingSchedule]" + List["QuoteModifyParamsSubscriptionDataOverrideBillingSchedule"] ] """ Billing schedules that will be applied to the subscription or subscription schedule created when the quote is accepted. diff --git a/stripe/params/_quote_update_params.py b/stripe/params/_quote_update_params.py index 5707faf03..920df8e84 100644 --- a/stripe/params/_quote_update_params.py +++ b/stripe/params/_quote_update_params.py @@ -1382,7 +1382,7 @@ class QuoteUpdateParamsSubscriptionDataOverride(TypedDict): Configures when the subscription schedule generates prorations for phase transitions. Possible values are `prorate_on_next_phase` or `prorate_up_front` with the default being `prorate_on_next_phase`. `prorate_on_next_phase` will apply phase changes and generate prorations at transition time. `prorate_up_front` will bill for all phases within the current billing cycle up front. """ billing_schedules: NotRequired[ - "Literal['']|List[QuoteUpdateParamsSubscriptionDataOverrideBillingSchedule]" + List["QuoteUpdateParamsSubscriptionDataOverrideBillingSchedule"] ] """ Billing schedules that will be applied to the subscription or subscription schedule created when the quote is accepted. diff --git a/stripe/params/_subscription_resume_params.py b/stripe/params/_subscription_resume_params.py index e1ad4a625..18f100847 100644 --- a/stripe/params/_subscription_resume_params.py +++ b/stripe/params/_subscription_resume_params.py @@ -24,3 +24,9 @@ class SubscriptionResumeParams(RequestOptions): """ If set, prorations will be calculated as though the subscription was resumed at the given time. This can be used to apply exactly the same prorations that were previewed with the [create preview](https://stripe.com/docs/api/invoices/create_preview) endpoint. """ + payment_behavior: NotRequired[ + Literal["allow_incomplete", "pending_if_incomplete"] + ] + """ + Controls when the subscription transitions from `paused` to `active`. Determines how payment on the invoice affects the resumption process.The default is `pending_if_incomplete`. + """ diff --git a/stripe/params/v2/billing/__init__.py b/stripe/params/v2/billing/__init__.py index d7cc68e62..d8965556e 100644 --- a/stripe/params/v2/billing/__init__.py +++ b/stripe/params/v2/billing/__init__.py @@ -6,6 +6,7 @@ if TYPE_CHECKING: from stripe.params.v2.billing import ( bill_settings as bill_settings, + cadences as cadences, collection_settings as collection_settings, intents as intents, license_fees as license_fees, @@ -128,9 +129,15 @@ IntentCreateParams as IntentCreateParams, IntentCreateParamsAction as IntentCreateParamsAction, IntentCreateParamsActionApply as IntentCreateParamsActionApply, + IntentCreateParamsActionApplyEffectiveAt as IntentCreateParamsActionApplyEffectiveAt, IntentCreateParamsActionApplyInvoiceDiscountRule as IntentCreateParamsActionApplyInvoiceDiscountRule, IntentCreateParamsActionApplyInvoiceDiscountRulePercentOff as IntentCreateParamsActionApplyInvoiceDiscountRulePercentOff, IntentCreateParamsActionApplyInvoiceDiscountRulePercentOffMaximumApplications as IntentCreateParamsActionApplyInvoiceDiscountRulePercentOffMaximumApplications, + IntentCreateParamsActionApplySpendModifierRule as IntentCreateParamsActionApplySpendModifierRule, + IntentCreateParamsActionApplySpendModifierRuleMaxBillingPeriodSpend as IntentCreateParamsActionApplySpendModifierRuleMaxBillingPeriodSpend, + IntentCreateParamsActionApplySpendModifierRuleMaxBillingPeriodSpendAmount as IntentCreateParamsActionApplySpendModifierRuleMaxBillingPeriodSpendAmount, + IntentCreateParamsActionApplySpendModifierRuleMaxBillingPeriodSpendAmountCustomPricingUnit as IntentCreateParamsActionApplySpendModifierRuleMaxBillingPeriodSpendAmountCustomPricingUnit, + IntentCreateParamsActionApplySpendModifierRuleMaxBillingPeriodSpendCustomPricingUnitOverageRate as IntentCreateParamsActionApplySpendModifierRuleMaxBillingPeriodSpendCustomPricingUnitOverageRate, IntentCreateParamsActionDeactivate as IntentCreateParamsActionDeactivate, IntentCreateParamsActionDeactivateCancellationDetails as IntentCreateParamsActionDeactivateCancellationDetails, IntentCreateParamsActionDeactivateEffectiveAt as IntentCreateParamsActionDeactivateEffectiveAt, @@ -146,6 +153,7 @@ IntentCreateParamsActionModifyPricingPlanSubscriptionDetailsOverridesPartialPeriodBehavior as IntentCreateParamsActionModifyPricingPlanSubscriptionDetailsOverridesPartialPeriodBehavior, IntentCreateParamsActionModifyPricingPlanSubscriptionDetailsOverridesPartialPeriodBehaviorLicenseFee as IntentCreateParamsActionModifyPricingPlanSubscriptionDetailsOverridesPartialPeriodBehaviorLicenseFee, IntentCreateParamsActionRemove as IntentCreateParamsActionRemove, + IntentCreateParamsActionRemoveEffectiveAt as IntentCreateParamsActionRemoveEffectiveAt, IntentCreateParamsActionSubscribe as IntentCreateParamsActionSubscribe, IntentCreateParamsActionSubscribeEffectiveAt as IntentCreateParamsActionSubscribeEffectiveAt, IntentCreateParamsActionSubscribePricingPlanSubscriptionDetails as IntentCreateParamsActionSubscribePricingPlanSubscriptionDetails, @@ -245,6 +253,20 @@ MeteredItemUpdateParams as MeteredItemUpdateParams, MeteredItemUpdateParamsTaxDetails as MeteredItemUpdateParamsTaxDetails, ) + from stripe.params.v2.billing._one_time_item_create_params import ( + OneTimeItemCreateParams as OneTimeItemCreateParams, + OneTimeItemCreateParamsTaxDetails as OneTimeItemCreateParamsTaxDetails, + ) + from stripe.params.v2.billing._one_time_item_list_params import ( + OneTimeItemListParams as OneTimeItemListParams, + ) + from stripe.params.v2.billing._one_time_item_retrieve_params import ( + OneTimeItemRetrieveParams as OneTimeItemRetrieveParams, + ) + from stripe.params.v2.billing._one_time_item_update_params import ( + OneTimeItemUpdateParams as OneTimeItemUpdateParams, + OneTimeItemUpdateParamsTaxDetails as OneTimeItemUpdateParamsTaxDetails, + ) from stripe.params.v2.billing._pricing_plan_create_params import ( PricingPlanCreateParams as PricingPlanCreateParams, ) @@ -340,6 +362,7 @@ # name -> (import_target, is_submodule) _import_map = { "bill_settings": ("stripe.params.v2.billing.bill_settings", True), + "cadences": ("stripe.params.v2.billing.cadences", True), "collection_settings": ( "stripe.params.v2.billing.collection_settings", True, @@ -656,6 +679,10 @@ "stripe.params.v2.billing._intent_create_params", False, ), + "IntentCreateParamsActionApplyEffectiveAt": ( + "stripe.params.v2.billing._intent_create_params", + False, + ), "IntentCreateParamsActionApplyInvoiceDiscountRule": ( "stripe.params.v2.billing._intent_create_params", False, @@ -668,6 +695,26 @@ "stripe.params.v2.billing._intent_create_params", False, ), + "IntentCreateParamsActionApplySpendModifierRule": ( + "stripe.params.v2.billing._intent_create_params", + False, + ), + "IntentCreateParamsActionApplySpendModifierRuleMaxBillingPeriodSpend": ( + "stripe.params.v2.billing._intent_create_params", + False, + ), + "IntentCreateParamsActionApplySpendModifierRuleMaxBillingPeriodSpendAmount": ( + "stripe.params.v2.billing._intent_create_params", + False, + ), + "IntentCreateParamsActionApplySpendModifierRuleMaxBillingPeriodSpendAmountCustomPricingUnit": ( + "stripe.params.v2.billing._intent_create_params", + False, + ), + "IntentCreateParamsActionApplySpendModifierRuleMaxBillingPeriodSpendCustomPricingUnitOverageRate": ( + "stripe.params.v2.billing._intent_create_params", + False, + ), "IntentCreateParamsActionDeactivate": ( "stripe.params.v2.billing._intent_create_params", False, @@ -728,6 +775,10 @@ "stripe.params.v2.billing._intent_create_params", False, ), + "IntentCreateParamsActionRemoveEffectiveAt": ( + "stripe.params.v2.billing._intent_create_params", + False, + ), "IntentCreateParamsActionSubscribe": ( "stripe.params.v2.billing._intent_create_params", False, @@ -952,6 +1003,30 @@ "stripe.params.v2.billing._metered_item_update_params", False, ), + "OneTimeItemCreateParams": ( + "stripe.params.v2.billing._one_time_item_create_params", + False, + ), + "OneTimeItemCreateParamsTaxDetails": ( + "stripe.params.v2.billing._one_time_item_create_params", + False, + ), + "OneTimeItemListParams": ( + "stripe.params.v2.billing._one_time_item_list_params", + False, + ), + "OneTimeItemRetrieveParams": ( + "stripe.params.v2.billing._one_time_item_retrieve_params", + False, + ), + "OneTimeItemUpdateParams": ( + "stripe.params.v2.billing._one_time_item_update_params", + False, + ), + "OneTimeItemUpdateParamsTaxDetails": ( + "stripe.params.v2.billing._one_time_item_update_params", + False, + ), "PricingPlanCreateParams": ( "stripe.params.v2.billing._pricing_plan_create_params", False, diff --git a/stripe/params/v2/billing/_collection_setting_create_params.py b/stripe/params/v2/billing/_collection_setting_create_params.py index f7d19546a..e6447117b 100644 --- a/stripe/params/v2/billing/_collection_setting_create_params.py +++ b/stripe/params/v2/billing/_collection_setting_create_params.py @@ -81,11 +81,11 @@ class CollectionSettingCreateParamsPaymentMethodOptions(TypedDict): """ This sub-hash contains details about the Bank transfer payment method options. """ - konbini: NotRequired[Dict[str, "Any"]] + konbini: NotRequired[Dict[str, Any]] """ This sub-hash contains details about the Konbini payment method options. """ - sepa_debit: NotRequired[Dict[str, "Any"]] + sepa_debit: NotRequired[Dict[str, Any]] """ This sub-hash contains details about the SEPA Direct Debit payment method options. """ diff --git a/stripe/params/v2/billing/_collection_setting_update_params.py b/stripe/params/v2/billing/_collection_setting_update_params.py index 5478565c5..0d9b2adf8 100644 --- a/stripe/params/v2/billing/_collection_setting_update_params.py +++ b/stripe/params/v2/billing/_collection_setting_update_params.py @@ -87,11 +87,11 @@ class CollectionSettingUpdateParamsPaymentMethodOptions(TypedDict): """ This sub-hash contains details about the Bank transfer payment method options. """ - konbini: NotRequired[Dict[str, "Any"]] + konbini: NotRequired[Dict[str, Any]] """ This sub-hash contains details about the Konbini payment method options. """ - sepa_debit: NotRequired[Dict[str, "Any"]] + sepa_debit: NotRequired[Dict[str, Any]] """ This sub-hash contains details about the SEPA Direct Debit payment method options. """ diff --git a/stripe/params/v2/billing/_intent_create_params.py b/stripe/params/v2/billing/_intent_create_params.py index b8a8747b4..0f10aa727 100644 --- a/stripe/params/v2/billing/_intent_create_params.py +++ b/stripe/params/v2/billing/_intent_create_params.py @@ -51,7 +51,11 @@ class IntentCreateParamsAction(TypedDict): class IntentCreateParamsActionApply(TypedDict): - type: Literal["invoice_discount_rule"] + effective_at: NotRequired["IntentCreateParamsActionApplyEffectiveAt"] + """ + When the apply action will take effect. Defaults to on_reserve if not specified. + """ + type: Literal["invoice_discount_rule", "spend_modifier_rule"] """ Type of the apply action details. """ @@ -61,6 +65,19 @@ class IntentCreateParamsActionApply(TypedDict): """ Details for applying a discount rule to future invoices. """ + spend_modifier_rule: NotRequired[ + "IntentCreateParamsActionApplySpendModifierRule" + ] + """ + Details for applying a spend modifier rule. Only present if type is spend_modifier_rule. + """ + + +class IntentCreateParamsActionApplyEffectiveAt(TypedDict): + type: Literal["current_billing_period_end", "on_reserve"] + """ + When the apply action will take effect. + """ class IntentCreateParamsActionApplyInvoiceDiscountRule(TypedDict): @@ -100,6 +117,69 @@ class IntentCreateParamsActionApplyInvoiceDiscountRulePercentOffMaximumApplicati """ +class IntentCreateParamsActionApplySpendModifierRule(TypedDict): + applies_to: Literal["cadence"] + """ + What the spend modifier applies to. + """ + type: Literal["max_billing_period_spend"] + """ + Type of the spend modifier. + """ + max_billing_period_spend: NotRequired[ + "IntentCreateParamsActionApplySpendModifierRuleMaxBillingPeriodSpend" + ] + """ + Details for max billing period spend modifier. Only present if type is max_billing_period_spend. + """ + + +class IntentCreateParamsActionApplySpendModifierRuleMaxBillingPeriodSpend( + TypedDict, +): + amount: "IntentCreateParamsActionApplySpendModifierRuleMaxBillingPeriodSpendAmount" + """ + The maximum amount allowed for the billing period. + """ + custom_pricing_unit_overage_rate: "IntentCreateParamsActionApplySpendModifierRuleMaxBillingPeriodSpendCustomPricingUnitOverageRate" + """ + The configration for the overage rate for the custom pricing unit. + """ + + +class IntentCreateParamsActionApplySpendModifierRuleMaxBillingPeriodSpendAmount( + TypedDict, +): + type: Literal["custom_pricing_unit"] + """ + The type of the amount. + """ + custom_pricing_unit: NotRequired[ + "IntentCreateParamsActionApplySpendModifierRuleMaxBillingPeriodSpendAmountCustomPricingUnit" + ] + """ + The custom pricing unit amount. + """ + + +class IntentCreateParamsActionApplySpendModifierRuleMaxBillingPeriodSpendAmountCustomPricingUnit( + TypedDict, +): + value: str + """ + The value of the custom pricing unit. + """ + + +class IntentCreateParamsActionApplySpendModifierRuleMaxBillingPeriodSpendCustomPricingUnitOverageRate( + TypedDict, +): + id: str + """ + ID of the custom pricing unit overage rate. + """ + + class IntentCreateParamsActionDeactivate(TypedDict): cancellation_details: NotRequired[ "IntentCreateParamsActionDeactivateCancellationDetails" @@ -337,7 +417,11 @@ class IntentCreateParamsActionModifyPricingPlanSubscriptionDetailsOverridesParti class IntentCreateParamsActionRemove(TypedDict): - type: Literal["invoice_discount_rule"] + effective_at: NotRequired["IntentCreateParamsActionRemoveEffectiveAt"] + """ + When the remove action will take effect. Defaults to on_reserve if not specified. + """ + type: Literal["invoice_discount_rule", "spend_modifier_rule"] """ Type of the remove action. """ @@ -345,6 +429,17 @@ class IntentCreateParamsActionRemove(TypedDict): """ The ID of the discount rule to remove for future invoices. """ + spend_modifier_rule: NotRequired[str] + """ + The ID of the spend modifier rule to remove. + """ + + +class IntentCreateParamsActionRemoveEffectiveAt(TypedDict): + type: Literal["current_billing_period_end", "on_reserve"] + """ + When the remove action will take effect. + """ class IntentCreateParamsActionSubscribe(TypedDict): diff --git a/stripe/params/v2/billing/_one_time_item_create_params.py b/stripe/params/v2/billing/_one_time_item_create_params.py new file mode 100644 index 000000000..80186b1f8 --- /dev/null +++ b/stripe/params/v2/billing/_one_time_item_create_params.py @@ -0,0 +1,39 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from typing import Dict +from typing_extensions import NotRequired, TypedDict + + +class OneTimeItemCreateParams(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 one-time item. + Must be unique among billable items. + Maximum length of 200 characters. + """ + 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. + """ + tax_details: NotRequired["OneTimeItemCreateParamsTaxDetails"] + """ + Stripe Tax details. + """ + unit_label: NotRequired[str] + """ + The unit to use when displaying prices for this one-time item. For example, set this field + to "credit" for the display to show "(price) per credit". + Maximum length of 100 characters. + """ + + +class OneTimeItemCreateParamsTaxDetails(TypedDict): + tax_code: str + """ + Product tax code (PTC). + """ diff --git a/stripe/params/v2/billing/_one_time_item_list_params.py b/stripe/params/v2/billing/_one_time_item_list_params.py new file mode 100644 index 000000000..1d2c8c7ab --- /dev/null +++ b/stripe/params/v2/billing/_one_time_item_list_params.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from typing import List +from typing_extensions import NotRequired, TypedDict + + +class OneTimeItemListParams(TypedDict): + limit: NotRequired[int] + """ + Optionally set the maximum number of results per page. Defaults to 20. + """ + lookup_keys: NotRequired[List[str]] + """ + Filter by lookup keys. + You can specify up to 10 lookup keys. + """ diff --git a/stripe/params/v2/billing/_one_time_item_retrieve_params.py b/stripe/params/v2/billing/_one_time_item_retrieve_params.py new file mode 100644 index 000000000..daed1ae2b --- /dev/null +++ b/stripe/params/v2/billing/_one_time_item_retrieve_params.py @@ -0,0 +1,7 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from typing_extensions import TypedDict + + +class OneTimeItemRetrieveParams(TypedDict): + pass diff --git a/stripe/params/v2/billing/_one_time_item_update_params.py b/stripe/params/v2/billing/_one_time_item_update_params.py new file mode 100644 index 000000000..4a92b7522 --- /dev/null +++ b/stripe/params/v2/billing/_one_time_item_update_params.py @@ -0,0 +1,39 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from typing import Dict, Optional +from typing_extensions import NotRequired, TypedDict + + +class OneTimeItemUpdateParams(TypedDict): + display_name: NotRequired[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 one-time item. + Maximum length of 200 characters. + To remove the lookup_key from the object, set it to null in the request. + """ + metadata: NotRequired[Dict[str, Optional[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. + """ + tax_details: NotRequired["OneTimeItemUpdateParamsTaxDetails"] + """ + Stripe Tax details. + """ + unit_label: NotRequired[str] + """ + The unit to use when displaying prices for this one-time item. For example, set this field + to "credit" for the display to show "(price) per credit". + Maximum length of 100 characters. + """ + + +class OneTimeItemUpdateParamsTaxDetails(TypedDict): + tax_code: str + """ + Product tax code (PTC). + """ diff --git a/stripe/params/v2/billing/_service_action_create_params.py b/stripe/params/v2/billing/_service_action_create_params.py index e72faf140..b20d3f6cf 100644 --- a/stripe/params/v2/billing/_service_action_create_params.py +++ b/stripe/params/v2/billing/_service_action_create_params.py @@ -91,11 +91,11 @@ class ServiceActionCreateParamsCreditGrantAmountCustomPricingUnit(TypedDict): class ServiceActionCreateParamsCreditGrantAmountMonetary(TypedDict): - value: NotRequired[int] + value: int """ A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). """ - currency: NotRequired[str] + 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). """ @@ -194,11 +194,11 @@ class ServiceActionCreateParamsCreditGrantPerTenantAmountCustomPricingUnit( class ServiceActionCreateParamsCreditGrantPerTenantAmountMonetary(TypedDict): - value: NotRequired[int] + value: int """ A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). """ - currency: NotRequired[str] + 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/billing/cadences/__init__.py b/stripe/params/v2/billing/cadences/__init__.py new file mode 100644 index 000000000..00c40b56d --- /dev/null +++ b/stripe/params/v2/billing/cadences/__init__.py @@ -0,0 +1,39 @@ +# -*- 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.cadences._spend_modifier_rule_list_params import ( + SpendModifierRuleListParams as SpendModifierRuleListParams, + ) + from stripe.params.v2.billing.cadences._spend_modifier_rule_retrieve_params import ( + SpendModifierRuleRetrieveParams as SpendModifierRuleRetrieveParams, + ) + +# name -> (import_target, is_submodule) +_import_map = { + "SpendModifierRuleListParams": ( + "stripe.params.v2.billing.cadences._spend_modifier_rule_list_params", + False, + ), + "SpendModifierRuleRetrieveParams": ( + "stripe.params.v2.billing.cadences._spend_modifier_rule_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/cadences/_spend_modifier_rule_list_params.py b/stripe/params/v2/billing/cadences/_spend_modifier_rule_list_params.py new file mode 100644 index 000000000..fc6df9400 --- /dev/null +++ b/stripe/params/v2/billing/cadences/_spend_modifier_rule_list_params.py @@ -0,0 +1,14 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from typing_extensions import NotRequired, TypedDict + + +class SpendModifierRuleListParams(TypedDict): + effective_at: NotRequired[str] + """ + Return only spend modifiers that are effective at the specified timestamp. + """ + limit: NotRequired[int] + """ + Optionally set the maximum number of results per page. Defaults to 20. + """ diff --git a/stripe/params/v2/billing/cadences/_spend_modifier_rule_retrieve_params.py b/stripe/params/v2/billing/cadences/_spend_modifier_rule_retrieve_params.py new file mode 100644 index 000000000..568e90065 --- /dev/null +++ b/stripe/params/v2/billing/cadences/_spend_modifier_rule_retrieve_params.py @@ -0,0 +1,7 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from typing_extensions import TypedDict + + +class SpendModifierRuleRetrieveParams(TypedDict): + pass diff --git a/stripe/params/v2/billing/rate_cards/__init__.py b/stripe/params/v2/billing/rate_cards/__init__.py index 13c269f3f..1b35649b1 100644 --- a/stripe/params/v2/billing/rate_cards/__init__.py +++ b/stripe/params/v2/billing/rate_cards/__init__.py @@ -4,6 +4,18 @@ from typing_extensions import TYPE_CHECKING if TYPE_CHECKING: + from stripe.params.v2.billing.rate_cards._custom_pricing_unit_overage_rate_create_params import ( + CustomPricingUnitOverageRateCreateParams as CustomPricingUnitOverageRateCreateParams, + ) + from stripe.params.v2.billing.rate_cards._custom_pricing_unit_overage_rate_delete_params import ( + CustomPricingUnitOverageRateDeleteParams as CustomPricingUnitOverageRateDeleteParams, + ) + from stripe.params.v2.billing.rate_cards._custom_pricing_unit_overage_rate_list_params import ( + CustomPricingUnitOverageRateListParams as CustomPricingUnitOverageRateListParams, + ) + from stripe.params.v2.billing.rate_cards._custom_pricing_unit_overage_rate_retrieve_params import ( + CustomPricingUnitOverageRateRetrieveParams as CustomPricingUnitOverageRateRetrieveParams, + ) from stripe.params.v2.billing.rate_cards._rate_create_params import ( RateCreateParams as RateCreateParams, RateCreateParamsCustomPricingUnitAmount as RateCreateParamsCustomPricingUnitAmount, @@ -28,6 +40,22 @@ # name -> (import_target, is_submodule) _import_map = { + "CustomPricingUnitOverageRateCreateParams": ( + "stripe.params.v2.billing.rate_cards._custom_pricing_unit_overage_rate_create_params", + False, + ), + "CustomPricingUnitOverageRateDeleteParams": ( + "stripe.params.v2.billing.rate_cards._custom_pricing_unit_overage_rate_delete_params", + False, + ), + "CustomPricingUnitOverageRateListParams": ( + "stripe.params.v2.billing.rate_cards._custom_pricing_unit_overage_rate_list_params", + False, + ), + "CustomPricingUnitOverageRateRetrieveParams": ( + "stripe.params.v2.billing.rate_cards._custom_pricing_unit_overage_rate_retrieve_params", + False, + ), "RateCreateParams": ( "stripe.params.v2.billing.rate_cards._rate_create_params", False, diff --git a/stripe/params/v2/billing/rate_cards/_custom_pricing_unit_overage_rate_create_params.py b/stripe/params/v2/billing/rate_cards/_custom_pricing_unit_overage_rate_create_params.py new file mode 100644 index 000000000..8ef42c88e --- /dev/null +++ b/stripe/params/v2/billing/rate_cards/_custom_pricing_unit_overage_rate_create_params.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from typing import Dict +from typing_extensions import NotRequired, TypedDict + + +class CustomPricingUnitOverageRateCreateParams(TypedDict): + custom_pricing_unit: str + """ + The ID of the custom pricing unit this overage rate applies to. + """ + 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. + """ + one_time_item: str + """ + The ID of the one-time item to use for overage line items. + """ + unit_amount: str + """ + The per-unit amount to charge for overages, represented as a decimal string in minor currency units with at most 12 decimal places. + """ diff --git a/stripe/params/v2/billing/rate_cards/_custom_pricing_unit_overage_rate_delete_params.py b/stripe/params/v2/billing/rate_cards/_custom_pricing_unit_overage_rate_delete_params.py new file mode 100644 index 000000000..7f1d07f22 --- /dev/null +++ b/stripe/params/v2/billing/rate_cards/_custom_pricing_unit_overage_rate_delete_params.py @@ -0,0 +1,7 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from typing_extensions import TypedDict + + +class CustomPricingUnitOverageRateDeleteParams(TypedDict): + pass diff --git a/stripe/params/v2/billing/rate_cards/_custom_pricing_unit_overage_rate_list_params.py b/stripe/params/v2/billing/rate_cards/_custom_pricing_unit_overage_rate_list_params.py new file mode 100644 index 000000000..6a38e2c9b --- /dev/null +++ b/stripe/params/v2/billing/rate_cards/_custom_pricing_unit_overage_rate_list_params.py @@ -0,0 +1,14 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from typing_extensions import NotRequired, TypedDict + + +class CustomPricingUnitOverageRateListParams(TypedDict): + limit: NotRequired[int] + """ + Optionally set the maximum number of results per page. Defaults to 20. + """ + rate_card_version: NotRequired[str] + """ + Optionally filter by a RateCard version. If not specified, defaults to the latest version. + """ diff --git a/stripe/params/v2/billing/rate_cards/_custom_pricing_unit_overage_rate_retrieve_params.py b/stripe/params/v2/billing/rate_cards/_custom_pricing_unit_overage_rate_retrieve_params.py new file mode 100644 index 000000000..aef749d5f --- /dev/null +++ b/stripe/params/v2/billing/rate_cards/_custom_pricing_unit_overage_rate_retrieve_params.py @@ -0,0 +1,7 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from typing_extensions import TypedDict + + +class CustomPricingUnitOverageRateRetrieveParams(TypedDict): + pass diff --git a/stripe/params/v2/core/_account_create_params.py b/stripe/params/v2/core/_account_create_params.py index e7e46c4fb..3120dc9b5 100644 --- a/stripe/params/v2/core/_account_create_params.py +++ b/stripe/params/v2/core/_account_create_params.py @@ -2833,11 +2833,11 @@ class AccountCreateParamsIdentityBusinessDetailsAnnualRevenue(TypedDict): class AccountCreateParamsIdentityBusinessDetailsAnnualRevenueAmount(TypedDict): - value: NotRequired[int] + value: int """ A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). """ - currency: NotRequired[str] + 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). """ @@ -3194,11 +3194,11 @@ class AccountCreateParamsIdentityBusinessDetailsMonthlyEstimatedRevenue( class AccountCreateParamsIdentityBusinessDetailsMonthlyEstimatedRevenueAmount( TypedDict, ): - value: NotRequired[int] + value: int """ A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). """ - currency: NotRequired[str] + 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/core/_account_token_create_params.py b/stripe/params/v2/core/_account_token_create_params.py index 5acc36be9..e84ffb528 100644 --- a/stripe/params/v2/core/_account_token_create_params.py +++ b/stripe/params/v2/core/_account_token_create_params.py @@ -609,11 +609,11 @@ class AccountTokenCreateParamsIdentityBusinessDetailsAnnualRevenue(TypedDict): class AccountTokenCreateParamsIdentityBusinessDetailsAnnualRevenueAmount( TypedDict, ): - value: NotRequired[int] + value: int """ A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). """ - currency: NotRequired[str] + 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). """ @@ -970,11 +970,11 @@ class AccountTokenCreateParamsIdentityBusinessDetailsMonthlyEstimatedRevenue( class AccountTokenCreateParamsIdentityBusinessDetailsMonthlyEstimatedRevenueAmount( TypedDict, ): - value: NotRequired[int] + value: int """ A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). """ - currency: NotRequired[str] + 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/core/_account_update_params.py b/stripe/params/v2/core/_account_update_params.py index 601e54495..a1026325c 100644 --- a/stripe/params/v2/core/_account_update_params.py +++ b/stripe/params/v2/core/_account_update_params.py @@ -2865,11 +2865,11 @@ class AccountUpdateParamsIdentityBusinessDetailsAnnualRevenue(TypedDict): class AccountUpdateParamsIdentityBusinessDetailsAnnualRevenueAmount(TypedDict): - value: NotRequired[int] + value: int """ A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). """ - currency: NotRequired[str] + 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). """ @@ -3226,11 +3226,11 @@ class AccountUpdateParamsIdentityBusinessDetailsMonthlyEstimatedRevenue( class AccountUpdateParamsIdentityBusinessDetailsMonthlyEstimatedRevenueAmount( TypedDict, ): - value: NotRequired[int] + value: int """ A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). """ - currency: NotRequired[str] + 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/_currency_conversion_create_params.py b/stripe/params/v2/money_management/_currency_conversion_create_params.py index d6781e0b2..a94347fab 100644 --- a/stripe/params/v2/money_management/_currency_conversion_create_params.py +++ b/stripe/params/v2/money_management/_currency_conversion_create_params.py @@ -31,11 +31,11 @@ class CurrencyConversionCreateParamsFrom(TypedDict): class CurrencyConversionCreateParamsFromAmount(TypedDict): - value: NotRequired[int] + value: int """ A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). """ - currency: NotRequired[str] + 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). """ @@ -53,11 +53,11 @@ class CurrencyConversionCreateParamsTo(TypedDict): class CurrencyConversionCreateParamsToAmount(TypedDict): - value: NotRequired[int] + value: int """ A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). """ - currency: NotRequired[str] + 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/_inbound_transfer_create_params.py b/stripe/params/v2/money_management/_inbound_transfer_create_params.py index 6d32f1730..715086b0e 100644 --- a/stripe/params/v2/money_management/_inbound_transfer_create_params.py +++ b/stripe/params/v2/money_management/_inbound_transfer_create_params.py @@ -24,11 +24,11 @@ class InboundTransferCreateParams(_InboundTransferCreateParamsBase): class InboundTransferCreateParamsAmount(TypedDict): - value: NotRequired[int] + value: int """ A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). """ - currency: NotRequired[str] + 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/_outbound_payment_create_params.py b/stripe/params/v2/money_management/_outbound_payment_create_params.py index 638920632..810c2b48b 100644 --- a/stripe/params/v2/money_management/_outbound_payment_create_params.py +++ b/stripe/params/v2/money_management/_outbound_payment_create_params.py @@ -47,11 +47,11 @@ class OutboundPaymentCreateParams(_OutboundPaymentCreateParamsBase): class OutboundPaymentCreateParamsAmount(TypedDict): - value: NotRequired[int] + value: int """ A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). """ - currency: NotRequired[str] + 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/_outbound_payment_quote_create_params.py b/stripe/params/v2/money_management/_outbound_payment_quote_create_params.py index 84a6f1c0a..ea20f2ca0 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 @@ -26,11 +26,11 @@ class OutboundPaymentQuoteCreateParams(_OutboundPaymentQuoteCreateParamsBase): class OutboundPaymentQuoteCreateParamsAmount(TypedDict): - value: NotRequired[int] + value: int """ A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). """ - currency: NotRequired[str] + 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/_outbound_transfer_create_params.py b/stripe/params/v2/money_management/_outbound_transfer_create_params.py index 72f291255..846aacbe3 100644 --- a/stripe/params/v2/money_management/_outbound_transfer_create_params.py +++ b/stripe/params/v2/money_management/_outbound_transfer_create_params.py @@ -39,11 +39,11 @@ class OutboundTransferCreateParams(_OutboundTransferCreateParamsBase): class OutboundTransferCreateParamsAmount(TypedDict): - value: NotRequired[int] + value: int """ A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). """ - currency: NotRequired[str] + 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/_off_session_payment_create_params.py b/stripe/params/v2/payments/_off_session_payment_create_params.py index 4000e24b7..846efe5ab 100644 --- a/stripe/params/v2/payments/_off_session_payment_create_params.py +++ b/stripe/params/v2/payments/_off_session_payment_create_params.py @@ -76,11 +76,11 @@ class OffSessionPaymentCreateParams(TypedDict): class OffSessionPaymentCreateParamsAmount(TypedDict): - value: NotRequired[int] + value: int """ A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). """ - currency: NotRequired[str] + 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_create_params.py b/stripe/params/v2/payments/_settlement_allocation_intent_create_params.py index b56298fdb..1a4b2be27 100644 --- a/stripe/params/v2/payments/_settlement_allocation_intent_create_params.py +++ b/stripe/params/v2/payments/_settlement_allocation_intent_create_params.py @@ -28,11 +28,11 @@ class SettlementAllocationIntentCreateParams(TypedDict): class SettlementAllocationIntentCreateParamsAmount(TypedDict): - value: NotRequired[int] + value: int """ A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). """ - currency: NotRequired[str] + 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 5218fc133..83ad0180c 100644 --- a/stripe/params/v2/payments/_settlement_allocation_intent_update_params.py +++ b/stripe/params/v2/payments/_settlement_allocation_intent_update_params.py @@ -15,11 +15,11 @@ class SettlementAllocationIntentUpdateParams(TypedDict): class SettlementAllocationIntentUpdateParamsAmount(TypedDict): - value: NotRequired[int] + value: int """ A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). """ - currency: NotRequired[str] + 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/_split_create_params.py b/stripe/params/v2/payments/settlement_allocation_intents/_split_create_params.py index a7704e148..4458a60cd 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 @@ -24,11 +24,11 @@ class SplitCreateParams(TypedDict): class SplitCreateParamsAmount(TypedDict): - value: NotRequired[int] + value: int """ A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). """ - currency: NotRequired[str] + 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/reporting/_report_run_create_params.py b/stripe/params/v2/reporting/_report_run_create_params.py index ece53d3e5..dfdb3f78c 100644 --- a/stripe/params/v2/reporting/_report_run_create_params.py +++ b/stripe/params/v2/reporting/_report_run_create_params.py @@ -9,7 +9,7 @@ class ReportRunCreateParams(TypedDict): """ The unique identifier of the `Report` being requested. """ - report_parameters: Dict[str, "Any"] + report_parameters: Dict[str, Any] """ A map of parameter names to values, specifying how the report should be customized. The accepted parameters depend on the specific `Report` being run. 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 3f6ae2849..5ff7bbc34 100644 --- a/stripe/params/v2/test_helpers/_financial_address_credit_params.py +++ b/stripe/params/v2/test_helpers/_financial_address_credit_params.py @@ -19,11 +19,11 @@ class FinancialAddressCreditParams(TypedDict): class FinancialAddressCreditParamsAmount(TypedDict): - value: NotRequired[int] + value: int """ A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). """ - currency: NotRequired[str] + 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 7ea9cade3..ed65ba398 100644 --- a/stripe/v2/_billing_service.py +++ b/stripe/v2/_billing_service.py @@ -30,6 +30,7 @@ MeterEventStreamService, ) from stripe.v2.billing._metered_item_service import MeteredItemService + from stripe.v2.billing._one_time_item_service import OneTimeItemService from stripe.v2.billing._pricing_plan_service import PricingPlanService from stripe.v2.billing._pricing_plan_subscription_service import ( PricingPlanSubscriptionService, @@ -88,6 +89,10 @@ "stripe.v2.billing._metered_item_service", "MeteredItemService", ], + "one_time_items": [ + "stripe.v2.billing._one_time_item_service", + "OneTimeItemService", + ], "pricing_plans": [ "stripe.v2.billing._pricing_plan_service", "PricingPlanService", @@ -123,6 +128,7 @@ class BillingService(StripeService): meter_event_session: "MeterEventSessionService" meter_event_stream: "MeterEventStreamService" metered_items: "MeteredItemService" + one_time_items: "OneTimeItemService" pricing_plans: "PricingPlanService" pricing_plan_subscriptions: "PricingPlanSubscriptionService" profiles: "ProfileService" diff --git a/stripe/v2/_financial_address_generated_microdeposits.py b/stripe/v2/_financial_address_generated_microdeposits.py index ec75a062c..a6fb2ffe1 100644 --- a/stripe/v2/_financial_address_generated_microdeposits.py +++ b/stripe/v2/_financial_address_generated_microdeposits.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec from stripe._stripe_object import StripeObject -from typing import ClassVar, List, Optional +from typing import ClassVar, List from typing_extensions import Literal @@ -11,11 +11,11 @@ class FinancialAddressGeneratedMicrodeposits(StripeObject): ] = "financial_address_generated_microdeposits" class Amount(StripeObject): - currency: Optional[str] + 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: Optional[int] + value: int """ A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). """ diff --git a/stripe/v2/billing/__init__.py b/stripe/v2/billing/__init__.py index b12001bac..92abc1912 100644 --- a/stripe/v2/billing/__init__.py +++ b/stripe/v2/billing/__init__.py @@ -6,6 +6,7 @@ if TYPE_CHECKING: from stripe.v2.billing import ( bill_settings as bill_settings, + cadences as cadences, collection_settings as collection_settings, intents as intents, license_fees as license_fees, @@ -24,6 +25,9 @@ from stripe.v2.billing._cadence_service import ( CadenceService as CadenceService, ) + from stripe.v2.billing._cadence_spend_modifier import ( + CadenceSpendModifier as CadenceSpendModifier, + ) from stripe.v2.billing._collection_setting import ( CollectionSetting as CollectionSetting, ) @@ -84,6 +88,10 @@ from stripe.v2.billing._metered_item_service import ( MeteredItemService as MeteredItemService, ) + from stripe.v2.billing._one_time_item import OneTimeItem as OneTimeItem + from stripe.v2.billing._one_time_item_service import ( + OneTimeItemService as OneTimeItemService, + ) from stripe.v2.billing._pricing_plan import PricingPlan as PricingPlan from stripe.v2.billing._pricing_plan_component import ( PricingPlanComponent as PricingPlanComponent, @@ -108,6 +116,9 @@ ProfileService as ProfileService, ) from stripe.v2.billing._rate_card import RateCard as RateCard + from stripe.v2.billing._rate_card_custom_pricing_unit_overage_rate import ( + RateCardCustomPricingUnitOverageRate as RateCardCustomPricingUnitOverageRate, + ) from stripe.v2.billing._rate_card_rate import RateCardRate as RateCardRate from stripe.v2.billing._rate_card_service import ( RateCardService as RateCardService, @@ -131,6 +142,7 @@ # name -> (import_target, is_submodule) _import_map = { "bill_settings": ("stripe.v2.billing.bill_settings", True), + "cadences": ("stripe.v2.billing.cadences", True), "collection_settings": ("stripe.v2.billing.collection_settings", True), "intents": ("stripe.v2.billing.intents", True), "license_fees": ("stripe.v2.billing.license_fees", True), @@ -145,6 +157,10 @@ "BillSettingVersion": ("stripe.v2.billing._bill_setting_version", False), "Cadence": ("stripe.v2.billing._cadence", False), "CadenceService": ("stripe.v2.billing._cadence_service", False), + "CadenceSpendModifier": ( + "stripe.v2.billing._cadence_spend_modifier", + False, + ), "CollectionSetting": ("stripe.v2.billing._collection_setting", False), "CollectionSettingService": ( "stripe.v2.billing._collection_setting_service", @@ -196,6 +212,8 @@ ), "MeteredItem": ("stripe.v2.billing._metered_item", False), "MeteredItemService": ("stripe.v2.billing._metered_item_service", False), + "OneTimeItem": ("stripe.v2.billing._one_time_item", False), + "OneTimeItemService": ("stripe.v2.billing._one_time_item_service", False), "PricingPlan": ("stripe.v2.billing._pricing_plan", False), "PricingPlanComponent": ( "stripe.v2.billing._pricing_plan_component", @@ -218,6 +236,10 @@ "Profile": ("stripe.v2.billing._profile", False), "ProfileService": ("stripe.v2.billing._profile_service", False), "RateCard": ("stripe.v2.billing._rate_card", False), + "RateCardCustomPricingUnitOverageRate": ( + "stripe.v2.billing._rate_card_custom_pricing_unit_overage_rate", + False, + ), "RateCardRate": ("stripe.v2.billing._rate_card_rate", False), "RateCardService": ("stripe.v2.billing._rate_card_service", False), "RateCardSubscription": ( diff --git a/stripe/v2/billing/_cadence.py b/stripe/v2/billing/_cadence.py index 5d0da463e..432ee224b 100644 --- a/stripe/v2/billing/_cadence.py +++ b/stripe/v2/billing/_cadence.py @@ -1,11 +1,8 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec from stripe._stripe_object import StripeObject -from typing import ClassVar, Dict, List, Optional -from typing_extensions import Literal, TYPE_CHECKING - -if TYPE_CHECKING: - from typing import Any +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Literal class Cadence(StripeObject): @@ -481,11 +478,11 @@ class Filters(StripeObject): """ This sub-hash contains details about the Bank transfer payment method options. """ - konbini: Optional[Dict[str, "Any"]] + konbini: Optional[Dict[str, Any]] """ This sub-hash contains details about the Konbini payment method options. """ - sepa_debit: Optional[Dict[str, "Any"]] + sepa_debit: Optional[Dict[str, Any]] """ This sub-hash contains details about the SEPA Direct Debit payment method options. """ diff --git a/stripe/v2/billing/_cadence_service.py b/stripe/v2/billing/_cadence_service.py index 51b8d56e2..1d766db90 100644 --- a/stripe/v2/billing/_cadence_service.py +++ b/stripe/v2/billing/_cadence_service.py @@ -3,6 +3,7 @@ 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: @@ -22,9 +23,40 @@ ) from stripe.v2._list_object import ListObject from stripe.v2.billing._cadence import Cadence + from stripe.v2.billing.cadences._spend_modifier_rule_service import ( + SpendModifierRuleService, + ) + +_subservices = { + "spend_modifier_rules": [ + "stripe.v2.billing.cadences._spend_modifier_rule_service", + "SpendModifierRuleService", + ], +} class CadenceService(StripeService): + spend_modifier_rules: "SpendModifierRuleService" + + 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["CadenceListParams"] = None, diff --git a/stripe/v2/billing/_cadence_spend_modifier.py b/stripe/v2/billing/_cadence_spend_modifier.py new file mode 100644 index 000000000..72c2e968b --- /dev/null +++ b/stripe/v2/billing/_cadence_spend_modifier.py @@ -0,0 +1,94 @@ +# -*- coding: utf-8 -*- +# File generated from our OpenAPI spec +from stripe._stripe_object import StripeObject +from typing import ClassVar, Optional +from typing_extensions import Literal + + +class CadenceSpendModifier(StripeObject): + """ + A Spend Modifier changes how spend is computed when billing for specific cadence. + """ + + OBJECT_NAME: ClassVar[Literal["v2.billing.cadence_spend_modifier"]] = ( + "v2.billing.cadence_spend_modifier" + ) + + class MaxBillingPeriodSpend(StripeObject): + class Amount(StripeObject): + class CustomPricingUnit(StripeObject): + value: str + """ + The decimal value of custom pricing units, represented as a string. + """ + + custom_pricing_unit: Optional[CustomPricingUnit] + """ + The custom pricing unit amount. Present if type is `custom_pricing_unit`. + """ + type: Literal["custom_pricing_unit"] + """ + The type of the spend modifier amount. + """ + _inner_class_types = {"custom_pricing_unit": CustomPricingUnit} + + class CustomPricingUnitOverageRate(StripeObject): + id: str + """ + ID of the custom pricing unit overage rate. + """ + + alert: str + """ + The billing alert associated with the maximum spend threshold. + """ + amount: Amount + """ + The maximum amount of invoice spend. + """ + custom_pricing_unit_overage_rate: CustomPricingUnitOverageRate + """ + The configuration for the overage rate for the custom pricing unit. + """ + effective_from: str + """ + The timestamp from which this spend modifier is effective. + """ + effective_until: Optional[str] + """ + The timestamp until which this spend modifier is effective. If not set, the modifier is effective indefinitely. + """ + _inner_class_types = { + "amount": Amount, + "custom_pricing_unit_overage_rate": CustomPricingUnitOverageRate, + } + + billing_cadence: str + """ + The ID of the Billing Cadence this spend modifier is associated with. + """ + created: str + """ + Timestamp of when the object was created. + """ + id: str + """ + Unique identifier for the object. + """ + livemode: bool + """ + Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. + """ + max_billing_period_spend: Optional[MaxBillingPeriodSpend] + """ + Max invoice spend details. Present if type is `max_billing_period_spend`. + """ + object: Literal["v2.billing.cadence_spend_modifier"] + """ + String representing the object's type. Objects of the same type share the same value of the object field. + """ + type: Literal["max_billing_period_spend"] + """ + The type of the spend modifier. + """ + _inner_class_types = {"max_billing_period_spend": MaxBillingPeriodSpend} diff --git a/stripe/v2/billing/_collection_setting.py b/stripe/v2/billing/_collection_setting.py index dba839329..3a9a369f7 100644 --- a/stripe/v2/billing/_collection_setting.py +++ b/stripe/v2/billing/_collection_setting.py @@ -1,11 +1,8 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec from stripe._stripe_object import StripeObject -from typing import ClassVar, Dict, List, Optional -from typing_extensions import Literal, TYPE_CHECKING - -if TYPE_CHECKING: - from typing import Any +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Literal class CollectionSetting(StripeObject): @@ -191,11 +188,11 @@ class Filters(StripeObject): """ This sub-hash contains details about the Bank transfer payment method options. """ - konbini: Optional[Dict[str, "Any"]] + konbini: Optional[Dict[str, Any]] """ This sub-hash contains details about the Konbini payment method options. """ - sepa_debit: Optional[Dict[str, "Any"]] + sepa_debit: Optional[Dict[str, Any]] """ This sub-hash contains details about the SEPA Direct Debit payment method options. """ diff --git a/stripe/v2/billing/_collection_setting_version.py b/stripe/v2/billing/_collection_setting_version.py index 0827e5e2a..663ff02cc 100644 --- a/stripe/v2/billing/_collection_setting_version.py +++ b/stripe/v2/billing/_collection_setting_version.py @@ -1,11 +1,8 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec from stripe._stripe_object import StripeObject -from typing import ClassVar, Dict, List, Optional -from typing_extensions import Literal, TYPE_CHECKING - -if TYPE_CHECKING: - from typing import Any +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Literal class CollectionSettingVersion(StripeObject): @@ -187,11 +184,11 @@ class Filters(StripeObject): """ This sub-hash contains details about the Bank transfer payment method options. """ - konbini: Optional[Dict[str, "Any"]] + konbini: Optional[Dict[str, Any]] """ This sub-hash contains details about the Konbini payment method options. """ - sepa_debit: Optional[Dict[str, "Any"]] + sepa_debit: Optional[Dict[str, Any]] """ This sub-hash contains details about the SEPA Direct Debit payment method options. """ diff --git a/stripe/v2/billing/_intent_action.py b/stripe/v2/billing/_intent_action.py index 9a1df9cc2..335ffbaca 100644 --- a/stripe/v2/billing/_intent_action.py +++ b/stripe/v2/billing/_intent_action.py @@ -11,6 +11,12 @@ class IntentAction(StripeObject): ) class Apply(StripeObject): + class EffectiveAt(StripeObject): + type: Literal["current_billing_period_end", "on_reserve"] + """ + When the apply action will take effect. + """ + class InvoiceDiscountRule(StripeObject): class PercentOff(StripeObject): class MaximumApplications(StripeObject): @@ -49,15 +55,87 @@ class MaximumApplications(StripeObject): """ _inner_class_types = {"percent_off": PercentOff} + class SpendModifierRule(StripeObject): + class MaxBillingPeriodSpend(StripeObject): + class Amount(StripeObject): + class CustomPricingUnit(StripeObject): + value: str + """ + The value of the custom pricing unit. + """ + + custom_pricing_unit: Optional[CustomPricingUnit] + """ + The custom pricing unit amount. + """ + type: Literal["custom_pricing_unit"] + """ + The type of the amount. + """ + _inner_class_types = { + "custom_pricing_unit": CustomPricingUnit, + } + + class CustomPricingUnitOverageRate(StripeObject): + id: str + """ + ID of the custom pricing unit overage rate. + """ + + amount: Amount + """ + The maximum amount allowed for the billing period. + """ + custom_pricing_unit_overage_rate: CustomPricingUnitOverageRate + """ + The configration for the overage rate for the custom pricing unit. + """ + _inner_class_types = { + "amount": Amount, + "custom_pricing_unit_overage_rate": CustomPricingUnitOverageRate, + } + + applies_to: Literal["cadence"] + """ + What the spend modifier applies to. + """ + id: str + """ + The ID of the spend modifier. + """ + max_billing_period_spend: Optional[MaxBillingPeriodSpend] + """ + Details for max billing period spend modifier. Only present if type is max_billing_period_spend. + """ + type: Literal["max_billing_period_spend"] + """ + Type of the spend modifier. + """ + _inner_class_types = { + "max_billing_period_spend": MaxBillingPeriodSpend, + } + + effective_at: Optional[EffectiveAt] + """ + When the apply action will take effect. Defaults to on_reserve if not specified. + """ invoice_discount_rule: Optional[InvoiceDiscountRule] """ Details for applying a discount rule to future invoices. """ - type: Literal["invoice_discount_rule"] + spend_modifier_rule: Optional[SpendModifierRule] + """ + Details for applying a spend modifier rule. Only present if type is spend_modifier_rule. + """ + type: Literal["invoice_discount_rule", "spend_modifier_rule"] """ Type of the apply action details. """ - _inner_class_types = {"invoice_discount_rule": InvoiceDiscountRule} + _inner_class_types = { + "effective_at": EffectiveAt, + "invoice_discount_rule": InvoiceDiscountRule, + "spend_modifier_rule": SpendModifierRule, + } class Deactivate(StripeObject): class CancellationDetails(StripeObject): @@ -272,14 +350,29 @@ class LicenseFee(StripeObject): } class Remove(StripeObject): + class EffectiveAt(StripeObject): + type: Literal["current_billing_period_end", "on_reserve"] + """ + When the remove action will take effect. + """ + + effective_at: Optional[EffectiveAt] + """ + When the remove action will take effect. Defaults to on_reserve if not specified. + """ invoice_discount_rule: Optional[str] """ The ID of the discount rule to remove for future invoices. """ - type: Literal["invoice_discount_rule"] + spend_modifier_rule: Optional[str] + """ + The ID of the spend modifier rule removed. + """ + type: Literal["invoice_discount_rule", "spend_modifier_rule"] """ Type of the remove action. """ + _inner_class_types = {"effective_at": EffectiveAt} class Subscribe(StripeObject): class EffectiveAt(StripeObject): diff --git a/stripe/v2/billing/_one_time_item.py b/stripe/v2/billing/_one_time_item.py new file mode 100644 index 000000000..d99acdbc4 --- /dev/null +++ b/stripe/v2/billing/_one_time_item.py @@ -0,0 +1,64 @@ +# -*- 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 OneTimeItem(StripeObject): + """ + A one-time item represents a product that can be charged as a one-time line item, + used for overage charges when custom pricing unit credits are exhausted. + """ + + OBJECT_NAME: ClassVar[Literal["v2.billing.one_time_item"]] = ( + "v2.billing.one_time_item" + ) + + class TaxDetails(StripeObject): + tax_code: str + """ + Product tax code (PTC). + """ + + created: str + """ + Timestamp of when the object was created. + """ + display_name: str + """ + Description that customers will see in the invoice line item. + Maximum length of 250 characters. + """ + id: str + """ + Unique identifier for the object. + """ + livemode: bool + """ + Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. + """ + lookup_key: Optional[str] + """ + An internal key you can use to search for a particular one-time item. + Maximum length of 200 characters. + """ + metadata: Optional[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. + """ + object: Literal["v2.billing.one_time_item"] + """ + String representing the object's type. Objects of the same type share the same value of the object field. + """ + tax_details: Optional[TaxDetails] + """ + Stripe Tax details. + """ + unit_label: Optional[str] + """ + The unit to use when displaying prices for this one-time item. For example, set this field + to "credit" for the display to show "(price) per credit". + Maximum length of 100 characters. + """ + _inner_class_types = {"tax_details": TaxDetails} diff --git a/stripe/v2/billing/_one_time_item_service.py b/stripe/v2/billing/_one_time_item_service.py new file mode 100644 index 000000000..2b12e2057 --- /dev/null +++ b/stripe/v2/billing/_one_time_item_service.py @@ -0,0 +1,181 @@ +# -*- 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._one_time_item_create_params import ( + OneTimeItemCreateParams, + ) + from stripe.params.v2.billing._one_time_item_list_params import ( + OneTimeItemListParams, + ) + from stripe.params.v2.billing._one_time_item_retrieve_params import ( + OneTimeItemRetrieveParams, + ) + from stripe.params.v2.billing._one_time_item_update_params import ( + OneTimeItemUpdateParams, + ) + from stripe.v2._list_object import ListObject + from stripe.v2.billing._one_time_item import OneTimeItem + + +class OneTimeItemService(StripeService): + def list( + self, + params: Optional["OneTimeItemListParams"] = None, + options: Optional["RequestOptions"] = None, + ) -> "ListObject[OneTimeItem]": + """ + List all One-Time Item objects in reverse chronological order of creation. + """ + return cast( + "ListObject[OneTimeItem]", + self._request( + "get", + "/v2/billing/one_time_items", + base_address="api", + params=params, + options=options, + ), + ) + + async def list_async( + self, + params: Optional["OneTimeItemListParams"] = None, + options: Optional["RequestOptions"] = None, + ) -> "ListObject[OneTimeItem]": + """ + List all One-Time Item objects in reverse chronological order of creation. + """ + return cast( + "ListObject[OneTimeItem]", + await self._request_async( + "get", + "/v2/billing/one_time_items", + base_address="api", + params=params, + options=options, + ), + ) + + def create( + self, + params: "OneTimeItemCreateParams", + options: Optional["RequestOptions"] = None, + ) -> "OneTimeItem": + """ + Create a One-Time Item object. + """ + return cast( + "OneTimeItem", + self._request( + "post", + "/v2/billing/one_time_items", + base_address="api", + params=params, + options=options, + ), + ) + + async def create_async( + self, + params: "OneTimeItemCreateParams", + options: Optional["RequestOptions"] = None, + ) -> "OneTimeItem": + """ + Create a One-Time Item object. + """ + return cast( + "OneTimeItem", + await self._request_async( + "post", + "/v2/billing/one_time_items", + base_address="api", + params=params, + options=options, + ), + ) + + def retrieve( + self, + id: str, + params: Optional["OneTimeItemRetrieveParams"] = None, + options: Optional["RequestOptions"] = None, + ) -> "OneTimeItem": + """ + Retrieve a One-Time Item object. + """ + return cast( + "OneTimeItem", + self._request( + "get", + "/v2/billing/one_time_items/{id}".format(id=sanitize_id(id)), + base_address="api", + params=params, + options=options, + ), + ) + + async def retrieve_async( + self, + id: str, + params: Optional["OneTimeItemRetrieveParams"] = None, + options: Optional["RequestOptions"] = None, + ) -> "OneTimeItem": + """ + Retrieve a One-Time Item object. + """ + return cast( + "OneTimeItem", + await self._request_async( + "get", + "/v2/billing/one_time_items/{id}".format(id=sanitize_id(id)), + base_address="api", + params=params, + options=options, + ), + ) + + def update( + self, + id: str, + params: Optional["OneTimeItemUpdateParams"] = None, + options: Optional["RequestOptions"] = None, + ) -> "OneTimeItem": + """ + Update a One-Time Item object. + """ + return cast( + "OneTimeItem", + self._request( + "post", + "/v2/billing/one_time_items/{id}".format(id=sanitize_id(id)), + base_address="api", + params=params, + options=options, + ), + ) + + async def update_async( + self, + id: str, + params: Optional["OneTimeItemUpdateParams"] = None, + options: Optional["RequestOptions"] = None, + ) -> "OneTimeItem": + """ + Update a One-Time Item object. + """ + return cast( + "OneTimeItem", + await self._request_async( + "post", + "/v2/billing/one_time_items/{id}".format(id=sanitize_id(id)), + base_address="api", + params=params, + options=options, + ), + ) diff --git a/stripe/v2/billing/_rate_card_custom_pricing_unit_overage_rate.py b/stripe/v2/billing/_rate_card_custom_pricing_unit_overage_rate.py new file mode 100644 index 000000000..84d1a7293 --- /dev/null +++ b/stripe/v2/billing/_rate_card_custom_pricing_unit_overage_rate.py @@ -0,0 +1,61 @@ +# -*- 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, TYPE_CHECKING + +if TYPE_CHECKING: + from stripe.v2.billing._one_time_item import OneTimeItem + + +class RateCardCustomPricingUnitOverageRate(StripeObject): + """ + A rate card custom pricing unit overage rate defines the conversion rate from a custom pricing unit + to fiat currency when credits are exhausted. This enables automatic overage charges + at a configurable per-unit rate. + """ + + OBJECT_NAME: ClassVar[ + Literal["v2.billing.rate_card_custom_pricing_unit_overage_rate"] + ] = "v2.billing.rate_card_custom_pricing_unit_overage_rate" + created: str + """ + Timestamp of when the object was created. + """ + custom_pricing_unit: str + """ + The ID of the custom pricing unit this overage rate applies to. + """ + id: str + """ + Unique identifier for the object. + """ + livemode: bool + """ + Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. + """ + metadata: Optional[Dict[str, str]] + """ + Set of [key-value pairs](https://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. + """ + object: Literal["v2.billing.rate_card_custom_pricing_unit_overage_rate"] + """ + String representing the object's type. Objects of the same type share the same value of the object field. + """ + one_time_item: "OneTimeItem" + """ + A one-time item represents a product that can be charged as a one-time line item, + used for overage charges when custom pricing unit credits are exhausted. + """ + rate_card: str + """ + The ID of the Rate Card this overage rate belongs to. + """ + rate_card_version: str + """ + The ID of the Rate Card Version this overage rate was created on. + """ + unit_amount: str + """ + The per-unit amount to charge for overages, represented as a decimal string in minor currency units with at most 12 decimal places. + """ diff --git a/stripe/v2/billing/_rate_card_service.py b/stripe/v2/billing/_rate_card_service.py index efb5f5083..a0033ad69 100644 --- a/stripe/v2/billing/_rate_card_service.py +++ b/stripe/v2/billing/_rate_card_service.py @@ -22,10 +22,17 @@ ) from stripe.v2._list_object import ListObject from stripe.v2.billing._rate_card import RateCard + from stripe.v2.billing.rate_cards._custom_pricing_unit_overage_rate_service import ( + CustomPricingUnitOverageRateService, + ) from stripe.v2.billing.rate_cards._rate_service import RateService from stripe.v2.billing.rate_cards._version_service import VersionService _subservices = { + "custom_pricing_unit_overage_rates": [ + "stripe.v2.billing.rate_cards._custom_pricing_unit_overage_rate_service", + "CustomPricingUnitOverageRateService", + ], "rates": ["stripe.v2.billing.rate_cards._rate_service", "RateService"], "versions": [ "stripe.v2.billing.rate_cards._version_service", @@ -35,6 +42,7 @@ class RateCardService(StripeService): + custom_pricing_unit_overage_rates: "CustomPricingUnitOverageRateService" rates: "RateService" versions: "VersionService" diff --git a/stripe/v2/billing/_service_action.py b/stripe/v2/billing/_service_action.py index f6edc50d4..309d70a20 100644 --- a/stripe/v2/billing/_service_action.py +++ b/stripe/v2/billing/_service_action.py @@ -34,11 +34,11 @@ class CustomPricingUnit(StripeObject): """ class Monetary(StripeObject): - currency: Optional[str] + 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: Optional[int] + value: int """ A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). """ @@ -132,11 +132,11 @@ class CustomPricingUnit(StripeObject): """ class Monetary(StripeObject): - currency: Optional[str] + 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: Optional[int] + value: int """ A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). """ diff --git a/stripe/v2/billing/cadences/__init__.py b/stripe/v2/billing/cadences/__init__.py new file mode 100644 index 000000000..e9ecf4ad8 --- /dev/null +++ b/stripe/v2/billing/cadences/__init__.py @@ -0,0 +1,32 @@ +# -*- 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.cadences._spend_modifier_rule_service import ( + SpendModifierRuleService as SpendModifierRuleService, + ) + +# name -> (import_target, is_submodule) +_import_map = { + "SpendModifierRuleService": ( + "stripe.v2.billing.cadences._spend_modifier_rule_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/cadences/_spend_modifier_rule_service.py b/stripe/v2/billing/cadences/_spend_modifier_rule_service.py new file mode 100644 index 000000000..a7cc3e868 --- /dev/null +++ b/stripe/v2/billing/cadences/_spend_modifier_rule_service.py @@ -0,0 +1,111 @@ +# -*- 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.cadences._spend_modifier_rule_list_params import ( + SpendModifierRuleListParams, + ) + from stripe.params.v2.billing.cadences._spend_modifier_rule_retrieve_params import ( + SpendModifierRuleRetrieveParams, + ) + from stripe.v2._list_object import ListObject + from stripe.v2.billing._cadence_spend_modifier import CadenceSpendModifier + + +class SpendModifierRuleService(StripeService): + def list( + self, + cadence_id: str, + params: Optional["SpendModifierRuleListParams"] = None, + options: Optional["RequestOptions"] = None, + ) -> "ListObject[CadenceSpendModifier]": + """ + List all Spend Modifiers associated with a Billing Cadence. + """ + return cast( + "ListObject[CadenceSpendModifier]", + self._request( + "get", + "/v2/billing/cadences/{cadence_id}/spend_modifier_rules".format( + cadence_id=sanitize_id(cadence_id), + ), + base_address="api", + params=params, + options=options, + ), + ) + + async def list_async( + self, + cadence_id: str, + params: Optional["SpendModifierRuleListParams"] = None, + options: Optional["RequestOptions"] = None, + ) -> "ListObject[CadenceSpendModifier]": + """ + List all Spend Modifiers associated with a Billing Cadence. + """ + return cast( + "ListObject[CadenceSpendModifier]", + await self._request_async( + "get", + "/v2/billing/cadences/{cadence_id}/spend_modifier_rules".format( + cadence_id=sanitize_id(cadence_id), + ), + base_address="api", + params=params, + options=options, + ), + ) + + def retrieve( + self, + cadence_id: str, + id: str, + params: Optional["SpendModifierRuleRetrieveParams"] = None, + options: Optional["RequestOptions"] = None, + ) -> "CadenceSpendModifier": + """ + Retrieve a Spend Modifier associated with a Billing Cadence. + """ + return cast( + "CadenceSpendModifier", + self._request( + "get", + "/v2/billing/cadences/{cadence_id}/spend_modifier_rules/{id}".format( + cadence_id=sanitize_id(cadence_id), + id=sanitize_id(id), + ), + base_address="api", + params=params, + options=options, + ), + ) + + async def retrieve_async( + self, + cadence_id: str, + id: str, + params: Optional["SpendModifierRuleRetrieveParams"] = None, + options: Optional["RequestOptions"] = None, + ) -> "CadenceSpendModifier": + """ + Retrieve a Spend Modifier associated with a Billing Cadence. + """ + return cast( + "CadenceSpendModifier", + await self._request_async( + "get", + "/v2/billing/cadences/{cadence_id}/spend_modifier_rules/{id}".format( + cadence_id=sanitize_id(cadence_id), + id=sanitize_id(id), + ), + base_address="api", + params=params, + options=options, + ), + ) diff --git a/stripe/v2/billing/rate_cards/__init__.py b/stripe/v2/billing/rate_cards/__init__.py index c11402d57..57021256d 100644 --- a/stripe/v2/billing/rate_cards/__init__.py +++ b/stripe/v2/billing/rate_cards/__init__.py @@ -4,6 +4,9 @@ from typing_extensions import TYPE_CHECKING if TYPE_CHECKING: + from stripe.v2.billing.rate_cards._custom_pricing_unit_overage_rate_service import ( + CustomPricingUnitOverageRateService as CustomPricingUnitOverageRateService, + ) from stripe.v2.billing.rate_cards._rate_service import ( RateService as RateService, ) @@ -13,6 +16,10 @@ # name -> (import_target, is_submodule) _import_map = { + "CustomPricingUnitOverageRateService": ( + "stripe.v2.billing.rate_cards._custom_pricing_unit_overage_rate_service", + False, + ), "RateService": ("stripe.v2.billing.rate_cards._rate_service", False), "VersionService": ("stripe.v2.billing.rate_cards._version_service", False), } diff --git a/stripe/v2/billing/rate_cards/_custom_pricing_unit_overage_rate_service.py b/stripe/v2/billing/rate_cards/_custom_pricing_unit_overage_rate_service.py new file mode 100644 index 000000000..e82e4ed62 --- /dev/null +++ b/stripe/v2/billing/rate_cards/_custom_pricing_unit_overage_rate_service.py @@ -0,0 +1,212 @@ +# -*- 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.rate_cards._custom_pricing_unit_overage_rate_create_params import ( + CustomPricingUnitOverageRateCreateParams, + ) + from stripe.params.v2.billing.rate_cards._custom_pricing_unit_overage_rate_delete_params import ( + CustomPricingUnitOverageRateDeleteParams, + ) + from stripe.params.v2.billing.rate_cards._custom_pricing_unit_overage_rate_list_params import ( + CustomPricingUnitOverageRateListParams, + ) + from stripe.params.v2.billing.rate_cards._custom_pricing_unit_overage_rate_retrieve_params import ( + CustomPricingUnitOverageRateRetrieveParams, + ) + from stripe.v2._deleted_object import DeletedObject + from stripe.v2._list_object import ListObject + from stripe.v2.billing._rate_card_custom_pricing_unit_overage_rate import ( + RateCardCustomPricingUnitOverageRate, + ) + + +class CustomPricingUnitOverageRateService(StripeService): + def list( + self, + rate_card_id: str, + params: Optional["CustomPricingUnitOverageRateListParams"] = None, + options: Optional["RequestOptions"] = None, + ) -> "ListObject[RateCardCustomPricingUnitOverageRate]": + """ + List all Rate Card Custom Pricing Unit Overage Rates on a Rate Card. + """ + return cast( + "ListObject[RateCardCustomPricingUnitOverageRate]", + self._request( + "get", + "/v2/billing/rate_cards/{rate_card_id}/custom_pricing_unit_overage_rates".format( + rate_card_id=sanitize_id(rate_card_id), + ), + base_address="api", + params=params, + options=options, + ), + ) + + async def list_async( + self, + rate_card_id: str, + params: Optional["CustomPricingUnitOverageRateListParams"] = None, + options: Optional["RequestOptions"] = None, + ) -> "ListObject[RateCardCustomPricingUnitOverageRate]": + """ + List all Rate Card Custom Pricing Unit Overage Rates on a Rate Card. + """ + return cast( + "ListObject[RateCardCustomPricingUnitOverageRate]", + await self._request_async( + "get", + "/v2/billing/rate_cards/{rate_card_id}/custom_pricing_unit_overage_rates".format( + rate_card_id=sanitize_id(rate_card_id), + ), + base_address="api", + params=params, + options=options, + ), + ) + + def create( + self, + rate_card_id: str, + params: "CustomPricingUnitOverageRateCreateParams", + options: Optional["RequestOptions"] = None, + ) -> "RateCardCustomPricingUnitOverageRate": + """ + Create a Rate Card Custom Pricing Unit Overage Rate on a Rate Card. + """ + return cast( + "RateCardCustomPricingUnitOverageRate", + self._request( + "post", + "/v2/billing/rate_cards/{rate_card_id}/custom_pricing_unit_overage_rates".format( + rate_card_id=sanitize_id(rate_card_id), + ), + base_address="api", + params=params, + options=options, + ), + ) + + async def create_async( + self, + rate_card_id: str, + params: "CustomPricingUnitOverageRateCreateParams", + options: Optional["RequestOptions"] = None, + ) -> "RateCardCustomPricingUnitOverageRate": + """ + Create a Rate Card Custom Pricing Unit Overage Rate on a Rate Card. + """ + return cast( + "RateCardCustomPricingUnitOverageRate", + await self._request_async( + "post", + "/v2/billing/rate_cards/{rate_card_id}/custom_pricing_unit_overage_rates".format( + rate_card_id=sanitize_id(rate_card_id), + ), + base_address="api", + params=params, + options=options, + ), + ) + + def delete( + self, + rate_card_id: str, + id: str, + params: Optional["CustomPricingUnitOverageRateDeleteParams"] = None, + options: Optional["RequestOptions"] = None, + ) -> "DeletedObject": + """ + Delete a Rate Card Custom Pricing Unit Overage Rate from a Rate Card. + """ + return cast( + "DeletedObject", + self._request( + "delete", + "/v2/billing/rate_cards/{rate_card_id}/custom_pricing_unit_overage_rates/{id}".format( + rate_card_id=sanitize_id(rate_card_id), + id=sanitize_id(id), + ), + base_address="api", + params=params, + options=options, + ), + ) + + async def delete_async( + self, + rate_card_id: str, + id: str, + params: Optional["CustomPricingUnitOverageRateDeleteParams"] = None, + options: Optional["RequestOptions"] = None, + ) -> "DeletedObject": + """ + Delete a Rate Card Custom Pricing Unit Overage Rate from a Rate Card. + """ + return cast( + "DeletedObject", + await self._request_async( + "delete", + "/v2/billing/rate_cards/{rate_card_id}/custom_pricing_unit_overage_rates/{id}".format( + rate_card_id=sanitize_id(rate_card_id), + id=sanitize_id(id), + ), + base_address="api", + params=params, + options=options, + ), + ) + + def retrieve( + self, + rate_card_id: str, + id: str, + params: Optional["CustomPricingUnitOverageRateRetrieveParams"] = None, + options: Optional["RequestOptions"] = None, + ) -> "RateCardCustomPricingUnitOverageRate": + """ + Retrieve a Rate Card Custom Pricing Unit Overage Rate from a Rate Card. + """ + return cast( + "RateCardCustomPricingUnitOverageRate", + self._request( + "get", + "/v2/billing/rate_cards/{rate_card_id}/custom_pricing_unit_overage_rates/{id}".format( + rate_card_id=sanitize_id(rate_card_id), + id=sanitize_id(id), + ), + base_address="api", + params=params, + options=options, + ), + ) + + async def retrieve_async( + self, + rate_card_id: str, + id: str, + params: Optional["CustomPricingUnitOverageRateRetrieveParams"] = None, + options: Optional["RequestOptions"] = None, + ) -> "RateCardCustomPricingUnitOverageRate": + """ + Retrieve a Rate Card Custom Pricing Unit Overage Rate from a Rate Card. + """ + return cast( + "RateCardCustomPricingUnitOverageRate", + await self._request_async( + "get", + "/v2/billing/rate_cards/{rate_card_id}/custom_pricing_unit_overage_rates/{id}".format( + rate_card_id=sanitize_id(rate_card_id), + id=sanitize_id(id), + ), + base_address="api", + params=params, + options=options, + ), + ) diff --git a/stripe/v2/core/_account.py b/stripe/v2/core/_account.py index ab275850c..3e0558401 100644 --- a/stripe/v2/core/_account.py +++ b/stripe/v2/core/_account.py @@ -4852,11 +4852,11 @@ class Address(StripeObject): class AnnualRevenue(StripeObject): class Amount(StripeObject): - currency: Optional[str] + 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: Optional[int] + value: int """ A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). """ @@ -5172,11 +5172,11 @@ class IdNumber(StripeObject): class MonthlyEstimatedRevenue(StripeObject): class Amount(StripeObject): - currency: Optional[str] + 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: Optional[int] + value: int """ A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). """ diff --git a/stripe/v2/core/_event.py b/stripe/v2/core/_event.py index 3dd7b960e..ba994c3cd 100644 --- a/stripe/v2/core/_event.py +++ b/stripe/v2/core/_event.py @@ -52,7 +52,7 @@ class DashboardUser(StripeObject): """ Dashboard user that triggered the event. """ - stripe_action: Optional[Dict[str, "Any"]] + stripe_action: Optional[Dict[str, Any]] """ Stripe action that triggered the event. """ @@ -89,7 +89,7 @@ class DashboardUser(StripeObject): """ _inner_class_types = {"request": Request} - changes: Optional[Dict[str, "Any"]] + changes: Optional[Dict[str, Any]] """ Before and after changes for the primary related object. """ diff --git a/stripe/v2/money_management/_adjustment.py b/stripe/v2/money_management/_adjustment.py index f35b47276..910857a63 100644 --- a/stripe/v2/money_management/_adjustment.py +++ b/stripe/v2/money_management/_adjustment.py @@ -54,11 +54,11 @@ class AdjustedFlow(StripeObject): """ class Amount(StripeObject): - currency: Optional[str] + 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: Optional[int] + value: int """ A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). """ diff --git a/stripe/v2/money_management/_currency_conversion.py b/stripe/v2/money_management/_currency_conversion.py index fce13f58e..517c74e39 100644 --- a/stripe/v2/money_management/_currency_conversion.py +++ b/stripe/v2/money_management/_currency_conversion.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 from typing_extensions import Literal @@ -16,11 +16,11 @@ class CurrencyConversion(StripeObject): class From(StripeObject): class Amount(StripeObject): - currency: Optional[str] + 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: Optional[int] + value: int """ A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). """ @@ -33,11 +33,11 @@ class Amount(StripeObject): class To(StripeObject): class Amount(StripeObject): - currency: Optional[str] + 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: Optional[int] + value: int """ A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). """ diff --git a/stripe/v2/money_management/_financial_account.py b/stripe/v2/money_management/_financial_account.py index 260358479..27e4c96e2 100644 --- a/stripe/v2/money_management/_financial_account.py +++ b/stripe/v2/money_management/_financial_account.py @@ -26,31 +26,31 @@ class AccruedFees(StripeObject): class Balance(StripeObject): class Available(StripeObject): - currency: Optional[str] + 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: Optional[int] + 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: Optional[str] + 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: Optional[int] + 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: Optional[str] + 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: Optional[int] + value: int """ A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). """ @@ -93,11 +93,11 @@ class Other(StripeObject): class Payments(StripeObject): class StartingBalance(StripeObject): class Available(StripeObject): - currency: Optional[str] + 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: Optional[int] + value: int """ A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). """ diff --git a/stripe/v2/money_management/_inbound_transfer.py b/stripe/v2/money_management/_inbound_transfer.py index 46f80f32e..463523c93 100644 --- a/stripe/v2/money_management/_inbound_transfer.py +++ b/stripe/v2/money_management/_inbound_transfer.py @@ -1,11 +1,8 @@ # -*- coding: utf-8 -*- # File generated from our OpenAPI spec from stripe._stripe_object import StripeObject -from typing import ClassVar, Dict, List, Optional -from typing_extensions import Literal, TYPE_CHECKING - -if TYPE_CHECKING: - from typing import Any +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Literal class InboundTransfer(StripeObject): @@ -19,22 +16,22 @@ class InboundTransfer(StripeObject): ) class Amount(StripeObject): - currency: Optional[str] + 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: Optional[int] + 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: Optional[str] + 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: Optional[int] + value: int """ A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). """ @@ -64,11 +61,11 @@ class PaymentMethod(StripeObject): class To(StripeObject): class Credited(StripeObject): - currency: Optional[str] + 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: Optional[int] + value: int """ A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). """ @@ -112,11 +109,11 @@ class BankDebitReturned(StripeObject): """ The history entry for a failed InboundTransfer. """ - bank_debit_processing: Optional[Dict[str, "Any"]] + bank_debit_processing: Optional[Dict[str, Any]] """ The history entry for a processing InboundTransfer. """ - bank_debit_queued: Optional[Dict[str, "Any"]] + bank_debit_queued: Optional[Dict[str, Any]] """ The history entry for a queued InboundTransfer. """ @@ -124,7 +121,7 @@ class BankDebitReturned(StripeObject): """ The history entry for a returned InboundTransfer. """ - bank_debit_succeeded: Optional[Dict[str, "Any"]] + bank_debit_succeeded: Optional[Dict[str, Any]] """ The history entry for a succeeded InboundTransfer. """ diff --git a/stripe/v2/money_management/_outbound_payment.py b/stripe/v2/money_management/_outbound_payment.py index 8dc110909..13cb86807 100644 --- a/stripe/v2/money_management/_outbound_payment.py +++ b/stripe/v2/money_management/_outbound_payment.py @@ -15,11 +15,11 @@ class OutboundPayment(StripeObject): ) class Amount(StripeObject): - currency: Optional[str] + 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: Optional[int] + value: int """ A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). """ @@ -55,11 +55,11 @@ class PaperCheck(StripeObject): class From(StripeObject): class Debited(StripeObject): - currency: Optional[str] + 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: Optional[int] + value: int """ A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). """ @@ -147,11 +147,11 @@ class StatusTransitions(StripeObject): class To(StripeObject): class Credited(StripeObject): - currency: Optional[str] + 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: Optional[int] + value: int """ A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). """ diff --git a/stripe/v2/money_management/_outbound_payment_quote.py b/stripe/v2/money_management/_outbound_payment_quote.py index 25a7adb1e..c6b220005 100644 --- a/stripe/v2/money_management/_outbound_payment_quote.py +++ b/stripe/v2/money_management/_outbound_payment_quote.py @@ -15,11 +15,11 @@ class OutboundPaymentQuote(StripeObject): ] = "v2.money_management.outbound_payment_quote" class Amount(StripeObject): - currency: Optional[str] + 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: Optional[int] + value: int """ A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). """ @@ -36,11 +36,11 @@ class DeliveryOptions(StripeObject): class EstimatedFee(StripeObject): class Amount(StripeObject): - currency: Optional[str] + 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: Optional[int] + value: int """ A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). """ @@ -64,11 +64,11 @@ class Amount(StripeObject): class From(StripeObject): class Debited(StripeObject): - currency: Optional[str] + 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: Optional[int] + value: int """ A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). """ @@ -115,11 +115,11 @@ class Rates(StripeObject): class To(StripeObject): class Credited(StripeObject): - currency: Optional[str] + 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: Optional[int] + value: int """ A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). """ diff --git a/stripe/v2/money_management/_outbound_transfer.py b/stripe/v2/money_management/_outbound_transfer.py index d0c143bed..d12358d74 100644 --- a/stripe/v2/money_management/_outbound_transfer.py +++ b/stripe/v2/money_management/_outbound_transfer.py @@ -15,11 +15,11 @@ class OutboundTransfer(StripeObject): ) class Amount(StripeObject): - currency: Optional[str] + 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: Optional[int] + value: int """ A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). """ @@ -32,11 +32,11 @@ class DeliveryOptions(StripeObject): class From(StripeObject): class Debited(StripeObject): - currency: Optional[str] + 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: Optional[int] + value: int """ A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). """ @@ -117,11 +117,11 @@ class StatusTransitions(StripeObject): class To(StripeObject): class Credited(StripeObject): - currency: Optional[str] + 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: Optional[int] + value: int """ A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). """ diff --git a/stripe/v2/money_management/_received_credit.py b/stripe/v2/money_management/_received_credit.py index 9be26624e..e965d05a2 100644 --- a/stripe/v2/money_management/_received_credit.py +++ b/stripe/v2/money_management/_received_credit.py @@ -15,11 +15,11 @@ class ReceivedCredit(StripeObject): ) class Amount(StripeObject): - currency: Optional[str] + 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: Optional[int] + value: int """ A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). """ @@ -179,11 +179,11 @@ class Refund(StripeObject): _inner_class_types = {"dispute": Dispute, "refund": Refund} class ExternalAmount(StripeObject): - currency: Optional[str] + 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: Optional[int] + value: int """ A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). """ diff --git a/stripe/v2/money_management/_received_debit.py b/stripe/v2/money_management/_received_debit.py index f15f5e95a..3d887c5fd 100644 --- a/stripe/v2/money_management/_received_debit.py +++ b/stripe/v2/money_management/_received_debit.py @@ -15,11 +15,11 @@ class ReceivedDebit(StripeObject): ) class Amount(StripeObject): - currency: Optional[str] + 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: Optional[int] + value: int """ A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). """ @@ -74,11 +74,11 @@ class UsBankAccount(StripeObject): class CardSpend(StripeObject): class Authorization(StripeObject): class Amount(StripeObject): - currency: Optional[str] + 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: Optional[int] + value: int """ A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). """ @@ -95,11 +95,11 @@ class Amount(StripeObject): class CardTransaction(StripeObject): class Amount(StripeObject): - currency: Optional[str] + 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: Optional[int] + value: int """ A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). """ @@ -132,11 +132,11 @@ class Amount(StripeObject): } class ExternalAmount(StripeObject): - currency: Optional[str] + 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: Optional[int] + value: int """ A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). """ diff --git a/stripe/v2/money_management/_transaction.py b/stripe/v2/money_management/_transaction.py index e8592e088..69af76c87 100644 --- a/stripe/v2/money_management/_transaction.py +++ b/stripe/v2/money_management/_transaction.py @@ -15,42 +15,42 @@ class Transaction(StripeObject): ) class Amount(StripeObject): - currency: Optional[str] + 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: Optional[int] + 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: Optional[str] + 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: Optional[int] + 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: Optional[str] + 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: Optional[int] + 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: Optional[str] + 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: Optional[int] + value: int """ A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). """ diff --git a/stripe/v2/money_management/_transaction_entry.py b/stripe/v2/money_management/_transaction_entry.py index 9f41cf77b..9fe1468c4 100644 --- a/stripe/v2/money_management/_transaction_entry.py +++ b/stripe/v2/money_management/_transaction_entry.py @@ -16,31 +16,31 @@ class TransactionEntry(StripeObject): class BalanceImpact(StripeObject): class Available(StripeObject): - currency: Optional[str] + 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: Optional[int] + 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: Optional[str] + 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: Optional[int] + 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: Optional[str] + 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: Optional[int] + value: int """ A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). """ diff --git a/stripe/v2/payments/_off_session_payment.py b/stripe/v2/payments/_off_session_payment.py index 5f8e9783d..f2819b26d 100644 --- a/stripe/v2/payments/_off_session_payment.py +++ b/stripe/v2/payments/_off_session_payment.py @@ -15,21 +15,21 @@ class OffSessionPayment(StripeObject): ) class AmountCapturable(StripeObject): - currency: Optional[str] + 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: Optional[int] + 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: Optional[str] + 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: Optional[int] + value: int """ A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). """ diff --git a/stripe/v2/payments/_settlement_allocation_intent.py b/stripe/v2/payments/_settlement_allocation_intent.py index a44046250..1f3a3c171 100644 --- a/stripe/v2/payments/_settlement_allocation_intent.py +++ b/stripe/v2/payments/_settlement_allocation_intent.py @@ -15,11 +15,11 @@ class SettlementAllocationIntent(StripeObject): ] = "v2.payments.settlement_allocation_intent" class Amount(StripeObject): - currency: Optional[str] + 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: Optional[int] + value: int """ A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). """ diff --git a/stripe/v2/payments/_settlement_allocation_intent_split.py b/stripe/v2/payments/_settlement_allocation_intent_split.py index a1daf6e54..576c4b859 100644 --- a/stripe/v2/payments/_settlement_allocation_intent_split.py +++ b/stripe/v2/payments/_settlement_allocation_intent_split.py @@ -15,11 +15,11 @@ class SettlementAllocationIntentSplit(StripeObject): ] = "v2.payments.settlement_allocation_intent_split" class Amount(StripeObject): - currency: Optional[str] + 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: Optional[int] + value: int """ A non-negative integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#minor-units). """ diff --git a/stripe/v2/reporting/_report_run.py b/stripe/v2/reporting/_report_run.py index 2962e4962..9a604d9c0 100644 --- a/stripe/v2/reporting/_report_run.py +++ b/stripe/v2/reporting/_report_run.py @@ -1,11 +1,8 @@ # -*- 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, TYPE_CHECKING - -if TYPE_CHECKING: - from typing import Any +from typing import Any, ClassVar, Dict, Optional +from typing_extensions import Literal class ReportRun(StripeObject): @@ -99,7 +96,7 @@ class StatusDetails(StripeObject): """ The human-readable name of the `Report` which was run. """ - report_parameters: Dict[str, "Any"] + report_parameters: Dict[str, Any] """ The parameters used to customize the generation of the report. """ diff --git a/tests/test_generated_examples.py b/tests/test_generated_examples.py index a1d93cfa3..1e98e680e 100644 --- a/tests/test_generated_examples.py +++ b/tests/test_generated_examples.py @@ -43739,6 +43739,49 @@ def test_v2_billing_cadence_post_3_service( is_json=True, ) + def test_v2_billing_cadences_spend_modifier_rule_get_service( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v2/billing/cadences/cadence_id_123/spend_modifier_rules", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.v2.billing.cadences.spend_modifier_rules.list("cadence_id_123") + http_client_mock.assert_requested( + "get", + path="/v2/billing/cadences/cadence_id_123/spend_modifier_rules", + query_string="", + api_base="https://api.stripe.com", + ) + + def test_v2_billing_cadences_spend_modifier_rule_get_2_service( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v2/billing/cadences/cadence_id_123/spend_modifier_rules/id_123", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.v2.billing.cadences.spend_modifier_rules.retrieve( + "cadence_id_123", + "id_123", + ) + http_client_mock.assert_requested( + "get", + path="/v2/billing/cadences/cadence_id_123/spend_modifier_rules/id_123", + query_string="", + api_base="https://api.stripe.com", + ) + def test_v2_billing_collection_setting_get_service( self, http_client_mock: HTTPClientMock ) -> None: @@ -43994,6 +44037,9 @@ def test_v2_billing_intent_post_service( { "type": "apply", "apply": { + "effective_at": { + "type": "current_billing_period_end" + }, "type": "invoice_discount_rule", "invoice_discount_rule": { "applies_to": "cadence", @@ -44005,6 +44051,21 @@ def test_v2_billing_intent_post_service( "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": { @@ -44063,8 +44124,12 @@ def test_v2_billing_intent_post_service( "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", @@ -44117,7 +44182,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":{"type":"invoice_discount_rule","invoice_discount_rule":{"applies_to":"cadence","type":"percent_off","percent_off":{"maximum_applications":{"type":"indefinite"},"percent_off":"percent_off"}}},"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":{"type":"invoice_discount_rule","invoice_discount_rule":"invoice_discount_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":{"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"}', is_json=True, ) @@ -44716,6 +44781,94 @@ def test_v2_billing_metered_item_post_2_service( is_json=True, ) + def test_v2_billing_one_time_item_get_service( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v2/billing/one_time_items", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.v2.billing.one_time_items.list() + http_client_mock.assert_requested( + "get", + path="/v2/billing/one_time_items", + query_string="", + api_base="https://api.stripe.com", + ) + + def test_v2_billing_one_time_item_post_service( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v2/billing/one_time_items", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.v2.billing.one_time_items.create( + { + "display_name": "display_name", + } + ) + http_client_mock.assert_requested( + "post", + path="/v2/billing/one_time_items", + query_string="", + api_base="https://api.stripe.com", + post_data='{"display_name":"display_name"}', + is_json=True, + ) + + def test_v2_billing_one_time_item_get_2_service( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v2/billing/one_time_items/id_123", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.v2.billing.one_time_items.retrieve("id_123") + http_client_mock.assert_requested( + "get", + path="/v2/billing/one_time_items/id_123", + query_string="", + api_base="https://api.stripe.com", + ) + + def test_v2_billing_one_time_item_post_2_service( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v2/billing/one_time_items/id_123", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.v2.billing.one_time_items.update("id_123") + http_client_mock.assert_requested( + "post", + path="/v2/billing/one_time_items/id_123", + query_string="", + api_base="https://api.stripe.com", + post_data="{}", + is_json=True, + ) + def test_v2_billing_pricing_plan_get_service( self, http_client_mock: HTTPClientMock ) -> None: @@ -45226,6 +45379,103 @@ def test_v2_billing_rate_card_post_2_service( is_json=True, ) + def test_v2_billing_rate_cards_custom_pricing_unit_overage_rate_get_service( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v2/billing/rate_cards/rate_card_id_123/custom_pricing_unit_overage_rates", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.v2.billing.rate_cards.custom_pricing_unit_overage_rates.list( + "rate_card_id_123", + ) + http_client_mock.assert_requested( + "get", + path="/v2/billing/rate_cards/rate_card_id_123/custom_pricing_unit_overage_rates", + query_string="", + api_base="https://api.stripe.com", + ) + + def test_v2_billing_rate_cards_custom_pricing_unit_overage_rate_post_service( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "post", + "/v2/billing/rate_cards/rate_card_id_123/custom_pricing_unit_overage_rates", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.v2.billing.rate_cards.custom_pricing_unit_overage_rates.create( + "rate_card_id_123", + { + "custom_pricing_unit": "custom_pricing_unit", + "one_time_item": "one_time_item", + "unit_amount": "unit_amount", + }, + ) + http_client_mock.assert_requested( + "post", + path="/v2/billing/rate_cards/rate_card_id_123/custom_pricing_unit_overage_rates", + query_string="", + api_base="https://api.stripe.com", + post_data='{"custom_pricing_unit":"custom_pricing_unit","one_time_item":"one_time_item","unit_amount":"unit_amount"}', + is_json=True, + ) + + def test_v2_billing_rate_cards_custom_pricing_unit_overage_rate_delete_service( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "delete", + "/v2/billing/rate_cards/rate_card_id_123/custom_pricing_unit_overage_rates/id_123", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.v2.billing.rate_cards.custom_pricing_unit_overage_rates.delete( + "rate_card_id_123", + "id_123", + ) + http_client_mock.assert_requested( + "delete", + path="/v2/billing/rate_cards/rate_card_id_123/custom_pricing_unit_overage_rates/id_123", + query_string="", + api_base="https://api.stripe.com", + ) + + def test_v2_billing_rate_cards_custom_pricing_unit_overage_rate_get_2_service( + self, http_client_mock: HTTPClientMock + ) -> None: + http_client_mock.stub_request( + "get", + "/v2/billing/rate_cards/rate_card_id_123/custom_pricing_unit_overage_rates/id_123", + ) + client = StripeClient( + "sk_test_123", + http_client=http_client_mock.get_mock_http_client(), + ) + + client.v2.billing.rate_cards.custom_pricing_unit_overage_rates.retrieve( + "rate_card_id_123", + "id_123", + ) + http_client_mock.assert_requested( + "get", + path="/v2/billing/rate_cards/rate_card_id_123/custom_pricing_unit_overage_rates/id_123", + query_string="", + api_base="https://api.stripe.com", + ) + def test_v2_billing_rate_cards_rate_get_service( self, http_client_mock: HTTPClientMock ) -> None: @@ -48548,7 +48798,7 @@ def test_insufficient_funds_error_service( try: client.v2.money_management.outbound_payments.create( { - "amount": {}, + "amount": {"value": 111972721, "currency": "usd"}, "from": { "currency": "usd", "financial_account": "financial_account", @@ -48563,7 +48813,7 @@ def test_insufficient_funds_error_service( path="/v2/money_management/outbound_payments", query_string="", api_base="https://api.stripe.com", - post_data='{"amount":{},"from":{"currency":"usd","financial_account":"financial_account"},"to":{"recipient":"recipient"}}', + post_data='{"amount":{"value":111972721,"currency":"usd"},"from":{"currency":"usd","financial_account":"financial_account"},"to":{"recipient":"recipient"}}', is_json=True, ) @@ -48752,7 +49002,7 @@ def test_recipient_not_notifiable_error_service( try: client.v2.money_management.outbound_payments.create( { - "amount": {}, + "amount": {"value": 111972721, "currency": "usd"}, "from": { "currency": "usd", "financial_account": "financial_account", @@ -48767,7 +49017,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":{},"from":{"currency":"usd","financial_account":"financial_account"},"to":{"recipient":"recipient"}}', + post_data='{"amount":{"value":111972721,"currency":"usd"},"from":{"currency":"usd","financial_account":"financial_account"},"to":{"recipient":"recipient"}}', is_json=True, )