diff --git a/.stats.yml b/.stats.yml index 49b2f4a1..7d050298 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 97 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-40a4e23dd482299a046fb62fd2b5a1e03d455156cb8cd4573e92e4132d74b243.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-14d1c1e4560c65c7c62f23343268ece4476ae079cd01ba2e6b924efde5f97c3e.yml diff --git a/src/orb/types/plan.py b/src/orb/types/plan.py index f3b3b805..1f72a913 100644 --- a/src/orb/types/plan.py +++ b/src/orb/types/plan.py @@ -1,15 +1,22 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Dict, List, Optional +from typing import Dict, List, Union, Optional from datetime import datetime -from typing_extensions import Literal +from typing_extensions import Literal, Annotated, TypeAlias from .price import Price +from .._utils import PropertyInfo from .._models import BaseModel from .shared.discount import Discount __all__ = [ "Plan", + "Adjustment", + "AdjustmentAmountDiscountAdjustment", + "AdjustmentPercentageDiscountAdjustment", + "AdjustmentUsageDiscountAdjustment", + "AdjustmentMinimumAdjustment", + "AdjustmentMaximumAdjustment", "BasePlan", "Maximum", "Minimum", @@ -21,6 +28,156 @@ ] +class AdjustmentAmountDiscountAdjustment(BaseModel): + id: str + + adjustment_type: Literal["amount_discount"] + + amount_discount: str + """ + The amount by which to discount the prices this adjustment applies to in a given + billing period. + """ + + applies_to_price_ids: List[str] + """The price IDs that this adjustment applies to.""" + + is_invoice_level: bool + """ + True for adjustments that apply to an entire invocice, false for adjustments + that apply to only one price. + """ + + plan_phase_order: Optional[int] = None + """The plan phase in which this adjustment is active.""" + + reason: Optional[str] = None + """The reason for the adjustment.""" + + +class AdjustmentPercentageDiscountAdjustment(BaseModel): + id: str + + adjustment_type: Literal["percentage_discount"] + + applies_to_price_ids: List[str] + """The price IDs that this adjustment applies to.""" + + is_invoice_level: bool + """ + True for adjustments that apply to an entire invocice, false for adjustments + that apply to only one price. + """ + + percentage_discount: float + """ + The percentage (as a value between 0 and 1) by which to discount the price + intervals this adjustment applies to in a given billing period. + """ + + plan_phase_order: Optional[int] = None + """The plan phase in which this adjustment is active.""" + + reason: Optional[str] = None + """The reason for the adjustment.""" + + +class AdjustmentUsageDiscountAdjustment(BaseModel): + id: str + + adjustment_type: Literal["usage_discount"] + + applies_to_price_ids: List[str] + """The price IDs that this adjustment applies to.""" + + is_invoice_level: bool + """ + True for adjustments that apply to an entire invocice, false for adjustments + that apply to only one price. + """ + + plan_phase_order: Optional[int] = None + """The plan phase in which this adjustment is active.""" + + reason: Optional[str] = None + """The reason for the adjustment.""" + + usage_discount: float + """ + The number of usage units by which to discount the price this adjustment applies + to in a given billing period. + """ + + +class AdjustmentMinimumAdjustment(BaseModel): + id: str + + adjustment_type: Literal["minimum"] + + applies_to_price_ids: List[str] + """The price IDs that this adjustment applies to.""" + + is_invoice_level: bool + """ + True for adjustments that apply to an entire invocice, false for adjustments + that apply to only one price. + """ + + item_id: str + """The item ID that revenue from this minimum will be attributed to.""" + + minimum_amount: str + """ + The minimum amount to charge in a given billing period for the prices this + adjustment applies to. + """ + + plan_phase_order: Optional[int] = None + """The plan phase in which this adjustment is active.""" + + reason: Optional[str] = None + """The reason for the adjustment.""" + + +class AdjustmentMaximumAdjustment(BaseModel): + id: str + + adjustment_type: Literal["maximum"] + + applies_to_price_ids: List[str] + """The price IDs that this adjustment applies to.""" + + is_invoice_level: bool + """ + True for adjustments that apply to an entire invocice, false for adjustments + that apply to only one price. + """ + + maximum_amount: str + """ + The maximum amount to charge in a given billing period for the prices this + adjustment applies to. + """ + + plan_phase_order: Optional[int] = None + """The plan phase in which this adjustment is active.""" + + reason: Optional[str] = None + """The reason for the adjustment.""" + + +Adjustment: TypeAlias = Annotated[ + Union[ + AdjustmentAmountDiscountAdjustment, + AdjustmentPercentageDiscountAdjustment, + AdjustmentUsageDiscountAdjustment, + AdjustmentMinimumAdjustment, + AdjustmentMaximumAdjustment, + ], + PropertyInfo(discriminator="adjustment_type"), +] + + class BasePlan(BaseModel): id: Optional[str] = None @@ -124,6 +281,12 @@ class TrialConfig(BaseModel): class Plan(BaseModel): id: str + adjustments: List[Adjustment] + """Adjustments for this plan. + + If the plan has phases, this includes adjustments across all phases of the plan. + """ + base_plan: Optional[BasePlan] = None base_plan_id: Optional[str] = None diff --git a/src/orb/types/subscription.py b/src/orb/types/subscription.py index 3c7a08d7..e5ecc9c1 100644 --- a/src/orb/types/subscription.py +++ b/src/orb/types/subscription.py @@ -35,6 +35,8 @@ class AdjustmentIntervalAdjustmentAmountDiscountAdjustment(BaseModel): + id: str + adjustment_type: Literal["amount_discount"] amount_discount: str @@ -46,32 +48,63 @@ class AdjustmentIntervalAdjustmentAmountDiscountAdjustment(BaseModel): applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" + is_invoice_level: bool + """ + True for adjustments that apply to an entire invocice, false for adjustments + that apply to only one price. + """ + + plan_phase_order: Optional[int] = None + """The plan phase in which this adjustment is active.""" + reason: Optional[str] = None """The reason for the adjustment.""" class AdjustmentIntervalAdjustmentPercentageDiscountAdjustment(BaseModel): + id: str + adjustment_type: Literal["percentage_discount"] applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" + is_invoice_level: bool + """ + True for adjustments that apply to an entire invocice, false for adjustments + that apply to only one price. + """ + percentage_discount: float """ The percentage (as a value between 0 and 1) by which to discount the price intervals this adjustment applies to in a given billing period. """ + plan_phase_order: Optional[int] = None + """The plan phase in which this adjustment is active.""" + reason: Optional[str] = None """The reason for the adjustment.""" class AdjustmentIntervalAdjustmentUsageDiscountAdjustment(BaseModel): + id: str + adjustment_type: Literal["usage_discount"] applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" + is_invoice_level: bool + """ + True for adjustments that apply to an entire invocice, false for adjustments + that apply to only one price. + """ + + plan_phase_order: Optional[int] = None + """The plan phase in which this adjustment is active.""" + reason: Optional[str] = None """The reason for the adjustment.""" @@ -83,11 +116,19 @@ class AdjustmentIntervalAdjustmentUsageDiscountAdjustment(BaseModel): class AdjustmentIntervalAdjustmentMinimumAdjustment(BaseModel): + id: str + adjustment_type: Literal["minimum"] applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" + is_invoice_level: bool + """ + True for adjustments that apply to an entire invocice, false for adjustments + that apply to only one price. + """ + item_id: str """The item ID that revenue from this minimum will be attributed to.""" @@ -97,22 +138,36 @@ class AdjustmentIntervalAdjustmentMinimumAdjustment(BaseModel): adjustment applies to. """ + plan_phase_order: Optional[int] = None + """The plan phase in which this adjustment is active.""" + reason: Optional[str] = None """The reason for the adjustment.""" class AdjustmentIntervalAdjustmentMaximumAdjustment(BaseModel): + id: str + adjustment_type: Literal["maximum"] applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" + is_invoice_level: bool + """ + True for adjustments that apply to an entire invocice, false for adjustments + that apply to only one price. + """ + maximum_amount: str """ The maximum amount to charge in a given billing period for the prices this adjustment applies to. """ + plan_phase_order: Optional[int] = None + """The plan phase in which this adjustment is active.""" + reason: Optional[str] = None """The reason for the adjustment.""" diff --git a/src/orb/types/subscription_cancel_response.py b/src/orb/types/subscription_cancel_response.py index fd2a7f32..ef4b970a 100644 --- a/src/orb/types/subscription_cancel_response.py +++ b/src/orb/types/subscription_cancel_response.py @@ -35,6 +35,8 @@ class AdjustmentIntervalAdjustmentAmountDiscountAdjustment(BaseModel): + id: str + adjustment_type: Literal["amount_discount"] amount_discount: str @@ -46,32 +48,63 @@ class AdjustmentIntervalAdjustmentAmountDiscountAdjustment(BaseModel): applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" + is_invoice_level: bool + """ + True for adjustments that apply to an entire invocice, false for adjustments + that apply to only one price. + """ + + plan_phase_order: Optional[int] = None + """The plan phase in which this adjustment is active.""" + reason: Optional[str] = None """The reason for the adjustment.""" class AdjustmentIntervalAdjustmentPercentageDiscountAdjustment(BaseModel): + id: str + adjustment_type: Literal["percentage_discount"] applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" + is_invoice_level: bool + """ + True for adjustments that apply to an entire invocice, false for adjustments + that apply to only one price. + """ + percentage_discount: float """ The percentage (as a value between 0 and 1) by which to discount the price intervals this adjustment applies to in a given billing period. """ + plan_phase_order: Optional[int] = None + """The plan phase in which this adjustment is active.""" + reason: Optional[str] = None """The reason for the adjustment.""" class AdjustmentIntervalAdjustmentUsageDiscountAdjustment(BaseModel): + id: str + adjustment_type: Literal["usage_discount"] applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" + is_invoice_level: bool + """ + True for adjustments that apply to an entire invocice, false for adjustments + that apply to only one price. + """ + + plan_phase_order: Optional[int] = None + """The plan phase in which this adjustment is active.""" + reason: Optional[str] = None """The reason for the adjustment.""" @@ -83,11 +116,19 @@ class AdjustmentIntervalAdjustmentUsageDiscountAdjustment(BaseModel): class AdjustmentIntervalAdjustmentMinimumAdjustment(BaseModel): + id: str + adjustment_type: Literal["minimum"] applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" + is_invoice_level: bool + """ + True for adjustments that apply to an entire invocice, false for adjustments + that apply to only one price. + """ + item_id: str """The item ID that revenue from this minimum will be attributed to.""" @@ -97,22 +138,36 @@ class AdjustmentIntervalAdjustmentMinimumAdjustment(BaseModel): adjustment applies to. """ + plan_phase_order: Optional[int] = None + """The plan phase in which this adjustment is active.""" + reason: Optional[str] = None """The reason for the adjustment.""" class AdjustmentIntervalAdjustmentMaximumAdjustment(BaseModel): + id: str + adjustment_type: Literal["maximum"] applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" + is_invoice_level: bool + """ + True for adjustments that apply to an entire invocice, false for adjustments + that apply to only one price. + """ + maximum_amount: str """ The maximum amount to charge in a given billing period for the prices this adjustment applies to. """ + plan_phase_order: Optional[int] = None + """The plan phase in which this adjustment is active.""" + reason: Optional[str] = None """The reason for the adjustment.""" diff --git a/src/orb/types/subscription_create_params.py b/src/orb/types/subscription_create_params.py index 882896b3..72273456 100644 --- a/src/orb/types/subscription_create_params.py +++ b/src/orb/types/subscription_create_params.py @@ -13,6 +13,7 @@ "AddAdjustment", "AddAdjustmentAdjustment", "AddAdjustmentAdjustmentNewPercentageDiscount", + "AddAdjustmentAdjustmentNewUsageDiscount", "AddAdjustmentAdjustmentNewAmountDiscount", "AddAdjustmentAdjustmentNewMinimum", "AddAdjustmentAdjustmentNewMaximum", @@ -92,6 +93,7 @@ "ReplaceAdjustment", "ReplaceAdjustmentAdjustment", "ReplaceAdjustmentAdjustmentNewPercentageDiscount", + "ReplaceAdjustmentAdjustmentNewUsageDiscount", "ReplaceAdjustmentAdjustmentNewAmountDiscount", "ReplaceAdjustmentAdjustmentNewMinimum", "ReplaceAdjustmentAdjustmentNewMaximum", @@ -323,6 +325,27 @@ class AddAdjustmentAdjustmentNewPercentageDiscount(TypedDict, total=False): percentage_discount: Required[float] + is_invoice_level: bool + """When false, this adjustment will be applied to a single price. + + Otherwise, it will be applied at the invoice level, possibly to multiple prices. + """ + + +class AddAdjustmentAdjustmentNewUsageDiscount(TypedDict, total=False): + adjustment_type: Required[Literal["usage_discount"]] + + applies_to_price_ids: Required[List[str]] + """The set of price IDs to which this adjustment applies.""" + + usage_discount: Required[float] + + is_invoice_level: bool + """When false, this adjustment will be applied to a single price. + + Otherwise, it will be applied at the invoice level, possibly to multiple prices. + """ + class AddAdjustmentAdjustmentNewAmountDiscount(TypedDict, total=False): adjustment_type: Required[Literal["amount_discount"]] @@ -332,6 +355,12 @@ class AddAdjustmentAdjustmentNewAmountDiscount(TypedDict, total=False): applies_to_price_ids: Required[List[str]] """The set of price IDs to which this adjustment applies.""" + is_invoice_level: bool + """When false, this adjustment will be applied to a single price. + + Otherwise, it will be applied at the invoice level, possibly to multiple prices. + """ + class AddAdjustmentAdjustmentNewMinimum(TypedDict, total=False): adjustment_type: Required[Literal["minimum"]] @@ -344,6 +373,12 @@ class AddAdjustmentAdjustmentNewMinimum(TypedDict, total=False): minimum_amount: Required[str] + is_invoice_level: bool + """When false, this adjustment will be applied to a single price. + + Otherwise, it will be applied at the invoice level, possibly to multiple prices. + """ + class AddAdjustmentAdjustmentNewMaximum(TypedDict, total=False): adjustment_type: Required[Literal["maximum"]] @@ -353,9 +388,16 @@ class AddAdjustmentAdjustmentNewMaximum(TypedDict, total=False): maximum_amount: Required[str] + is_invoice_level: bool + """When false, this adjustment will be applied to a single price. + + Otherwise, it will be applied at the invoice level, possibly to multiple prices. + """ + AddAdjustmentAdjustment: TypeAlias = Union[ AddAdjustmentAdjustmentNewPercentageDiscount, + AddAdjustmentAdjustmentNewUsageDiscount, AddAdjustmentAdjustmentNewAmountDiscount, AddAdjustmentAdjustmentNewMinimum, AddAdjustmentAdjustmentNewMaximum, @@ -2171,7 +2213,10 @@ class AddPricePriceNewSubscriptionBulkWithProrationPrice(TypedDict, total=False) class AddPrice(TypedDict, total=False): discounts: Optional[Iterable[AddPriceDiscount]] - """The subscription's discounts for this price.""" + """[DEPRECATED] Use add_adjustments instead. + + The subscription's discounts for this price. + """ end_date: Annotated[Union[str, datetime, None], PropertyInfo(format="iso8601")] """The end date of the price interval. @@ -2184,10 +2229,16 @@ class AddPrice(TypedDict, total=False): """The external price id of the price to add to the subscription.""" maximum_amount: Optional[str] - """The subscription's maximum amount for this price.""" + """[DEPRECATED] Use add_adjustments instead. + + The subscription's maximum amount for this price. + """ minimum_amount: Optional[str] - """The subscription's minimum amount for this price.""" + """[DEPRECATED] Use add_adjustments instead. + + The subscription's minimum amount for this price. + """ plan_phase_order: Optional[int] """The phase to add this price to.""" @@ -2251,6 +2302,27 @@ class ReplaceAdjustmentAdjustmentNewPercentageDiscount(TypedDict, total=False): percentage_discount: Required[float] + is_invoice_level: bool + """When false, this adjustment will be applied to a single price. + + Otherwise, it will be applied at the invoice level, possibly to multiple prices. + """ + + +class ReplaceAdjustmentAdjustmentNewUsageDiscount(TypedDict, total=False): + adjustment_type: Required[Literal["usage_discount"]] + + applies_to_price_ids: Required[List[str]] + """The set of price IDs to which this adjustment applies.""" + + usage_discount: Required[float] + + is_invoice_level: bool + """When false, this adjustment will be applied to a single price. + + Otherwise, it will be applied at the invoice level, possibly to multiple prices. + """ + class ReplaceAdjustmentAdjustmentNewAmountDiscount(TypedDict, total=False): adjustment_type: Required[Literal["amount_discount"]] @@ -2260,6 +2332,12 @@ class ReplaceAdjustmentAdjustmentNewAmountDiscount(TypedDict, total=False): applies_to_price_ids: Required[List[str]] """The set of price IDs to which this adjustment applies.""" + is_invoice_level: bool + """When false, this adjustment will be applied to a single price. + + Otherwise, it will be applied at the invoice level, possibly to multiple prices. + """ + class ReplaceAdjustmentAdjustmentNewMinimum(TypedDict, total=False): adjustment_type: Required[Literal["minimum"]] @@ -2272,6 +2350,12 @@ class ReplaceAdjustmentAdjustmentNewMinimum(TypedDict, total=False): minimum_amount: Required[str] + is_invoice_level: bool + """When false, this adjustment will be applied to a single price. + + Otherwise, it will be applied at the invoice level, possibly to multiple prices. + """ + class ReplaceAdjustmentAdjustmentNewMaximum(TypedDict, total=False): adjustment_type: Required[Literal["maximum"]] @@ -2281,9 +2365,16 @@ class ReplaceAdjustmentAdjustmentNewMaximum(TypedDict, total=False): maximum_amount: Required[str] + is_invoice_level: bool + """When false, this adjustment will be applied to a single price. + + Otherwise, it will be applied at the invoice level, possibly to multiple prices. + """ + ReplaceAdjustmentAdjustment: TypeAlias = Union[ ReplaceAdjustmentAdjustmentNewPercentageDiscount, + ReplaceAdjustmentAdjustmentNewUsageDiscount, ReplaceAdjustmentAdjustmentNewAmountDiscount, ReplaceAdjustmentAdjustmentNewMinimum, ReplaceAdjustmentAdjustmentNewMaximum, @@ -4102,7 +4193,10 @@ class ReplacePrice(TypedDict, total=False): """The id of the price on the plan to replace in the subscription.""" discounts: Optional[Iterable[ReplacePriceDiscount]] - """The subscription's discounts for the replacement price.""" + """[DEPRECATED] Use add_adjustments instead. + + The subscription's discounts for the replacement price. + """ external_price_id: Optional[str] """The external price id of the price to add to the subscription.""" @@ -4111,10 +4205,16 @@ class ReplacePrice(TypedDict, total=False): """The new quantity of the price, if the price is a fixed price.""" maximum_amount: Optional[str] - """The subscription's maximum amount for the replacement price.""" + """[DEPRECATED] Use add_adjustments instead. + + The subscription's maximum amount for the replacement price. + """ minimum_amount: Optional[str] - """The subscription's minimum amount for the replacement price.""" + """[DEPRECATED] Use add_adjustments instead. + + The subscription's minimum amount for the replacement price. + """ price: Optional[ReplacePricePrice] """The definition of a new price to create and add to the subscription.""" diff --git a/src/orb/types/subscription_create_response.py b/src/orb/types/subscription_create_response.py index 646b88b7..b4fa41f7 100644 --- a/src/orb/types/subscription_create_response.py +++ b/src/orb/types/subscription_create_response.py @@ -35,6 +35,8 @@ class AdjustmentIntervalAdjustmentAmountDiscountAdjustment(BaseModel): + id: str + adjustment_type: Literal["amount_discount"] amount_discount: str @@ -46,32 +48,63 @@ class AdjustmentIntervalAdjustmentAmountDiscountAdjustment(BaseModel): applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" + is_invoice_level: bool + """ + True for adjustments that apply to an entire invocice, false for adjustments + that apply to only one price. + """ + + plan_phase_order: Optional[int] = None + """The plan phase in which this adjustment is active.""" + reason: Optional[str] = None """The reason for the adjustment.""" class AdjustmentIntervalAdjustmentPercentageDiscountAdjustment(BaseModel): + id: str + adjustment_type: Literal["percentage_discount"] applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" + is_invoice_level: bool + """ + True for adjustments that apply to an entire invocice, false for adjustments + that apply to only one price. + """ + percentage_discount: float """ The percentage (as a value between 0 and 1) by which to discount the price intervals this adjustment applies to in a given billing period. """ + plan_phase_order: Optional[int] = None + """The plan phase in which this adjustment is active.""" + reason: Optional[str] = None """The reason for the adjustment.""" class AdjustmentIntervalAdjustmentUsageDiscountAdjustment(BaseModel): + id: str + adjustment_type: Literal["usage_discount"] applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" + is_invoice_level: bool + """ + True for adjustments that apply to an entire invocice, false for adjustments + that apply to only one price. + """ + + plan_phase_order: Optional[int] = None + """The plan phase in which this adjustment is active.""" + reason: Optional[str] = None """The reason for the adjustment.""" @@ -83,11 +116,19 @@ class AdjustmentIntervalAdjustmentUsageDiscountAdjustment(BaseModel): class AdjustmentIntervalAdjustmentMinimumAdjustment(BaseModel): + id: str + adjustment_type: Literal["minimum"] applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" + is_invoice_level: bool + """ + True for adjustments that apply to an entire invocice, false for adjustments + that apply to only one price. + """ + item_id: str """The item ID that revenue from this minimum will be attributed to.""" @@ -97,22 +138,36 @@ class AdjustmentIntervalAdjustmentMinimumAdjustment(BaseModel): adjustment applies to. """ + plan_phase_order: Optional[int] = None + """The plan phase in which this adjustment is active.""" + reason: Optional[str] = None """The reason for the adjustment.""" class AdjustmentIntervalAdjustmentMaximumAdjustment(BaseModel): + id: str + adjustment_type: Literal["maximum"] applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" + is_invoice_level: bool + """ + True for adjustments that apply to an entire invocice, false for adjustments + that apply to only one price. + """ + maximum_amount: str """ The maximum amount to charge in a given billing period for the prices this adjustment applies to. """ + plan_phase_order: Optional[int] = None + """The plan phase in which this adjustment is active.""" + reason: Optional[str] = None """The reason for the adjustment.""" diff --git a/src/orb/types/subscription_price_intervals_params.py b/src/orb/types/subscription_price_intervals_params.py index b3c1e580..6718c2e8 100644 --- a/src/orb/types/subscription_price_intervals_params.py +++ b/src/orb/types/subscription_price_intervals_params.py @@ -109,6 +109,7 @@ "AddAdjustment", "AddAdjustmentAdjustment", "AddAdjustmentAdjustmentNewPercentageDiscount", + "AddAdjustmentAdjustmentNewUsageDiscount", "AddAdjustmentAdjustmentNewAmountDiscount", "AddAdjustmentAdjustmentNewMinimum", "AddAdjustmentAdjustmentNewMaximum", @@ -2344,6 +2345,27 @@ class AddAdjustmentAdjustmentNewPercentageDiscount(TypedDict, total=False): percentage_discount: Required[float] + is_invoice_level: bool + """When false, this adjustment will be applied to a single price. + + Otherwise, it will be applied at the invoice level, possibly to multiple prices. + """ + + +class AddAdjustmentAdjustmentNewUsageDiscount(TypedDict, total=False): + adjustment_type: Required[Literal["usage_discount"]] + + applies_to_price_ids: Required[List[str]] + """The set of price IDs to which this adjustment applies.""" + + usage_discount: Required[float] + + is_invoice_level: bool + """When false, this adjustment will be applied to a single price. + + Otherwise, it will be applied at the invoice level, possibly to multiple prices. + """ + class AddAdjustmentAdjustmentNewAmountDiscount(TypedDict, total=False): adjustment_type: Required[Literal["amount_discount"]] @@ -2353,6 +2375,12 @@ class AddAdjustmentAdjustmentNewAmountDiscount(TypedDict, total=False): applies_to_price_ids: Required[List[str]] """The set of price IDs to which this adjustment applies.""" + is_invoice_level: bool + """When false, this adjustment will be applied to a single price. + + Otherwise, it will be applied at the invoice level, possibly to multiple prices. + """ + class AddAdjustmentAdjustmentNewMinimum(TypedDict, total=False): adjustment_type: Required[Literal["minimum"]] @@ -2365,6 +2393,12 @@ class AddAdjustmentAdjustmentNewMinimum(TypedDict, total=False): minimum_amount: Required[str] + is_invoice_level: bool + """When false, this adjustment will be applied to a single price. + + Otherwise, it will be applied at the invoice level, possibly to multiple prices. + """ + class AddAdjustmentAdjustmentNewMaximum(TypedDict, total=False): adjustment_type: Required[Literal["maximum"]] @@ -2374,9 +2408,16 @@ class AddAdjustmentAdjustmentNewMaximum(TypedDict, total=False): maximum_amount: Required[str] + is_invoice_level: bool + """When false, this adjustment will be applied to a single price. + + Otherwise, it will be applied at the invoice level, possibly to multiple prices. + """ + AddAdjustmentAdjustment: TypeAlias = Union[ AddAdjustmentAdjustmentNewPercentageDiscount, + AddAdjustmentAdjustmentNewUsageDiscount, AddAdjustmentAdjustmentNewAmountDiscount, AddAdjustmentAdjustmentNewMinimum, AddAdjustmentAdjustmentNewMaximum, diff --git a/src/orb/types/subscription_price_intervals_response.py b/src/orb/types/subscription_price_intervals_response.py index 31fd180c..a83dcd42 100644 --- a/src/orb/types/subscription_price_intervals_response.py +++ b/src/orb/types/subscription_price_intervals_response.py @@ -35,6 +35,8 @@ class AdjustmentIntervalAdjustmentAmountDiscountAdjustment(BaseModel): + id: str + adjustment_type: Literal["amount_discount"] amount_discount: str @@ -46,32 +48,63 @@ class AdjustmentIntervalAdjustmentAmountDiscountAdjustment(BaseModel): applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" + is_invoice_level: bool + """ + True for adjustments that apply to an entire invocice, false for adjustments + that apply to only one price. + """ + + plan_phase_order: Optional[int] = None + """The plan phase in which this adjustment is active.""" + reason: Optional[str] = None """The reason for the adjustment.""" class AdjustmentIntervalAdjustmentPercentageDiscountAdjustment(BaseModel): + id: str + adjustment_type: Literal["percentage_discount"] applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" + is_invoice_level: bool + """ + True for adjustments that apply to an entire invocice, false for adjustments + that apply to only one price. + """ + percentage_discount: float """ The percentage (as a value between 0 and 1) by which to discount the price intervals this adjustment applies to in a given billing period. """ + plan_phase_order: Optional[int] = None + """The plan phase in which this adjustment is active.""" + reason: Optional[str] = None """The reason for the adjustment.""" class AdjustmentIntervalAdjustmentUsageDiscountAdjustment(BaseModel): + id: str + adjustment_type: Literal["usage_discount"] applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" + is_invoice_level: bool + """ + True for adjustments that apply to an entire invocice, false for adjustments + that apply to only one price. + """ + + plan_phase_order: Optional[int] = None + """The plan phase in which this adjustment is active.""" + reason: Optional[str] = None """The reason for the adjustment.""" @@ -83,11 +116,19 @@ class AdjustmentIntervalAdjustmentUsageDiscountAdjustment(BaseModel): class AdjustmentIntervalAdjustmentMinimumAdjustment(BaseModel): + id: str + adjustment_type: Literal["minimum"] applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" + is_invoice_level: bool + """ + True for adjustments that apply to an entire invocice, false for adjustments + that apply to only one price. + """ + item_id: str """The item ID that revenue from this minimum will be attributed to.""" @@ -97,22 +138,36 @@ class AdjustmentIntervalAdjustmentMinimumAdjustment(BaseModel): adjustment applies to. """ + plan_phase_order: Optional[int] = None + """The plan phase in which this adjustment is active.""" + reason: Optional[str] = None """The reason for the adjustment.""" class AdjustmentIntervalAdjustmentMaximumAdjustment(BaseModel): + id: str + adjustment_type: Literal["maximum"] applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" + is_invoice_level: bool + """ + True for adjustments that apply to an entire invocice, false for adjustments + that apply to only one price. + """ + maximum_amount: str """ The maximum amount to charge in a given billing period for the prices this adjustment applies to. """ + plan_phase_order: Optional[int] = None + """The plan phase in which this adjustment is active.""" + reason: Optional[str] = None """The reason for the adjustment.""" diff --git a/src/orb/types/subscription_schedule_plan_change_params.py b/src/orb/types/subscription_schedule_plan_change_params.py index 577fed31..6b3c7074 100644 --- a/src/orb/types/subscription_schedule_plan_change_params.py +++ b/src/orb/types/subscription_schedule_plan_change_params.py @@ -13,6 +13,7 @@ "AddAdjustment", "AddAdjustmentAdjustment", "AddAdjustmentAdjustmentNewPercentageDiscount", + "AddAdjustmentAdjustmentNewUsageDiscount", "AddAdjustmentAdjustmentNewAmountDiscount", "AddAdjustmentAdjustmentNewMinimum", "AddAdjustmentAdjustmentNewMaximum", @@ -92,6 +93,7 @@ "ReplaceAdjustment", "ReplaceAdjustmentAdjustment", "ReplaceAdjustmentAdjustmentNewPercentageDiscount", + "ReplaceAdjustmentAdjustmentNewUsageDiscount", "ReplaceAdjustmentAdjustmentNewAmountDiscount", "ReplaceAdjustmentAdjustmentNewMinimum", "ReplaceAdjustmentAdjustmentNewMaximum", @@ -321,6 +323,27 @@ class AddAdjustmentAdjustmentNewPercentageDiscount(TypedDict, total=False): percentage_discount: Required[float] + is_invoice_level: bool + """When false, this adjustment will be applied to a single price. + + Otherwise, it will be applied at the invoice level, possibly to multiple prices. + """ + + +class AddAdjustmentAdjustmentNewUsageDiscount(TypedDict, total=False): + adjustment_type: Required[Literal["usage_discount"]] + + applies_to_price_ids: Required[List[str]] + """The set of price IDs to which this adjustment applies.""" + + usage_discount: Required[float] + + is_invoice_level: bool + """When false, this adjustment will be applied to a single price. + + Otherwise, it will be applied at the invoice level, possibly to multiple prices. + """ + class AddAdjustmentAdjustmentNewAmountDiscount(TypedDict, total=False): adjustment_type: Required[Literal["amount_discount"]] @@ -330,6 +353,12 @@ class AddAdjustmentAdjustmentNewAmountDiscount(TypedDict, total=False): applies_to_price_ids: Required[List[str]] """The set of price IDs to which this adjustment applies.""" + is_invoice_level: bool + """When false, this adjustment will be applied to a single price. + + Otherwise, it will be applied at the invoice level, possibly to multiple prices. + """ + class AddAdjustmentAdjustmentNewMinimum(TypedDict, total=False): adjustment_type: Required[Literal["minimum"]] @@ -342,6 +371,12 @@ class AddAdjustmentAdjustmentNewMinimum(TypedDict, total=False): minimum_amount: Required[str] + is_invoice_level: bool + """When false, this adjustment will be applied to a single price. + + Otherwise, it will be applied at the invoice level, possibly to multiple prices. + """ + class AddAdjustmentAdjustmentNewMaximum(TypedDict, total=False): adjustment_type: Required[Literal["maximum"]] @@ -351,9 +386,16 @@ class AddAdjustmentAdjustmentNewMaximum(TypedDict, total=False): maximum_amount: Required[str] + is_invoice_level: bool + """When false, this adjustment will be applied to a single price. + + Otherwise, it will be applied at the invoice level, possibly to multiple prices. + """ + AddAdjustmentAdjustment: TypeAlias = Union[ AddAdjustmentAdjustmentNewPercentageDiscount, + AddAdjustmentAdjustmentNewUsageDiscount, AddAdjustmentAdjustmentNewAmountDiscount, AddAdjustmentAdjustmentNewMinimum, AddAdjustmentAdjustmentNewMaximum, @@ -2169,7 +2211,10 @@ class AddPricePriceNewSubscriptionBulkWithProrationPrice(TypedDict, total=False) class AddPrice(TypedDict, total=False): discounts: Optional[Iterable[AddPriceDiscount]] - """The subscription's discounts for this price.""" + """[DEPRECATED] Use add_adjustments instead. + + The subscription's discounts for this price. + """ end_date: Annotated[Union[str, datetime, None], PropertyInfo(format="iso8601")] """The end date of the price interval. @@ -2182,10 +2227,16 @@ class AddPrice(TypedDict, total=False): """The external price id of the price to add to the subscription.""" maximum_amount: Optional[str] - """The subscription's maximum amount for this price.""" + """[DEPRECATED] Use add_adjustments instead. + + The subscription's maximum amount for this price. + """ minimum_amount: Optional[str] - """The subscription's minimum amount for this price.""" + """[DEPRECATED] Use add_adjustments instead. + + The subscription's minimum amount for this price. + """ plan_phase_order: Optional[int] """The phase to add this price to.""" @@ -2249,6 +2300,27 @@ class ReplaceAdjustmentAdjustmentNewPercentageDiscount(TypedDict, total=False): percentage_discount: Required[float] + is_invoice_level: bool + """When false, this adjustment will be applied to a single price. + + Otherwise, it will be applied at the invoice level, possibly to multiple prices. + """ + + +class ReplaceAdjustmentAdjustmentNewUsageDiscount(TypedDict, total=False): + adjustment_type: Required[Literal["usage_discount"]] + + applies_to_price_ids: Required[List[str]] + """The set of price IDs to which this adjustment applies.""" + + usage_discount: Required[float] + + is_invoice_level: bool + """When false, this adjustment will be applied to a single price. + + Otherwise, it will be applied at the invoice level, possibly to multiple prices. + """ + class ReplaceAdjustmentAdjustmentNewAmountDiscount(TypedDict, total=False): adjustment_type: Required[Literal["amount_discount"]] @@ -2258,6 +2330,12 @@ class ReplaceAdjustmentAdjustmentNewAmountDiscount(TypedDict, total=False): applies_to_price_ids: Required[List[str]] """The set of price IDs to which this adjustment applies.""" + is_invoice_level: bool + """When false, this adjustment will be applied to a single price. + + Otherwise, it will be applied at the invoice level, possibly to multiple prices. + """ + class ReplaceAdjustmentAdjustmentNewMinimum(TypedDict, total=False): adjustment_type: Required[Literal["minimum"]] @@ -2270,6 +2348,12 @@ class ReplaceAdjustmentAdjustmentNewMinimum(TypedDict, total=False): minimum_amount: Required[str] + is_invoice_level: bool + """When false, this adjustment will be applied to a single price. + + Otherwise, it will be applied at the invoice level, possibly to multiple prices. + """ + class ReplaceAdjustmentAdjustmentNewMaximum(TypedDict, total=False): adjustment_type: Required[Literal["maximum"]] @@ -2279,9 +2363,16 @@ class ReplaceAdjustmentAdjustmentNewMaximum(TypedDict, total=False): maximum_amount: Required[str] + is_invoice_level: bool + """When false, this adjustment will be applied to a single price. + + Otherwise, it will be applied at the invoice level, possibly to multiple prices. + """ + ReplaceAdjustmentAdjustment: TypeAlias = Union[ ReplaceAdjustmentAdjustmentNewPercentageDiscount, + ReplaceAdjustmentAdjustmentNewUsageDiscount, ReplaceAdjustmentAdjustmentNewAmountDiscount, ReplaceAdjustmentAdjustmentNewMinimum, ReplaceAdjustmentAdjustmentNewMaximum, @@ -4100,7 +4191,10 @@ class ReplacePrice(TypedDict, total=False): """The id of the price on the plan to replace in the subscription.""" discounts: Optional[Iterable[ReplacePriceDiscount]] - """The subscription's discounts for the replacement price.""" + """[DEPRECATED] Use add_adjustments instead. + + The subscription's discounts for the replacement price. + """ external_price_id: Optional[str] """The external price id of the price to add to the subscription.""" @@ -4109,10 +4203,16 @@ class ReplacePrice(TypedDict, total=False): """The new quantity of the price, if the price is a fixed price.""" maximum_amount: Optional[str] - """The subscription's maximum amount for the replacement price.""" + """[DEPRECATED] Use add_adjustments instead. + + The subscription's maximum amount for the replacement price. + """ minimum_amount: Optional[str] - """The subscription's minimum amount for the replacement price.""" + """[DEPRECATED] Use add_adjustments instead. + + The subscription's minimum amount for the replacement price. + """ price: Optional[ReplacePricePrice] """The definition of a new price to create and add to the subscription.""" diff --git a/src/orb/types/subscription_schedule_plan_change_response.py b/src/orb/types/subscription_schedule_plan_change_response.py index e1368797..01cae797 100644 --- a/src/orb/types/subscription_schedule_plan_change_response.py +++ b/src/orb/types/subscription_schedule_plan_change_response.py @@ -35,6 +35,8 @@ class AdjustmentIntervalAdjustmentAmountDiscountAdjustment(BaseModel): + id: str + adjustment_type: Literal["amount_discount"] amount_discount: str @@ -46,32 +48,63 @@ class AdjustmentIntervalAdjustmentAmountDiscountAdjustment(BaseModel): applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" + is_invoice_level: bool + """ + True for adjustments that apply to an entire invocice, false for adjustments + that apply to only one price. + """ + + plan_phase_order: Optional[int] = None + """The plan phase in which this adjustment is active.""" + reason: Optional[str] = None """The reason for the adjustment.""" class AdjustmentIntervalAdjustmentPercentageDiscountAdjustment(BaseModel): + id: str + adjustment_type: Literal["percentage_discount"] applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" + is_invoice_level: bool + """ + True for adjustments that apply to an entire invocice, false for adjustments + that apply to only one price. + """ + percentage_discount: float """ The percentage (as a value between 0 and 1) by which to discount the price intervals this adjustment applies to in a given billing period. """ + plan_phase_order: Optional[int] = None + """The plan phase in which this adjustment is active.""" + reason: Optional[str] = None """The reason for the adjustment.""" class AdjustmentIntervalAdjustmentUsageDiscountAdjustment(BaseModel): + id: str + adjustment_type: Literal["usage_discount"] applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" + is_invoice_level: bool + """ + True for adjustments that apply to an entire invocice, false for adjustments + that apply to only one price. + """ + + plan_phase_order: Optional[int] = None + """The plan phase in which this adjustment is active.""" + reason: Optional[str] = None """The reason for the adjustment.""" @@ -83,11 +116,19 @@ class AdjustmentIntervalAdjustmentUsageDiscountAdjustment(BaseModel): class AdjustmentIntervalAdjustmentMinimumAdjustment(BaseModel): + id: str + adjustment_type: Literal["minimum"] applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" + is_invoice_level: bool + """ + True for adjustments that apply to an entire invocice, false for adjustments + that apply to only one price. + """ + item_id: str """The item ID that revenue from this minimum will be attributed to.""" @@ -97,22 +138,36 @@ class AdjustmentIntervalAdjustmentMinimumAdjustment(BaseModel): adjustment applies to. """ + plan_phase_order: Optional[int] = None + """The plan phase in which this adjustment is active.""" + reason: Optional[str] = None """The reason for the adjustment.""" class AdjustmentIntervalAdjustmentMaximumAdjustment(BaseModel): + id: str + adjustment_type: Literal["maximum"] applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" + is_invoice_level: bool + """ + True for adjustments that apply to an entire invocice, false for adjustments + that apply to only one price. + """ + maximum_amount: str """ The maximum amount to charge in a given billing period for the prices this adjustment applies to. """ + plan_phase_order: Optional[int] = None + """The plan phase in which this adjustment is active.""" + reason: Optional[str] = None """The reason for the adjustment.""" diff --git a/src/orb/types/subscription_trigger_phase_response.py b/src/orb/types/subscription_trigger_phase_response.py index 5036d2a5..46c4e437 100644 --- a/src/orb/types/subscription_trigger_phase_response.py +++ b/src/orb/types/subscription_trigger_phase_response.py @@ -35,6 +35,8 @@ class AdjustmentIntervalAdjustmentAmountDiscountAdjustment(BaseModel): + id: str + adjustment_type: Literal["amount_discount"] amount_discount: str @@ -46,32 +48,63 @@ class AdjustmentIntervalAdjustmentAmountDiscountAdjustment(BaseModel): applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" + is_invoice_level: bool + """ + True for adjustments that apply to an entire invocice, false for adjustments + that apply to only one price. + """ + + plan_phase_order: Optional[int] = None + """The plan phase in which this adjustment is active.""" + reason: Optional[str] = None """The reason for the adjustment.""" class AdjustmentIntervalAdjustmentPercentageDiscountAdjustment(BaseModel): + id: str + adjustment_type: Literal["percentage_discount"] applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" + is_invoice_level: bool + """ + True for adjustments that apply to an entire invocice, false for adjustments + that apply to only one price. + """ + percentage_discount: float """ The percentage (as a value between 0 and 1) by which to discount the price intervals this adjustment applies to in a given billing period. """ + plan_phase_order: Optional[int] = None + """The plan phase in which this adjustment is active.""" + reason: Optional[str] = None """The reason for the adjustment.""" class AdjustmentIntervalAdjustmentUsageDiscountAdjustment(BaseModel): + id: str + adjustment_type: Literal["usage_discount"] applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" + is_invoice_level: bool + """ + True for adjustments that apply to an entire invocice, false for adjustments + that apply to only one price. + """ + + plan_phase_order: Optional[int] = None + """The plan phase in which this adjustment is active.""" + reason: Optional[str] = None """The reason for the adjustment.""" @@ -83,11 +116,19 @@ class AdjustmentIntervalAdjustmentUsageDiscountAdjustment(BaseModel): class AdjustmentIntervalAdjustmentMinimumAdjustment(BaseModel): + id: str + adjustment_type: Literal["minimum"] applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" + is_invoice_level: bool + """ + True for adjustments that apply to an entire invocice, false for adjustments + that apply to only one price. + """ + item_id: str """The item ID that revenue from this minimum will be attributed to.""" @@ -97,22 +138,36 @@ class AdjustmentIntervalAdjustmentMinimumAdjustment(BaseModel): adjustment applies to. """ + plan_phase_order: Optional[int] = None + """The plan phase in which this adjustment is active.""" + reason: Optional[str] = None """The reason for the adjustment.""" class AdjustmentIntervalAdjustmentMaximumAdjustment(BaseModel): + id: str + adjustment_type: Literal["maximum"] applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" + is_invoice_level: bool + """ + True for adjustments that apply to an entire invocice, false for adjustments + that apply to only one price. + """ + maximum_amount: str """ The maximum amount to charge in a given billing period for the prices this adjustment applies to. """ + plan_phase_order: Optional[int] = None + """The plan phase in which this adjustment is active.""" + reason: Optional[str] = None """The reason for the adjustment.""" diff --git a/src/orb/types/subscription_unschedule_cancellation_response.py b/src/orb/types/subscription_unschedule_cancellation_response.py index 0d9b131c..d8642ac4 100644 --- a/src/orb/types/subscription_unschedule_cancellation_response.py +++ b/src/orb/types/subscription_unschedule_cancellation_response.py @@ -35,6 +35,8 @@ class AdjustmentIntervalAdjustmentAmountDiscountAdjustment(BaseModel): + id: str + adjustment_type: Literal["amount_discount"] amount_discount: str @@ -46,32 +48,63 @@ class AdjustmentIntervalAdjustmentAmountDiscountAdjustment(BaseModel): applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" + is_invoice_level: bool + """ + True for adjustments that apply to an entire invocice, false for adjustments + that apply to only one price. + """ + + plan_phase_order: Optional[int] = None + """The plan phase in which this adjustment is active.""" + reason: Optional[str] = None """The reason for the adjustment.""" class AdjustmentIntervalAdjustmentPercentageDiscountAdjustment(BaseModel): + id: str + adjustment_type: Literal["percentage_discount"] applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" + is_invoice_level: bool + """ + True for adjustments that apply to an entire invocice, false for adjustments + that apply to only one price. + """ + percentage_discount: float """ The percentage (as a value between 0 and 1) by which to discount the price intervals this adjustment applies to in a given billing period. """ + plan_phase_order: Optional[int] = None + """The plan phase in which this adjustment is active.""" + reason: Optional[str] = None """The reason for the adjustment.""" class AdjustmentIntervalAdjustmentUsageDiscountAdjustment(BaseModel): + id: str + adjustment_type: Literal["usage_discount"] applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" + is_invoice_level: bool + """ + True for adjustments that apply to an entire invocice, false for adjustments + that apply to only one price. + """ + + plan_phase_order: Optional[int] = None + """The plan phase in which this adjustment is active.""" + reason: Optional[str] = None """The reason for the adjustment.""" @@ -83,11 +116,19 @@ class AdjustmentIntervalAdjustmentUsageDiscountAdjustment(BaseModel): class AdjustmentIntervalAdjustmentMinimumAdjustment(BaseModel): + id: str + adjustment_type: Literal["minimum"] applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" + is_invoice_level: bool + """ + True for adjustments that apply to an entire invocice, false for adjustments + that apply to only one price. + """ + item_id: str """The item ID that revenue from this minimum will be attributed to.""" @@ -97,22 +138,36 @@ class AdjustmentIntervalAdjustmentMinimumAdjustment(BaseModel): adjustment applies to. """ + plan_phase_order: Optional[int] = None + """The plan phase in which this adjustment is active.""" + reason: Optional[str] = None """The reason for the adjustment.""" class AdjustmentIntervalAdjustmentMaximumAdjustment(BaseModel): + id: str + adjustment_type: Literal["maximum"] applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" + is_invoice_level: bool + """ + True for adjustments that apply to an entire invocice, false for adjustments + that apply to only one price. + """ + maximum_amount: str """ The maximum amount to charge in a given billing period for the prices this adjustment applies to. """ + plan_phase_order: Optional[int] = None + """The plan phase in which this adjustment is active.""" + reason: Optional[str] = None """The reason for the adjustment.""" diff --git a/src/orb/types/subscription_unschedule_fixed_fee_quantity_updates_response.py b/src/orb/types/subscription_unschedule_fixed_fee_quantity_updates_response.py index cc72ea4e..28d2b6aa 100644 --- a/src/orb/types/subscription_unschedule_fixed_fee_quantity_updates_response.py +++ b/src/orb/types/subscription_unschedule_fixed_fee_quantity_updates_response.py @@ -35,6 +35,8 @@ class AdjustmentIntervalAdjustmentAmountDiscountAdjustment(BaseModel): + id: str + adjustment_type: Literal["amount_discount"] amount_discount: str @@ -46,32 +48,63 @@ class AdjustmentIntervalAdjustmentAmountDiscountAdjustment(BaseModel): applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" + is_invoice_level: bool + """ + True for adjustments that apply to an entire invocice, false for adjustments + that apply to only one price. + """ + + plan_phase_order: Optional[int] = None + """The plan phase in which this adjustment is active.""" + reason: Optional[str] = None """The reason for the adjustment.""" class AdjustmentIntervalAdjustmentPercentageDiscountAdjustment(BaseModel): + id: str + adjustment_type: Literal["percentage_discount"] applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" + is_invoice_level: bool + """ + True for adjustments that apply to an entire invocice, false for adjustments + that apply to only one price. + """ + percentage_discount: float """ The percentage (as a value between 0 and 1) by which to discount the price intervals this adjustment applies to in a given billing period. """ + plan_phase_order: Optional[int] = None + """The plan phase in which this adjustment is active.""" + reason: Optional[str] = None """The reason for the adjustment.""" class AdjustmentIntervalAdjustmentUsageDiscountAdjustment(BaseModel): + id: str + adjustment_type: Literal["usage_discount"] applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" + is_invoice_level: bool + """ + True for adjustments that apply to an entire invocice, false for adjustments + that apply to only one price. + """ + + plan_phase_order: Optional[int] = None + """The plan phase in which this adjustment is active.""" + reason: Optional[str] = None """The reason for the adjustment.""" @@ -83,11 +116,19 @@ class AdjustmentIntervalAdjustmentUsageDiscountAdjustment(BaseModel): class AdjustmentIntervalAdjustmentMinimumAdjustment(BaseModel): + id: str + adjustment_type: Literal["minimum"] applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" + is_invoice_level: bool + """ + True for adjustments that apply to an entire invocice, false for adjustments + that apply to only one price. + """ + item_id: str """The item ID that revenue from this minimum will be attributed to.""" @@ -97,22 +138,36 @@ class AdjustmentIntervalAdjustmentMinimumAdjustment(BaseModel): adjustment applies to. """ + plan_phase_order: Optional[int] = None + """The plan phase in which this adjustment is active.""" + reason: Optional[str] = None """The reason for the adjustment.""" class AdjustmentIntervalAdjustmentMaximumAdjustment(BaseModel): + id: str + adjustment_type: Literal["maximum"] applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" + is_invoice_level: bool + """ + True for adjustments that apply to an entire invocice, false for adjustments + that apply to only one price. + """ + maximum_amount: str """ The maximum amount to charge in a given billing period for the prices this adjustment applies to. """ + plan_phase_order: Optional[int] = None + """The plan phase in which this adjustment is active.""" + reason: Optional[str] = None """The reason for the adjustment.""" diff --git a/src/orb/types/subscription_unschedule_pending_plan_changes_response.py b/src/orb/types/subscription_unschedule_pending_plan_changes_response.py index 336ab322..3b4bfd32 100644 --- a/src/orb/types/subscription_unschedule_pending_plan_changes_response.py +++ b/src/orb/types/subscription_unschedule_pending_plan_changes_response.py @@ -35,6 +35,8 @@ class AdjustmentIntervalAdjustmentAmountDiscountAdjustment(BaseModel): + id: str + adjustment_type: Literal["amount_discount"] amount_discount: str @@ -46,32 +48,63 @@ class AdjustmentIntervalAdjustmentAmountDiscountAdjustment(BaseModel): applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" + is_invoice_level: bool + """ + True for adjustments that apply to an entire invocice, false for adjustments + that apply to only one price. + """ + + plan_phase_order: Optional[int] = None + """The plan phase in which this adjustment is active.""" + reason: Optional[str] = None """The reason for the adjustment.""" class AdjustmentIntervalAdjustmentPercentageDiscountAdjustment(BaseModel): + id: str + adjustment_type: Literal["percentage_discount"] applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" + is_invoice_level: bool + """ + True for adjustments that apply to an entire invocice, false for adjustments + that apply to only one price. + """ + percentage_discount: float """ The percentage (as a value between 0 and 1) by which to discount the price intervals this adjustment applies to in a given billing period. """ + plan_phase_order: Optional[int] = None + """The plan phase in which this adjustment is active.""" + reason: Optional[str] = None """The reason for the adjustment.""" class AdjustmentIntervalAdjustmentUsageDiscountAdjustment(BaseModel): + id: str + adjustment_type: Literal["usage_discount"] applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" + is_invoice_level: bool + """ + True for adjustments that apply to an entire invocice, false for adjustments + that apply to only one price. + """ + + plan_phase_order: Optional[int] = None + """The plan phase in which this adjustment is active.""" + reason: Optional[str] = None """The reason for the adjustment.""" @@ -83,11 +116,19 @@ class AdjustmentIntervalAdjustmentUsageDiscountAdjustment(BaseModel): class AdjustmentIntervalAdjustmentMinimumAdjustment(BaseModel): + id: str + adjustment_type: Literal["minimum"] applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" + is_invoice_level: bool + """ + True for adjustments that apply to an entire invocice, false for adjustments + that apply to only one price. + """ + item_id: str """The item ID that revenue from this minimum will be attributed to.""" @@ -97,22 +138,36 @@ class AdjustmentIntervalAdjustmentMinimumAdjustment(BaseModel): adjustment applies to. """ + plan_phase_order: Optional[int] = None + """The plan phase in which this adjustment is active.""" + reason: Optional[str] = None """The reason for the adjustment.""" class AdjustmentIntervalAdjustmentMaximumAdjustment(BaseModel): + id: str + adjustment_type: Literal["maximum"] applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" + is_invoice_level: bool + """ + True for adjustments that apply to an entire invocice, false for adjustments + that apply to only one price. + """ + maximum_amount: str """ The maximum amount to charge in a given billing period for the prices this adjustment applies to. """ + plan_phase_order: Optional[int] = None + """The plan phase in which this adjustment is active.""" + reason: Optional[str] = None """The reason for the adjustment.""" diff --git a/src/orb/types/subscription_update_fixed_fee_quantity_response.py b/src/orb/types/subscription_update_fixed_fee_quantity_response.py index 27dcf8bc..55a83b5e 100644 --- a/src/orb/types/subscription_update_fixed_fee_quantity_response.py +++ b/src/orb/types/subscription_update_fixed_fee_quantity_response.py @@ -35,6 +35,8 @@ class AdjustmentIntervalAdjustmentAmountDiscountAdjustment(BaseModel): + id: str + adjustment_type: Literal["amount_discount"] amount_discount: str @@ -46,32 +48,63 @@ class AdjustmentIntervalAdjustmentAmountDiscountAdjustment(BaseModel): applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" + is_invoice_level: bool + """ + True for adjustments that apply to an entire invocice, false for adjustments + that apply to only one price. + """ + + plan_phase_order: Optional[int] = None + """The plan phase in which this adjustment is active.""" + reason: Optional[str] = None """The reason for the adjustment.""" class AdjustmentIntervalAdjustmentPercentageDiscountAdjustment(BaseModel): + id: str + adjustment_type: Literal["percentage_discount"] applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" + is_invoice_level: bool + """ + True for adjustments that apply to an entire invocice, false for adjustments + that apply to only one price. + """ + percentage_discount: float """ The percentage (as a value between 0 and 1) by which to discount the price intervals this adjustment applies to in a given billing period. """ + plan_phase_order: Optional[int] = None + """The plan phase in which this adjustment is active.""" + reason: Optional[str] = None """The reason for the adjustment.""" class AdjustmentIntervalAdjustmentUsageDiscountAdjustment(BaseModel): + id: str + adjustment_type: Literal["usage_discount"] applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" + is_invoice_level: bool + """ + True for adjustments that apply to an entire invocice, false for adjustments + that apply to only one price. + """ + + plan_phase_order: Optional[int] = None + """The plan phase in which this adjustment is active.""" + reason: Optional[str] = None """The reason for the adjustment.""" @@ -83,11 +116,19 @@ class AdjustmentIntervalAdjustmentUsageDiscountAdjustment(BaseModel): class AdjustmentIntervalAdjustmentMinimumAdjustment(BaseModel): + id: str + adjustment_type: Literal["minimum"] applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" + is_invoice_level: bool + """ + True for adjustments that apply to an entire invocice, false for adjustments + that apply to only one price. + """ + item_id: str """The item ID that revenue from this minimum will be attributed to.""" @@ -97,22 +138,36 @@ class AdjustmentIntervalAdjustmentMinimumAdjustment(BaseModel): adjustment applies to. """ + plan_phase_order: Optional[int] = None + """The plan phase in which this adjustment is active.""" + reason: Optional[str] = None """The reason for the adjustment.""" class AdjustmentIntervalAdjustmentMaximumAdjustment(BaseModel): + id: str + adjustment_type: Literal["maximum"] applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" + is_invoice_level: bool + """ + True for adjustments that apply to an entire invocice, false for adjustments + that apply to only one price. + """ + maximum_amount: str """ The maximum amount to charge in a given billing period for the prices this adjustment applies to. """ + plan_phase_order: Optional[int] = None + """The plan phase in which this adjustment is active.""" + reason: Optional[str] = None """The reason for the adjustment.""" diff --git a/src/orb/types/subscription_update_trial_response.py b/src/orb/types/subscription_update_trial_response.py index 7b95149a..c2b6797b 100644 --- a/src/orb/types/subscription_update_trial_response.py +++ b/src/orb/types/subscription_update_trial_response.py @@ -35,6 +35,8 @@ class AdjustmentIntervalAdjustmentAmountDiscountAdjustment(BaseModel): + id: str + adjustment_type: Literal["amount_discount"] amount_discount: str @@ -46,32 +48,63 @@ class AdjustmentIntervalAdjustmentAmountDiscountAdjustment(BaseModel): applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" + is_invoice_level: bool + """ + True for adjustments that apply to an entire invocice, false for adjustments + that apply to only one price. + """ + + plan_phase_order: Optional[int] = None + """The plan phase in which this adjustment is active.""" + reason: Optional[str] = None """The reason for the adjustment.""" class AdjustmentIntervalAdjustmentPercentageDiscountAdjustment(BaseModel): + id: str + adjustment_type: Literal["percentage_discount"] applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" + is_invoice_level: bool + """ + True for adjustments that apply to an entire invocice, false for adjustments + that apply to only one price. + """ + percentage_discount: float """ The percentage (as a value between 0 and 1) by which to discount the price intervals this adjustment applies to in a given billing period. """ + plan_phase_order: Optional[int] = None + """The plan phase in which this adjustment is active.""" + reason: Optional[str] = None """The reason for the adjustment.""" class AdjustmentIntervalAdjustmentUsageDiscountAdjustment(BaseModel): + id: str + adjustment_type: Literal["usage_discount"] applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" + is_invoice_level: bool + """ + True for adjustments that apply to an entire invocice, false for adjustments + that apply to only one price. + """ + + plan_phase_order: Optional[int] = None + """The plan phase in which this adjustment is active.""" + reason: Optional[str] = None """The reason for the adjustment.""" @@ -83,11 +116,19 @@ class AdjustmentIntervalAdjustmentUsageDiscountAdjustment(BaseModel): class AdjustmentIntervalAdjustmentMinimumAdjustment(BaseModel): + id: str + adjustment_type: Literal["minimum"] applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" + is_invoice_level: bool + """ + True for adjustments that apply to an entire invocice, false for adjustments + that apply to only one price. + """ + item_id: str """The item ID that revenue from this minimum will be attributed to.""" @@ -97,22 +138,36 @@ class AdjustmentIntervalAdjustmentMinimumAdjustment(BaseModel): adjustment applies to. """ + plan_phase_order: Optional[int] = None + """The plan phase in which this adjustment is active.""" + reason: Optional[str] = None """The reason for the adjustment.""" class AdjustmentIntervalAdjustmentMaximumAdjustment(BaseModel): + id: str + adjustment_type: Literal["maximum"] applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" + is_invoice_level: bool + """ + True for adjustments that apply to an entire invocice, false for adjustments + that apply to only one price. + """ + maximum_amount: str """ The maximum amount to charge in a given billing period for the prices this adjustment applies to. """ + plan_phase_order: Optional[int] = None + """The plan phase in which this adjustment is active.""" + reason: Optional[str] = None """The reason for the adjustment.""" diff --git a/tests/api_resources/test_subscriptions.py b/tests/api_resources/test_subscriptions.py index 060c6add..6caa8672 100644 --- a/tests/api_resources/test_subscriptions.py +++ b/tests/api_resources/test_subscriptions.py @@ -48,6 +48,7 @@ def test_method_create_with_all_params(self, client: Orb) -> None: "adjustment_type": "percentage_discount", "applies_to_price_ids": ["price_1", "price_2"], "percentage_discount": 0, + "is_invoice_level": True, }, "end_date": parse_datetime("2019-12-27T18:11:19.117Z"), "plan_phase_order": 0, @@ -136,6 +137,7 @@ def test_method_create_with_all_params(self, client: Orb) -> None: "adjustment_type": "percentage_discount", "applies_to_price_ids": ["price_1", "price_2"], "percentage_discount": 0, + "is_invoice_level": True, }, "replaces_adjustment_id": "replaces_adjustment_id", } @@ -616,6 +618,7 @@ def test_method_price_intervals_with_all_params(self, client: Orb) -> None: "adjustment_type": "percentage_discount", "applies_to_price_ids": ["price_1", "price_2"], "percentage_discount": 0, + "is_invoice_level": True, }, "start_date": parse_datetime("2019-12-27T18:11:19.117Z"), "end_date": parse_datetime("2019-12-27T18:11:19.117Z"), @@ -698,6 +701,7 @@ def test_method_schedule_plan_change_with_all_params(self, client: Orb) -> None: "adjustment_type": "percentage_discount", "applies_to_price_ids": ["price_1", "price_2"], "percentage_discount": 0, + "is_invoice_level": True, }, "end_date": parse_datetime("2019-12-27T18:11:19.117Z"), "plan_phase_order": 0, @@ -781,6 +785,7 @@ def test_method_schedule_plan_change_with_all_params(self, client: Orb) -> None: "adjustment_type": "percentage_discount", "applies_to_price_ids": ["price_1", "price_2"], "percentage_discount": 0, + "is_invoice_level": True, }, "replaces_adjustment_id": "replaces_adjustment_id", } @@ -1155,6 +1160,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncOrb) -> No "adjustment_type": "percentage_discount", "applies_to_price_ids": ["price_1", "price_2"], "percentage_discount": 0, + "is_invoice_level": True, }, "end_date": parse_datetime("2019-12-27T18:11:19.117Z"), "plan_phase_order": 0, @@ -1243,6 +1249,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncOrb) -> No "adjustment_type": "percentage_discount", "applies_to_price_ids": ["price_1", "price_2"], "percentage_discount": 0, + "is_invoice_level": True, }, "replaces_adjustment_id": "replaces_adjustment_id", } @@ -1723,6 +1730,7 @@ async def test_method_price_intervals_with_all_params(self, async_client: AsyncO "adjustment_type": "percentage_discount", "applies_to_price_ids": ["price_1", "price_2"], "percentage_discount": 0, + "is_invoice_level": True, }, "start_date": parse_datetime("2019-12-27T18:11:19.117Z"), "end_date": parse_datetime("2019-12-27T18:11:19.117Z"), @@ -1805,6 +1813,7 @@ async def test_method_schedule_plan_change_with_all_params(self, async_client: A "adjustment_type": "percentage_discount", "applies_to_price_ids": ["price_1", "price_2"], "percentage_discount": 0, + "is_invoice_level": True, }, "end_date": parse_datetime("2019-12-27T18:11:19.117Z"), "plan_phase_order": 0, @@ -1888,6 +1897,7 @@ async def test_method_schedule_plan_change_with_all_params(self, async_client: A "adjustment_type": "percentage_discount", "applies_to_price_ids": ["price_1", "price_2"], "percentage_discount": 0, + "is_invoice_level": True, }, "replaces_adjustment_id": "replaces_adjustment_id", }