diff --git a/.release-please-manifest.json b/.release-please-manifest.json index fa522860..3d5f4e35 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.4.2" + ".": "4.5.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index 31ac085d..d44c6fa9 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 116 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-0db984d367f9ae04249fb6c72789b0a38ef1785d156b438fe03290fa4e262a7d.yml -openapi_spec_hash: c901c8b4fc2b0399a33b1346f8521850 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-612316c13276a207f56e2e2c7bbc68f4bb73de85e3661595a23f23d9ccc80276.yml +openapi_spec_hash: 6e125f05e40521ec485edf6e15beec2e config_hash: 3c3524be9607afb24d2139ce26ce5389 diff --git a/CHANGELOG.md b/CHANGELOG.md index 5d3980bf..4bace10a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## 4.5.0 (2025-07-16) + +Full Changelog: [v4.4.2...v4.5.0](https://github.com/orbcorp/orb-python/compare/v4.4.2...v4.5.0) + +### Features + +* **api:** api update ([eefec6f](https://github.com/orbcorp/orb-python/commit/eefec6f4b2c23cb08343567c1a3a067cd17d9076)) +* clean up environment call outs ([fabad9f](https://github.com/orbcorp/orb-python/commit/fabad9ffbdf724b695a41c355ea53f5546889610)) + ## 4.4.2 (2025-07-11) Full Changelog: [v4.4.1...v4.4.2](https://github.com/orbcorp/orb-python/compare/v4.4.1...v4.4.2) diff --git a/README.md b/README.md index af2d95fc..76d92759 100644 --- a/README.md +++ b/README.md @@ -83,7 +83,6 @@ pip install orb-billing[aiohttp] Then you can enable it by instantiating the client with `http_client=DefaultAioHttpClient()`: ```python -import os import asyncio from orb import DefaultAioHttpClient from orb import AsyncOrb @@ -91,7 +90,7 @@ from orb import AsyncOrb async def main() -> None: async with AsyncOrb( - api_key=os.environ.get("ORB_API_KEY"), # This is the default and can be omitted + api_key="My API Key", http_client=DefaultAioHttpClient(), ) as client: customer = await client.customers.create( diff --git a/pyproject.toml b/pyproject.toml index 8586713f..216b11ec 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "orb-billing" -version = "4.4.2" +version = "4.5.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 6d411fc2..1a9597d2 100644 --- a/src/orb/_version.py +++ b/src/orb/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "orb" -__version__ = "4.4.2" # x-release-please-version +__version__ = "4.5.0" # x-release-please-version diff --git a/src/orb/resources/credit_notes.py b/src/orb/resources/credit_notes.py index 778e3ff5..3dceea3b 100644 --- a/src/orb/resources/credit_notes.py +++ b/src/orb/resources/credit_notes.py @@ -3,7 +3,7 @@ from __future__ import annotations from typing import Union, Iterable, Optional -from datetime import datetime +from datetime import date, datetime from typing_extensions import Literal import httpx @@ -47,7 +47,9 @@ def create( *, line_items: Iterable[credit_note_create_params.LineItem], reason: Literal["duplicate", "fraudulent", "order_change", "product_unsatisfactory"], + end_date: Union[str, date, None] | NotGiven = NOT_GIVEN, memo: Optional[str] | NotGiven = NOT_GIVEN, + start_date: Union[str, date, None] | 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, @@ -60,11 +62,46 @@ def create( This endpoint is used to create a single [`Credit Note`](/invoicing/credit-notes). + The credit note service period configuration supports two explicit modes: + + 1. Global service periods: Specify start_date and end_date at the credit note + level. These dates will be applied to all line items uniformly. + + 2. Individual service periods: Specify start_date and end_date for each line + item. When using this mode, ALL line items must have individual periods + specified. + + 3. Default behavior: If no service periods are specified (neither global nor + individual), the original invoice line item service periods will be used. + + Note: Mixing global and individual service periods in the same request is not + allowed to prevent confusion. + + Service period dates are normalized to the start of the day in the customer's + timezone to ensure consistent handling across different timezones. + + Date Format: Use start_date and end_date with format "YYYY-MM-DD" (e.g., + "2023-09-22") to match other Orb APIs like /v1/invoice_line_items. + + Note: Both start_date and end_date are inclusive - the service period will cover + both the start date and end date completely (from start of start_date to end of + end_date). + Args: reason: An optional reason for the credit note. + end_date: A date string to specify the global credit note service period end date in the + customer's timezone. This will be applied to all line items that don't have + their own individual service periods specified. If not provided, line items will + use their original invoice line item service periods. This date is inclusive. + memo: An optional memo to attach to the credit note. + start_date: A date string to specify the global credit note service period start date in the + customer's timezone. This will be applied to all line items that don't have + their own individual service periods specified. If not provided, line items will + use their original invoice line item service periods. This date is inclusive. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -81,7 +118,9 @@ def create( { "line_items": line_items, "reason": reason, + "end_date": end_date, "memo": memo, + "start_date": start_date, }, credit_note_create_params.CreditNoteCreateParams, ), @@ -214,7 +253,9 @@ async def create( *, line_items: Iterable[credit_note_create_params.LineItem], reason: Literal["duplicate", "fraudulent", "order_change", "product_unsatisfactory"], + end_date: Union[str, date, None] | NotGiven = NOT_GIVEN, memo: Optional[str] | NotGiven = NOT_GIVEN, + start_date: Union[str, date, None] | 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, @@ -227,11 +268,46 @@ async def create( This endpoint is used to create a single [`Credit Note`](/invoicing/credit-notes). + The credit note service period configuration supports two explicit modes: + + 1. Global service periods: Specify start_date and end_date at the credit note + level. These dates will be applied to all line items uniformly. + + 2. Individual service periods: Specify start_date and end_date for each line + item. When using this mode, ALL line items must have individual periods + specified. + + 3. Default behavior: If no service periods are specified (neither global nor + individual), the original invoice line item service periods will be used. + + Note: Mixing global and individual service periods in the same request is not + allowed to prevent confusion. + + Service period dates are normalized to the start of the day in the customer's + timezone to ensure consistent handling across different timezones. + + Date Format: Use start_date and end_date with format "YYYY-MM-DD" (e.g., + "2023-09-22") to match other Orb APIs like /v1/invoice_line_items. + + Note: Both start_date and end_date are inclusive - the service period will cover + both the start date and end date completely (from start of start_date to end of + end_date). + Args: reason: An optional reason for the credit note. + end_date: A date string to specify the global credit note service period end date in the + customer's timezone. This will be applied to all line items that don't have + their own individual service periods specified. If not provided, line items will + use their original invoice line item service periods. This date is inclusive. + memo: An optional memo to attach to the credit note. + start_date: A date string to specify the global credit note service period start date in the + customer's timezone. This will be applied to all line items that don't have + their own individual service periods specified. If not provided, line items will + use their original invoice line item service periods. This date is inclusive. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -248,7 +324,9 @@ async def create( { "line_items": line_items, "reason": reason, + "end_date": end_date, "memo": memo, + "start_date": start_date, }, credit_note_create_params.CreditNoteCreateParams, ), diff --git a/src/orb/resources/customers/costs.py b/src/orb/resources/customers/costs.py index a063f27e..6798a487 100644 --- a/src/orb/resources/customers/costs.py +++ b/src/orb/resources/customers/costs.py @@ -111,17 +111,17 @@ def list( A customer that uses a few API calls a day but has a minimum commitment might exhibit the following pattern for their subtotal and total in the first few days - of the month. Here, we assume that each API call is $2.50, the customer's plan - has a monthly minimum of $50 for this price, and that the subscription's billing - period bounds are aligned to the first of the month: + of the month. Here, we assume that each API call is \\$$2.50, the customer's plan + has a monthly minimum of \\$$50 for this price, and that the subscription's + billing period bounds are aligned to the first of the month: | timeframe_start | timeframe_end | Cumulative usage | Subtotal | Total (incl. commitment) | | --------------- | ------------- | ---------------- | -------- | ------------------------ | - | 2023-02-01 | 2023-02-02 | 9 | $22.50 | $50.00 | - | 2023-02-01 | 2023-02-03 | 19 | $47.50 | $50.00 | - | 2023-02-01 | 2023-02-04 | 20 | $50.00 | $50.00 | - | 2023-02-01 | 2023-02-05 | 28 | $70.00 | $70.00 | - | 2023-02-01 | 2023-02-06 | 36 | $90.00 | $90.00 | + | 2023-02-01 | 2023-02-02 | 9 | \\$$22.50 | \\$$50.00 | + | 2023-02-01 | 2023-02-03 | 19 | \\$$47.50 | \\$$50.00 | + | 2023-02-01 | 2023-02-04 | 20 | \\$$50.00 | \\$$50.00 | + | 2023-02-01 | 2023-02-05 | 28 | \\$$70.00 | \\$$70.00 | + | 2023-02-01 | 2023-02-06 | 36 | \\$$90.00 | \\$$90.00 | ### Periodic values @@ -287,17 +287,17 @@ def list_by_external_id( A customer that uses a few API calls a day but has a minimum commitment might exhibit the following pattern for their subtotal and total in the first few days - of the month. Here, we assume that each API call is $2.50, the customer's plan - has a monthly minimum of $50 for this price, and that the subscription's billing - period bounds are aligned to the first of the month: + of the month. Here, we assume that each API call is \\$$2.50, the customer's plan + has a monthly minimum of \\$$50 for this price, and that the subscription's + billing period bounds are aligned to the first of the month: | timeframe_start | timeframe_end | Cumulative usage | Subtotal | Total (incl. commitment) | | --------------- | ------------- | ---------------- | -------- | ------------------------ | - | 2023-02-01 | 2023-02-02 | 9 | $22.50 | $50.00 | - | 2023-02-01 | 2023-02-03 | 19 | $47.50 | $50.00 | - | 2023-02-01 | 2023-02-04 | 20 | $50.00 | $50.00 | - | 2023-02-01 | 2023-02-05 | 28 | $70.00 | $70.00 | - | 2023-02-01 | 2023-02-06 | 36 | $90.00 | $90.00 | + | 2023-02-01 | 2023-02-02 | 9 | \\$$22.50 | \\$$50.00 | + | 2023-02-01 | 2023-02-03 | 19 | \\$$47.50 | \\$$50.00 | + | 2023-02-01 | 2023-02-04 | 20 | \\$$50.00 | \\$$50.00 | + | 2023-02-01 | 2023-02-05 | 28 | \\$$70.00 | \\$$70.00 | + | 2023-02-01 | 2023-02-06 | 36 | \\$$90.00 | \\$$90.00 | ### Periodic values @@ -486,17 +486,17 @@ async def list( A customer that uses a few API calls a day but has a minimum commitment might exhibit the following pattern for their subtotal and total in the first few days - of the month. Here, we assume that each API call is $2.50, the customer's plan - has a monthly minimum of $50 for this price, and that the subscription's billing - period bounds are aligned to the first of the month: + of the month. Here, we assume that each API call is \\$$2.50, the customer's plan + has a monthly minimum of \\$$50 for this price, and that the subscription's + billing period bounds are aligned to the first of the month: | timeframe_start | timeframe_end | Cumulative usage | Subtotal | Total (incl. commitment) | | --------------- | ------------- | ---------------- | -------- | ------------------------ | - | 2023-02-01 | 2023-02-02 | 9 | $22.50 | $50.00 | - | 2023-02-01 | 2023-02-03 | 19 | $47.50 | $50.00 | - | 2023-02-01 | 2023-02-04 | 20 | $50.00 | $50.00 | - | 2023-02-01 | 2023-02-05 | 28 | $70.00 | $70.00 | - | 2023-02-01 | 2023-02-06 | 36 | $90.00 | $90.00 | + | 2023-02-01 | 2023-02-02 | 9 | \\$$22.50 | \\$$50.00 | + | 2023-02-01 | 2023-02-03 | 19 | \\$$47.50 | \\$$50.00 | + | 2023-02-01 | 2023-02-04 | 20 | \\$$50.00 | \\$$50.00 | + | 2023-02-01 | 2023-02-05 | 28 | \\$$70.00 | \\$$70.00 | + | 2023-02-01 | 2023-02-06 | 36 | \\$$90.00 | \\$$90.00 | ### Periodic values @@ -662,17 +662,17 @@ async def list_by_external_id( A customer that uses a few API calls a day but has a minimum commitment might exhibit the following pattern for their subtotal and total in the first few days - of the month. Here, we assume that each API call is $2.50, the customer's plan - has a monthly minimum of $50 for this price, and that the subscription's billing - period bounds are aligned to the first of the month: + of the month. Here, we assume that each API call is \\$$2.50, the customer's plan + has a monthly minimum of \\$$50 for this price, and that the subscription's + billing period bounds are aligned to the first of the month: | timeframe_start | timeframe_end | Cumulative usage | Subtotal | Total (incl. commitment) | | --------------- | ------------- | ---------------- | -------- | ------------------------ | - | 2023-02-01 | 2023-02-02 | 9 | $22.50 | $50.00 | - | 2023-02-01 | 2023-02-03 | 19 | $47.50 | $50.00 | - | 2023-02-01 | 2023-02-04 | 20 | $50.00 | $50.00 | - | 2023-02-01 | 2023-02-05 | 28 | $70.00 | $70.00 | - | 2023-02-01 | 2023-02-06 | 36 | $90.00 | $90.00 | + | 2023-02-01 | 2023-02-02 | 9 | \\$$22.50 | \\$$50.00 | + | 2023-02-01 | 2023-02-03 | 19 | \\$$47.50 | \\$$50.00 | + | 2023-02-01 | 2023-02-04 | 20 | \\$$50.00 | \\$$50.00 | + | 2023-02-01 | 2023-02-05 | 28 | \\$$70.00 | \\$$70.00 | + | 2023-02-01 | 2023-02-06 | 36 | \\$$90.00 | \\$$90.00 | ### Periodic values diff --git a/src/orb/resources/customers/credits/ledger.py b/src/orb/resources/customers/credits/ledger.py index d68dce31..f82310d6 100644 --- a/src/orb/resources/customers/credits/ledger.py +++ b/src/orb/resources/customers/credits/ledger.py @@ -123,8 +123,8 @@ def list( deductions take place from a non-expiring credit block. If there are multiple blocks with the same expiration date, Orb will deduct from - the block with the _lower cost basis_ first (e.g. trial credits with a $0 cost - basis before paid credits with a $5.00 cost basis). + the block with the _lower cost basis_ first (e.g. trial credits with a \\$$0 cost + basis before paid credits with a \\$$5.00 cost basis). It's also possible for a single usage event's deduction to _span_ credit blocks. In this case, Orb will deduct from the next block, ending at the credit block @@ -2069,8 +2069,8 @@ def list_by_external_id( deductions take place from a non-expiring credit block. If there are multiple blocks with the same expiration date, Orb will deduct from - the block with the _lower cost basis_ first (e.g. trial credits with a $0 cost - basis before paid credits with a $5.00 cost basis). + the block with the _lower cost basis_ first (e.g. trial credits with a \\$$0 cost + basis before paid credits with a \\$$5.00 cost basis). It's also possible for a single usage event's deduction to _span_ credit blocks. In this case, Orb will deduct from the next block, ending at the credit block @@ -2254,8 +2254,8 @@ def list( deductions take place from a non-expiring credit block. If there are multiple blocks with the same expiration date, Orb will deduct from - the block with the _lower cost basis_ first (e.g. trial credits with a $0 cost - basis before paid credits with a $5.00 cost basis). + the block with the _lower cost basis_ first (e.g. trial credits with a \\$$0 cost + basis before paid credits with a \\$$5.00 cost basis). It's also possible for a single usage event's deduction to _span_ credit blocks. In this case, Orb will deduct from the next block, ending at the credit block @@ -4200,8 +4200,8 @@ def list_by_external_id( deductions take place from a non-expiring credit block. If there are multiple blocks with the same expiration date, Orb will deduct from - the block with the _lower cost basis_ first (e.g. trial credits with a $0 cost - basis before paid credits with a $5.00 cost basis). + the block with the _lower cost basis_ first (e.g. trial credits with a \\$$0 cost + basis before paid credits with a \\$$5.00 cost basis). It's also possible for a single usage event's deduction to _span_ credit blocks. In this case, Orb will deduct from the next block, ending at the credit block diff --git a/src/orb/resources/events/backfills.py b/src/orb/resources/events/backfills.py index ebcce1f8..bcec768d 100644 --- a/src/orb/resources/events/backfills.py +++ b/src/orb/resources/events/backfills.py @@ -104,11 +104,11 @@ def create( Args: timeframe_end: The (exclusive) end of the usage timeframe affected by this backfill. By - default, Orb allows backfills up to 10 days in duration at a time. Reach out to + default, Orb allows backfills up to 31 days in duration at a time. Reach out to discuss extending this limit and your use case. timeframe_start: The (inclusive) start of the usage timeframe affected by this backfill. By - default, Orb allows backfills up to 10 days in duration at a time. Reach out to + default, Orb allows backfills up to 31 days in duration at a time. Reach out to discuss extending this limit and your use case. close_time: The time at which no more events will be accepted for this backfill. The @@ -420,11 +420,11 @@ async def create( Args: timeframe_end: The (exclusive) end of the usage timeframe affected by this backfill. By - default, Orb allows backfills up to 10 days in duration at a time. Reach out to + default, Orb allows backfills up to 31 days in duration at a time. Reach out to discuss extending this limit and your use case. timeframe_start: The (inclusive) start of the usage timeframe affected by this backfill. By - default, Orb allows backfills up to 10 days in duration at a time. Reach out to + default, Orb allows backfills up to 31 days in duration at a time. Reach out to discuss extending this limit and your use case. close_time: The time at which no more events will be accepted for this backfill. The diff --git a/src/orb/resources/invoices.py b/src/orb/resources/invoices.py index 494b0dab..d4d1951b 100644 --- a/src/orb/resources/invoices.py +++ b/src/orb/resources/invoices.py @@ -538,7 +538,7 @@ def void( If the associated invoice has used the customer balance to change the amount due, the customer balance operation will be reverted. For example, if the - invoice used $10 of customer balance, that amount will be added back to the + invoice used \\$$10 of customer balance, that amount will be added back to the customer balance upon voiding. If the invoice was used to purchase a credit block, but the invoice is not yet @@ -1078,7 +1078,7 @@ async def void( If the associated invoice has used the customer balance to change the amount due, the customer balance operation will be reverted. For example, if the - invoice used $10 of customer balance, that amount will be added back to the + invoice used \\$$10 of customer balance, that amount will be added back to the customer balance upon voiding. If the invoice was used to purchase a credit block, but the invoice is not yet diff --git a/src/orb/resources/subscriptions.py b/src/orb/resources/subscriptions.py index 11d99e98..64212514 100644 --- a/src/orb/resources/subscriptions.py +++ b/src/orb/resources/subscriptions.py @@ -363,7 +363,7 @@ def create( is hit. To enable threshold billing, pass in an `invoicing_threshold`, which is specified in the subscription's invoicing currency, when creating a subscription. E.g. pass in `10.00` to issue an invoice when usage amounts hit - $10.00 for a subscription that invoices in USD. + \\$$10.00 for a subscription that invoices in USD. Args: add_adjustments: Additional adjustments to be added to the subscription. (Only available for @@ -2449,7 +2449,7 @@ async def create( is hit. To enable threshold billing, pass in an `invoicing_threshold`, which is specified in the subscription's invoicing currency, when creating a subscription. E.g. pass in `10.00` to issue an invoice when usage amounts hit - $10.00 for a subscription that invoices in USD. + \\$$10.00 for a subscription that invoices in USD. Args: add_adjustments: Additional adjustments to be added to the subscription. (Only available for diff --git a/src/orb/types/credit_note_create_params.py b/src/orb/types/credit_note_create_params.py index 0b6c04dd..8e58bceb 100644 --- a/src/orb/types/credit_note_create_params.py +++ b/src/orb/types/credit_note_create_params.py @@ -2,8 +2,11 @@ from __future__ import annotations -from typing import Iterable, Optional -from typing_extensions import Literal, Required, TypedDict +from typing import Union, Iterable, Optional +from datetime import date +from typing_extensions import Literal, Required, Annotated, TypedDict + +from .._utils import PropertyInfo __all__ = ["CreditNoteCreateParams", "LineItem"] @@ -14,9 +17,25 @@ class CreditNoteCreateParams(TypedDict, total=False): reason: Required[Literal["duplicate", "fraudulent", "order_change", "product_unsatisfactory"]] """An optional reason for the credit note.""" + end_date: Annotated[Union[str, date, None], PropertyInfo(format="iso8601")] + """ + A date string to specify the global credit note service period end date in the + customer's timezone. This will be applied to all line items that don't have + their own individual service periods specified. If not provided, line items will + use their original invoice line item service periods. This date is inclusive. + """ + memo: Optional[str] """An optional memo to attach to the credit note.""" + start_date: Annotated[Union[str, date, None], PropertyInfo(format="iso8601")] + """ + A date string to specify the global credit note service period start date in the + customer's timezone. This will be applied to all line items that don't have + their own individual service periods specified. If not provided, line items will + use their original invoice line item service periods. This date is inclusive. + """ + class LineItem(TypedDict, total=False): amount: Required[str] @@ -24,3 +43,20 @@ class LineItem(TypedDict, total=False): invoice_line_item_id: Required[str] """The ID of the line item to credit.""" + + end_date: Annotated[Union[str, date, None], PropertyInfo(format="iso8601")] + """ + A date string to specify this line item's credit note service period end date in + the customer's timezone. If provided, this will be used for this specific line + item. If not provided, will use the global end_date if available, otherwise + defaults to the original invoice line item's end date. This date is inclusive. + """ + + start_date: Annotated[Union[str, date, None], PropertyInfo(format="iso8601")] + """ + A date string to specify this line item's credit note service period start date + in the customer's timezone. If provided, this will be used for this specific + line item. If not provided, will use the global start_date if available, + otherwise defaults to the original invoice line item's start date. This date is + inclusive. + """ diff --git a/src/orb/types/events/backfill_create_params.py b/src/orb/types/events/backfill_create_params.py index 138c0e0e..2ba0fe88 100644 --- a/src/orb/types/events/backfill_create_params.py +++ b/src/orb/types/events/backfill_create_params.py @@ -15,14 +15,14 @@ class BackfillCreateParams(TypedDict, total=False): timeframe_end: Required[Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]] """The (exclusive) end of the usage timeframe affected by this backfill. - By default, Orb allows backfills up to 10 days in duration at a time. Reach out + By default, Orb allows backfills up to 31 days in duration at a time. Reach out to discuss extending this limit and your use case. """ timeframe_start: Required[Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]] """The (inclusive) start of the usage timeframe affected by this backfill. - By default, Orb allows backfills up to 10 days in duration at a time. Reach out + By default, Orb allows backfills up to 31 days in duration at a time. Reach out to discuss extending this limit and your use case. """ diff --git a/src/orb/types/mutated_subscription.py b/src/orb/types/mutated_subscription.py index cdfae9ac..25746d4b 100644 --- a/src/orb/types/mutated_subscription.py +++ b/src/orb/types/mutated_subscription.py @@ -107,7 +107,10 @@ class MutatedSubscription(BaseModel): """ discount_intervals: List[DiscountInterval] - """The discount intervals for this subscription sorted by the start_date.""" + """The discount intervals for this subscription sorted by the start_date. + + This field is deprecated in favor of `adjustment_intervals`. + """ end_date: Optional[datetime] = None """The date Orb stops billing for this subscription.""" @@ -117,7 +120,10 @@ class MutatedSubscription(BaseModel): invoicing_threshold: Optional[str] = None maximum_intervals: List[MaximumInterval] - """The maximum intervals for this subscription sorted by the start_date.""" + """The maximum intervals for this subscription sorted by the start_date. + + This field is deprecated in favor of `adjustment_intervals`. + """ metadata: Dict[str, str] """User specified key-value pairs for the resource. @@ -128,7 +134,10 @@ class MutatedSubscription(BaseModel): """ minimum_intervals: List[MinimumInterval] - """The minimum intervals for this subscription sorted by the start_date.""" + """The minimum intervals for this subscription sorted by the start_date. + + This field is deprecated in favor of `adjustment_intervals`. + """ name: str """The name of the subscription.""" diff --git a/src/orb/types/price_evaluate_multiple_params.py b/src/orb/types/price_evaluate_multiple_params.py index 1a4049d2..4587cb96 100644 --- a/src/orb/types/price_evaluate_multiple_params.py +++ b/src/orb/types/price_evaluate_multiple_params.py @@ -93,6 +93,9 @@ class PriceEvaluateMultipleParams(TypedDict, total=False): class PriceEvaluation(TypedDict, total=False): + external_price_id: Optional[str] + """The external ID of a price to evaluate that exists in your Orb account.""" + filter: Optional[str] """ A boolean diff --git a/src/orb/types/price_evaluate_multiple_response.py b/src/orb/types/price_evaluate_multiple_response.py index b846e87b..98d435c9 100644 --- a/src/orb/types/price_evaluate_multiple_response.py +++ b/src/orb/types/price_evaluate_multiple_response.py @@ -15,6 +15,9 @@ class Data(BaseModel): price_groups: List[EvaluatePriceGroup] """The computed price groups associated with input price.""" + external_price_id: Optional[str] = None + """The external ID of the price""" + inline_price_index: Optional[int] = None """The index of the inline price""" diff --git a/src/orb/types/price_evaluate_preview_events_params.py b/src/orb/types/price_evaluate_preview_events_params.py index 7af54e90..187942a9 100644 --- a/src/orb/types/price_evaluate_preview_events_params.py +++ b/src/orb/types/price_evaluate_preview_events_params.py @@ -124,6 +124,9 @@ class Event(TypedDict, total=False): class PriceEvaluation(TypedDict, total=False): + external_price_id: Optional[str] + """The external ID of a price to evaluate that exists in your Orb account.""" + filter: Optional[str] """ A boolean diff --git a/src/orb/types/price_evaluate_preview_events_response.py b/src/orb/types/price_evaluate_preview_events_response.py index e402f053..949eeec4 100644 --- a/src/orb/types/price_evaluate_preview_events_response.py +++ b/src/orb/types/price_evaluate_preview_events_response.py @@ -15,6 +15,9 @@ class Data(BaseModel): price_groups: List[EvaluatePriceGroup] """The computed price groups associated with input price.""" + external_price_id: Optional[str] = None + """The external ID of the price""" + inline_price_index: Optional[int] = None """The index of the inline price""" diff --git a/src/orb/types/shared/credit_note.py b/src/orb/types/shared/credit_note.py index 2b205f3f..4c7e6f23 100644 --- a/src/orb/types/shared/credit_note.py +++ b/src/orb/types/shared/credit_note.py @@ -60,6 +60,12 @@ class LineItem(BaseModel): discounts: Optional[List[LineItemDiscount]] = None """Any line item discounts from the invoice's line item.""" + end_time_exclusive: Optional[datetime] = None + """The end time of the service period for this credit note line item.""" + + start_time_inclusive: Optional[datetime] = None + """The start time of the service period for this credit note line item.""" + class MaximumAmountAdjustmentAppliesToPrice(BaseModel): id: str diff --git a/src/orb/types/subscription.py b/src/orb/types/subscription.py index 0d92273c..cac64a05 100644 --- a/src/orb/types/subscription.py +++ b/src/orb/types/subscription.py @@ -106,7 +106,10 @@ class Subscription(BaseModel): """ discount_intervals: List[DiscountInterval] - """The discount intervals for this subscription sorted by the start_date.""" + """The discount intervals for this subscription sorted by the start_date. + + This field is deprecated in favor of `adjustment_intervals`. + """ end_date: Optional[datetime] = None """The date Orb stops billing for this subscription.""" @@ -116,7 +119,10 @@ class Subscription(BaseModel): invoicing_threshold: Optional[str] = None maximum_intervals: List[MaximumInterval] - """The maximum intervals for this subscription sorted by the start_date.""" + """The maximum intervals for this subscription sorted by the start_date. + + This field is deprecated in favor of `adjustment_intervals`. + """ metadata: Dict[str, str] """User specified key-value pairs for the resource. @@ -127,7 +133,10 @@ class Subscription(BaseModel): """ minimum_intervals: List[MinimumInterval] - """The minimum intervals for this subscription sorted by the start_date.""" + """The minimum intervals for this subscription sorted by the start_date. + + This field is deprecated in favor of `adjustment_intervals`. + """ name: str """The name of the subscription.""" diff --git a/src/orb/types/subscription_price_intervals_params.py b/src/orb/types/subscription_price_intervals_params.py index a709d7ea..ab7bb60a 100644 --- a/src/orb/types/subscription_price_intervals_params.py +++ b/src/orb/types/subscription_price_intervals_params.py @@ -275,7 +275,7 @@ class Edit(TypedDict, total=False): end_date: Annotated[Union[Union[str, datetime], BillingCycleRelativeDate, None], PropertyInfo(format="iso8601")] """The updated end date of this price interval. - If not specified, the start date will not be updated. + If not specified, the end date will not be updated. """ filter: Optional[str] @@ -317,7 +317,7 @@ class EditAdjustment(TypedDict, total=False): end_date: Annotated[Union[Union[str, datetime], BillingCycleRelativeDate, None], PropertyInfo(format="iso8601")] """The updated end date of this adjustment interval. - If not specified, the start date will not be updated. + If not specified, the end date will not be updated. """ start_date: Annotated[Union[Union[str, datetime], BillingCycleRelativeDate], PropertyInfo(format="iso8601")] diff --git a/tests/api_resources/test_credit_notes.py b/tests/api_resources/test_credit_notes.py index 198527c6..01c84445 100644 --- a/tests/api_resources/test_credit_notes.py +++ b/tests/api_resources/test_credit_notes.py @@ -8,7 +8,7 @@ import pytest from orb import Orb, AsyncOrb -from orb._utils import parse_datetime +from orb._utils import parse_date, parse_datetime from tests.utils import assert_matches_type from orb.pagination import SyncPage, AsyncPage from orb.types.shared import CreditNote @@ -39,10 +39,14 @@ def test_method_create_with_all_params(self, client: Orb) -> None: { "amount": "amount", "invoice_line_item_id": "4khy3nwzktxv7", + "end_date": parse_date("2023-09-22"), + "start_date": parse_date("2023-09-22"), } ], reason="duplicate", + end_date=parse_date("2023-09-22"), memo="An optional memo for my credit note.", + start_date=parse_date("2023-09-22"), ) assert_matches_type(CreditNote, credit_note, path=["response"]) @@ -183,10 +187,14 @@ async def test_method_create_with_all_params(self, async_client: AsyncOrb) -> No { "amount": "amount", "invoice_line_item_id": "4khy3nwzktxv7", + "end_date": parse_date("2023-09-22"), + "start_date": parse_date("2023-09-22"), } ], reason="duplicate", + end_date=parse_date("2023-09-22"), memo="An optional memo for my credit note.", + start_date=parse_date("2023-09-22"), ) assert_matches_type(CreditNote, credit_note, path=["response"]) diff --git a/tests/api_resources/test_prices.py b/tests/api_resources/test_prices.py index c27f8d1b..57cdf47e 100644 --- a/tests/api_resources/test_prices.py +++ b/tests/api_resources/test_prices.py @@ -2640,6 +2640,7 @@ def test_method_evaluate_multiple_with_all_params(self, client: Orb) -> None: external_customer_id="external_customer_id", price_evaluations=[ { + "external_price_id": "external_price_id", "filter": "my_numeric_property > 100 AND my_other_property = 'bar'", "grouping_keys": ["case when my_event_type = 'foo' then true else false end"], "price": { @@ -2732,6 +2733,7 @@ def test_method_evaluate_preview_events_with_all_params(self, client: Orb) -> No external_customer_id="external_customer_id", price_evaluations=[ { + "external_price_id": "external_price_id", "filter": "my_numeric_property > 100 AND my_other_property = 'bar'", "grouping_keys": ["case when my_event_type = 'foo' then true else false end"], "price": { @@ -5458,6 +5460,7 @@ async def test_method_evaluate_multiple_with_all_params(self, async_client: Asyn external_customer_id="external_customer_id", price_evaluations=[ { + "external_price_id": "external_price_id", "filter": "my_numeric_property > 100 AND my_other_property = 'bar'", "grouping_keys": ["case when my_event_type = 'foo' then true else false end"], "price": { @@ -5550,6 +5553,7 @@ async def test_method_evaluate_preview_events_with_all_params(self, async_client external_customer_id="external_customer_id", price_evaluations=[ { + "external_price_id": "external_price_id", "filter": "my_numeric_property > 100 AND my_other_property = 'bar'", "grouping_keys": ["case when my_event_type = 'foo' then true else false end"], "price": {