diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 25e9535f..ea3d667e 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.35.0" + ".": "4.36.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index 467b7cc3..5d845f55 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 118 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-5b9152241ebdd0d2f3fd536784f33721d24a5c4a59e75cab366a3dcb36552d3d.yml -openapi_spec_hash: b40061d10bbe1ebab8998bddd1827cf8 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-f2b97a2c3e41f618dc8955ed325092320ff2170a7d7a9a26a31dc235c969b657.yml +openapi_spec_hash: 64548564dc8ce80ef3ad38fc8cb56b30 config_hash: dd4343ce95871032ef6e0735a4ca038c diff --git a/CHANGELOG.md b/CHANGELOG.md index 10683c84..cff9fd22 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 4.36.0 (2025-11-05) + +Full Changelog: [v4.35.0...v4.36.0](https://github.com/orbcorp/orb-python/compare/v4.35.0...v4.36.0) + +### Features + +* **api:** api update ([e70d3c9](https://github.com/orbcorp/orb-python/commit/e70d3c93ea62dea62e5b3b8e16538f8945bdc4e9)) + ## 4.35.0 (2025-11-04) Full Changelog: [v4.34.0...v4.35.0](https://github.com/orbcorp/orb-python/compare/v4.34.0...v4.35.0) diff --git a/pyproject.toml b/pyproject.toml index 8c339b3c..02b7894c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "orb-billing" -version = "4.35.0" +version = "4.36.0" description = "The official Python library for the orb API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/orb/_version.py b/src/orb/_version.py index d0acff00..f344a89d 100644 --- a/src/orb/_version.py +++ b/src/orb/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "orb" -__version__ = "4.35.0" # x-release-please-version +__version__ = "4.36.0" # x-release-please-version diff --git a/src/orb/resources/subscriptions.py b/src/orb/resources/subscriptions.py index e6140f32..8dcfbad7 100644 --- a/src/orb/resources/subscriptions.py +++ b/src/orb/resources/subscriptions.py @@ -1222,6 +1222,7 @@ def price_intervals( add: Iterable[subscription_price_intervals_params.Add] | Omit = omit, add_adjustments: Iterable[subscription_price_intervals_params.AddAdjustment] | Omit = omit, allow_invoice_credit_or_void: Optional[bool] | Omit = omit, + can_defer_billing: Optional[bool] | Omit = omit, edit: Iterable[subscription_price_intervals_params.Edit] | Omit = omit, edit_adjustments: Iterable[subscription_price_intervals_params.EditAdjustment] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -1315,6 +1316,10 @@ def price_intervals( credit note. Consider using this as a safety mechanism if you do not expect existing invoices to be changed. + can_defer_billing: If true, ending an in-arrears price interval mid-cycle will defer billing the + final line itemuntil the next scheduled invoice. If false, it will be billed on + its end date. If not provided, behaviorwill follow account default. + edit: A list of price intervals to edit on the subscription. edit_adjustments: A list of adjustments to edit on the subscription. @@ -1338,6 +1343,7 @@ def price_intervals( "add": add, "add_adjustments": add_adjustments, "allow_invoice_credit_or_void": allow_invoice_credit_or_void, + "can_defer_billing": can_defer_billing, "edit": edit, "edit_adjustments": edit_adjustments, }, @@ -3308,6 +3314,7 @@ async def price_intervals( add: Iterable[subscription_price_intervals_params.Add] | Omit = omit, add_adjustments: Iterable[subscription_price_intervals_params.AddAdjustment] | Omit = omit, allow_invoice_credit_or_void: Optional[bool] | Omit = omit, + can_defer_billing: Optional[bool] | Omit = omit, edit: Iterable[subscription_price_intervals_params.Edit] | Omit = omit, edit_adjustments: Iterable[subscription_price_intervals_params.EditAdjustment] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -3401,6 +3408,10 @@ async def price_intervals( credit note. Consider using this as a safety mechanism if you do not expect existing invoices to be changed. + can_defer_billing: If true, ending an in-arrears price interval mid-cycle will defer billing the + final line itemuntil the next scheduled invoice. If false, it will be billed on + its end date. If not provided, behaviorwill follow account default. + edit: A list of price intervals to edit on the subscription. edit_adjustments: A list of adjustments to edit on the subscription. @@ -3424,6 +3435,7 @@ async def price_intervals( "add": add, "add_adjustments": add_adjustments, "allow_invoice_credit_or_void": allow_invoice_credit_or_void, + "can_defer_billing": can_defer_billing, "edit": edit, "edit_adjustments": edit_adjustments, }, diff --git a/src/orb/types/shared/price_interval.py b/src/orb/types/shared/price_interval.py index e449f3bb..f2805398 100644 --- a/src/orb/types/shared/price_interval.py +++ b/src/orb/types/shared/price_interval.py @@ -16,6 +16,13 @@ class PriceInterval(BaseModel): billing_cycle_day: int """The day of the month that Orb bills for this price""" + can_defer_billing: bool + """For in-arrears prices. + + If true, and the price interval ends mid-cycle, the final line item will be + deferred to the next scheduled invoice instead of being billed mid-cycle. + """ + current_billing_period_end_date: Optional[datetime] = None """The end of the current billing period. diff --git a/src/orb/types/shared/tiered_config.py b/src/orb/types/shared/tiered_config.py index 3b2e5e8f..fa173f26 100644 --- a/src/orb/types/shared/tiered_config.py +++ b/src/orb/types/shared/tiered_config.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List +from typing import List, Optional from .tier import Tier from ..._models import BaseModel @@ -11,3 +11,6 @@ class TieredConfig(BaseModel): tiers: List[Tier] """Tiers for rating based on total usage quantities into the specified tier""" + + prorated: Optional[bool] = None + """If true, subtotals from this price are prorated based on the service period""" diff --git a/src/orb/types/shared/unit_config.py b/src/orb/types/shared/unit_config.py index 6c5cc436..b8b15658 100644 --- a/src/orb/types/shared/unit_config.py +++ b/src/orb/types/shared/unit_config.py @@ -1,5 +1,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +from typing import Optional + from ..._models import BaseModel __all__ = ["UnitConfig"] @@ -8,3 +10,6 @@ class UnitConfig(BaseModel): unit_amount: str """Rate per unit of usage""" + + prorated: Optional[bool] = None + """If true, subtotals from this price are prorated based on the service period""" diff --git a/src/orb/types/shared_params/tiered_config.py b/src/orb/types/shared_params/tiered_config.py index d4272b32..f5d1c264 100644 --- a/src/orb/types/shared_params/tiered_config.py +++ b/src/orb/types/shared_params/tiered_config.py @@ -13,3 +13,6 @@ class TieredConfig(TypedDict, total=False): tiers: Required[Iterable[Tier]] """Tiers for rating based on total usage quantities into the specified tier""" + + prorated: bool + """If true, subtotals from this price are prorated based on the service period""" diff --git a/src/orb/types/shared_params/unit_config.py b/src/orb/types/shared_params/unit_config.py index a677a6dc..2a41542c 100644 --- a/src/orb/types/shared_params/unit_config.py +++ b/src/orb/types/shared_params/unit_config.py @@ -10,3 +10,6 @@ class UnitConfig(TypedDict, total=False): unit_amount: Required[str] """Rate per unit of usage""" + + prorated: bool + """If true, subtotals from this price are prorated based on the service period""" diff --git a/src/orb/types/subscription_price_intervals_params.py b/src/orb/types/subscription_price_intervals_params.py index 09f87d0b..6e79da65 100644 --- a/src/orb/types/subscription_price_intervals_params.py +++ b/src/orb/types/subscription_price_intervals_params.py @@ -95,6 +95,13 @@ class SubscriptionPriceIntervalsParams(TypedDict, total=False): existing invoices to be changed. """ + can_defer_billing: Optional[bool] + """ + If true, ending an in-arrears price interval mid-cycle will defer billing the + final line itemuntil the next scheduled invoice. If false, it will be billed on + its end date. If not provided, behaviorwill follow account default. + """ + edit: Iterable[Edit] """A list of price intervals to edit on the subscription.""" @@ -669,6 +676,13 @@ class Edit(TypedDict, total=False): overlapping price intervals must have the same billing cycle day. """ + can_defer_billing: Optional[bool] + """ + If true, ending an in-arrears price interval mid-cycle will defer billing the + final line itemuntil the next scheduled invoice. If false, it will be billed on + its end date. If not provided, behaviorwill follow account default. + """ + end_date: Annotated[Union[Union[str, datetime], BillingCycleRelativeDate, None], PropertyInfo(format="iso8601")] """The updated end date of this price interval. diff --git a/tests/api_resources/beta/test_external_plan_id.py b/tests/api_resources/beta/test_external_plan_id.py index 8c574032..6f7c409b 100644 --- a/tests/api_resources/beta/test_external_plan_id.py +++ b/tests/api_resources/beta/test_external_plan_id.py @@ -77,7 +77,10 @@ def test_method_create_plan_version_with_all_params(self, client: Orb) -> None: "item_id": "item_id", "model_type": "unit", "name": "Annual fee", - "unit_config": {"unit_amount": "unit_amount"}, + "unit_config": { + "unit_amount": "unit_amount", + "prorated": True, + }, "billable_metric_id": "billable_metric_id", "billed_in_advance": True, "billing_cycle_configuration": { @@ -168,7 +171,10 @@ def test_method_create_plan_version_with_all_params(self, client: Orb) -> None: "item_id": "item_id", "model_type": "unit", "name": "Annual fee", - "unit_config": {"unit_amount": "unit_amount"}, + "unit_config": { + "unit_amount": "unit_amount", + "prorated": True, + }, "billable_metric_id": "billable_metric_id", "billed_in_advance": True, "billing_cycle_configuration": { @@ -392,7 +398,10 @@ async def test_method_create_plan_version_with_all_params(self, async_client: As "item_id": "item_id", "model_type": "unit", "name": "Annual fee", - "unit_config": {"unit_amount": "unit_amount"}, + "unit_config": { + "unit_amount": "unit_amount", + "prorated": True, + }, "billable_metric_id": "billable_metric_id", "billed_in_advance": True, "billing_cycle_configuration": { @@ -483,7 +492,10 @@ async def test_method_create_plan_version_with_all_params(self, async_client: As "item_id": "item_id", "model_type": "unit", "name": "Annual fee", - "unit_config": {"unit_amount": "unit_amount"}, + "unit_config": { + "unit_amount": "unit_amount", + "prorated": True, + }, "billable_metric_id": "billable_metric_id", "billed_in_advance": True, "billing_cycle_configuration": { diff --git a/tests/api_resources/test_beta.py b/tests/api_resources/test_beta.py index 87ffc66d..3a683691 100644 --- a/tests/api_resources/test_beta.py +++ b/tests/api_resources/test_beta.py @@ -77,7 +77,10 @@ def test_method_create_plan_version_with_all_params(self, client: Orb) -> None: "item_id": "item_id", "model_type": "unit", "name": "Annual fee", - "unit_config": {"unit_amount": "unit_amount"}, + "unit_config": { + "unit_amount": "unit_amount", + "prorated": True, + }, "billable_metric_id": "billable_metric_id", "billed_in_advance": True, "billing_cycle_configuration": { @@ -168,7 +171,10 @@ def test_method_create_plan_version_with_all_params(self, client: Orb) -> None: "item_id": "item_id", "model_type": "unit", "name": "Annual fee", - "unit_config": {"unit_amount": "unit_amount"}, + "unit_config": { + "unit_amount": "unit_amount", + "prorated": True, + }, "billable_metric_id": "billable_metric_id", "billed_in_advance": True, "billing_cycle_configuration": { @@ -392,7 +398,10 @@ async def test_method_create_plan_version_with_all_params(self, async_client: As "item_id": "item_id", "model_type": "unit", "name": "Annual fee", - "unit_config": {"unit_amount": "unit_amount"}, + "unit_config": { + "unit_amount": "unit_amount", + "prorated": True, + }, "billable_metric_id": "billable_metric_id", "billed_in_advance": True, "billing_cycle_configuration": { @@ -483,7 +492,10 @@ async def test_method_create_plan_version_with_all_params(self, async_client: As "item_id": "item_id", "model_type": "unit", "name": "Annual fee", - "unit_config": {"unit_amount": "unit_amount"}, + "unit_config": { + "unit_amount": "unit_amount", + "prorated": True, + }, "billable_metric_id": "billable_metric_id", "billed_in_advance": True, "billing_cycle_configuration": { diff --git a/tests/api_resources/test_invoices.py b/tests/api_resources/test_invoices.py index 29b1c63f..db64ecc2 100644 --- a/tests/api_resources/test_invoices.py +++ b/tests/api_resources/test_invoices.py @@ -54,7 +54,10 @@ def test_method_create_with_all_params(self, client: Orb) -> None: "name": "Line Item Name", "quantity": 1, "start_date": parse_date("2023-09-22"), - "unit_config": {"unit_amount": "unit_amount"}, + "unit_config": { + "unit_amount": "unit_amount", + "prorated": True, + }, } ], customer_id="4khy3nwzktxv7", @@ -508,7 +511,10 @@ async def test_method_create_with_all_params(self, async_client: AsyncOrb) -> No "name": "Line Item Name", "quantity": 1, "start_date": parse_date("2023-09-22"), - "unit_config": {"unit_amount": "unit_amount"}, + "unit_config": { + "unit_amount": "unit_amount", + "prorated": True, + }, } ], customer_id="4khy3nwzktxv7", diff --git a/tests/api_resources/test_plans.py b/tests/api_resources/test_plans.py index 26bacdbe..82650993 100644 --- a/tests/api_resources/test_plans.py +++ b/tests/api_resources/test_plans.py @@ -58,7 +58,10 @@ def test_method_create_with_all_params(self, client: Orb) -> None: "item_id": "item_id", "model_type": "unit", "name": "Annual fee", - "unit_config": {"unit_amount": "unit_amount"}, + "unit_config": { + "unit_amount": "unit_amount", + "prorated": True, + }, "billable_metric_id": "billable_metric_id", "billed_in_advance": True, "billing_cycle_configuration": { @@ -322,7 +325,10 @@ async def test_method_create_with_all_params(self, async_client: AsyncOrb) -> No "item_id": "item_id", "model_type": "unit", "name": "Annual fee", - "unit_config": {"unit_amount": "unit_amount"}, + "unit_config": { + "unit_amount": "unit_amount", + "prorated": True, + }, "billable_metric_id": "billable_metric_id", "billed_in_advance": True, "billing_cycle_configuration": { diff --git a/tests/api_resources/test_prices.py b/tests/api_resources/test_prices.py index 9aedb4e2..f19b1f05 100644 --- a/tests/api_resources/test_prices.py +++ b/tests/api_resources/test_prices.py @@ -44,7 +44,10 @@ def test_method_create_with_all_params_overload_1(self, client: Orb) -> None: item_id="item_id", model_type="unit", name="Annual fee", - unit_config={"unit_amount": "unit_amount"}, + unit_config={ + "unit_amount": "unit_amount", + "prorated": True, + }, billable_metric_id="billable_metric_id", billed_in_advance=True, billing_cycle_configuration={ @@ -140,7 +143,8 @@ def test_method_create_with_all_params_overload_2(self, client: Orb) -> None: "unit_amount": "unit_amount", "last_unit": 0, } - ] + ], + "prorated": True, }, billable_metric_id="billable_metric_id", billed_in_advance=True, @@ -3547,7 +3551,10 @@ def test_method_evaluate_multiple_with_all_params(self, client: Orb) -> None: "item_id": "item_id", "model_type": "unit", "name": "Annual fee", - "unit_config": {"unit_amount": "unit_amount"}, + "unit_config": { + "unit_amount": "unit_amount", + "prorated": True, + }, "billable_metric_id": "billable_metric_id", "billed_in_advance": True, "billing_cycle_configuration": { @@ -3640,7 +3647,10 @@ def test_method_evaluate_preview_events_with_all_params(self, client: Orb) -> No "item_id": "item_id", "model_type": "unit", "name": "Annual fee", - "unit_config": {"unit_amount": "unit_amount"}, + "unit_config": { + "unit_amount": "unit_amount", + "prorated": True, + }, "billable_metric_id": "billable_metric_id", "billed_in_advance": True, "billing_cycle_configuration": { @@ -3762,7 +3772,10 @@ async def test_method_create_with_all_params_overload_1(self, async_client: Asyn item_id="item_id", model_type="unit", name="Annual fee", - unit_config={"unit_amount": "unit_amount"}, + unit_config={ + "unit_amount": "unit_amount", + "prorated": True, + }, billable_metric_id="billable_metric_id", billed_in_advance=True, billing_cycle_configuration={ @@ -3858,7 +3871,8 @@ async def test_method_create_with_all_params_overload_2(self, async_client: Asyn "unit_amount": "unit_amount", "last_unit": 0, } - ] + ], + "prorated": True, }, billable_metric_id="billable_metric_id", billed_in_advance=True, @@ -7265,7 +7279,10 @@ async def test_method_evaluate_multiple_with_all_params(self, async_client: Asyn "item_id": "item_id", "model_type": "unit", "name": "Annual fee", - "unit_config": {"unit_amount": "unit_amount"}, + "unit_config": { + "unit_amount": "unit_amount", + "prorated": True, + }, "billable_metric_id": "billable_metric_id", "billed_in_advance": True, "billing_cycle_configuration": { @@ -7358,7 +7375,10 @@ async def test_method_evaluate_preview_events_with_all_params(self, async_client "item_id": "item_id", "model_type": "unit", "name": "Annual fee", - "unit_config": {"unit_amount": "unit_amount"}, + "unit_config": { + "unit_amount": "unit_amount", + "prorated": True, + }, "billable_metric_id": "billable_metric_id", "billed_in_advance": True, "billing_cycle_configuration": { diff --git a/tests/api_resources/test_subscriptions.py b/tests/api_resources/test_subscriptions.py index 7270ed6e..ab0b6ad0 100644 --- a/tests/api_resources/test_subscriptions.py +++ b/tests/api_resources/test_subscriptions.py @@ -94,7 +94,10 @@ def test_method_create_with_all_params(self, client: Orb) -> None: "item_id": "item_id", "model_type": "unit", "name": "Annual fee", - "unit_config": {"unit_amount": "unit_amount"}, + "unit_config": { + "unit_amount": "unit_amount", + "prorated": True, + }, "billable_metric_id": "billable_metric_id", "billed_in_advance": True, "billing_cycle_configuration": { @@ -220,7 +223,10 @@ def test_method_create_with_all_params(self, client: Orb) -> None: "item_id": "item_id", "model_type": "unit", "name": "Annual fee", - "unit_config": {"unit_amount": "unit_amount"}, + "unit_config": { + "unit_amount": "unit_amount", + "prorated": True, + }, "billable_metric_id": "billable_metric_id", "billed_in_advance": True, "billing_cycle_configuration": { @@ -675,7 +681,10 @@ def test_method_price_intervals_with_all_params(self, client: Orb) -> None: "item_id": "item_id", "model_type": "unit", "name": "Annual fee", - "unit_config": {"unit_amount": "unit_amount"}, + "unit_config": { + "unit_amount": "unit_amount", + "prorated": True, + }, "billable_metric_id": "billable_metric_id", "billed_in_advance": True, "billing_cycle_configuration": { @@ -730,10 +739,12 @@ def test_method_price_intervals_with_all_params(self, client: Orb) -> None: } ], allow_invoice_credit_or_void=True, + can_defer_billing=True, edit=[ { "price_interval_id": "sdfs6wdjvn7ujokd", "billing_cycle_day": 0, + "can_defer_billing": True, "end_date": parse_datetime("2019-12-27T18:11:19.117Z"), "filter": "my_property > 100 AND my_other_property = 'bar'", "fixed_fee_quantity_transitions": [ @@ -918,7 +929,10 @@ def test_method_schedule_plan_change_with_all_params(self, client: Orb) -> None: "item_id": "item_id", "model_type": "unit", "name": "Annual fee", - "unit_config": {"unit_amount": "unit_amount"}, + "unit_config": { + "unit_amount": "unit_amount", + "prorated": True, + }, "billable_metric_id": "billable_metric_id", "billed_in_advance": True, "billing_cycle_configuration": { @@ -1037,7 +1051,10 @@ def test_method_schedule_plan_change_with_all_params(self, client: Orb) -> None: "item_id": "item_id", "model_type": "unit", "name": "Annual fee", - "unit_config": {"unit_amount": "unit_amount"}, + "unit_config": { + "unit_amount": "unit_amount", + "prorated": True, + }, "billable_metric_id": "billable_metric_id", "billed_in_advance": True, "billing_cycle_configuration": { @@ -1456,7 +1473,10 @@ async def test_method_create_with_all_params(self, async_client: AsyncOrb) -> No "item_id": "item_id", "model_type": "unit", "name": "Annual fee", - "unit_config": {"unit_amount": "unit_amount"}, + "unit_config": { + "unit_amount": "unit_amount", + "prorated": True, + }, "billable_metric_id": "billable_metric_id", "billed_in_advance": True, "billing_cycle_configuration": { @@ -1582,7 +1602,10 @@ async def test_method_create_with_all_params(self, async_client: AsyncOrb) -> No "item_id": "item_id", "model_type": "unit", "name": "Annual fee", - "unit_config": {"unit_amount": "unit_amount"}, + "unit_config": { + "unit_amount": "unit_amount", + "prorated": True, + }, "billable_metric_id": "billable_metric_id", "billed_in_advance": True, "billing_cycle_configuration": { @@ -2037,7 +2060,10 @@ async def test_method_price_intervals_with_all_params(self, async_client: AsyncO "item_id": "item_id", "model_type": "unit", "name": "Annual fee", - "unit_config": {"unit_amount": "unit_amount"}, + "unit_config": { + "unit_amount": "unit_amount", + "prorated": True, + }, "billable_metric_id": "billable_metric_id", "billed_in_advance": True, "billing_cycle_configuration": { @@ -2092,10 +2118,12 @@ async def test_method_price_intervals_with_all_params(self, async_client: AsyncO } ], allow_invoice_credit_or_void=True, + can_defer_billing=True, edit=[ { "price_interval_id": "sdfs6wdjvn7ujokd", "billing_cycle_day": 0, + "can_defer_billing": True, "end_date": parse_datetime("2019-12-27T18:11:19.117Z"), "filter": "my_property > 100 AND my_other_property = 'bar'", "fixed_fee_quantity_transitions": [ @@ -2280,7 +2308,10 @@ async def test_method_schedule_plan_change_with_all_params(self, async_client: A "item_id": "item_id", "model_type": "unit", "name": "Annual fee", - "unit_config": {"unit_amount": "unit_amount"}, + "unit_config": { + "unit_amount": "unit_amount", + "prorated": True, + }, "billable_metric_id": "billable_metric_id", "billed_in_advance": True, "billing_cycle_configuration": { @@ -2399,7 +2430,10 @@ async def test_method_schedule_plan_change_with_all_params(self, async_client: A "item_id": "item_id", "model_type": "unit", "name": "Annual fee", - "unit_config": {"unit_amount": "unit_amount"}, + "unit_config": { + "unit_amount": "unit_amount", + "prorated": True, + }, "billable_metric_id": "billable_metric_id", "billed_in_advance": True, "billing_cycle_configuration": {