From 4d62ec1144ff2df084fc0c690d7ffae0984072a3 Mon Sep 17 00:00:00 2001 From: Stainless Bot Date: Wed, 19 Jun 2024 17:09:34 +0000 Subject: [PATCH] feat(api): add support for adding allocation price to subscription --- .stats.yml | 2 +- .../subscription_price_intervals_params.py | 24 +++++++++++++ tests/api_resources/test_subscriptions.py | 36 +++++++++++++++++++ 3 files changed, 61 insertions(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 2105f66c..b6290eb0 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 90 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb-d9cc087ece8a2eba847035f3cd8ae44d3401046e01761ab6ad7fd6165d93f0c8.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb-d08c3c586f46f155358104a907afa8300ce44a25814c1574c0f4344935c1b838.yml diff --git a/src/orb/types/subscription_price_intervals_params.py b/src/orb/types/subscription_price_intervals_params.py index 7acacca4..a13f70e0 100644 --- a/src/orb/types/subscription_price_intervals_params.py +++ b/src/orb/types/subscription_price_intervals_params.py @@ -12,6 +12,7 @@ __all__ = [ "SubscriptionPriceIntervalsParams", "Add", + "AddAllocationPrice", "AddDiscount", "AddDiscountAmountDiscountCreationParams", "AddDiscountPercentageDiscountCreationParams", @@ -77,6 +78,26 @@ class SubscriptionPriceIntervalsParams(TypedDict, total=False): """A list of adjustments to edit on the subscription.""" +class AddAllocationPrice(TypedDict, total=False): + amount: Required[float] + """An amount of the currency to allocate to the customer at the specified cadence.""" + + cadence: Required[Literal["one_time", "monthly", "quarterly", "semi_annual", "annual"]] + """The cadence at which to allocate the amount to the customer.""" + + currency: Required[str] + """ + An ISO 4217 currency string or a custom pricing unit identifier in which to bill + this price. + """ + + expires_at_end_of_cadence: Required[bool] + """ + Whether the allocated amount should expire at the end of the cadence or roll + over to the next period. + """ + + class AddDiscountAmountDiscountCreationParams(TypedDict, total=False): amount_discount: Required[float] """Only available if discount_type is `amount`.""" @@ -1104,6 +1125,9 @@ class Add(TypedDict, total=False): This is the date that the price will start billing on the subscription. """ + allocation_price: Optional[AddAllocationPrice] + """The definition of a new allocation price to create and add to the subscription.""" + discounts: Optional[Iterable[AddDiscount]] """A list of discounts to initialize on the price interval.""" diff --git a/tests/api_resources/test_subscriptions.py b/tests/api_resources/test_subscriptions.py index 73f116a4..60df4e75 100644 --- a/tests/api_resources/test_subscriptions.py +++ b/tests/api_resources/test_subscriptions.py @@ -501,6 +501,12 @@ def test_method_price_intervals_with_all_params(self, client: Orb) -> None: "unit_config": {"unit_amount": "string"}, "currency": "string", }, + "allocation_price": { + "currency": "USD", + "amount": 0, + "cadence": "monthly", + "expires_at_end_of_cadence": True, + }, "start_date": parse_datetime("2019-12-27T18:11:19.117Z"), "end_date": parse_datetime("2019-12-27T18:11:19.117Z"), "fixed_fee_quantity_transitions": [ @@ -551,6 +557,12 @@ def test_method_price_intervals_with_all_params(self, client: Orb) -> None: "unit_config": {"unit_amount": "string"}, "currency": "string", }, + "allocation_price": { + "currency": "USD", + "amount": 0, + "cadence": "monthly", + "expires_at_end_of_cadence": True, + }, "start_date": parse_datetime("2019-12-27T18:11:19.117Z"), "end_date": parse_datetime("2019-12-27T18:11:19.117Z"), "fixed_fee_quantity_transitions": [ @@ -601,6 +613,12 @@ def test_method_price_intervals_with_all_params(self, client: Orb) -> None: "unit_config": {"unit_amount": "string"}, "currency": "string", }, + "allocation_price": { + "currency": "USD", + "amount": 0, + "cadence": "monthly", + "expires_at_end_of_cadence": True, + }, "start_date": parse_datetime("2019-12-27T18:11:19.117Z"), "end_date": parse_datetime("2019-12-27T18:11:19.117Z"), "fixed_fee_quantity_transitions": [ @@ -1598,6 +1616,12 @@ async def test_method_price_intervals_with_all_params(self, async_client: AsyncO "unit_config": {"unit_amount": "string"}, "currency": "string", }, + "allocation_price": { + "currency": "USD", + "amount": 0, + "cadence": "monthly", + "expires_at_end_of_cadence": True, + }, "start_date": parse_datetime("2019-12-27T18:11:19.117Z"), "end_date": parse_datetime("2019-12-27T18:11:19.117Z"), "fixed_fee_quantity_transitions": [ @@ -1648,6 +1672,12 @@ async def test_method_price_intervals_with_all_params(self, async_client: AsyncO "unit_config": {"unit_amount": "string"}, "currency": "string", }, + "allocation_price": { + "currency": "USD", + "amount": 0, + "cadence": "monthly", + "expires_at_end_of_cadence": True, + }, "start_date": parse_datetime("2019-12-27T18:11:19.117Z"), "end_date": parse_datetime("2019-12-27T18:11:19.117Z"), "fixed_fee_quantity_transitions": [ @@ -1698,6 +1728,12 @@ async def test_method_price_intervals_with_all_params(self, async_client: AsyncO "unit_config": {"unit_amount": "string"}, "currency": "string", }, + "allocation_price": { + "currency": "USD", + "amount": 0, + "cadence": "monthly", + "expires_at_end_of_cadence": True, + }, "start_date": parse_datetime("2019-12-27T18:11:19.117Z"), "end_date": parse_datetime("2019-12-27T18:11:19.117Z"), "fixed_fee_quantity_transitions": [