diff --git a/.release-please-manifest.json b/.release-please-manifest.json index fdd6f7be..d6f5f39e 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "3.23.0" + ".": "3.24.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index 854a0355..ee8fe3fc 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 115 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-028b94908fa562ed9c31c1137078f958f859e79b33b8fddbd64934e1bb4ffd32.yml -openapi_spec_hash: e9a8403fd1da4edf627451a88ba27a55 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-fee4c7438579fd72ae7c08ad11cc502da279ad3cccfe2235b18afcacc91ad0d9.yml +openapi_spec_hash: dc9d553a388715ba22d873aee54a3ed1 config_hash: 1e2186b09e57d7d27b6ab5c8e6410b31 diff --git a/CHANGELOG.md b/CHANGELOG.md index 14e1683c..f2499d53 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## 3.24.0 (2025-06-04) + +Full Changelog: [v3.23.0...v3.24.0](https://github.com/orbcorp/orb-python/compare/v3.23.0...v3.24.0) + +### Features + +* **api:** api update ([4e8a240](https://github.com/orbcorp/orb-python/commit/4e8a2406e262ffcb459d2b1bbac33c40f2a785a6)) +* **api:** api update ([46147bc](https://github.com/orbcorp/orb-python/commit/46147bca3aac31572571312652965f1c84cd07ee)) + ## 3.23.0 (2025-06-03) Full Changelog: [v3.22.0...v3.23.0](https://github.com/orbcorp/orb-python/compare/v3.22.0...v3.23.0) diff --git a/pyproject.toml b/pyproject.toml index b50286b5..808dd447 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "orb-billing" -version = "3.23.0" +version = "3.24.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 08b99968..7956ed6e 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__ = "3.23.0" # x-release-please-version +__version__ = "3.24.0" # x-release-please-version diff --git a/src/orb/resources/subscriptions.py b/src/orb/resources/subscriptions.py index 75be053d..d4981291 100644 --- a/src/orb/resources/subscriptions.py +++ b/src/orb/resources/subscriptions.py @@ -1368,9 +1368,10 @@ def redeem_coupon( subscription_id: str, *, change_option: Literal["requested_date", "end_of_subscription_term", "immediate"], - coupon_id: str, allow_invoice_credit_or_void: Optional[bool] | NotGiven = NOT_GIVEN, change_date: Union[str, datetime, None] | NotGiven = NOT_GIVEN, + coupon_id: Optional[str] | NotGiven = NOT_GIVEN, + coupon_redemption_code: Optional[str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -1383,8 +1384,6 @@ def redeem_coupon( Redeem a coupon effective at a given time. Args: - coupon_id: Coupon ID to be redeemed for this subscription. - allow_invoice_credit_or_void: If false, this request will fail if it would void an issued invoice or create a credit note. Consider using this as a safety mechanism if you do not expect existing invoices to be changed. @@ -1392,6 +1391,10 @@ def redeem_coupon( change_date: The date that the coupon discount should take effect. This parameter can only be passed if the `change_option` is `requested_date`. + coupon_id: Coupon ID to be redeemed for this subscription. + + coupon_redemption_code: Redemption code of the coupon to be redeemed for this subscription. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -1409,9 +1412,10 @@ def redeem_coupon( body=maybe_transform( { "change_option": change_option, - "coupon_id": coupon_id, "allow_invoice_credit_or_void": allow_invoice_credit_or_void, "change_date": change_date, + "coupon_id": coupon_id, + "coupon_redemption_code": coupon_redemption_code, }, subscription_redeem_coupon_params.SubscriptionRedeemCouponParams, ), @@ -3454,9 +3458,10 @@ async def redeem_coupon( subscription_id: str, *, change_option: Literal["requested_date", "end_of_subscription_term", "immediate"], - coupon_id: str, allow_invoice_credit_or_void: Optional[bool] | NotGiven = NOT_GIVEN, change_date: Union[str, datetime, None] | NotGiven = NOT_GIVEN, + coupon_id: Optional[str] | NotGiven = NOT_GIVEN, + coupon_redemption_code: Optional[str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -3469,8 +3474,6 @@ async def redeem_coupon( Redeem a coupon effective at a given time. Args: - coupon_id: Coupon ID to be redeemed for this subscription. - allow_invoice_credit_or_void: If false, this request will fail if it would void an issued invoice or create a credit note. Consider using this as a safety mechanism if you do not expect existing invoices to be changed. @@ -3478,6 +3481,10 @@ async def redeem_coupon( change_date: The date that the coupon discount should take effect. This parameter can only be passed if the `change_option` is `requested_date`. + coupon_id: Coupon ID to be redeemed for this subscription. + + coupon_redemption_code: Redemption code of the coupon to be redeemed for this subscription. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -3495,9 +3502,10 @@ async def redeem_coupon( body=await async_maybe_transform( { "change_option": change_option, - "coupon_id": coupon_id, "allow_invoice_credit_or_void": allow_invoice_credit_or_void, "change_date": change_date, + "coupon_id": coupon_id, + "coupon_redemption_code": coupon_redemption_code, }, subscription_redeem_coupon_params.SubscriptionRedeemCouponParams, ), diff --git a/src/orb/types/beta/external_plan_id_create_plan_version_params.py b/src/orb/types/beta/external_plan_id_create_plan_version_params.py index 4c45a519..845d91af 100644 --- a/src/orb/types/beta/external_plan_id_create_plan_version_params.py +++ b/src/orb/types/beta/external_plan_id_create_plan_version_params.py @@ -10,10 +10,15 @@ "AddAdjustment", "AddAdjustmentAdjustment", "AddAdjustmentAdjustmentNewPercentageDiscount", + "AddAdjustmentAdjustmentNewPercentageDiscountFilter", "AddAdjustmentAdjustmentNewUsageDiscount", + "AddAdjustmentAdjustmentNewUsageDiscountFilter", "AddAdjustmentAdjustmentNewAmountDiscount", + "AddAdjustmentAdjustmentNewAmountDiscountFilter", "AddAdjustmentAdjustmentNewMinimum", + "AddAdjustmentAdjustmentNewMinimumFilter", "AddAdjustmentAdjustmentNewMaximum", + "AddAdjustmentAdjustmentNewMaximumFilter", "AddPrice", "AddPriceAllocationPrice", "AddPriceAllocationPriceCustomExpiration", @@ -150,10 +155,15 @@ "ReplaceAdjustment", "ReplaceAdjustmentAdjustment", "ReplaceAdjustmentAdjustmentNewPercentageDiscount", + "ReplaceAdjustmentAdjustmentNewPercentageDiscountFilter", "ReplaceAdjustmentAdjustmentNewUsageDiscount", + "ReplaceAdjustmentAdjustmentNewUsageDiscountFilter", "ReplaceAdjustmentAdjustmentNewAmountDiscount", + "ReplaceAdjustmentAdjustmentNewAmountDiscountFilter", "ReplaceAdjustmentAdjustmentNewMinimum", + "ReplaceAdjustmentAdjustmentNewMinimumFilter", "ReplaceAdjustmentAdjustmentNewMaximum", + "ReplaceAdjustmentAdjustmentNewMaximumFilter", "ReplacePrice", "ReplacePriceAllocationPrice", "ReplacePriceAllocationPriceCustomExpiration", @@ -314,50 +324,139 @@ class ExternalPlanIDCreatePlanVersionParams(TypedDict, total=False): """Set this new plan version as the default""" +class AddAdjustmentAdjustmentNewPercentageDiscountFilter(TypedDict, total=False): + field: Required[Literal["price_id", "item_id", "price_type", "currency", "pricing_unit_id"]] + """The property of the price to filter on.""" + + operator: Required[Literal["includes", "excludes"]] + """Should prices that match the filter be included or excluded.""" + + values: Required[List[str]] + """The IDs or values that match this filter.""" + + class AddAdjustmentAdjustmentNewPercentageDiscount(TypedDict, total=False): adjustment_type: Required[Literal["percentage_discount"]] percentage_discount: Required[float] + applies_to_all: Optional[Literal[True]] + """If set, the adjustment will apply to every price on the subscription.""" + + applies_to_item_ids: Optional[List[str]] + """The set of item IDs to which this adjustment applies.""" + applies_to_price_ids: Optional[List[str]] """The set of price IDs to which this adjustment applies.""" + currency: Optional[str] + """If set, only prices in the specified currency will have the adjustment applied.""" + + filters: Optional[Iterable[AddAdjustmentAdjustmentNewPercentageDiscountFilter]] + """A list of filters that determine which prices this adjustment will apply to.""" + 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. """ + price_type: Optional[Literal["usage", "fixed_in_advance", "fixed_in_arrears", "fixed", "in_arrears"]] + """If set, only prices of the specified type will have the adjustment applied.""" + + +class AddAdjustmentAdjustmentNewUsageDiscountFilter(TypedDict, total=False): + field: Required[Literal["price_id", "item_id", "price_type", "currency", "pricing_unit_id"]] + """The property of the price to filter on.""" + + operator: Required[Literal["includes", "excludes"]] + """Should prices that match the filter be included or excluded.""" + + values: Required[List[str]] + """The IDs or values that match this filter.""" + class AddAdjustmentAdjustmentNewUsageDiscount(TypedDict, total=False): adjustment_type: Required[Literal["usage_discount"]] usage_discount: Required[float] + applies_to_all: Optional[Literal[True]] + """If set, the adjustment will apply to every price on the subscription.""" + + applies_to_item_ids: Optional[List[str]] + """The set of item IDs to which this adjustment applies.""" + applies_to_price_ids: Optional[List[str]] """The set of price IDs to which this adjustment applies.""" + currency: Optional[str] + """If set, only prices in the specified currency will have the adjustment applied.""" + + filters: Optional[Iterable[AddAdjustmentAdjustmentNewUsageDiscountFilter]] + """A list of filters that determine which prices this adjustment will apply to.""" + 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. """ + price_type: Optional[Literal["usage", "fixed_in_advance", "fixed_in_arrears", "fixed", "in_arrears"]] + """If set, only prices of the specified type will have the adjustment applied.""" + + +class AddAdjustmentAdjustmentNewAmountDiscountFilter(TypedDict, total=False): + field: Required[Literal["price_id", "item_id", "price_type", "currency", "pricing_unit_id"]] + """The property of the price to filter on.""" + + operator: Required[Literal["includes", "excludes"]] + """Should prices that match the filter be included or excluded.""" + + values: Required[List[str]] + """The IDs or values that match this filter.""" + class AddAdjustmentAdjustmentNewAmountDiscount(TypedDict, total=False): adjustment_type: Required[Literal["amount_discount"]] amount_discount: Required[str] + applies_to_all: Optional[Literal[True]] + """If set, the adjustment will apply to every price on the subscription.""" + + applies_to_item_ids: Optional[List[str]] + """The set of item IDs to which this adjustment applies.""" + applies_to_price_ids: Optional[List[str]] """The set of price IDs to which this adjustment applies.""" + currency: Optional[str] + """If set, only prices in the specified currency will have the adjustment applied.""" + + filters: Optional[Iterable[AddAdjustmentAdjustmentNewAmountDiscountFilter]] + """A list of filters that determine which prices this adjustment will apply to.""" + 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. """ + price_type: Optional[Literal["usage", "fixed_in_advance", "fixed_in_arrears", "fixed", "in_arrears"]] + """If set, only prices of the specified type will have the adjustment applied.""" + + +class AddAdjustmentAdjustmentNewMinimumFilter(TypedDict, total=False): + field: Required[Literal["price_id", "item_id", "price_type", "currency", "pricing_unit_id"]] + """The property of the price to filter on.""" + + operator: Required[Literal["includes", "excludes"]] + """Should prices that match the filter be included or excluded.""" + + values: Required[List[str]] + """The IDs or values that match this filter.""" + class AddAdjustmentAdjustmentNewMinimum(TypedDict, total=False): adjustment_type: Required[Literal["minimum"]] @@ -367,30 +466,71 @@ class AddAdjustmentAdjustmentNewMinimum(TypedDict, total=False): minimum_amount: Required[str] + applies_to_all: Optional[Literal[True]] + """If set, the adjustment will apply to every price on the subscription.""" + + applies_to_item_ids: Optional[List[str]] + """The set of item IDs to which this adjustment applies.""" + applies_to_price_ids: Optional[List[str]] """The set of price IDs to which this adjustment applies.""" + currency: Optional[str] + """If set, only prices in the specified currency will have the adjustment applied.""" + + filters: Optional[Iterable[AddAdjustmentAdjustmentNewMinimumFilter]] + """A list of filters that determine which prices this adjustment will apply to.""" + 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. """ + price_type: Optional[Literal["usage", "fixed_in_advance", "fixed_in_arrears", "fixed", "in_arrears"]] + """If set, only prices of the specified type will have the adjustment applied.""" + + +class AddAdjustmentAdjustmentNewMaximumFilter(TypedDict, total=False): + field: Required[Literal["price_id", "item_id", "price_type", "currency", "pricing_unit_id"]] + """The property of the price to filter on.""" + + operator: Required[Literal["includes", "excludes"]] + """Should prices that match the filter be included or excluded.""" + + values: Required[List[str]] + """The IDs or values that match this filter.""" + class AddAdjustmentAdjustmentNewMaximum(TypedDict, total=False): adjustment_type: Required[Literal["maximum"]] maximum_amount: Required[str] + applies_to_all: Optional[Literal[True]] + """If set, the adjustment will apply to every price on the subscription.""" + + applies_to_item_ids: Optional[List[str]] + """The set of item IDs to which this adjustment applies.""" + applies_to_price_ids: Optional[List[str]] """The set of price IDs to which this adjustment applies.""" + currency: Optional[str] + """If set, only prices in the specified currency will have the adjustment applied.""" + + filters: Optional[Iterable[AddAdjustmentAdjustmentNewMaximumFilter]] + """A list of filters that determine which prices this adjustment will apply to.""" + 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. """ + price_type: Optional[Literal["usage", "fixed_in_advance", "fixed_in_arrears", "fixed", "in_arrears"]] + """If set, only prices of the specified type will have the adjustment applied.""" + AddAdjustmentAdjustment: TypeAlias = Union[ AddAdjustmentAdjustmentNewPercentageDiscount, @@ -3481,50 +3621,139 @@ class RemovePrice(TypedDict, total=False): """The phase to remove this price from.""" +class ReplaceAdjustmentAdjustmentNewPercentageDiscountFilter(TypedDict, total=False): + field: Required[Literal["price_id", "item_id", "price_type", "currency", "pricing_unit_id"]] + """The property of the price to filter on.""" + + operator: Required[Literal["includes", "excludes"]] + """Should prices that match the filter be included or excluded.""" + + values: Required[List[str]] + """The IDs or values that match this filter.""" + + class ReplaceAdjustmentAdjustmentNewPercentageDiscount(TypedDict, total=False): adjustment_type: Required[Literal["percentage_discount"]] percentage_discount: Required[float] + applies_to_all: Optional[Literal[True]] + """If set, the adjustment will apply to every price on the subscription.""" + + applies_to_item_ids: Optional[List[str]] + """The set of item IDs to which this adjustment applies.""" + applies_to_price_ids: Optional[List[str]] """The set of price IDs to which this adjustment applies.""" + currency: Optional[str] + """If set, only prices in the specified currency will have the adjustment applied.""" + + filters: Optional[Iterable[ReplaceAdjustmentAdjustmentNewPercentageDiscountFilter]] + """A list of filters that determine which prices this adjustment will apply to.""" + 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. """ + price_type: Optional[Literal["usage", "fixed_in_advance", "fixed_in_arrears", "fixed", "in_arrears"]] + """If set, only prices of the specified type will have the adjustment applied.""" + + +class ReplaceAdjustmentAdjustmentNewUsageDiscountFilter(TypedDict, total=False): + field: Required[Literal["price_id", "item_id", "price_type", "currency", "pricing_unit_id"]] + """The property of the price to filter on.""" + + operator: Required[Literal["includes", "excludes"]] + """Should prices that match the filter be included or excluded.""" + + values: Required[List[str]] + """The IDs or values that match this filter.""" + class ReplaceAdjustmentAdjustmentNewUsageDiscount(TypedDict, total=False): adjustment_type: Required[Literal["usage_discount"]] usage_discount: Required[float] + applies_to_all: Optional[Literal[True]] + """If set, the adjustment will apply to every price on the subscription.""" + + applies_to_item_ids: Optional[List[str]] + """The set of item IDs to which this adjustment applies.""" + applies_to_price_ids: Optional[List[str]] """The set of price IDs to which this adjustment applies.""" + currency: Optional[str] + """If set, only prices in the specified currency will have the adjustment applied.""" + + filters: Optional[Iterable[ReplaceAdjustmentAdjustmentNewUsageDiscountFilter]] + """A list of filters that determine which prices this adjustment will apply to.""" + 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. """ + price_type: Optional[Literal["usage", "fixed_in_advance", "fixed_in_arrears", "fixed", "in_arrears"]] + """If set, only prices of the specified type will have the adjustment applied.""" + + +class ReplaceAdjustmentAdjustmentNewAmountDiscountFilter(TypedDict, total=False): + field: Required[Literal["price_id", "item_id", "price_type", "currency", "pricing_unit_id"]] + """The property of the price to filter on.""" + + operator: Required[Literal["includes", "excludes"]] + """Should prices that match the filter be included or excluded.""" + + values: Required[List[str]] + """The IDs or values that match this filter.""" + class ReplaceAdjustmentAdjustmentNewAmountDiscount(TypedDict, total=False): adjustment_type: Required[Literal["amount_discount"]] amount_discount: Required[str] + applies_to_all: Optional[Literal[True]] + """If set, the adjustment will apply to every price on the subscription.""" + + applies_to_item_ids: Optional[List[str]] + """The set of item IDs to which this adjustment applies.""" + applies_to_price_ids: Optional[List[str]] """The set of price IDs to which this adjustment applies.""" + currency: Optional[str] + """If set, only prices in the specified currency will have the adjustment applied.""" + + filters: Optional[Iterable[ReplaceAdjustmentAdjustmentNewAmountDiscountFilter]] + """A list of filters that determine which prices this adjustment will apply to.""" + 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. """ + price_type: Optional[Literal["usage", "fixed_in_advance", "fixed_in_arrears", "fixed", "in_arrears"]] + """If set, only prices of the specified type will have the adjustment applied.""" + + +class ReplaceAdjustmentAdjustmentNewMinimumFilter(TypedDict, total=False): + field: Required[Literal["price_id", "item_id", "price_type", "currency", "pricing_unit_id"]] + """The property of the price to filter on.""" + + operator: Required[Literal["includes", "excludes"]] + """Should prices that match the filter be included or excluded.""" + + values: Required[List[str]] + """The IDs or values that match this filter.""" + class ReplaceAdjustmentAdjustmentNewMinimum(TypedDict, total=False): adjustment_type: Required[Literal["minimum"]] @@ -3534,30 +3763,71 @@ class ReplaceAdjustmentAdjustmentNewMinimum(TypedDict, total=False): minimum_amount: Required[str] + applies_to_all: Optional[Literal[True]] + """If set, the adjustment will apply to every price on the subscription.""" + + applies_to_item_ids: Optional[List[str]] + """The set of item IDs to which this adjustment applies.""" + applies_to_price_ids: Optional[List[str]] """The set of price IDs to which this adjustment applies.""" + currency: Optional[str] + """If set, only prices in the specified currency will have the adjustment applied.""" + + filters: Optional[Iterable[ReplaceAdjustmentAdjustmentNewMinimumFilter]] + """A list of filters that determine which prices this adjustment will apply to.""" + 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. """ + price_type: Optional[Literal["usage", "fixed_in_advance", "fixed_in_arrears", "fixed", "in_arrears"]] + """If set, only prices of the specified type will have the adjustment applied.""" + + +class ReplaceAdjustmentAdjustmentNewMaximumFilter(TypedDict, total=False): + field: Required[Literal["price_id", "item_id", "price_type", "currency", "pricing_unit_id"]] + """The property of the price to filter on.""" + + operator: Required[Literal["includes", "excludes"]] + """Should prices that match the filter be included or excluded.""" + + values: Required[List[str]] + """The IDs or values that match this filter.""" + class ReplaceAdjustmentAdjustmentNewMaximum(TypedDict, total=False): adjustment_type: Required[Literal["maximum"]] maximum_amount: Required[str] + applies_to_all: Optional[Literal[True]] + """If set, the adjustment will apply to every price on the subscription.""" + + applies_to_item_ids: Optional[List[str]] + """The set of item IDs to which this adjustment applies.""" + applies_to_price_ids: Optional[List[str]] """The set of price IDs to which this adjustment applies.""" + currency: Optional[str] + """If set, only prices in the specified currency will have the adjustment applied.""" + + filters: Optional[Iterable[ReplaceAdjustmentAdjustmentNewMaximumFilter]] + """A list of filters that determine which prices this adjustment will apply to.""" + 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. """ + price_type: Optional[Literal["usage", "fixed_in_advance", "fixed_in_arrears", "fixed", "in_arrears"]] + """If set, only prices of the specified type will have the adjustment applied.""" + ReplaceAdjustmentAdjustment: TypeAlias = Union[ ReplaceAdjustmentAdjustmentNewPercentageDiscount, diff --git a/src/orb/types/beta_create_plan_version_params.py b/src/orb/types/beta_create_plan_version_params.py index 543e3097..0ff4daf4 100644 --- a/src/orb/types/beta_create_plan_version_params.py +++ b/src/orb/types/beta_create_plan_version_params.py @@ -10,10 +10,15 @@ "AddAdjustment", "AddAdjustmentAdjustment", "AddAdjustmentAdjustmentNewPercentageDiscount", + "AddAdjustmentAdjustmentNewPercentageDiscountFilter", "AddAdjustmentAdjustmentNewUsageDiscount", + "AddAdjustmentAdjustmentNewUsageDiscountFilter", "AddAdjustmentAdjustmentNewAmountDiscount", + "AddAdjustmentAdjustmentNewAmountDiscountFilter", "AddAdjustmentAdjustmentNewMinimum", + "AddAdjustmentAdjustmentNewMinimumFilter", "AddAdjustmentAdjustmentNewMaximum", + "AddAdjustmentAdjustmentNewMaximumFilter", "AddPrice", "AddPriceAllocationPrice", "AddPriceAllocationPriceCustomExpiration", @@ -150,10 +155,15 @@ "ReplaceAdjustment", "ReplaceAdjustmentAdjustment", "ReplaceAdjustmentAdjustmentNewPercentageDiscount", + "ReplaceAdjustmentAdjustmentNewPercentageDiscountFilter", "ReplaceAdjustmentAdjustmentNewUsageDiscount", + "ReplaceAdjustmentAdjustmentNewUsageDiscountFilter", "ReplaceAdjustmentAdjustmentNewAmountDiscount", + "ReplaceAdjustmentAdjustmentNewAmountDiscountFilter", "ReplaceAdjustmentAdjustmentNewMinimum", + "ReplaceAdjustmentAdjustmentNewMinimumFilter", "ReplaceAdjustmentAdjustmentNewMaximum", + "ReplaceAdjustmentAdjustmentNewMaximumFilter", "ReplacePrice", "ReplacePriceAllocationPrice", "ReplacePriceAllocationPriceCustomExpiration", @@ -314,50 +324,139 @@ class BetaCreatePlanVersionParams(TypedDict, total=False): """Set this new plan version as the default""" +class AddAdjustmentAdjustmentNewPercentageDiscountFilter(TypedDict, total=False): + field: Required[Literal["price_id", "item_id", "price_type", "currency", "pricing_unit_id"]] + """The property of the price to filter on.""" + + operator: Required[Literal["includes", "excludes"]] + """Should prices that match the filter be included or excluded.""" + + values: Required[List[str]] + """The IDs or values that match this filter.""" + + class AddAdjustmentAdjustmentNewPercentageDiscount(TypedDict, total=False): adjustment_type: Required[Literal["percentage_discount"]] percentage_discount: Required[float] + applies_to_all: Optional[Literal[True]] + """If set, the adjustment will apply to every price on the subscription.""" + + applies_to_item_ids: Optional[List[str]] + """The set of item IDs to which this adjustment applies.""" + applies_to_price_ids: Optional[List[str]] """The set of price IDs to which this adjustment applies.""" + currency: Optional[str] + """If set, only prices in the specified currency will have the adjustment applied.""" + + filters: Optional[Iterable[AddAdjustmentAdjustmentNewPercentageDiscountFilter]] + """A list of filters that determine which prices this adjustment will apply to.""" + 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. """ + price_type: Optional[Literal["usage", "fixed_in_advance", "fixed_in_arrears", "fixed", "in_arrears"]] + """If set, only prices of the specified type will have the adjustment applied.""" + + +class AddAdjustmentAdjustmentNewUsageDiscountFilter(TypedDict, total=False): + field: Required[Literal["price_id", "item_id", "price_type", "currency", "pricing_unit_id"]] + """The property of the price to filter on.""" + + operator: Required[Literal["includes", "excludes"]] + """Should prices that match the filter be included or excluded.""" + + values: Required[List[str]] + """The IDs or values that match this filter.""" + class AddAdjustmentAdjustmentNewUsageDiscount(TypedDict, total=False): adjustment_type: Required[Literal["usage_discount"]] usage_discount: Required[float] + applies_to_all: Optional[Literal[True]] + """If set, the adjustment will apply to every price on the subscription.""" + + applies_to_item_ids: Optional[List[str]] + """The set of item IDs to which this adjustment applies.""" + applies_to_price_ids: Optional[List[str]] """The set of price IDs to which this adjustment applies.""" + currency: Optional[str] + """If set, only prices in the specified currency will have the adjustment applied.""" + + filters: Optional[Iterable[AddAdjustmentAdjustmentNewUsageDiscountFilter]] + """A list of filters that determine which prices this adjustment will apply to.""" + 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. """ + price_type: Optional[Literal["usage", "fixed_in_advance", "fixed_in_arrears", "fixed", "in_arrears"]] + """If set, only prices of the specified type will have the adjustment applied.""" + + +class AddAdjustmentAdjustmentNewAmountDiscountFilter(TypedDict, total=False): + field: Required[Literal["price_id", "item_id", "price_type", "currency", "pricing_unit_id"]] + """The property of the price to filter on.""" + + operator: Required[Literal["includes", "excludes"]] + """Should prices that match the filter be included or excluded.""" + + values: Required[List[str]] + """The IDs or values that match this filter.""" + class AddAdjustmentAdjustmentNewAmountDiscount(TypedDict, total=False): adjustment_type: Required[Literal["amount_discount"]] amount_discount: Required[str] + applies_to_all: Optional[Literal[True]] + """If set, the adjustment will apply to every price on the subscription.""" + + applies_to_item_ids: Optional[List[str]] + """The set of item IDs to which this adjustment applies.""" + applies_to_price_ids: Optional[List[str]] """The set of price IDs to which this adjustment applies.""" + currency: Optional[str] + """If set, only prices in the specified currency will have the adjustment applied.""" + + filters: Optional[Iterable[AddAdjustmentAdjustmentNewAmountDiscountFilter]] + """A list of filters that determine which prices this adjustment will apply to.""" + 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. """ + price_type: Optional[Literal["usage", "fixed_in_advance", "fixed_in_arrears", "fixed", "in_arrears"]] + """If set, only prices of the specified type will have the adjustment applied.""" + + +class AddAdjustmentAdjustmentNewMinimumFilter(TypedDict, total=False): + field: Required[Literal["price_id", "item_id", "price_type", "currency", "pricing_unit_id"]] + """The property of the price to filter on.""" + + operator: Required[Literal["includes", "excludes"]] + """Should prices that match the filter be included or excluded.""" + + values: Required[List[str]] + """The IDs or values that match this filter.""" + class AddAdjustmentAdjustmentNewMinimum(TypedDict, total=False): adjustment_type: Required[Literal["minimum"]] @@ -367,30 +466,71 @@ class AddAdjustmentAdjustmentNewMinimum(TypedDict, total=False): minimum_amount: Required[str] + applies_to_all: Optional[Literal[True]] + """If set, the adjustment will apply to every price on the subscription.""" + + applies_to_item_ids: Optional[List[str]] + """The set of item IDs to which this adjustment applies.""" + applies_to_price_ids: Optional[List[str]] """The set of price IDs to which this adjustment applies.""" + currency: Optional[str] + """If set, only prices in the specified currency will have the adjustment applied.""" + + filters: Optional[Iterable[AddAdjustmentAdjustmentNewMinimumFilter]] + """A list of filters that determine which prices this adjustment will apply to.""" + 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. """ + price_type: Optional[Literal["usage", "fixed_in_advance", "fixed_in_arrears", "fixed", "in_arrears"]] + """If set, only prices of the specified type will have the adjustment applied.""" + + +class AddAdjustmentAdjustmentNewMaximumFilter(TypedDict, total=False): + field: Required[Literal["price_id", "item_id", "price_type", "currency", "pricing_unit_id"]] + """The property of the price to filter on.""" + + operator: Required[Literal["includes", "excludes"]] + """Should prices that match the filter be included or excluded.""" + + values: Required[List[str]] + """The IDs or values that match this filter.""" + class AddAdjustmentAdjustmentNewMaximum(TypedDict, total=False): adjustment_type: Required[Literal["maximum"]] maximum_amount: Required[str] + applies_to_all: Optional[Literal[True]] + """If set, the adjustment will apply to every price on the subscription.""" + + applies_to_item_ids: Optional[List[str]] + """The set of item IDs to which this adjustment applies.""" + applies_to_price_ids: Optional[List[str]] """The set of price IDs to which this adjustment applies.""" + currency: Optional[str] + """If set, only prices in the specified currency will have the adjustment applied.""" + + filters: Optional[Iterable[AddAdjustmentAdjustmentNewMaximumFilter]] + """A list of filters that determine which prices this adjustment will apply to.""" + 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. """ + price_type: Optional[Literal["usage", "fixed_in_advance", "fixed_in_arrears", "fixed", "in_arrears"]] + """If set, only prices of the specified type will have the adjustment applied.""" + AddAdjustmentAdjustment: TypeAlias = Union[ AddAdjustmentAdjustmentNewPercentageDiscount, @@ -3481,50 +3621,139 @@ class RemovePrice(TypedDict, total=False): """The phase to remove this price from.""" +class ReplaceAdjustmentAdjustmentNewPercentageDiscountFilter(TypedDict, total=False): + field: Required[Literal["price_id", "item_id", "price_type", "currency", "pricing_unit_id"]] + """The property of the price to filter on.""" + + operator: Required[Literal["includes", "excludes"]] + """Should prices that match the filter be included or excluded.""" + + values: Required[List[str]] + """The IDs or values that match this filter.""" + + class ReplaceAdjustmentAdjustmentNewPercentageDiscount(TypedDict, total=False): adjustment_type: Required[Literal["percentage_discount"]] percentage_discount: Required[float] + applies_to_all: Optional[Literal[True]] + """If set, the adjustment will apply to every price on the subscription.""" + + applies_to_item_ids: Optional[List[str]] + """The set of item IDs to which this adjustment applies.""" + applies_to_price_ids: Optional[List[str]] """The set of price IDs to which this adjustment applies.""" + currency: Optional[str] + """If set, only prices in the specified currency will have the adjustment applied.""" + + filters: Optional[Iterable[ReplaceAdjustmentAdjustmentNewPercentageDiscountFilter]] + """A list of filters that determine which prices this adjustment will apply to.""" + 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. """ + price_type: Optional[Literal["usage", "fixed_in_advance", "fixed_in_arrears", "fixed", "in_arrears"]] + """If set, only prices of the specified type will have the adjustment applied.""" + + +class ReplaceAdjustmentAdjustmentNewUsageDiscountFilter(TypedDict, total=False): + field: Required[Literal["price_id", "item_id", "price_type", "currency", "pricing_unit_id"]] + """The property of the price to filter on.""" + + operator: Required[Literal["includes", "excludes"]] + """Should prices that match the filter be included or excluded.""" + + values: Required[List[str]] + """The IDs or values that match this filter.""" + class ReplaceAdjustmentAdjustmentNewUsageDiscount(TypedDict, total=False): adjustment_type: Required[Literal["usage_discount"]] usage_discount: Required[float] + applies_to_all: Optional[Literal[True]] + """If set, the adjustment will apply to every price on the subscription.""" + + applies_to_item_ids: Optional[List[str]] + """The set of item IDs to which this adjustment applies.""" + applies_to_price_ids: Optional[List[str]] """The set of price IDs to which this adjustment applies.""" + currency: Optional[str] + """If set, only prices in the specified currency will have the adjustment applied.""" + + filters: Optional[Iterable[ReplaceAdjustmentAdjustmentNewUsageDiscountFilter]] + """A list of filters that determine which prices this adjustment will apply to.""" + 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. """ + price_type: Optional[Literal["usage", "fixed_in_advance", "fixed_in_arrears", "fixed", "in_arrears"]] + """If set, only prices of the specified type will have the adjustment applied.""" + + +class ReplaceAdjustmentAdjustmentNewAmountDiscountFilter(TypedDict, total=False): + field: Required[Literal["price_id", "item_id", "price_type", "currency", "pricing_unit_id"]] + """The property of the price to filter on.""" + + operator: Required[Literal["includes", "excludes"]] + """Should prices that match the filter be included or excluded.""" + + values: Required[List[str]] + """The IDs or values that match this filter.""" + class ReplaceAdjustmentAdjustmentNewAmountDiscount(TypedDict, total=False): adjustment_type: Required[Literal["amount_discount"]] amount_discount: Required[str] + applies_to_all: Optional[Literal[True]] + """If set, the adjustment will apply to every price on the subscription.""" + + applies_to_item_ids: Optional[List[str]] + """The set of item IDs to which this adjustment applies.""" + applies_to_price_ids: Optional[List[str]] """The set of price IDs to which this adjustment applies.""" + currency: Optional[str] + """If set, only prices in the specified currency will have the adjustment applied.""" + + filters: Optional[Iterable[ReplaceAdjustmentAdjustmentNewAmountDiscountFilter]] + """A list of filters that determine which prices this adjustment will apply to.""" + 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. """ + price_type: Optional[Literal["usage", "fixed_in_advance", "fixed_in_arrears", "fixed", "in_arrears"]] + """If set, only prices of the specified type will have the adjustment applied.""" + + +class ReplaceAdjustmentAdjustmentNewMinimumFilter(TypedDict, total=False): + field: Required[Literal["price_id", "item_id", "price_type", "currency", "pricing_unit_id"]] + """The property of the price to filter on.""" + + operator: Required[Literal["includes", "excludes"]] + """Should prices that match the filter be included or excluded.""" + + values: Required[List[str]] + """The IDs or values that match this filter.""" + class ReplaceAdjustmentAdjustmentNewMinimum(TypedDict, total=False): adjustment_type: Required[Literal["minimum"]] @@ -3534,30 +3763,71 @@ class ReplaceAdjustmentAdjustmentNewMinimum(TypedDict, total=False): minimum_amount: Required[str] + applies_to_all: Optional[Literal[True]] + """If set, the adjustment will apply to every price on the subscription.""" + + applies_to_item_ids: Optional[List[str]] + """The set of item IDs to which this adjustment applies.""" + applies_to_price_ids: Optional[List[str]] """The set of price IDs to which this adjustment applies.""" + currency: Optional[str] + """If set, only prices in the specified currency will have the adjustment applied.""" + + filters: Optional[Iterable[ReplaceAdjustmentAdjustmentNewMinimumFilter]] + """A list of filters that determine which prices this adjustment will apply to.""" + 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. """ + price_type: Optional[Literal["usage", "fixed_in_advance", "fixed_in_arrears", "fixed", "in_arrears"]] + """If set, only prices of the specified type will have the adjustment applied.""" + + +class ReplaceAdjustmentAdjustmentNewMaximumFilter(TypedDict, total=False): + field: Required[Literal["price_id", "item_id", "price_type", "currency", "pricing_unit_id"]] + """The property of the price to filter on.""" + + operator: Required[Literal["includes", "excludes"]] + """Should prices that match the filter be included or excluded.""" + + values: Required[List[str]] + """The IDs or values that match this filter.""" + class ReplaceAdjustmentAdjustmentNewMaximum(TypedDict, total=False): adjustment_type: Required[Literal["maximum"]] maximum_amount: Required[str] + applies_to_all: Optional[Literal[True]] + """If set, the adjustment will apply to every price on the subscription.""" + + applies_to_item_ids: Optional[List[str]] + """The set of item IDs to which this adjustment applies.""" + applies_to_price_ids: Optional[List[str]] """The set of price IDs to which this adjustment applies.""" + currency: Optional[str] + """If set, only prices in the specified currency will have the adjustment applied.""" + + filters: Optional[Iterable[ReplaceAdjustmentAdjustmentNewMaximumFilter]] + """A list of filters that determine which prices this adjustment will apply to.""" + 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. """ + price_type: Optional[Literal["usage", "fixed_in_advance", "fixed_in_arrears", "fixed", "in_arrears"]] + """If set, only prices of the specified type will have the adjustment applied.""" + ReplaceAdjustmentAdjustment: TypeAlias = Union[ ReplaceAdjustmentAdjustmentNewPercentageDiscount, diff --git a/src/orb/types/shared/amount_discount.py b/src/orb/types/shared/amount_discount.py index a21bddfe..e2d3506f 100644 --- a/src/orb/types/shared/amount_discount.py +++ b/src/orb/types/shared/amount_discount.py @@ -5,7 +5,18 @@ from ..._models import BaseModel -__all__ = ["AmountDiscount"] +__all__ = ["AmountDiscount", "Filter"] + + +class Filter(BaseModel): + field: Literal["price_id", "item_id", "price_type", "currency", "pricing_unit_id"] + """The property of the price to filter on.""" + + operator: Literal["includes", "excludes"] + """Should prices that match the filter be included or excluded.""" + + values: List[str] + """The IDs or values that match this filter.""" class AmountDiscount(BaseModel): @@ -20,4 +31,7 @@ class AmountDiscount(BaseModel): For plan/plan phase discounts, this can be a subset of prices. """ + filters: Optional[List[Filter]] = None + """The filters that determine which prices to apply this discount to.""" + reason: Optional[str] = None diff --git a/src/orb/types/shared/percentage_discount.py b/src/orb/types/shared/percentage_discount.py index 32fd52b4..3fb86bb5 100644 --- a/src/orb/types/shared/percentage_discount.py +++ b/src/orb/types/shared/percentage_discount.py @@ -5,7 +5,18 @@ from ..._models import BaseModel -__all__ = ["PercentageDiscount"] +__all__ = ["PercentageDiscount", "Filter"] + + +class Filter(BaseModel): + field: Literal["price_id", "item_id", "price_type", "currency", "pricing_unit_id"] + """The property of the price to filter on.""" + + operator: Literal["includes", "excludes"] + """Should prices that match the filter be included or excluded.""" + + values: List[str] + """The IDs or values that match this filter.""" class PercentageDiscount(BaseModel): @@ -23,4 +34,7 @@ class PercentageDiscount(BaseModel): For plan/plan phase discounts, this can be a subset of prices. """ + filters: Optional[List[Filter]] = None + """The filters that determine which prices to apply this discount to.""" + reason: Optional[str] = None diff --git a/src/orb/types/shared/trial_discount.py b/src/orb/types/shared/trial_discount.py index eaeb9de3..a39fa8dd 100644 --- a/src/orb/types/shared/trial_discount.py +++ b/src/orb/types/shared/trial_discount.py @@ -5,7 +5,18 @@ from ..._models import BaseModel -__all__ = ["TrialDiscount"] +__all__ = ["TrialDiscount", "Filter"] + + +class Filter(BaseModel): + field: Literal["price_id", "item_id", "price_type", "currency", "pricing_unit_id"] + """The property of the price to filter on.""" + + operator: Literal["includes", "excludes"] + """Should prices that match the filter be included or excluded.""" + + values: List[str] + """The IDs or values that match this filter.""" class TrialDiscount(BaseModel): @@ -17,6 +28,9 @@ class TrialDiscount(BaseModel): For plan/plan phase discounts, this can be a subset of prices. """ + filters: Optional[List[Filter]] = None + """The filters that determine which prices to apply this discount to.""" + reason: Optional[str] = None trial_amount_discount: Optional[str] = None diff --git a/src/orb/types/shared/usage_discount.py b/src/orb/types/shared/usage_discount.py index 620128fb..34548a0e 100644 --- a/src/orb/types/shared/usage_discount.py +++ b/src/orb/types/shared/usage_discount.py @@ -5,7 +5,18 @@ from ..._models import BaseModel -__all__ = ["UsageDiscount"] +__all__ = ["UsageDiscount", "Filter"] + + +class Filter(BaseModel): + field: Literal["price_id", "item_id", "price_type", "currency", "pricing_unit_id"] + """The property of the price to filter on.""" + + operator: Literal["includes", "excludes"] + """Should prices that match the filter be included or excluded.""" + + values: List[str] + """The IDs or values that match this filter.""" class UsageDiscount(BaseModel): @@ -23,4 +34,7 @@ class UsageDiscount(BaseModel): For plan/plan phase discounts, this can be a subset of prices. """ + filters: Optional[List[Filter]] = None + """The filters that determine which prices to apply this discount to.""" + reason: Optional[str] = None diff --git a/src/orb/types/shared_params/amount_discount.py b/src/orb/types/shared_params/amount_discount.py index 03956cd4..921bb48f 100644 --- a/src/orb/types/shared_params/amount_discount.py +++ b/src/orb/types/shared_params/amount_discount.py @@ -2,10 +2,21 @@ from __future__ import annotations -from typing import List, Optional +from typing import List, Iterable, Optional from typing_extensions import Literal, Required, TypedDict -__all__ = ["AmountDiscount"] +__all__ = ["AmountDiscount", "Filter"] + + +class Filter(TypedDict, total=False): + field: Required[Literal["price_id", "item_id", "price_type", "currency", "pricing_unit_id"]] + """The property of the price to filter on.""" + + operator: Required[Literal["includes", "excludes"]] + """Should prices that match the filter be included or excluded.""" + + values: Required[List[str]] + """The IDs or values that match this filter.""" class AmountDiscount(TypedDict, total=False): @@ -20,4 +31,7 @@ class AmountDiscount(TypedDict, total=False): For plan/plan phase discounts, this can be a subset of prices. """ + filters: Optional[Iterable[Filter]] + """The filters that determine which prices to apply this discount to.""" + reason: Optional[str] diff --git a/src/orb/types/shared_params/percentage_discount.py b/src/orb/types/shared_params/percentage_discount.py index 288ec075..7468db3b 100644 --- a/src/orb/types/shared_params/percentage_discount.py +++ b/src/orb/types/shared_params/percentage_discount.py @@ -2,10 +2,21 @@ from __future__ import annotations -from typing import List, Optional +from typing import List, Iterable, Optional from typing_extensions import Literal, Required, TypedDict -__all__ = ["PercentageDiscount"] +__all__ = ["PercentageDiscount", "Filter"] + + +class Filter(TypedDict, total=False): + field: Required[Literal["price_id", "item_id", "price_type", "currency", "pricing_unit_id"]] + """The property of the price to filter on.""" + + operator: Required[Literal["includes", "excludes"]] + """Should prices that match the filter be included or excluded.""" + + values: Required[List[str]] + """The IDs or values that match this filter.""" class PercentageDiscount(TypedDict, total=False): @@ -23,4 +34,7 @@ class PercentageDiscount(TypedDict, total=False): For plan/plan phase discounts, this can be a subset of prices. """ + filters: Optional[Iterable[Filter]] + """The filters that determine which prices to apply this discount to.""" + reason: Optional[str] diff --git a/src/orb/types/shared_params/trial_discount.py b/src/orb/types/shared_params/trial_discount.py index 3aebe792..7777fe40 100644 --- a/src/orb/types/shared_params/trial_discount.py +++ b/src/orb/types/shared_params/trial_discount.py @@ -2,10 +2,21 @@ from __future__ import annotations -from typing import List, Optional +from typing import List, Iterable, Optional from typing_extensions import Literal, Required, TypedDict -__all__ = ["TrialDiscount"] +__all__ = ["TrialDiscount", "Filter"] + + +class Filter(TypedDict, total=False): + field: Required[Literal["price_id", "item_id", "price_type", "currency", "pricing_unit_id"]] + """The property of the price to filter on.""" + + operator: Required[Literal["includes", "excludes"]] + """Should prices that match the filter be included or excluded.""" + + values: Required[List[str]] + """The IDs or values that match this filter.""" class TrialDiscount(TypedDict, total=False): @@ -17,6 +28,9 @@ class TrialDiscount(TypedDict, total=False): For plan/plan phase discounts, this can be a subset of prices. """ + filters: Optional[Iterable[Filter]] + """The filters that determine which prices to apply this discount to.""" + reason: Optional[str] trial_amount_discount: Optional[str] diff --git a/src/orb/types/shared_params/usage_discount.py b/src/orb/types/shared_params/usage_discount.py index f20196ff..d3007ec8 100644 --- a/src/orb/types/shared_params/usage_discount.py +++ b/src/orb/types/shared_params/usage_discount.py @@ -2,10 +2,21 @@ from __future__ import annotations -from typing import List, Optional +from typing import List, Iterable, Optional from typing_extensions import Literal, Required, TypedDict -__all__ = ["UsageDiscount"] +__all__ = ["UsageDiscount", "Filter"] + + +class Filter(TypedDict, total=False): + field: Required[Literal["price_id", "item_id", "price_type", "currency", "pricing_unit_id"]] + """The property of the price to filter on.""" + + operator: Required[Literal["includes", "excludes"]] + """Should prices that match the filter be included or excluded.""" + + values: Required[List[str]] + """The IDs or values that match this filter.""" class UsageDiscount(TypedDict, total=False): @@ -23,4 +34,7 @@ class UsageDiscount(TypedDict, total=False): For plan/plan phase discounts, this can be a subset of prices. """ + filters: Optional[Iterable[Filter]] + """The filters that determine which prices to apply this discount to.""" + reason: Optional[str] diff --git a/src/orb/types/subscription_create_params.py b/src/orb/types/subscription_create_params.py index a85819a9..3ba01736 100644 --- a/src/orb/types/subscription_create_params.py +++ b/src/orb/types/subscription_create_params.py @@ -13,10 +13,15 @@ "AddAdjustment", "AddAdjustmentAdjustment", "AddAdjustmentAdjustmentNewPercentageDiscount", + "AddAdjustmentAdjustmentNewPercentageDiscountFilter", "AddAdjustmentAdjustmentNewUsageDiscount", + "AddAdjustmentAdjustmentNewUsageDiscountFilter", "AddAdjustmentAdjustmentNewAmountDiscount", + "AddAdjustmentAdjustmentNewAmountDiscountFilter", "AddAdjustmentAdjustmentNewMinimum", + "AddAdjustmentAdjustmentNewMinimumFilter", "AddAdjustmentAdjustmentNewMaximum", + "AddAdjustmentAdjustmentNewMaximumFilter", "AddPrice", "AddPriceAllocationPrice", "AddPriceAllocationPriceCustomExpiration", @@ -155,10 +160,15 @@ "ReplaceAdjustment", "ReplaceAdjustmentAdjustment", "ReplaceAdjustmentAdjustmentNewPercentageDiscount", + "ReplaceAdjustmentAdjustmentNewPercentageDiscountFilter", "ReplaceAdjustmentAdjustmentNewUsageDiscount", + "ReplaceAdjustmentAdjustmentNewUsageDiscountFilter", "ReplaceAdjustmentAdjustmentNewAmountDiscount", + "ReplaceAdjustmentAdjustmentNewAmountDiscountFilter", "ReplaceAdjustmentAdjustmentNewMinimum", + "ReplaceAdjustmentAdjustmentNewMinimumFilter", "ReplaceAdjustmentAdjustmentNewMaximum", + "ReplaceAdjustmentAdjustmentNewMaximumFilter", "ReplacePrice", "ReplacePriceAllocationPrice", "ReplacePriceAllocationPriceCustomExpiration", @@ -463,50 +473,139 @@ class SubscriptionCreateParams(TypedDict, total=False): """ +class AddAdjustmentAdjustmentNewPercentageDiscountFilter(TypedDict, total=False): + field: Required[Literal["price_id", "item_id", "price_type", "currency", "pricing_unit_id"]] + """The property of the price to filter on.""" + + operator: Required[Literal["includes", "excludes"]] + """Should prices that match the filter be included or excluded.""" + + values: Required[List[str]] + """The IDs or values that match this filter.""" + + class AddAdjustmentAdjustmentNewPercentageDiscount(TypedDict, total=False): adjustment_type: Required[Literal["percentage_discount"]] percentage_discount: Required[float] + applies_to_all: Optional[Literal[True]] + """If set, the adjustment will apply to every price on the subscription.""" + + applies_to_item_ids: Optional[List[str]] + """The set of item IDs to which this adjustment applies.""" + applies_to_price_ids: Optional[List[str]] """The set of price IDs to which this adjustment applies.""" + currency: Optional[str] + """If set, only prices in the specified currency will have the adjustment applied.""" + + filters: Optional[Iterable[AddAdjustmentAdjustmentNewPercentageDiscountFilter]] + """A list of filters that determine which prices this adjustment will apply to.""" + 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. """ + price_type: Optional[Literal["usage", "fixed_in_advance", "fixed_in_arrears", "fixed", "in_arrears"]] + """If set, only prices of the specified type will have the adjustment applied.""" + + +class AddAdjustmentAdjustmentNewUsageDiscountFilter(TypedDict, total=False): + field: Required[Literal["price_id", "item_id", "price_type", "currency", "pricing_unit_id"]] + """The property of the price to filter on.""" + + operator: Required[Literal["includes", "excludes"]] + """Should prices that match the filter be included or excluded.""" + + values: Required[List[str]] + """The IDs or values that match this filter.""" + class AddAdjustmentAdjustmentNewUsageDiscount(TypedDict, total=False): adjustment_type: Required[Literal["usage_discount"]] usage_discount: Required[float] + applies_to_all: Optional[Literal[True]] + """If set, the adjustment will apply to every price on the subscription.""" + + applies_to_item_ids: Optional[List[str]] + """The set of item IDs to which this adjustment applies.""" + applies_to_price_ids: Optional[List[str]] """The set of price IDs to which this adjustment applies.""" + currency: Optional[str] + """If set, only prices in the specified currency will have the adjustment applied.""" + + filters: Optional[Iterable[AddAdjustmentAdjustmentNewUsageDiscountFilter]] + """A list of filters that determine which prices this adjustment will apply to.""" + 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. """ + price_type: Optional[Literal["usage", "fixed_in_advance", "fixed_in_arrears", "fixed", "in_arrears"]] + """If set, only prices of the specified type will have the adjustment applied.""" + + +class AddAdjustmentAdjustmentNewAmountDiscountFilter(TypedDict, total=False): + field: Required[Literal["price_id", "item_id", "price_type", "currency", "pricing_unit_id"]] + """The property of the price to filter on.""" + + operator: Required[Literal["includes", "excludes"]] + """Should prices that match the filter be included or excluded.""" + + values: Required[List[str]] + """The IDs or values that match this filter.""" + class AddAdjustmentAdjustmentNewAmountDiscount(TypedDict, total=False): adjustment_type: Required[Literal["amount_discount"]] amount_discount: Required[str] + applies_to_all: Optional[Literal[True]] + """If set, the adjustment will apply to every price on the subscription.""" + + applies_to_item_ids: Optional[List[str]] + """The set of item IDs to which this adjustment applies.""" + applies_to_price_ids: Optional[List[str]] """The set of price IDs to which this adjustment applies.""" + currency: Optional[str] + """If set, only prices in the specified currency will have the adjustment applied.""" + + filters: Optional[Iterable[AddAdjustmentAdjustmentNewAmountDiscountFilter]] + """A list of filters that determine which prices this adjustment will apply to.""" + 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. """ + price_type: Optional[Literal["usage", "fixed_in_advance", "fixed_in_arrears", "fixed", "in_arrears"]] + """If set, only prices of the specified type will have the adjustment applied.""" + + +class AddAdjustmentAdjustmentNewMinimumFilter(TypedDict, total=False): + field: Required[Literal["price_id", "item_id", "price_type", "currency", "pricing_unit_id"]] + """The property of the price to filter on.""" + + operator: Required[Literal["includes", "excludes"]] + """Should prices that match the filter be included or excluded.""" + + values: Required[List[str]] + """The IDs or values that match this filter.""" + class AddAdjustmentAdjustmentNewMinimum(TypedDict, total=False): adjustment_type: Required[Literal["minimum"]] @@ -516,30 +615,71 @@ class AddAdjustmentAdjustmentNewMinimum(TypedDict, total=False): minimum_amount: Required[str] + applies_to_all: Optional[Literal[True]] + """If set, the adjustment will apply to every price on the subscription.""" + + applies_to_item_ids: Optional[List[str]] + """The set of item IDs to which this adjustment applies.""" + applies_to_price_ids: Optional[List[str]] """The set of price IDs to which this adjustment applies.""" + currency: Optional[str] + """If set, only prices in the specified currency will have the adjustment applied.""" + + filters: Optional[Iterable[AddAdjustmentAdjustmentNewMinimumFilter]] + """A list of filters that determine which prices this adjustment will apply to.""" + 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. """ + price_type: Optional[Literal["usage", "fixed_in_advance", "fixed_in_arrears", "fixed", "in_arrears"]] + """If set, only prices of the specified type will have the adjustment applied.""" + + +class AddAdjustmentAdjustmentNewMaximumFilter(TypedDict, total=False): + field: Required[Literal["price_id", "item_id", "price_type", "currency", "pricing_unit_id"]] + """The property of the price to filter on.""" + + operator: Required[Literal["includes", "excludes"]] + """Should prices that match the filter be included or excluded.""" + + values: Required[List[str]] + """The IDs or values that match this filter.""" + class AddAdjustmentAdjustmentNewMaximum(TypedDict, total=False): adjustment_type: Required[Literal["maximum"]] maximum_amount: Required[str] + applies_to_all: Optional[Literal[True]] + """If set, the adjustment will apply to every price on the subscription.""" + + applies_to_item_ids: Optional[List[str]] + """The set of item IDs to which this adjustment applies.""" + applies_to_price_ids: Optional[List[str]] """The set of price IDs to which this adjustment applies.""" + currency: Optional[str] + """If set, only prices in the specified currency will have the adjustment applied.""" + + filters: Optional[Iterable[AddAdjustmentAdjustmentNewMaximumFilter]] + """A list of filters that determine which prices this adjustment will apply to.""" + 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. """ + price_type: Optional[Literal["usage", "fixed_in_advance", "fixed_in_arrears", "fixed", "in_arrears"]] + """If set, only prices of the specified type will have the adjustment applied.""" + AddAdjustmentAdjustment: TypeAlias = Union[ AddAdjustmentAdjustmentNewPercentageDiscount, @@ -3961,50 +4101,139 @@ class RemovePrice(TypedDict, total=False): """The id of the price to remove on the subscription.""" +class ReplaceAdjustmentAdjustmentNewPercentageDiscountFilter(TypedDict, total=False): + field: Required[Literal["price_id", "item_id", "price_type", "currency", "pricing_unit_id"]] + """The property of the price to filter on.""" + + operator: Required[Literal["includes", "excludes"]] + """Should prices that match the filter be included or excluded.""" + + values: Required[List[str]] + """The IDs or values that match this filter.""" + + class ReplaceAdjustmentAdjustmentNewPercentageDiscount(TypedDict, total=False): adjustment_type: Required[Literal["percentage_discount"]] percentage_discount: Required[float] + applies_to_all: Optional[Literal[True]] + """If set, the adjustment will apply to every price on the subscription.""" + + applies_to_item_ids: Optional[List[str]] + """The set of item IDs to which this adjustment applies.""" + applies_to_price_ids: Optional[List[str]] """The set of price IDs to which this adjustment applies.""" + currency: Optional[str] + """If set, only prices in the specified currency will have the adjustment applied.""" + + filters: Optional[Iterable[ReplaceAdjustmentAdjustmentNewPercentageDiscountFilter]] + """A list of filters that determine which prices this adjustment will apply to.""" + 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. """ + price_type: Optional[Literal["usage", "fixed_in_advance", "fixed_in_arrears", "fixed", "in_arrears"]] + """If set, only prices of the specified type will have the adjustment applied.""" + + +class ReplaceAdjustmentAdjustmentNewUsageDiscountFilter(TypedDict, total=False): + field: Required[Literal["price_id", "item_id", "price_type", "currency", "pricing_unit_id"]] + """The property of the price to filter on.""" + + operator: Required[Literal["includes", "excludes"]] + """Should prices that match the filter be included or excluded.""" + + values: Required[List[str]] + """The IDs or values that match this filter.""" + class ReplaceAdjustmentAdjustmentNewUsageDiscount(TypedDict, total=False): adjustment_type: Required[Literal["usage_discount"]] usage_discount: Required[float] + applies_to_all: Optional[Literal[True]] + """If set, the adjustment will apply to every price on the subscription.""" + + applies_to_item_ids: Optional[List[str]] + """The set of item IDs to which this adjustment applies.""" + applies_to_price_ids: Optional[List[str]] """The set of price IDs to which this adjustment applies.""" + currency: Optional[str] + """If set, only prices in the specified currency will have the adjustment applied.""" + + filters: Optional[Iterable[ReplaceAdjustmentAdjustmentNewUsageDiscountFilter]] + """A list of filters that determine which prices this adjustment will apply to.""" + 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. """ + price_type: Optional[Literal["usage", "fixed_in_advance", "fixed_in_arrears", "fixed", "in_arrears"]] + """If set, only prices of the specified type will have the adjustment applied.""" + + +class ReplaceAdjustmentAdjustmentNewAmountDiscountFilter(TypedDict, total=False): + field: Required[Literal["price_id", "item_id", "price_type", "currency", "pricing_unit_id"]] + """The property of the price to filter on.""" + + operator: Required[Literal["includes", "excludes"]] + """Should prices that match the filter be included or excluded.""" + + values: Required[List[str]] + """The IDs or values that match this filter.""" + class ReplaceAdjustmentAdjustmentNewAmountDiscount(TypedDict, total=False): adjustment_type: Required[Literal["amount_discount"]] amount_discount: Required[str] + applies_to_all: Optional[Literal[True]] + """If set, the adjustment will apply to every price on the subscription.""" + + applies_to_item_ids: Optional[List[str]] + """The set of item IDs to which this adjustment applies.""" + applies_to_price_ids: Optional[List[str]] """The set of price IDs to which this adjustment applies.""" + currency: Optional[str] + """If set, only prices in the specified currency will have the adjustment applied.""" + + filters: Optional[Iterable[ReplaceAdjustmentAdjustmentNewAmountDiscountFilter]] + """A list of filters that determine which prices this adjustment will apply to.""" + 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. """ + price_type: Optional[Literal["usage", "fixed_in_advance", "fixed_in_arrears", "fixed", "in_arrears"]] + """If set, only prices of the specified type will have the adjustment applied.""" + + +class ReplaceAdjustmentAdjustmentNewMinimumFilter(TypedDict, total=False): + field: Required[Literal["price_id", "item_id", "price_type", "currency", "pricing_unit_id"]] + """The property of the price to filter on.""" + + operator: Required[Literal["includes", "excludes"]] + """Should prices that match the filter be included or excluded.""" + + values: Required[List[str]] + """The IDs or values that match this filter.""" + class ReplaceAdjustmentAdjustmentNewMinimum(TypedDict, total=False): adjustment_type: Required[Literal["minimum"]] @@ -4014,30 +4243,71 @@ class ReplaceAdjustmentAdjustmentNewMinimum(TypedDict, total=False): minimum_amount: Required[str] + applies_to_all: Optional[Literal[True]] + """If set, the adjustment will apply to every price on the subscription.""" + + applies_to_item_ids: Optional[List[str]] + """The set of item IDs to which this adjustment applies.""" + applies_to_price_ids: Optional[List[str]] """The set of price IDs to which this adjustment applies.""" + currency: Optional[str] + """If set, only prices in the specified currency will have the adjustment applied.""" + + filters: Optional[Iterable[ReplaceAdjustmentAdjustmentNewMinimumFilter]] + """A list of filters that determine which prices this adjustment will apply to.""" + 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. """ + price_type: Optional[Literal["usage", "fixed_in_advance", "fixed_in_arrears", "fixed", "in_arrears"]] + """If set, only prices of the specified type will have the adjustment applied.""" + + +class ReplaceAdjustmentAdjustmentNewMaximumFilter(TypedDict, total=False): + field: Required[Literal["price_id", "item_id", "price_type", "currency", "pricing_unit_id"]] + """The property of the price to filter on.""" + + operator: Required[Literal["includes", "excludes"]] + """Should prices that match the filter be included or excluded.""" + + values: Required[List[str]] + """The IDs or values that match this filter.""" + class ReplaceAdjustmentAdjustmentNewMaximum(TypedDict, total=False): adjustment_type: Required[Literal["maximum"]] maximum_amount: Required[str] + applies_to_all: Optional[Literal[True]] + """If set, the adjustment will apply to every price on the subscription.""" + + applies_to_item_ids: Optional[List[str]] + """The set of item IDs to which this adjustment applies.""" + applies_to_price_ids: Optional[List[str]] """The set of price IDs to which this adjustment applies.""" + currency: Optional[str] + """If set, only prices in the specified currency will have the adjustment applied.""" + + filters: Optional[Iterable[ReplaceAdjustmentAdjustmentNewMaximumFilter]] + """A list of filters that determine which prices this adjustment will apply to.""" + 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. """ + price_type: Optional[Literal["usage", "fixed_in_advance", "fixed_in_arrears", "fixed", "in_arrears"]] + """If set, only prices of the specified type will have the adjustment applied.""" + ReplaceAdjustmentAdjustment: TypeAlias = Union[ ReplaceAdjustmentAdjustmentNewPercentageDiscount, diff --git a/src/orb/types/subscription_price_intervals_params.py b/src/orb/types/subscription_price_intervals_params.py index 90b09781..f34b7ff2 100644 --- a/src/orb/types/subscription_price_intervals_params.py +++ b/src/orb/types/subscription_price_intervals_params.py @@ -150,10 +150,15 @@ "AddAdjustment", "AddAdjustmentAdjustment", "AddAdjustmentAdjustmentNewPercentageDiscount", + "AddAdjustmentAdjustmentNewPercentageDiscountFilter", "AddAdjustmentAdjustmentNewUsageDiscount", + "AddAdjustmentAdjustmentNewUsageDiscountFilter", "AddAdjustmentAdjustmentNewAmountDiscount", + "AddAdjustmentAdjustmentNewAmountDiscountFilter", "AddAdjustmentAdjustmentNewMinimum", + "AddAdjustmentAdjustmentNewMinimumFilter", "AddAdjustmentAdjustmentNewMaximum", + "AddAdjustmentAdjustmentNewMaximumFilter", "Edit", "EditFixedFeeQuantityTransition", "EditAdjustment", @@ -3238,50 +3243,139 @@ class Add(TypedDict, total=False): """ +class AddAdjustmentAdjustmentNewPercentageDiscountFilter(TypedDict, total=False): + field: Required[Literal["price_id", "item_id", "price_type", "currency", "pricing_unit_id"]] + """The property of the price to filter on.""" + + operator: Required[Literal["includes", "excludes"]] + """Should prices that match the filter be included or excluded.""" + + values: Required[List[str]] + """The IDs or values that match this filter.""" + + class AddAdjustmentAdjustmentNewPercentageDiscount(TypedDict, total=False): adjustment_type: Required[Literal["percentage_discount"]] percentage_discount: Required[float] + applies_to_all: Optional[Literal[True]] + """If set, the adjustment will apply to every price on the subscription.""" + + applies_to_item_ids: Optional[List[str]] + """The set of item IDs to which this adjustment applies.""" + applies_to_price_ids: Optional[List[str]] """The set of price IDs to which this adjustment applies.""" + currency: Optional[str] + """If set, only prices in the specified currency will have the adjustment applied.""" + + filters: Optional[Iterable[AddAdjustmentAdjustmentNewPercentageDiscountFilter]] + """A list of filters that determine which prices this adjustment will apply to.""" + 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. """ + price_type: Optional[Literal["usage", "fixed_in_advance", "fixed_in_arrears", "fixed", "in_arrears"]] + """If set, only prices of the specified type will have the adjustment applied.""" + + +class AddAdjustmentAdjustmentNewUsageDiscountFilter(TypedDict, total=False): + field: Required[Literal["price_id", "item_id", "price_type", "currency", "pricing_unit_id"]] + """The property of the price to filter on.""" + + operator: Required[Literal["includes", "excludes"]] + """Should prices that match the filter be included or excluded.""" + + values: Required[List[str]] + """The IDs or values that match this filter.""" + class AddAdjustmentAdjustmentNewUsageDiscount(TypedDict, total=False): adjustment_type: Required[Literal["usage_discount"]] usage_discount: Required[float] + applies_to_all: Optional[Literal[True]] + """If set, the adjustment will apply to every price on the subscription.""" + + applies_to_item_ids: Optional[List[str]] + """The set of item IDs to which this adjustment applies.""" + applies_to_price_ids: Optional[List[str]] """The set of price IDs to which this adjustment applies.""" + currency: Optional[str] + """If set, only prices in the specified currency will have the adjustment applied.""" + + filters: Optional[Iterable[AddAdjustmentAdjustmentNewUsageDiscountFilter]] + """A list of filters that determine which prices this adjustment will apply to.""" + 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. """ + price_type: Optional[Literal["usage", "fixed_in_advance", "fixed_in_arrears", "fixed", "in_arrears"]] + """If set, only prices of the specified type will have the adjustment applied.""" + + +class AddAdjustmentAdjustmentNewAmountDiscountFilter(TypedDict, total=False): + field: Required[Literal["price_id", "item_id", "price_type", "currency", "pricing_unit_id"]] + """The property of the price to filter on.""" + + operator: Required[Literal["includes", "excludes"]] + """Should prices that match the filter be included or excluded.""" + + values: Required[List[str]] + """The IDs or values that match this filter.""" + class AddAdjustmentAdjustmentNewAmountDiscount(TypedDict, total=False): adjustment_type: Required[Literal["amount_discount"]] amount_discount: Required[str] + applies_to_all: Optional[Literal[True]] + """If set, the adjustment will apply to every price on the subscription.""" + + applies_to_item_ids: Optional[List[str]] + """The set of item IDs to which this adjustment applies.""" + applies_to_price_ids: Optional[List[str]] """The set of price IDs to which this adjustment applies.""" + currency: Optional[str] + """If set, only prices in the specified currency will have the adjustment applied.""" + + filters: Optional[Iterable[AddAdjustmentAdjustmentNewAmountDiscountFilter]] + """A list of filters that determine which prices this adjustment will apply to.""" + 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. """ + price_type: Optional[Literal["usage", "fixed_in_advance", "fixed_in_arrears", "fixed", "in_arrears"]] + """If set, only prices of the specified type will have the adjustment applied.""" + + +class AddAdjustmentAdjustmentNewMinimumFilter(TypedDict, total=False): + field: Required[Literal["price_id", "item_id", "price_type", "currency", "pricing_unit_id"]] + """The property of the price to filter on.""" + + operator: Required[Literal["includes", "excludes"]] + """Should prices that match the filter be included or excluded.""" + + values: Required[List[str]] + """The IDs or values that match this filter.""" + class AddAdjustmentAdjustmentNewMinimum(TypedDict, total=False): adjustment_type: Required[Literal["minimum"]] @@ -3291,30 +3385,71 @@ class AddAdjustmentAdjustmentNewMinimum(TypedDict, total=False): minimum_amount: Required[str] + applies_to_all: Optional[Literal[True]] + """If set, the adjustment will apply to every price on the subscription.""" + + applies_to_item_ids: Optional[List[str]] + """The set of item IDs to which this adjustment applies.""" + applies_to_price_ids: Optional[List[str]] """The set of price IDs to which this adjustment applies.""" + currency: Optional[str] + """If set, only prices in the specified currency will have the adjustment applied.""" + + filters: Optional[Iterable[AddAdjustmentAdjustmentNewMinimumFilter]] + """A list of filters that determine which prices this adjustment will apply to.""" + 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. """ + price_type: Optional[Literal["usage", "fixed_in_advance", "fixed_in_arrears", "fixed", "in_arrears"]] + """If set, only prices of the specified type will have the adjustment applied.""" + + +class AddAdjustmentAdjustmentNewMaximumFilter(TypedDict, total=False): + field: Required[Literal["price_id", "item_id", "price_type", "currency", "pricing_unit_id"]] + """The property of the price to filter on.""" + + operator: Required[Literal["includes", "excludes"]] + """Should prices that match the filter be included or excluded.""" + + values: Required[List[str]] + """The IDs or values that match this filter.""" + class AddAdjustmentAdjustmentNewMaximum(TypedDict, total=False): adjustment_type: Required[Literal["maximum"]] maximum_amount: Required[str] + applies_to_all: Optional[Literal[True]] + """If set, the adjustment will apply to every price on the subscription.""" + + applies_to_item_ids: Optional[List[str]] + """The set of item IDs to which this adjustment applies.""" + applies_to_price_ids: Optional[List[str]] """The set of price IDs to which this adjustment applies.""" + currency: Optional[str] + """If set, only prices in the specified currency will have the adjustment applied.""" + + filters: Optional[Iterable[AddAdjustmentAdjustmentNewMaximumFilter]] + """A list of filters that determine which prices this adjustment will apply to.""" + 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. """ + price_type: Optional[Literal["usage", "fixed_in_advance", "fixed_in_arrears", "fixed", "in_arrears"]] + """If set, only prices of the specified type will have the adjustment applied.""" + AddAdjustmentAdjustment: TypeAlias = Union[ AddAdjustmentAdjustmentNewPercentageDiscount, diff --git a/src/orb/types/subscription_redeem_coupon_params.py b/src/orb/types/subscription_redeem_coupon_params.py index 385a6e26..3b4e9878 100644 --- a/src/orb/types/subscription_redeem_coupon_params.py +++ b/src/orb/types/subscription_redeem_coupon_params.py @@ -14,9 +14,6 @@ class SubscriptionRedeemCouponParams(TypedDict, total=False): change_option: Required[Literal["requested_date", "end_of_subscription_term", "immediate"]] - coupon_id: Required[str] - """Coupon ID to be redeemed for this subscription.""" - allow_invoice_credit_or_void: Optional[bool] """ If false, this request will fail if it would void an issued invoice or create a @@ -29,3 +26,9 @@ class SubscriptionRedeemCouponParams(TypedDict, total=False): This parameter can only be passed if the `change_option` is `requested_date`. """ + + coupon_id: Optional[str] + """Coupon ID to be redeemed for this subscription.""" + + coupon_redemption_code: Optional[str] + """Redemption code of the coupon to be redeemed for this subscription.""" diff --git a/src/orb/types/subscription_schedule_plan_change_params.py b/src/orb/types/subscription_schedule_plan_change_params.py index aff9676c..9dc350e3 100644 --- a/src/orb/types/subscription_schedule_plan_change_params.py +++ b/src/orb/types/subscription_schedule_plan_change_params.py @@ -13,10 +13,15 @@ "AddAdjustment", "AddAdjustmentAdjustment", "AddAdjustmentAdjustmentNewPercentageDiscount", + "AddAdjustmentAdjustmentNewPercentageDiscountFilter", "AddAdjustmentAdjustmentNewUsageDiscount", + "AddAdjustmentAdjustmentNewUsageDiscountFilter", "AddAdjustmentAdjustmentNewAmountDiscount", + "AddAdjustmentAdjustmentNewAmountDiscountFilter", "AddAdjustmentAdjustmentNewMinimum", + "AddAdjustmentAdjustmentNewMinimumFilter", "AddAdjustmentAdjustmentNewMaximum", + "AddAdjustmentAdjustmentNewMaximumFilter", "AddPrice", "AddPriceAllocationPrice", "AddPriceAllocationPriceCustomExpiration", @@ -155,10 +160,15 @@ "ReplaceAdjustment", "ReplaceAdjustmentAdjustment", "ReplaceAdjustmentAdjustmentNewPercentageDiscount", + "ReplaceAdjustmentAdjustmentNewPercentageDiscountFilter", "ReplaceAdjustmentAdjustmentNewUsageDiscount", + "ReplaceAdjustmentAdjustmentNewUsageDiscountFilter", "ReplaceAdjustmentAdjustmentNewAmountDiscount", + "ReplaceAdjustmentAdjustmentNewAmountDiscountFilter", "ReplaceAdjustmentAdjustmentNewMinimum", + "ReplaceAdjustmentAdjustmentNewMinimumFilter", "ReplaceAdjustmentAdjustmentNewMaximum", + "ReplaceAdjustmentAdjustmentNewMaximumFilter", "ReplacePrice", "ReplacePriceAllocationPrice", "ReplacePriceAllocationPriceCustomExpiration", @@ -451,50 +461,139 @@ class SubscriptionSchedulePlanChangeParams(TypedDict, total=False): """ +class AddAdjustmentAdjustmentNewPercentageDiscountFilter(TypedDict, total=False): + field: Required[Literal["price_id", "item_id", "price_type", "currency", "pricing_unit_id"]] + """The property of the price to filter on.""" + + operator: Required[Literal["includes", "excludes"]] + """Should prices that match the filter be included or excluded.""" + + values: Required[List[str]] + """The IDs or values that match this filter.""" + + class AddAdjustmentAdjustmentNewPercentageDiscount(TypedDict, total=False): adjustment_type: Required[Literal["percentage_discount"]] percentage_discount: Required[float] + applies_to_all: Optional[Literal[True]] + """If set, the adjustment will apply to every price on the subscription.""" + + applies_to_item_ids: Optional[List[str]] + """The set of item IDs to which this adjustment applies.""" + applies_to_price_ids: Optional[List[str]] """The set of price IDs to which this adjustment applies.""" + currency: Optional[str] + """If set, only prices in the specified currency will have the adjustment applied.""" + + filters: Optional[Iterable[AddAdjustmentAdjustmentNewPercentageDiscountFilter]] + """A list of filters that determine which prices this adjustment will apply to.""" + 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. """ + price_type: Optional[Literal["usage", "fixed_in_advance", "fixed_in_arrears", "fixed", "in_arrears"]] + """If set, only prices of the specified type will have the adjustment applied.""" + + +class AddAdjustmentAdjustmentNewUsageDiscountFilter(TypedDict, total=False): + field: Required[Literal["price_id", "item_id", "price_type", "currency", "pricing_unit_id"]] + """The property of the price to filter on.""" + + operator: Required[Literal["includes", "excludes"]] + """Should prices that match the filter be included or excluded.""" + + values: Required[List[str]] + """The IDs or values that match this filter.""" + class AddAdjustmentAdjustmentNewUsageDiscount(TypedDict, total=False): adjustment_type: Required[Literal["usage_discount"]] usage_discount: Required[float] + applies_to_all: Optional[Literal[True]] + """If set, the adjustment will apply to every price on the subscription.""" + + applies_to_item_ids: Optional[List[str]] + """The set of item IDs to which this adjustment applies.""" + applies_to_price_ids: Optional[List[str]] """The set of price IDs to which this adjustment applies.""" + currency: Optional[str] + """If set, only prices in the specified currency will have the adjustment applied.""" + + filters: Optional[Iterable[AddAdjustmentAdjustmentNewUsageDiscountFilter]] + """A list of filters that determine which prices this adjustment will apply to.""" + 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. """ + price_type: Optional[Literal["usage", "fixed_in_advance", "fixed_in_arrears", "fixed", "in_arrears"]] + """If set, only prices of the specified type will have the adjustment applied.""" + + +class AddAdjustmentAdjustmentNewAmountDiscountFilter(TypedDict, total=False): + field: Required[Literal["price_id", "item_id", "price_type", "currency", "pricing_unit_id"]] + """The property of the price to filter on.""" + + operator: Required[Literal["includes", "excludes"]] + """Should prices that match the filter be included or excluded.""" + + values: Required[List[str]] + """The IDs or values that match this filter.""" + class AddAdjustmentAdjustmentNewAmountDiscount(TypedDict, total=False): adjustment_type: Required[Literal["amount_discount"]] amount_discount: Required[str] + applies_to_all: Optional[Literal[True]] + """If set, the adjustment will apply to every price on the subscription.""" + + applies_to_item_ids: Optional[List[str]] + """The set of item IDs to which this adjustment applies.""" + applies_to_price_ids: Optional[List[str]] """The set of price IDs to which this adjustment applies.""" + currency: Optional[str] + """If set, only prices in the specified currency will have the adjustment applied.""" + + filters: Optional[Iterable[AddAdjustmentAdjustmentNewAmountDiscountFilter]] + """A list of filters that determine which prices this adjustment will apply to.""" + 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. """ + price_type: Optional[Literal["usage", "fixed_in_advance", "fixed_in_arrears", "fixed", "in_arrears"]] + """If set, only prices of the specified type will have the adjustment applied.""" + + +class AddAdjustmentAdjustmentNewMinimumFilter(TypedDict, total=False): + field: Required[Literal["price_id", "item_id", "price_type", "currency", "pricing_unit_id"]] + """The property of the price to filter on.""" + + operator: Required[Literal["includes", "excludes"]] + """Should prices that match the filter be included or excluded.""" + + values: Required[List[str]] + """The IDs or values that match this filter.""" + class AddAdjustmentAdjustmentNewMinimum(TypedDict, total=False): adjustment_type: Required[Literal["minimum"]] @@ -504,30 +603,71 @@ class AddAdjustmentAdjustmentNewMinimum(TypedDict, total=False): minimum_amount: Required[str] + applies_to_all: Optional[Literal[True]] + """If set, the adjustment will apply to every price on the subscription.""" + + applies_to_item_ids: Optional[List[str]] + """The set of item IDs to which this adjustment applies.""" + applies_to_price_ids: Optional[List[str]] """The set of price IDs to which this adjustment applies.""" + currency: Optional[str] + """If set, only prices in the specified currency will have the adjustment applied.""" + + filters: Optional[Iterable[AddAdjustmentAdjustmentNewMinimumFilter]] + """A list of filters that determine which prices this adjustment will apply to.""" + 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. """ + price_type: Optional[Literal["usage", "fixed_in_advance", "fixed_in_arrears", "fixed", "in_arrears"]] + """If set, only prices of the specified type will have the adjustment applied.""" + + +class AddAdjustmentAdjustmentNewMaximumFilter(TypedDict, total=False): + field: Required[Literal["price_id", "item_id", "price_type", "currency", "pricing_unit_id"]] + """The property of the price to filter on.""" + + operator: Required[Literal["includes", "excludes"]] + """Should prices that match the filter be included or excluded.""" + + values: Required[List[str]] + """The IDs or values that match this filter.""" + class AddAdjustmentAdjustmentNewMaximum(TypedDict, total=False): adjustment_type: Required[Literal["maximum"]] maximum_amount: Required[str] + applies_to_all: Optional[Literal[True]] + """If set, the adjustment will apply to every price on the subscription.""" + + applies_to_item_ids: Optional[List[str]] + """The set of item IDs to which this adjustment applies.""" + applies_to_price_ids: Optional[List[str]] """The set of price IDs to which this adjustment applies.""" + currency: Optional[str] + """If set, only prices in the specified currency will have the adjustment applied.""" + + filters: Optional[Iterable[AddAdjustmentAdjustmentNewMaximumFilter]] + """A list of filters that determine which prices this adjustment will apply to.""" + 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. """ + price_type: Optional[Literal["usage", "fixed_in_advance", "fixed_in_arrears", "fixed", "in_arrears"]] + """If set, only prices of the specified type will have the adjustment applied.""" + AddAdjustmentAdjustment: TypeAlias = Union[ AddAdjustmentAdjustmentNewPercentageDiscount, @@ -3949,50 +4089,139 @@ class RemovePrice(TypedDict, total=False): """The id of the price to remove on the subscription.""" +class ReplaceAdjustmentAdjustmentNewPercentageDiscountFilter(TypedDict, total=False): + field: Required[Literal["price_id", "item_id", "price_type", "currency", "pricing_unit_id"]] + """The property of the price to filter on.""" + + operator: Required[Literal["includes", "excludes"]] + """Should prices that match the filter be included or excluded.""" + + values: Required[List[str]] + """The IDs or values that match this filter.""" + + class ReplaceAdjustmentAdjustmentNewPercentageDiscount(TypedDict, total=False): adjustment_type: Required[Literal["percentage_discount"]] percentage_discount: Required[float] + applies_to_all: Optional[Literal[True]] + """If set, the adjustment will apply to every price on the subscription.""" + + applies_to_item_ids: Optional[List[str]] + """The set of item IDs to which this adjustment applies.""" + applies_to_price_ids: Optional[List[str]] """The set of price IDs to which this adjustment applies.""" + currency: Optional[str] + """If set, only prices in the specified currency will have the adjustment applied.""" + + filters: Optional[Iterable[ReplaceAdjustmentAdjustmentNewPercentageDiscountFilter]] + """A list of filters that determine which prices this adjustment will apply to.""" + 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. """ + price_type: Optional[Literal["usage", "fixed_in_advance", "fixed_in_arrears", "fixed", "in_arrears"]] + """If set, only prices of the specified type will have the adjustment applied.""" + + +class ReplaceAdjustmentAdjustmentNewUsageDiscountFilter(TypedDict, total=False): + field: Required[Literal["price_id", "item_id", "price_type", "currency", "pricing_unit_id"]] + """The property of the price to filter on.""" + + operator: Required[Literal["includes", "excludes"]] + """Should prices that match the filter be included or excluded.""" + + values: Required[List[str]] + """The IDs or values that match this filter.""" + class ReplaceAdjustmentAdjustmentNewUsageDiscount(TypedDict, total=False): adjustment_type: Required[Literal["usage_discount"]] usage_discount: Required[float] + applies_to_all: Optional[Literal[True]] + """If set, the adjustment will apply to every price on the subscription.""" + + applies_to_item_ids: Optional[List[str]] + """The set of item IDs to which this adjustment applies.""" + applies_to_price_ids: Optional[List[str]] """The set of price IDs to which this adjustment applies.""" + currency: Optional[str] + """If set, only prices in the specified currency will have the adjustment applied.""" + + filters: Optional[Iterable[ReplaceAdjustmentAdjustmentNewUsageDiscountFilter]] + """A list of filters that determine which prices this adjustment will apply to.""" + 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. """ + price_type: Optional[Literal["usage", "fixed_in_advance", "fixed_in_arrears", "fixed", "in_arrears"]] + """If set, only prices of the specified type will have the adjustment applied.""" + + +class ReplaceAdjustmentAdjustmentNewAmountDiscountFilter(TypedDict, total=False): + field: Required[Literal["price_id", "item_id", "price_type", "currency", "pricing_unit_id"]] + """The property of the price to filter on.""" + + operator: Required[Literal["includes", "excludes"]] + """Should prices that match the filter be included or excluded.""" + + values: Required[List[str]] + """The IDs or values that match this filter.""" + class ReplaceAdjustmentAdjustmentNewAmountDiscount(TypedDict, total=False): adjustment_type: Required[Literal["amount_discount"]] amount_discount: Required[str] + applies_to_all: Optional[Literal[True]] + """If set, the adjustment will apply to every price on the subscription.""" + + applies_to_item_ids: Optional[List[str]] + """The set of item IDs to which this adjustment applies.""" + applies_to_price_ids: Optional[List[str]] """The set of price IDs to which this adjustment applies.""" + currency: Optional[str] + """If set, only prices in the specified currency will have the adjustment applied.""" + + filters: Optional[Iterable[ReplaceAdjustmentAdjustmentNewAmountDiscountFilter]] + """A list of filters that determine which prices this adjustment will apply to.""" + 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. """ + price_type: Optional[Literal["usage", "fixed_in_advance", "fixed_in_arrears", "fixed", "in_arrears"]] + """If set, only prices of the specified type will have the adjustment applied.""" + + +class ReplaceAdjustmentAdjustmentNewMinimumFilter(TypedDict, total=False): + field: Required[Literal["price_id", "item_id", "price_type", "currency", "pricing_unit_id"]] + """The property of the price to filter on.""" + + operator: Required[Literal["includes", "excludes"]] + """Should prices that match the filter be included or excluded.""" + + values: Required[List[str]] + """The IDs or values that match this filter.""" + class ReplaceAdjustmentAdjustmentNewMinimum(TypedDict, total=False): adjustment_type: Required[Literal["minimum"]] @@ -4002,30 +4231,71 @@ class ReplaceAdjustmentAdjustmentNewMinimum(TypedDict, total=False): minimum_amount: Required[str] + applies_to_all: Optional[Literal[True]] + """If set, the adjustment will apply to every price on the subscription.""" + + applies_to_item_ids: Optional[List[str]] + """The set of item IDs to which this adjustment applies.""" + applies_to_price_ids: Optional[List[str]] """The set of price IDs to which this adjustment applies.""" + currency: Optional[str] + """If set, only prices in the specified currency will have the adjustment applied.""" + + filters: Optional[Iterable[ReplaceAdjustmentAdjustmentNewMinimumFilter]] + """A list of filters that determine which prices this adjustment will apply to.""" + 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. """ + price_type: Optional[Literal["usage", "fixed_in_advance", "fixed_in_arrears", "fixed", "in_arrears"]] + """If set, only prices of the specified type will have the adjustment applied.""" + + +class ReplaceAdjustmentAdjustmentNewMaximumFilter(TypedDict, total=False): + field: Required[Literal["price_id", "item_id", "price_type", "currency", "pricing_unit_id"]] + """The property of the price to filter on.""" + + operator: Required[Literal["includes", "excludes"]] + """Should prices that match the filter be included or excluded.""" + + values: Required[List[str]] + """The IDs or values that match this filter.""" + class ReplaceAdjustmentAdjustmentNewMaximum(TypedDict, total=False): adjustment_type: Required[Literal["maximum"]] maximum_amount: Required[str] + applies_to_all: Optional[Literal[True]] + """If set, the adjustment will apply to every price on the subscription.""" + + applies_to_item_ids: Optional[List[str]] + """The set of item IDs to which this adjustment applies.""" + applies_to_price_ids: Optional[List[str]] """The set of price IDs to which this adjustment applies.""" + currency: Optional[str] + """If set, only prices in the specified currency will have the adjustment applied.""" + + filters: Optional[Iterable[ReplaceAdjustmentAdjustmentNewMaximumFilter]] + """A list of filters that determine which prices this adjustment will apply to.""" + 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. """ + price_type: Optional[Literal["usage", "fixed_in_advance", "fixed_in_arrears", "fixed", "in_arrears"]] + """If set, only prices of the specified type will have the adjustment applied.""" + ReplaceAdjustmentAdjustment: TypeAlias = Union[ ReplaceAdjustmentAdjustmentNewPercentageDiscount, diff --git a/tests/api_resources/beta/test_external_plan_id.py b/tests/api_resources/beta/test_external_plan_id.py index ec1fcb07..a569d90a 100644 --- a/tests/api_resources/beta/test_external_plan_id.py +++ b/tests/api_resources/beta/test_external_plan_id.py @@ -35,8 +35,19 @@ def test_method_create_plan_version_with_all_params(self, client: Orb) -> None: "adjustment": { "adjustment_type": "percentage_discount", "percentage_discount": 0, + "applies_to_all": True, + "applies_to_item_ids": ["item_1", "item_2"], "applies_to_price_ids": ["price_1", "price_2"], + "currency": "currency", + "filters": [ + { + "field": "price_id", + "operator": "includes", + "values": ["string"], + } + ], "is_invoice_level": True, + "price_type": "usage", }, "plan_phase_order": 0, } @@ -101,8 +112,19 @@ def test_method_create_plan_version_with_all_params(self, client: Orb) -> None: "adjustment": { "adjustment_type": "percentage_discount", "percentage_discount": 0, + "applies_to_all": True, + "applies_to_item_ids": ["item_1", "item_2"], "applies_to_price_ids": ["price_1", "price_2"], + "currency": "currency", + "filters": [ + { + "field": "price_id", + "operator": "includes", + "values": ["string"], + } + ], "is_invoice_level": True, + "price_type": "usage", }, "replaces_adjustment_id": "replaces_adjustment_id", "plan_phase_order": 0, @@ -302,8 +324,19 @@ async def test_method_create_plan_version_with_all_params(self, async_client: As "adjustment": { "adjustment_type": "percentage_discount", "percentage_discount": 0, + "applies_to_all": True, + "applies_to_item_ids": ["item_1", "item_2"], "applies_to_price_ids": ["price_1", "price_2"], + "currency": "currency", + "filters": [ + { + "field": "price_id", + "operator": "includes", + "values": ["string"], + } + ], "is_invoice_level": True, + "price_type": "usage", }, "plan_phase_order": 0, } @@ -368,8 +401,19 @@ async def test_method_create_plan_version_with_all_params(self, async_client: As "adjustment": { "adjustment_type": "percentage_discount", "percentage_discount": 0, + "applies_to_all": True, + "applies_to_item_ids": ["item_1", "item_2"], "applies_to_price_ids": ["price_1", "price_2"], + "currency": "currency", + "filters": [ + { + "field": "price_id", + "operator": "includes", + "values": ["string"], + } + ], "is_invoice_level": True, + "price_type": "usage", }, "replaces_adjustment_id": "replaces_adjustment_id", "plan_phase_order": 0, diff --git a/tests/api_resources/test_beta.py b/tests/api_resources/test_beta.py index 8461a6e0..fd995dab 100644 --- a/tests/api_resources/test_beta.py +++ b/tests/api_resources/test_beta.py @@ -35,8 +35,19 @@ def test_method_create_plan_version_with_all_params(self, client: Orb) -> None: "adjustment": { "adjustment_type": "percentage_discount", "percentage_discount": 0, + "applies_to_all": True, + "applies_to_item_ids": ["item_1", "item_2"], "applies_to_price_ids": ["price_1", "price_2"], + "currency": "currency", + "filters": [ + { + "field": "price_id", + "operator": "includes", + "values": ["string"], + } + ], "is_invoice_level": True, + "price_type": "usage", }, "plan_phase_order": 0, } @@ -101,8 +112,19 @@ def test_method_create_plan_version_with_all_params(self, client: Orb) -> None: "adjustment": { "adjustment_type": "percentage_discount", "percentage_discount": 0, + "applies_to_all": True, + "applies_to_item_ids": ["item_1", "item_2"], "applies_to_price_ids": ["price_1", "price_2"], + "currency": "currency", + "filters": [ + { + "field": "price_id", + "operator": "includes", + "values": ["string"], + } + ], "is_invoice_level": True, + "price_type": "usage", }, "replaces_adjustment_id": "replaces_adjustment_id", "plan_phase_order": 0, @@ -302,8 +324,19 @@ async def test_method_create_plan_version_with_all_params(self, async_client: As "adjustment": { "adjustment_type": "percentage_discount", "percentage_discount": 0, + "applies_to_all": True, + "applies_to_item_ids": ["item_1", "item_2"], "applies_to_price_ids": ["price_1", "price_2"], + "currency": "currency", + "filters": [ + { + "field": "price_id", + "operator": "includes", + "values": ["string"], + } + ], "is_invoice_level": True, + "price_type": "usage", }, "plan_phase_order": 0, } @@ -368,8 +401,19 @@ async def test_method_create_plan_version_with_all_params(self, async_client: As "adjustment": { "adjustment_type": "percentage_discount", "percentage_discount": 0, + "applies_to_all": True, + "applies_to_item_ids": ["item_1", "item_2"], "applies_to_price_ids": ["price_1", "price_2"], + "currency": "currency", + "filters": [ + { + "field": "price_id", + "operator": "includes", + "values": ["string"], + } + ], "is_invoice_level": True, + "price_type": "usage", }, "replaces_adjustment_id": "replaces_adjustment_id", "plan_phase_order": 0, diff --git a/tests/api_resources/test_invoices.py b/tests/api_resources/test_invoices.py index bc2b7669..a45a38cd 100644 --- a/tests/api_resources/test_invoices.py +++ b/tests/api_resources/test_invoices.py @@ -64,6 +64,13 @@ def test_method_create_with_all_params(self, client: Orb) -> None: "discount_type": "percentage", "percentage_discount": 0.15, "applies_to_price_ids": ["h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl"], + "filters": [ + { + "field": "price_id", + "operator": "includes", + "values": ["string"], + } + ], "reason": "reason", }, external_customer_id="external-customer-id", @@ -508,6 +515,13 @@ async def test_method_create_with_all_params(self, async_client: AsyncOrb) -> No "discount_type": "percentage", "percentage_discount": 0.15, "applies_to_price_ids": ["h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl"], + "filters": [ + { + "field": "price_id", + "operator": "includes", + "values": ["string"], + } + ], "reason": "reason", }, external_customer_id="external-customer-id", diff --git a/tests/api_resources/test_subscriptions.py b/tests/api_resources/test_subscriptions.py index 08ad18e5..faff8913 100644 --- a/tests/api_resources/test_subscriptions.py +++ b/tests/api_resources/test_subscriptions.py @@ -48,8 +48,19 @@ def test_method_create_with_all_params(self, client: Orb) -> None: "adjustment": { "adjustment_type": "percentage_discount", "percentage_discount": 0, + "applies_to_all": True, + "applies_to_item_ids": ["item_1", "item_2"], "applies_to_price_ids": ["price_1", "price_2"], + "currency": "currency", + "filters": [ + { + "field": "price_id", + "operator": "includes", + "values": ["string"], + } + ], "is_invoice_level": True, + "price_type": "usage", }, "end_date": parse_datetime("2019-12-27T18:11:19.117Z"), "plan_phase_order": 0, @@ -154,8 +165,19 @@ def test_method_create_with_all_params(self, client: Orb) -> None: "adjustment": { "adjustment_type": "percentage_discount", "percentage_discount": 0, + "applies_to_all": True, + "applies_to_item_ids": ["item_1", "item_2"], "applies_to_price_ids": ["price_1", "price_2"], + "currency": "currency", + "filters": [ + { + "field": "price_id", + "operator": "includes", + "values": ["string"], + } + ], "is_invoice_level": True, + "price_type": "usage", }, "replaces_adjustment_id": "replaces_adjustment_id", } @@ -663,8 +685,19 @@ def test_method_price_intervals_with_all_params(self, client: Orb) -> None: "adjustment": { "adjustment_type": "percentage_discount", "percentage_discount": 0, + "applies_to_all": True, + "applies_to_item_ids": ["item_1", "item_2"], "applies_to_price_ids": ["price_1", "price_2"], + "currency": "currency", + "filters": [ + { + "field": "price_id", + "operator": "includes", + "values": ["string"], + } + ], "is_invoice_level": True, + "price_type": "usage", }, "start_date": parse_datetime("2019-12-27T18:11:19.117Z"), "end_date": parse_datetime("2019-12-27T18:11:19.117Z"), @@ -736,7 +769,6 @@ def test_method_redeem_coupon(self, client: Orb) -> None: subscription = client.subscriptions.redeem_coupon( subscription_id="subscription_id", change_option="requested_date", - coupon_id="coupon_id", ) assert_matches_type(SubscriptionRedeemCouponResponse, subscription, path=["response"]) @@ -745,9 +777,10 @@ def test_method_redeem_coupon_with_all_params(self, client: Orb) -> None: subscription = client.subscriptions.redeem_coupon( subscription_id="subscription_id", change_option="requested_date", - coupon_id="coupon_id", allow_invoice_credit_or_void=True, change_date=parse_datetime("2017-07-21T17:32:28Z"), + coupon_id="coupon_id", + coupon_redemption_code="coupon_redemption_code", ) assert_matches_type(SubscriptionRedeemCouponResponse, subscription, path=["response"]) @@ -756,7 +789,6 @@ def test_raw_response_redeem_coupon(self, client: Orb) -> None: response = client.subscriptions.with_raw_response.redeem_coupon( subscription_id="subscription_id", change_option="requested_date", - coupon_id="coupon_id", ) assert response.is_closed is True @@ -769,7 +801,6 @@ def test_streaming_response_redeem_coupon(self, client: Orb) -> None: with client.subscriptions.with_streaming_response.redeem_coupon( subscription_id="subscription_id", change_option="requested_date", - coupon_id="coupon_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -785,7 +816,6 @@ def test_path_params_redeem_coupon(self, client: Orb) -> None: client.subscriptions.with_raw_response.redeem_coupon( subscription_id="", change_option="requested_date", - coupon_id="coupon_id", ) @parametrize @@ -806,8 +836,19 @@ def test_method_schedule_plan_change_with_all_params(self, client: Orb) -> None: "adjustment": { "adjustment_type": "percentage_discount", "percentage_discount": 0, + "applies_to_all": True, + "applies_to_item_ids": ["item_1", "item_2"], "applies_to_price_ids": ["price_1", "price_2"], + "currency": "currency", + "filters": [ + { + "field": "price_id", + "operator": "includes", + "values": ["string"], + } + ], "is_invoice_level": True, + "price_type": "usage", }, "end_date": parse_datetime("2019-12-27T18:11:19.117Z"), "plan_phase_order": 0, @@ -905,8 +946,19 @@ def test_method_schedule_plan_change_with_all_params(self, client: Orb) -> None: "adjustment": { "adjustment_type": "percentage_discount", "percentage_discount": 0, + "applies_to_all": True, + "applies_to_item_ids": ["item_1", "item_2"], "applies_to_price_ids": ["price_1", "price_2"], + "currency": "currency", + "filters": [ + { + "field": "price_id", + "operator": "includes", + "values": ["string"], + } + ], "is_invoice_level": True, + "price_type": "usage", }, "replaces_adjustment_id": "replaces_adjustment_id", } @@ -1298,8 +1350,19 @@ async def test_method_create_with_all_params(self, async_client: AsyncOrb) -> No "adjustment": { "adjustment_type": "percentage_discount", "percentage_discount": 0, + "applies_to_all": True, + "applies_to_item_ids": ["item_1", "item_2"], "applies_to_price_ids": ["price_1", "price_2"], + "currency": "currency", + "filters": [ + { + "field": "price_id", + "operator": "includes", + "values": ["string"], + } + ], "is_invoice_level": True, + "price_type": "usage", }, "end_date": parse_datetime("2019-12-27T18:11:19.117Z"), "plan_phase_order": 0, @@ -1404,8 +1467,19 @@ async def test_method_create_with_all_params(self, async_client: AsyncOrb) -> No "adjustment": { "adjustment_type": "percentage_discount", "percentage_discount": 0, + "applies_to_all": True, + "applies_to_item_ids": ["item_1", "item_2"], "applies_to_price_ids": ["price_1", "price_2"], + "currency": "currency", + "filters": [ + { + "field": "price_id", + "operator": "includes", + "values": ["string"], + } + ], "is_invoice_level": True, + "price_type": "usage", }, "replaces_adjustment_id": "replaces_adjustment_id", } @@ -1913,8 +1987,19 @@ async def test_method_price_intervals_with_all_params(self, async_client: AsyncO "adjustment": { "adjustment_type": "percentage_discount", "percentage_discount": 0, + "applies_to_all": True, + "applies_to_item_ids": ["item_1", "item_2"], "applies_to_price_ids": ["price_1", "price_2"], + "currency": "currency", + "filters": [ + { + "field": "price_id", + "operator": "includes", + "values": ["string"], + } + ], "is_invoice_level": True, + "price_type": "usage", }, "start_date": parse_datetime("2019-12-27T18:11:19.117Z"), "end_date": parse_datetime("2019-12-27T18:11:19.117Z"), @@ -1986,7 +2071,6 @@ async def test_method_redeem_coupon(self, async_client: AsyncOrb) -> None: subscription = await async_client.subscriptions.redeem_coupon( subscription_id="subscription_id", change_option="requested_date", - coupon_id="coupon_id", ) assert_matches_type(SubscriptionRedeemCouponResponse, subscription, path=["response"]) @@ -1995,9 +2079,10 @@ async def test_method_redeem_coupon_with_all_params(self, async_client: AsyncOrb subscription = await async_client.subscriptions.redeem_coupon( subscription_id="subscription_id", change_option="requested_date", - coupon_id="coupon_id", allow_invoice_credit_or_void=True, change_date=parse_datetime("2017-07-21T17:32:28Z"), + coupon_id="coupon_id", + coupon_redemption_code="coupon_redemption_code", ) assert_matches_type(SubscriptionRedeemCouponResponse, subscription, path=["response"]) @@ -2006,7 +2091,6 @@ async def test_raw_response_redeem_coupon(self, async_client: AsyncOrb) -> None: response = await async_client.subscriptions.with_raw_response.redeem_coupon( subscription_id="subscription_id", change_option="requested_date", - coupon_id="coupon_id", ) assert response.is_closed is True @@ -2019,7 +2103,6 @@ async def test_streaming_response_redeem_coupon(self, async_client: AsyncOrb) -> async with async_client.subscriptions.with_streaming_response.redeem_coupon( subscription_id="subscription_id", change_option="requested_date", - coupon_id="coupon_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -2035,7 +2118,6 @@ async def test_path_params_redeem_coupon(self, async_client: AsyncOrb) -> None: await async_client.subscriptions.with_raw_response.redeem_coupon( subscription_id="", change_option="requested_date", - coupon_id="coupon_id", ) @parametrize @@ -2056,8 +2138,19 @@ async def test_method_schedule_plan_change_with_all_params(self, async_client: A "adjustment": { "adjustment_type": "percentage_discount", "percentage_discount": 0, + "applies_to_all": True, + "applies_to_item_ids": ["item_1", "item_2"], "applies_to_price_ids": ["price_1", "price_2"], + "currency": "currency", + "filters": [ + { + "field": "price_id", + "operator": "includes", + "values": ["string"], + } + ], "is_invoice_level": True, + "price_type": "usage", }, "end_date": parse_datetime("2019-12-27T18:11:19.117Z"), "plan_phase_order": 0, @@ -2155,8 +2248,19 @@ async def test_method_schedule_plan_change_with_all_params(self, async_client: A "adjustment": { "adjustment_type": "percentage_discount", "percentage_discount": 0, + "applies_to_all": True, + "applies_to_item_ids": ["item_1", "item_2"], "applies_to_price_ids": ["price_1", "price_2"], + "currency": "currency", + "filters": [ + { + "field": "price_id", + "operator": "includes", + "values": ["string"], + } + ], "is_invoice_level": True, + "price_type": "usage", }, "replaces_adjustment_id": "replaces_adjustment_id", }