From 36b5da67dac07a00e4c78701a194c3fd1efbb422 Mon Sep 17 00:00:00 2001 From: Stainless Bot Date: Thu, 26 Oct 2023 02:02:23 +0000 Subject: [PATCH] feat(api): updates --- api.md | 12 +- src/orb/resources/coupons/coupons.py | 4 +- src/orb/resources/customers/customers.py | 510 ++++++++++++++ src/orb/resources/customers/usage.py | 182 ++--- src/orb/resources/events/events.py | 160 ++--- src/orb/resources/invoices.py | 4 +- src/orb/resources/plans/plans.py | 4 +- src/orb/resources/prices/prices.py | 116 ++-- src/orb/resources/subscriptions.py | 622 ++++++++--------- src/orb/types/__init__.py | 3 +- src/orb/types/coupon.py | 43 +- src/orb/types/coupon_create_params.py | 44 +- src/orb/types/credit_note.py | 86 ++- src/orb/types/customer.py | 205 +++++- src/orb/types/customer_create_params.py | 209 +++++- .../customer_update_by_external_id_params.py | 209 +++++- src/orb/types/customer_update_params.py | 209 +++++- .../balance_transaction_create_response.py | 11 +- .../balance_transaction_list_response.py | 11 +- .../usage_update_by_external_id_params.py | 27 +- .../types/customers/usage_update_params.py | 27 +- src/orb/types/discount_param.py | 36 - src/orb/types/invoice.py | 228 +++++- .../types/invoice_fetch_upcoming_response.py | 228 +++++- .../invoice_line_item_create_response.py | 4 +- src/orb/types/invoice_list_params.py | 6 +- src/orb/types/plan.py | 6 +- src/orb/types/plan_create_params.py | 650 +++++++++++++++++- src/orb/types/price.py | 30 +- src/orb/types/price_create_params.py | 174 ++--- src/orb/types/shared/__init__.py | 3 + .../discount.py} | 20 +- src/orb/types/shared_params/__init__.py | 3 + src/orb/types/shared_params/discount.py | 80 +++ src/orb/types/subscription.py | 4 +- src/orb/types/subscription_create_params.py | 435 +++++++++++- .../subscription_price_intervals_params.py | 189 ++--- ...ubscription_schedule_plan_change_params.py | 436 +++++++++++- tests/api_resources/customers/test_usage.py | 192 +++++- tests/api_resources/test_coupons.py | 26 +- tests/api_resources/test_customers.py | 24 +- tests/api_resources/test_invoices.py | 12 +- tests/api_resources/test_plans.py | 56 +- tests/api_resources/test_subscriptions.py | 114 +-- 44 files changed, 4594 insertions(+), 1060 deletions(-) delete mode 100644 src/orb/types/discount_param.py create mode 100644 src/orb/types/shared/__init__.py rename src/orb/types/{invoice_discount.py => shared/discount.py} (78%) create mode 100644 src/orb/types/shared_params/__init__.py create mode 100644 src/orb/types/shared_params/discount.py diff --git a/api.md b/api.md index 24d3665f..71be487b 100644 --- a/api.md +++ b/api.md @@ -1,3 +1,9 @@ +# Shared Types + +```python +from orb.types import Discount +``` + # TopLevel Types: @@ -196,7 +202,7 @@ Methods: Types: ```python -from orb.types import Invoice, InvoiceDiscount, InvoiceFetchUpcomingResponse +from orb.types import Invoice, InvoiceFetchUpcomingResponse ``` Methods: @@ -263,7 +269,7 @@ Methods: Types: ```python -from orb.types import Discount, Price +from orb.types import Price ``` Methods: @@ -285,8 +291,8 @@ Types: ```python from orb.types import ( Subscription, - Subscriptions, SubscriptionUsage, + Subscriptions, SubscriptionFetchCostsResponse, SubscriptionFetchScheduleResponse, ) diff --git a/src/orb/resources/coupons/coupons.py b/src/orb/resources/coupons/coupons.py index b4786b52..2ec3dc95 100644 --- a/src/orb/resources/coupons/coupons.py +++ b/src/orb/resources/coupons/coupons.py @@ -28,7 +28,7 @@ def __init__(self, client: Orb) -> None: def create( self, *, - discount: object, + discount: coupon_create_params.Discount, redemption_code: str, duration_in_months: Optional[int] | NotGiven = NOT_GIVEN, max_redemptions: Optional[int] | NotGiven = NOT_GIVEN, @@ -232,7 +232,7 @@ def __init__(self, client: AsyncOrb) -> None: async def create( self, *, - discount: object, + discount: coupon_create_params.Discount, redemption_code: str, duration_in_months: Optional[int] | NotGiven = NOT_GIVEN, max_redemptions: Optional[int] | NotGiven = NOT_GIVEN, diff --git a/src/orb/resources/customers/customers.py b/src/orb/resources/customers/customers.py index ea10ce80..44be2054 100644 --- a/src/orb/resources/customers/customers.py +++ b/src/orb/resources/customers/customers.py @@ -116,6 +116,91 @@ def create( payment_provider_id: The ID of this customer in an external payments solution, such as Stripe. This is used for creating charges or invoices in the external system via Orb. + tax_id: Tax IDs are commonly required to be displayed on customer invoices, which are + added to the headers of invoices. + + ### Supported Tax ID Countries and Types + + | Country | Type | Description | + | -------------------- | ------------ | ------------------------------------------------------------------------------------------------------- | + | Australia | `au_abn` | Australian Business Number (AU ABN) | + | Australia | `au_arn` | Australian Taxation Office Reference Number | + | Austria | `eu_vat` | European VAT number | + | Belgium | `eu_vat` | European VAT number | + | Brazil | `br_cnpj` | Brazilian CNPJ number | + | Brazil | `br_cpf` | Brazilian CPF number | + | Bulgaria | `bg_uic` | Bulgaria Unified Identification Code | + | Bulgaria | `eu_vat` | European VAT number | + | Canada | `ca_bn` | Canadian BN | + | Canada | `ca_gst_hst` | Canadian GST/HST number | + | Canada | `ca_pst_bc` | Canadian PST number (British Columbia) | + | Canada | `ca_pst_mb` | Canadian PST number (Manitoba) | + | Canada | `ca_pst_sk` | Canadian PST number (Saskatchewan) | + | Canada | `ca_qst` | Canadian QST number (Québec) | + | Chile | `cl_tin` | Chilean TIN | + | Croatia | `eu_vat` | European VAT number | + | Cyprus | `eu_vat` | European VAT number | + | Czech Republic | `eu_vat` | European VAT number | + | Denmark | `eu_vat` | European VAT number | + | Egypt | `eg_tin` | Egyptian Tax Identification Number | + | Estonia | `eu_vat` | European VAT number | + | EU | `eu_oss_vat` | European One Stop Shop VAT number for non-Union scheme | + | Finland | `eu_vat` | European VAT number | + | France | `eu_vat` | European VAT number | + | Georgia | `ge_vat` | Georgian VAT | + | Germany | `eu_vat` | European VAT number | + | Greece | `eu_vat` | European VAT number | + | Hong Kong | `hk_br` | Hong Kong BR number | + | Hungary | `eu_vat` | European VAT number | + | Hungary | `hu_tin` | Hungary tax number (adószám) | + | Iceland | `is_vat` | Icelandic VAT | + | India | `in_gst` | Indian GST number | + | Indonesia | `id_npwp` | Indonesian NPWP number | + | Ireland | `eu_vat` | European VAT number | + | Israel | `il_vat` | Israel VAT | + | Italy | `eu_vat` | European VAT number | + | Japan | `jp_cn` | Japanese Corporate Number (_Hōjin Bangō_) | + | Japan | `jp_rn` | Japanese Registered Foreign Businesses' Registration Number (_Tōroku Kokugai Jigyōsha no Tōroku Bangō_) | + | Japan | `jp_trn` | Japanese Tax Registration Number (_Tōroku Bangō_) | + | Kenya | `ke_pin` | Kenya Revenue Authority Personal Identification Number | + | Latvia | `eu_vat` | European VAT number | + | Liechtenstein | `li_uid` | Liechtensteinian UID number | + | Lithuania | `eu_vat` | European VAT number | + | Luxembourg | `eu_vat` | European VAT number | + | Malaysia | `my_frp` | Malaysian FRP number | + | Malaysia | `my_itn` | Malaysian ITN | + | Malaysia | `my_sst` | Malaysian SST number | + | Malta | `eu_vat ` | European VAT number | + | Mexico | `mx_rfc` | Mexican RFC number | + | Netherlands | `eu_vat` | European VAT number | + | New Zealand | `nz_gst` | New Zealand GST number | + | Norway | `no_vat` | Norwegian VAT number | + | Philippines | `ph_tin ` | Philippines Tax Identification Number | + | Poland | `eu_vat` | European VAT number | + | Portugal | `eu_vat` | European VAT number | + | Romania | `eu_vat` | European VAT number | + | Russia | `ru_inn` | Russian INN | + | Russia | `ru_kpp` | Russian KPP | + | Saudi Arabia | `sg_gst` | Singaporean GST | + | Singapore | `sg_uen` | Singaporean UEN | + | Slovakia | `eu_vat` | European VAT number | + | Slovenia | `eu_vat` | European VAT number | + | Slovenia | `si_tin` | Slovenia tax number (davčna številka) | + | South Africa | `za_vat` | South African VAT number | + | South Korea | `kr_brn` | Korean BRN | + | Spain | `es_cif` | Spanish NIF number (previously Spanish CIF number) | + | Spain | `eu_vat` | European VAT number | + | Sweden | `eu_vat` | European VAT number | + | Switzerland | `ch_vat` | Switzerland VAT number | + | Taiwan | `tw_vat` | Taiwanese VAT | + | Thailand | `th_vat` | Thai VAT | + | Turkey | `tr_tin` | Turkish Tax Identification Number | + | Ukraine | `ua_vat` | Ukrainian VAT | + | United Arab Emirates | `ae_trn` | United Arab Emirates TRN | + | United Kingdom | `eu_vat` | Northern Ireland VAT number | + | United Kingdom | `gb_vat` | United Kingdom VAT number | + | United States | `us_ein` | United States EIN | + timezone: A timezone identifier from the IANA timezone database, such as `"America/Los_Angeles"`. This defaults to your account's timezone if not set. This cannot be changed after customer creation. @@ -232,6 +317,91 @@ def update( payment_provider_id: The ID of this customer in an external payments solution, such as Stripe. This is used for creating charges or invoices in the external system via Orb. + tax_id: Tax IDs are commonly required to be displayed on customer invoices, which are + added to the headers of invoices. + + ### Supported Tax ID Countries and Types + + | Country | Type | Description | + | -------------------- | ------------ | ------------------------------------------------------------------------------------------------------- | + | Australia | `au_abn` | Australian Business Number (AU ABN) | + | Australia | `au_arn` | Australian Taxation Office Reference Number | + | Austria | `eu_vat` | European VAT number | + | Belgium | `eu_vat` | European VAT number | + | Brazil | `br_cnpj` | Brazilian CNPJ number | + | Brazil | `br_cpf` | Brazilian CPF number | + | Bulgaria | `bg_uic` | Bulgaria Unified Identification Code | + | Bulgaria | `eu_vat` | European VAT number | + | Canada | `ca_bn` | Canadian BN | + | Canada | `ca_gst_hst` | Canadian GST/HST number | + | Canada | `ca_pst_bc` | Canadian PST number (British Columbia) | + | Canada | `ca_pst_mb` | Canadian PST number (Manitoba) | + | Canada | `ca_pst_sk` | Canadian PST number (Saskatchewan) | + | Canada | `ca_qst` | Canadian QST number (Québec) | + | Chile | `cl_tin` | Chilean TIN | + | Croatia | `eu_vat` | European VAT number | + | Cyprus | `eu_vat` | European VAT number | + | Czech Republic | `eu_vat` | European VAT number | + | Denmark | `eu_vat` | European VAT number | + | Egypt | `eg_tin` | Egyptian Tax Identification Number | + | Estonia | `eu_vat` | European VAT number | + | EU | `eu_oss_vat` | European One Stop Shop VAT number for non-Union scheme | + | Finland | `eu_vat` | European VAT number | + | France | `eu_vat` | European VAT number | + | Georgia | `ge_vat` | Georgian VAT | + | Germany | `eu_vat` | European VAT number | + | Greece | `eu_vat` | European VAT number | + | Hong Kong | `hk_br` | Hong Kong BR number | + | Hungary | `eu_vat` | European VAT number | + | Hungary | `hu_tin` | Hungary tax number (adószám) | + | Iceland | `is_vat` | Icelandic VAT | + | India | `in_gst` | Indian GST number | + | Indonesia | `id_npwp` | Indonesian NPWP number | + | Ireland | `eu_vat` | European VAT number | + | Israel | `il_vat` | Israel VAT | + | Italy | `eu_vat` | European VAT number | + | Japan | `jp_cn` | Japanese Corporate Number (_Hōjin Bangō_) | + | Japan | `jp_rn` | Japanese Registered Foreign Businesses' Registration Number (_Tōroku Kokugai Jigyōsha no Tōroku Bangō_) | + | Japan | `jp_trn` | Japanese Tax Registration Number (_Tōroku Bangō_) | + | Kenya | `ke_pin` | Kenya Revenue Authority Personal Identification Number | + | Latvia | `eu_vat` | European VAT number | + | Liechtenstein | `li_uid` | Liechtensteinian UID number | + | Lithuania | `eu_vat` | European VAT number | + | Luxembourg | `eu_vat` | European VAT number | + | Malaysia | `my_frp` | Malaysian FRP number | + | Malaysia | `my_itn` | Malaysian ITN | + | Malaysia | `my_sst` | Malaysian SST number | + | Malta | `eu_vat ` | European VAT number | + | Mexico | `mx_rfc` | Mexican RFC number | + | Netherlands | `eu_vat` | European VAT number | + | New Zealand | `nz_gst` | New Zealand GST number | + | Norway | `no_vat` | Norwegian VAT number | + | Philippines | `ph_tin ` | Philippines Tax Identification Number | + | Poland | `eu_vat` | European VAT number | + | Portugal | `eu_vat` | European VAT number | + | Romania | `eu_vat` | European VAT number | + | Russia | `ru_inn` | Russian INN | + | Russia | `ru_kpp` | Russian KPP | + | Saudi Arabia | `sg_gst` | Singaporean GST | + | Singapore | `sg_uen` | Singaporean UEN | + | Slovakia | `eu_vat` | European VAT number | + | Slovenia | `eu_vat` | European VAT number | + | Slovenia | `si_tin` | Slovenia tax number (davčna številka) | + | South Africa | `za_vat` | South African VAT number | + | South Korea | `kr_brn` | Korean BRN | + | Spain | `es_cif` | Spanish NIF number (previously Spanish CIF number) | + | Spain | `eu_vat` | European VAT number | + | Sweden | `eu_vat` | European VAT number | + | Switzerland | `ch_vat` | Switzerland VAT number | + | Taiwan | `tw_vat` | Taiwanese VAT | + | Thailand | `th_vat` | Thai VAT | + | Turkey | `tr_tin` | Turkish Tax Identification Number | + | Ukraine | `ua_vat` | Ukrainian VAT | + | United Arab Emirates | `ae_trn` | United Arab Emirates TRN | + | United Kingdom | `eu_vat` | Northern Ireland VAT number | + | United Kingdom | `gb_vat` | United Kingdom VAT number | + | United States | `us_ein` | United States EIN | + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -528,6 +698,91 @@ def update_by_external_id( payment_provider_id: The ID of this customer in an external payments solution, such as Stripe. This is used for creating charges or invoices in the external system via Orb. + tax_id: Tax IDs are commonly required to be displayed on customer invoices, which are + added to the headers of invoices. + + ### Supported Tax ID Countries and Types + + | Country | Type | Description | + | -------------------- | ------------ | ------------------------------------------------------------------------------------------------------- | + | Australia | `au_abn` | Australian Business Number (AU ABN) | + | Australia | `au_arn` | Australian Taxation Office Reference Number | + | Austria | `eu_vat` | European VAT number | + | Belgium | `eu_vat` | European VAT number | + | Brazil | `br_cnpj` | Brazilian CNPJ number | + | Brazil | `br_cpf` | Brazilian CPF number | + | Bulgaria | `bg_uic` | Bulgaria Unified Identification Code | + | Bulgaria | `eu_vat` | European VAT number | + | Canada | `ca_bn` | Canadian BN | + | Canada | `ca_gst_hst` | Canadian GST/HST number | + | Canada | `ca_pst_bc` | Canadian PST number (British Columbia) | + | Canada | `ca_pst_mb` | Canadian PST number (Manitoba) | + | Canada | `ca_pst_sk` | Canadian PST number (Saskatchewan) | + | Canada | `ca_qst` | Canadian QST number (Québec) | + | Chile | `cl_tin` | Chilean TIN | + | Croatia | `eu_vat` | European VAT number | + | Cyprus | `eu_vat` | European VAT number | + | Czech Republic | `eu_vat` | European VAT number | + | Denmark | `eu_vat` | European VAT number | + | Egypt | `eg_tin` | Egyptian Tax Identification Number | + | Estonia | `eu_vat` | European VAT number | + | EU | `eu_oss_vat` | European One Stop Shop VAT number for non-Union scheme | + | Finland | `eu_vat` | European VAT number | + | France | `eu_vat` | European VAT number | + | Georgia | `ge_vat` | Georgian VAT | + | Germany | `eu_vat` | European VAT number | + | Greece | `eu_vat` | European VAT number | + | Hong Kong | `hk_br` | Hong Kong BR number | + | Hungary | `eu_vat` | European VAT number | + | Hungary | `hu_tin` | Hungary tax number (adószám) | + | Iceland | `is_vat` | Icelandic VAT | + | India | `in_gst` | Indian GST number | + | Indonesia | `id_npwp` | Indonesian NPWP number | + | Ireland | `eu_vat` | European VAT number | + | Israel | `il_vat` | Israel VAT | + | Italy | `eu_vat` | European VAT number | + | Japan | `jp_cn` | Japanese Corporate Number (_Hōjin Bangō_) | + | Japan | `jp_rn` | Japanese Registered Foreign Businesses' Registration Number (_Tōroku Kokugai Jigyōsha no Tōroku Bangō_) | + | Japan | `jp_trn` | Japanese Tax Registration Number (_Tōroku Bangō_) | + | Kenya | `ke_pin` | Kenya Revenue Authority Personal Identification Number | + | Latvia | `eu_vat` | European VAT number | + | Liechtenstein | `li_uid` | Liechtensteinian UID number | + | Lithuania | `eu_vat` | European VAT number | + | Luxembourg | `eu_vat` | European VAT number | + | Malaysia | `my_frp` | Malaysian FRP number | + | Malaysia | `my_itn` | Malaysian ITN | + | Malaysia | `my_sst` | Malaysian SST number | + | Malta | `eu_vat ` | European VAT number | + | Mexico | `mx_rfc` | Mexican RFC number | + | Netherlands | `eu_vat` | European VAT number | + | New Zealand | `nz_gst` | New Zealand GST number | + | Norway | `no_vat` | Norwegian VAT number | + | Philippines | `ph_tin ` | Philippines Tax Identification Number | + | Poland | `eu_vat` | European VAT number | + | Portugal | `eu_vat` | European VAT number | + | Romania | `eu_vat` | European VAT number | + | Russia | `ru_inn` | Russian INN | + | Russia | `ru_kpp` | Russian KPP | + | Saudi Arabia | `sg_gst` | Singaporean GST | + | Singapore | `sg_uen` | Singaporean UEN | + | Slovakia | `eu_vat` | European VAT number | + | Slovenia | `eu_vat` | European VAT number | + | Slovenia | `si_tin` | Slovenia tax number (davčna številka) | + | South Africa | `za_vat` | South African VAT number | + | South Korea | `kr_brn` | Korean BRN | + | Spain | `es_cif` | Spanish NIF number (previously Spanish CIF number) | + | Spain | `eu_vat` | European VAT number | + | Sweden | `eu_vat` | European VAT number | + | Switzerland | `ch_vat` | Switzerland VAT number | + | Taiwan | `tw_vat` | Taiwanese VAT | + | Thailand | `th_vat` | Thai VAT | + | Turkey | `tr_tin` | Turkish Tax Identification Number | + | Ukraine | `ua_vat` | Ukrainian VAT | + | United Arab Emirates | `ae_trn` | United Arab Emirates TRN | + | United Kingdom | `eu_vat` | Northern Ireland VAT number | + | United Kingdom | `gb_vat` | United Kingdom VAT number | + | United States | `us_ein` | United States EIN | + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -658,6 +913,91 @@ async def create( payment_provider_id: The ID of this customer in an external payments solution, such as Stripe. This is used for creating charges or invoices in the external system via Orb. + tax_id: Tax IDs are commonly required to be displayed on customer invoices, which are + added to the headers of invoices. + + ### Supported Tax ID Countries and Types + + | Country | Type | Description | + | -------------------- | ------------ | ------------------------------------------------------------------------------------------------------- | + | Australia | `au_abn` | Australian Business Number (AU ABN) | + | Australia | `au_arn` | Australian Taxation Office Reference Number | + | Austria | `eu_vat` | European VAT number | + | Belgium | `eu_vat` | European VAT number | + | Brazil | `br_cnpj` | Brazilian CNPJ number | + | Brazil | `br_cpf` | Brazilian CPF number | + | Bulgaria | `bg_uic` | Bulgaria Unified Identification Code | + | Bulgaria | `eu_vat` | European VAT number | + | Canada | `ca_bn` | Canadian BN | + | Canada | `ca_gst_hst` | Canadian GST/HST number | + | Canada | `ca_pst_bc` | Canadian PST number (British Columbia) | + | Canada | `ca_pst_mb` | Canadian PST number (Manitoba) | + | Canada | `ca_pst_sk` | Canadian PST number (Saskatchewan) | + | Canada | `ca_qst` | Canadian QST number (Québec) | + | Chile | `cl_tin` | Chilean TIN | + | Croatia | `eu_vat` | European VAT number | + | Cyprus | `eu_vat` | European VAT number | + | Czech Republic | `eu_vat` | European VAT number | + | Denmark | `eu_vat` | European VAT number | + | Egypt | `eg_tin` | Egyptian Tax Identification Number | + | Estonia | `eu_vat` | European VAT number | + | EU | `eu_oss_vat` | European One Stop Shop VAT number for non-Union scheme | + | Finland | `eu_vat` | European VAT number | + | France | `eu_vat` | European VAT number | + | Georgia | `ge_vat` | Georgian VAT | + | Germany | `eu_vat` | European VAT number | + | Greece | `eu_vat` | European VAT number | + | Hong Kong | `hk_br` | Hong Kong BR number | + | Hungary | `eu_vat` | European VAT number | + | Hungary | `hu_tin` | Hungary tax number (adószám) | + | Iceland | `is_vat` | Icelandic VAT | + | India | `in_gst` | Indian GST number | + | Indonesia | `id_npwp` | Indonesian NPWP number | + | Ireland | `eu_vat` | European VAT number | + | Israel | `il_vat` | Israel VAT | + | Italy | `eu_vat` | European VAT number | + | Japan | `jp_cn` | Japanese Corporate Number (_Hōjin Bangō_) | + | Japan | `jp_rn` | Japanese Registered Foreign Businesses' Registration Number (_Tōroku Kokugai Jigyōsha no Tōroku Bangō_) | + | Japan | `jp_trn` | Japanese Tax Registration Number (_Tōroku Bangō_) | + | Kenya | `ke_pin` | Kenya Revenue Authority Personal Identification Number | + | Latvia | `eu_vat` | European VAT number | + | Liechtenstein | `li_uid` | Liechtensteinian UID number | + | Lithuania | `eu_vat` | European VAT number | + | Luxembourg | `eu_vat` | European VAT number | + | Malaysia | `my_frp` | Malaysian FRP number | + | Malaysia | `my_itn` | Malaysian ITN | + | Malaysia | `my_sst` | Malaysian SST number | + | Malta | `eu_vat ` | European VAT number | + | Mexico | `mx_rfc` | Mexican RFC number | + | Netherlands | `eu_vat` | European VAT number | + | New Zealand | `nz_gst` | New Zealand GST number | + | Norway | `no_vat` | Norwegian VAT number | + | Philippines | `ph_tin ` | Philippines Tax Identification Number | + | Poland | `eu_vat` | European VAT number | + | Portugal | `eu_vat` | European VAT number | + | Romania | `eu_vat` | European VAT number | + | Russia | `ru_inn` | Russian INN | + | Russia | `ru_kpp` | Russian KPP | + | Saudi Arabia | `sg_gst` | Singaporean GST | + | Singapore | `sg_uen` | Singaporean UEN | + | Slovakia | `eu_vat` | European VAT number | + | Slovenia | `eu_vat` | European VAT number | + | Slovenia | `si_tin` | Slovenia tax number (davčna številka) | + | South Africa | `za_vat` | South African VAT number | + | South Korea | `kr_brn` | Korean BRN | + | Spain | `es_cif` | Spanish NIF number (previously Spanish CIF number) | + | Spain | `eu_vat` | European VAT number | + | Sweden | `eu_vat` | European VAT number | + | Switzerland | `ch_vat` | Switzerland VAT number | + | Taiwan | `tw_vat` | Taiwanese VAT | + | Thailand | `th_vat` | Thai VAT | + | Turkey | `tr_tin` | Turkish Tax Identification Number | + | Ukraine | `ua_vat` | Ukrainian VAT | + | United Arab Emirates | `ae_trn` | United Arab Emirates TRN | + | United Kingdom | `eu_vat` | Northern Ireland VAT number | + | United Kingdom | `gb_vat` | United Kingdom VAT number | + | United States | `us_ein` | United States EIN | + timezone: A timezone identifier from the IANA timezone database, such as `"America/Los_Angeles"`. This defaults to your account's timezone if not set. This cannot be changed after customer creation. @@ -774,6 +1114,91 @@ async def update( payment_provider_id: The ID of this customer in an external payments solution, such as Stripe. This is used for creating charges or invoices in the external system via Orb. + tax_id: Tax IDs are commonly required to be displayed on customer invoices, which are + added to the headers of invoices. + + ### Supported Tax ID Countries and Types + + | Country | Type | Description | + | -------------------- | ------------ | ------------------------------------------------------------------------------------------------------- | + | Australia | `au_abn` | Australian Business Number (AU ABN) | + | Australia | `au_arn` | Australian Taxation Office Reference Number | + | Austria | `eu_vat` | European VAT number | + | Belgium | `eu_vat` | European VAT number | + | Brazil | `br_cnpj` | Brazilian CNPJ number | + | Brazil | `br_cpf` | Brazilian CPF number | + | Bulgaria | `bg_uic` | Bulgaria Unified Identification Code | + | Bulgaria | `eu_vat` | European VAT number | + | Canada | `ca_bn` | Canadian BN | + | Canada | `ca_gst_hst` | Canadian GST/HST number | + | Canada | `ca_pst_bc` | Canadian PST number (British Columbia) | + | Canada | `ca_pst_mb` | Canadian PST number (Manitoba) | + | Canada | `ca_pst_sk` | Canadian PST number (Saskatchewan) | + | Canada | `ca_qst` | Canadian QST number (Québec) | + | Chile | `cl_tin` | Chilean TIN | + | Croatia | `eu_vat` | European VAT number | + | Cyprus | `eu_vat` | European VAT number | + | Czech Republic | `eu_vat` | European VAT number | + | Denmark | `eu_vat` | European VAT number | + | Egypt | `eg_tin` | Egyptian Tax Identification Number | + | Estonia | `eu_vat` | European VAT number | + | EU | `eu_oss_vat` | European One Stop Shop VAT number for non-Union scheme | + | Finland | `eu_vat` | European VAT number | + | France | `eu_vat` | European VAT number | + | Georgia | `ge_vat` | Georgian VAT | + | Germany | `eu_vat` | European VAT number | + | Greece | `eu_vat` | European VAT number | + | Hong Kong | `hk_br` | Hong Kong BR number | + | Hungary | `eu_vat` | European VAT number | + | Hungary | `hu_tin` | Hungary tax number (adószám) | + | Iceland | `is_vat` | Icelandic VAT | + | India | `in_gst` | Indian GST number | + | Indonesia | `id_npwp` | Indonesian NPWP number | + | Ireland | `eu_vat` | European VAT number | + | Israel | `il_vat` | Israel VAT | + | Italy | `eu_vat` | European VAT number | + | Japan | `jp_cn` | Japanese Corporate Number (_Hōjin Bangō_) | + | Japan | `jp_rn` | Japanese Registered Foreign Businesses' Registration Number (_Tōroku Kokugai Jigyōsha no Tōroku Bangō_) | + | Japan | `jp_trn` | Japanese Tax Registration Number (_Tōroku Bangō_) | + | Kenya | `ke_pin` | Kenya Revenue Authority Personal Identification Number | + | Latvia | `eu_vat` | European VAT number | + | Liechtenstein | `li_uid` | Liechtensteinian UID number | + | Lithuania | `eu_vat` | European VAT number | + | Luxembourg | `eu_vat` | European VAT number | + | Malaysia | `my_frp` | Malaysian FRP number | + | Malaysia | `my_itn` | Malaysian ITN | + | Malaysia | `my_sst` | Malaysian SST number | + | Malta | `eu_vat ` | European VAT number | + | Mexico | `mx_rfc` | Mexican RFC number | + | Netherlands | `eu_vat` | European VAT number | + | New Zealand | `nz_gst` | New Zealand GST number | + | Norway | `no_vat` | Norwegian VAT number | + | Philippines | `ph_tin ` | Philippines Tax Identification Number | + | Poland | `eu_vat` | European VAT number | + | Portugal | `eu_vat` | European VAT number | + | Romania | `eu_vat` | European VAT number | + | Russia | `ru_inn` | Russian INN | + | Russia | `ru_kpp` | Russian KPP | + | Saudi Arabia | `sg_gst` | Singaporean GST | + | Singapore | `sg_uen` | Singaporean UEN | + | Slovakia | `eu_vat` | European VAT number | + | Slovenia | `eu_vat` | European VAT number | + | Slovenia | `si_tin` | Slovenia tax number (davčna številka) | + | South Africa | `za_vat` | South African VAT number | + | South Korea | `kr_brn` | Korean BRN | + | Spain | `es_cif` | Spanish NIF number (previously Spanish CIF number) | + | Spain | `eu_vat` | European VAT number | + | Sweden | `eu_vat` | European VAT number | + | Switzerland | `ch_vat` | Switzerland VAT number | + | Taiwan | `tw_vat` | Taiwanese VAT | + | Thailand | `th_vat` | Thai VAT | + | Turkey | `tr_tin` | Turkish Tax Identification Number | + | Ukraine | `ua_vat` | Ukrainian VAT | + | United Arab Emirates | `ae_trn` | United Arab Emirates TRN | + | United Kingdom | `eu_vat` | Northern Ireland VAT number | + | United Kingdom | `gb_vat` | United Kingdom VAT number | + | United States | `us_ein` | United States EIN | + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -1070,6 +1495,91 @@ async def update_by_external_id( payment_provider_id: The ID of this customer in an external payments solution, such as Stripe. This is used for creating charges or invoices in the external system via Orb. + tax_id: Tax IDs are commonly required to be displayed on customer invoices, which are + added to the headers of invoices. + + ### Supported Tax ID Countries and Types + + | Country | Type | Description | + | -------------------- | ------------ | ------------------------------------------------------------------------------------------------------- | + | Australia | `au_abn` | Australian Business Number (AU ABN) | + | Australia | `au_arn` | Australian Taxation Office Reference Number | + | Austria | `eu_vat` | European VAT number | + | Belgium | `eu_vat` | European VAT number | + | Brazil | `br_cnpj` | Brazilian CNPJ number | + | Brazil | `br_cpf` | Brazilian CPF number | + | Bulgaria | `bg_uic` | Bulgaria Unified Identification Code | + | Bulgaria | `eu_vat` | European VAT number | + | Canada | `ca_bn` | Canadian BN | + | Canada | `ca_gst_hst` | Canadian GST/HST number | + | Canada | `ca_pst_bc` | Canadian PST number (British Columbia) | + | Canada | `ca_pst_mb` | Canadian PST number (Manitoba) | + | Canada | `ca_pst_sk` | Canadian PST number (Saskatchewan) | + | Canada | `ca_qst` | Canadian QST number (Québec) | + | Chile | `cl_tin` | Chilean TIN | + | Croatia | `eu_vat` | European VAT number | + | Cyprus | `eu_vat` | European VAT number | + | Czech Republic | `eu_vat` | European VAT number | + | Denmark | `eu_vat` | European VAT number | + | Egypt | `eg_tin` | Egyptian Tax Identification Number | + | Estonia | `eu_vat` | European VAT number | + | EU | `eu_oss_vat` | European One Stop Shop VAT number for non-Union scheme | + | Finland | `eu_vat` | European VAT number | + | France | `eu_vat` | European VAT number | + | Georgia | `ge_vat` | Georgian VAT | + | Germany | `eu_vat` | European VAT number | + | Greece | `eu_vat` | European VAT number | + | Hong Kong | `hk_br` | Hong Kong BR number | + | Hungary | `eu_vat` | European VAT number | + | Hungary | `hu_tin` | Hungary tax number (adószám) | + | Iceland | `is_vat` | Icelandic VAT | + | India | `in_gst` | Indian GST number | + | Indonesia | `id_npwp` | Indonesian NPWP number | + | Ireland | `eu_vat` | European VAT number | + | Israel | `il_vat` | Israel VAT | + | Italy | `eu_vat` | European VAT number | + | Japan | `jp_cn` | Japanese Corporate Number (_Hōjin Bangō_) | + | Japan | `jp_rn` | Japanese Registered Foreign Businesses' Registration Number (_Tōroku Kokugai Jigyōsha no Tōroku Bangō_) | + | Japan | `jp_trn` | Japanese Tax Registration Number (_Tōroku Bangō_) | + | Kenya | `ke_pin` | Kenya Revenue Authority Personal Identification Number | + | Latvia | `eu_vat` | European VAT number | + | Liechtenstein | `li_uid` | Liechtensteinian UID number | + | Lithuania | `eu_vat` | European VAT number | + | Luxembourg | `eu_vat` | European VAT number | + | Malaysia | `my_frp` | Malaysian FRP number | + | Malaysia | `my_itn` | Malaysian ITN | + | Malaysia | `my_sst` | Malaysian SST number | + | Malta | `eu_vat ` | European VAT number | + | Mexico | `mx_rfc` | Mexican RFC number | + | Netherlands | `eu_vat` | European VAT number | + | New Zealand | `nz_gst` | New Zealand GST number | + | Norway | `no_vat` | Norwegian VAT number | + | Philippines | `ph_tin ` | Philippines Tax Identification Number | + | Poland | `eu_vat` | European VAT number | + | Portugal | `eu_vat` | European VAT number | + | Romania | `eu_vat` | European VAT number | + | Russia | `ru_inn` | Russian INN | + | Russia | `ru_kpp` | Russian KPP | + | Saudi Arabia | `sg_gst` | Singaporean GST | + | Singapore | `sg_uen` | Singaporean UEN | + | Slovakia | `eu_vat` | European VAT number | + | Slovenia | `eu_vat` | European VAT number | + | Slovenia | `si_tin` | Slovenia tax number (davčna številka) | + | South Africa | `za_vat` | South African VAT number | + | South Korea | `kr_brn` | Korean BRN | + | Spain | `es_cif` | Spanish NIF number (previously Spanish CIF number) | + | Spain | `eu_vat` | European VAT number | + | Sweden | `eu_vat` | European VAT number | + | Switzerland | `ch_vat` | Switzerland VAT number | + | Taiwan | `tw_vat` | Taiwanese VAT | + | Thailand | `th_vat` | Thai VAT | + | Turkey | `tr_tin` | Turkish Tax Identification Number | + | Ukraine | `ua_vat` | Ukrainian VAT | + | United Arab Emirates | `ae_trn` | United Arab Emirates TRN | + | United Kingdom | `eu_vat` | Northern Ireland VAT number | + | United Kingdom | `gb_vat` | United Kingdom VAT number | + | United States | `us_ein` | United States EIN | + extra_headers: Send extra headers extra_query: Add additional query parameters to the request diff --git a/src/orb/resources/customers/usage.py b/src/orb/resources/customers/usage.py index 72dc633d..b8b7411f 100644 --- a/src/orb/resources/customers/usage.py +++ b/src/orb/resources/customers/usage.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Union, Optional +from typing import List, Union, Optional from datetime import datetime from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven @@ -24,13 +24,9 @@ def update( self, id: Optional[str], *, - event_name: str, - properties: object, - timestamp: Union[str, datetime], + events: List[usage_update_params.Event], timeframe_end: Union[str, datetime] | NotGiven = NOT_GIVEN, timeframe_start: Union[str, datetime] | NotGiven = NOT_GIVEN, - customer_id: Optional[str] | NotGiven = NOT_GIVEN, - external_customer_id: 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, @@ -44,7 +40,7 @@ def update( an active subscription. This endpoint will mark _all_ existing events within - `[timeframe_start, timeframe_end)` as _ignored_ for billing purpo ses, and Orb + `[timeframe_start, timeframe_end)` as _ignored_ for billing purposes, and Orb will only use the _new_ events passed in the body of this request as the source of truth for that timeframe moving forwards. Note that a given time period can be amended any number of times, so events can be overwritten in subsequent calls @@ -56,7 +52,7 @@ def update( - decrease historical usage consumption because of degraded service availability in your systems - account for gaps from your usage reporting mechanism - - make point-in-time fixes for specific event records, while ret aining the + - make point-in-time fixes for specific event records, while retaining the original time of usage and associated metadata. This amendment API is designed with two explicit goals: @@ -64,10 +60,10 @@ def update( original events in the timeframe, though they will be ignored for billing calculations. For auditing a nd data fidelity purposes, Orb never overwrites or permanently deletes ingested usage data. - 2. Amendments always preser ve data **consistency**. In other words, either an - amendment is fully processed by the system (and the new events for th e + 2. Amendments always preserve data **consistency**. In other words, either an + amendment is fully processed by the system (and the new events for the timeframe are honored rather than the existing ones) or the amendment request - fails. To maintain this important proper ty, Orb prevents _partial event + fails. To maintain this important property, Orb prevents _partial event ingestion_ on this endpoint. ## Response semantics @@ -79,12 +75,12 @@ def update( also not deprecate existing events in the time period. - You can assume that the amendment is successful on receipt of a `2xx` response.While a successful response from this endpoint indicates that the new - events have been ingested, updati ng usage totals happens asynchronously and + events have been ingested, updating usage totals happens asynchronously and may be delayed by a few minutes. As emphasized above, Orb will never show an inconsistent state (e.g. in invoice previews or dashboards); either it will show the existing state (before the - amend ment) or the new state (with new events in the requested timeframe). + amendment) or the new state (with new events in the requested timeframe). ## Sample request body @@ -138,25 +134,13 @@ def update( using multiple calls with small adjacent (e.g. every hour) timeframes. Args: - event_name: A name to meaningfully identify the action or event type. - - properties: A dictionary of custom properties. Values in this dictionary must be numeric, - boolean, or strings. Nested dictionaries are disallowed. - - timestamp: An ISO 8601 format date with no timezone offset (i.e. UTC). This should - represent the time that usage was recorded, and is particularly important to - attribute usage to a given billing period. + events: Events to update timeframe_end: This bound is exclusive (i.e. events before this timestamp will be updated) timeframe_start: This bound is inclusive (i.e. events with this timestamp onward, inclusive will be updated) - customer_id: The Orb Customer identifier - - external_customer_id: An alias for the Orb customer, whose mapping is specified when creating the - customer - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -169,16 +153,7 @@ def update( """ return self._patch( f"/customers/{id}/usage", - body=maybe_transform( - { - "event_name": event_name, - "properties": properties, - "timestamp": timestamp, - "customer_id": customer_id, - "external_customer_id": external_customer_id, - }, - usage_update_params.UsageUpdateParams, - ), + body=maybe_transform({"events": events}, usage_update_params.UsageUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -200,13 +175,9 @@ def update_by_external_id( self, id: Optional[str], *, - event_name: str, - properties: object, - timestamp: Union[str, datetime], + events: List[usage_update_by_external_id_params.Event], timeframe_end: Union[str, datetime] | NotGiven = NOT_GIVEN, timeframe_start: Union[str, datetime] | NotGiven = NOT_GIVEN, - customer_id: Optional[str] | NotGiven = NOT_GIVEN, - external_customer_id: 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, @@ -220,7 +191,7 @@ def update_by_external_id( an active subscription. This endpoint will mark _all_ existing events within - `[timeframe_start, timeframe_end)` as _ignored_ for billing purpo ses, and Orb + `[timeframe_start, timeframe_end)` as _ignored_ for billing purposes, and Orb will only use the _new_ events passed in the body of this request as the source of truth for that timeframe moving forwards. Note that a given time period can be amended any number of times, so events can be overwritten in subsequent calls @@ -232,7 +203,7 @@ def update_by_external_id( - decrease historical usage consumption because of degraded service availability in your systems - account for gaps from your usage reporting mechanism - - make point-in-time fixes for specific event records, while ret aining the + - make point-in-time fixes for specific event records, while retaining the original time of usage and associated metadata. This amendment API is designed with two explicit goals: @@ -240,10 +211,10 @@ def update_by_external_id( original events in the timeframe, though they will be ignored for billing calculations. For auditing a nd data fidelity purposes, Orb never overwrites or permanently deletes ingested usage data. - 2. Amendments always preser ve data **consistency**. In other words, either an - amendment is fully processed by the system (and the new events for th e + 2. Amendments always preserve data **consistency**. In other words, either an + amendment is fully processed by the system (and the new events for the timeframe are honored rather than the existing ones) or the amendment request - fails. To maintain this important proper ty, Orb prevents _partial event + fails. To maintain this important property, Orb prevents _partial event ingestion_ on this endpoint. ## Response semantics @@ -255,12 +226,12 @@ def update_by_external_id( also not deprecate existing events in the time period. - You can assume that the amendment is successful on receipt of a `2xx` response.While a successful response from this endpoint indicates that the new - events have been ingested, updati ng usage totals happens asynchronously and + events have been ingested, updating usage totals happens asynchronously and may be delayed by a few minutes. As emphasized above, Orb will never show an inconsistent state (e.g. in invoice previews or dashboards); either it will show the existing state (before the - amend ment) or the new state (with new events in the requested timeframe). + amendment) or the new state (with new events in the requested timeframe). ## Sample request body @@ -314,25 +285,13 @@ def update_by_external_id( using multiple calls with small adjacent (e.g. every hour) timeframes. Args: - event_name: A name to meaningfully identify the action or event type. - - properties: A dictionary of custom properties. Values in this dictionary must be numeric, - boolean, or strings. Nested dictionaries are disallowed. - - timestamp: An ISO 8601 format date with no timezone offset (i.e. UTC). This should - represent the time that usage was recorded, and is particularly important to - attribute usage to a given billing period. + events: Events to update timeframe_end: This bound is exclusive (i.e. events before this timestamp will be updated) timeframe_start: This bound is inclusive (i.e. events with this timestamp onward, inclusive will be updated) - customer_id: The Orb Customer identifier - - external_customer_id: An alias for the Orb customer, whose mapping is specified when creating the - customer - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -345,16 +304,7 @@ def update_by_external_id( """ return self._patch( f"/customers/external_customer_id/{id}/usage", - body=maybe_transform( - { - "event_name": event_name, - "properties": properties, - "timestamp": timestamp, - "customer_id": customer_id, - "external_customer_id": external_customer_id, - }, - usage_update_by_external_id_params.UsageUpdateByExternalIDParams, - ), + body=maybe_transform({"events": events}, usage_update_by_external_id_params.UsageUpdateByExternalIDParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -378,13 +328,9 @@ async def update( self, id: Optional[str], *, - event_name: str, - properties: object, - timestamp: Union[str, datetime], + events: List[usage_update_params.Event], timeframe_end: Union[str, datetime] | NotGiven = NOT_GIVEN, timeframe_start: Union[str, datetime] | NotGiven = NOT_GIVEN, - customer_id: Optional[str] | NotGiven = NOT_GIVEN, - external_customer_id: 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, @@ -398,7 +344,7 @@ async def update( an active subscription. This endpoint will mark _all_ existing events within - `[timeframe_start, timeframe_end)` as _ignored_ for billing purpo ses, and Orb + `[timeframe_start, timeframe_end)` as _ignored_ for billing purposes, and Orb will only use the _new_ events passed in the body of this request as the source of truth for that timeframe moving forwards. Note that a given time period can be amended any number of times, so events can be overwritten in subsequent calls @@ -410,7 +356,7 @@ async def update( - decrease historical usage consumption because of degraded service availability in your systems - account for gaps from your usage reporting mechanism - - make point-in-time fixes for specific event records, while ret aining the + - make point-in-time fixes for specific event records, while retaining the original time of usage and associated metadata. This amendment API is designed with two explicit goals: @@ -418,10 +364,10 @@ async def update( original events in the timeframe, though they will be ignored for billing calculations. For auditing a nd data fidelity purposes, Orb never overwrites or permanently deletes ingested usage data. - 2. Amendments always preser ve data **consistency**. In other words, either an - amendment is fully processed by the system (and the new events for th e + 2. Amendments always preserve data **consistency**. In other words, either an + amendment is fully processed by the system (and the new events for the timeframe are honored rather than the existing ones) or the amendment request - fails. To maintain this important proper ty, Orb prevents _partial event + fails. To maintain this important property, Orb prevents _partial event ingestion_ on this endpoint. ## Response semantics @@ -433,12 +379,12 @@ async def update( also not deprecate existing events in the time period. - You can assume that the amendment is successful on receipt of a `2xx` response.While a successful response from this endpoint indicates that the new - events have been ingested, updati ng usage totals happens asynchronously and + events have been ingested, updating usage totals happens asynchronously and may be delayed by a few minutes. As emphasized above, Orb will never show an inconsistent state (e.g. in invoice previews or dashboards); either it will show the existing state (before the - amend ment) or the new state (with new events in the requested timeframe). + amendment) or the new state (with new events in the requested timeframe). ## Sample request body @@ -492,25 +438,13 @@ async def update( using multiple calls with small adjacent (e.g. every hour) timeframes. Args: - event_name: A name to meaningfully identify the action or event type. - - properties: A dictionary of custom properties. Values in this dictionary must be numeric, - boolean, or strings. Nested dictionaries are disallowed. - - timestamp: An ISO 8601 format date with no timezone offset (i.e. UTC). This should - represent the time that usage was recorded, and is particularly important to - attribute usage to a given billing period. + events: Events to update timeframe_end: This bound is exclusive (i.e. events before this timestamp will be updated) timeframe_start: This bound is inclusive (i.e. events with this timestamp onward, inclusive will be updated) - customer_id: The Orb Customer identifier - - external_customer_id: An alias for the Orb customer, whose mapping is specified when creating the - customer - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -523,16 +457,7 @@ async def update( """ return await self._patch( f"/customers/{id}/usage", - body=maybe_transform( - { - "event_name": event_name, - "properties": properties, - "timestamp": timestamp, - "customer_id": customer_id, - "external_customer_id": external_customer_id, - }, - usage_update_params.UsageUpdateParams, - ), + body=maybe_transform({"events": events}, usage_update_params.UsageUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -554,13 +479,9 @@ async def update_by_external_id( self, id: Optional[str], *, - event_name: str, - properties: object, - timestamp: Union[str, datetime], + events: List[usage_update_by_external_id_params.Event], timeframe_end: Union[str, datetime] | NotGiven = NOT_GIVEN, timeframe_start: Union[str, datetime] | NotGiven = NOT_GIVEN, - customer_id: Optional[str] | NotGiven = NOT_GIVEN, - external_customer_id: 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, @@ -574,7 +495,7 @@ async def update_by_external_id( an active subscription. This endpoint will mark _all_ existing events within - `[timeframe_start, timeframe_end)` as _ignored_ for billing purpo ses, and Orb + `[timeframe_start, timeframe_end)` as _ignored_ for billing purposes, and Orb will only use the _new_ events passed in the body of this request as the source of truth for that timeframe moving forwards. Note that a given time period can be amended any number of times, so events can be overwritten in subsequent calls @@ -586,7 +507,7 @@ async def update_by_external_id( - decrease historical usage consumption because of degraded service availability in your systems - account for gaps from your usage reporting mechanism - - make point-in-time fixes for specific event records, while ret aining the + - make point-in-time fixes for specific event records, while retaining the original time of usage and associated metadata. This amendment API is designed with two explicit goals: @@ -594,10 +515,10 @@ async def update_by_external_id( original events in the timeframe, though they will be ignored for billing calculations. For auditing a nd data fidelity purposes, Orb never overwrites or permanently deletes ingested usage data. - 2. Amendments always preser ve data **consistency**. In other words, either an - amendment is fully processed by the system (and the new events for th e + 2. Amendments always preserve data **consistency**. In other words, either an + amendment is fully processed by the system (and the new events for the timeframe are honored rather than the existing ones) or the amendment request - fails. To maintain this important proper ty, Orb prevents _partial event + fails. To maintain this important property, Orb prevents _partial event ingestion_ on this endpoint. ## Response semantics @@ -609,12 +530,12 @@ async def update_by_external_id( also not deprecate existing events in the time period. - You can assume that the amendment is successful on receipt of a `2xx` response.While a successful response from this endpoint indicates that the new - events have been ingested, updati ng usage totals happens asynchronously and + events have been ingested, updating usage totals happens asynchronously and may be delayed by a few minutes. As emphasized above, Orb will never show an inconsistent state (e.g. in invoice previews or dashboards); either it will show the existing state (before the - amend ment) or the new state (with new events in the requested timeframe). + amendment) or the new state (with new events in the requested timeframe). ## Sample request body @@ -668,25 +589,13 @@ async def update_by_external_id( using multiple calls with small adjacent (e.g. every hour) timeframes. Args: - event_name: A name to meaningfully identify the action or event type. - - properties: A dictionary of custom properties. Values in this dictionary must be numeric, - boolean, or strings. Nested dictionaries are disallowed. - - timestamp: An ISO 8601 format date with no timezone offset (i.e. UTC). This should - represent the time that usage was recorded, and is particularly important to - attribute usage to a given billing period. + events: Events to update timeframe_end: This bound is exclusive (i.e. events before this timestamp will be updated) timeframe_start: This bound is inclusive (i.e. events with this timestamp onward, inclusive will be updated) - customer_id: The Orb Customer identifier - - external_customer_id: An alias for the Orb customer, whose mapping is specified when creating the - customer - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -699,16 +608,7 @@ async def update_by_external_id( """ return await self._patch( f"/customers/external_customer_id/{id}/usage", - body=maybe_transform( - { - "event_name": event_name, - "properties": properties, - "timestamp": timestamp, - "customer_id": customer_id, - "external_customer_id": external_customer_id, - }, - usage_update_by_external_id_params.UsageUpdateByExternalIDParams, - ), + body=maybe_transform({"events": events}, usage_update_by_external_id_params.UsageUpdateByExternalIDParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/orb/resources/events/events.py b/src/orb/resources/events/events.py index 8c696fdf..9bddce1b 100644 --- a/src/orb/resources/events/events.py +++ b/src/orb/resources/events/events.py @@ -246,47 +246,47 @@ def ingest( Events are the starting point for all usage calculations in the system, and are simple at their core: - ```json + ```ts { - // customer_id and external_customer_id are used to - // attribute usage to a given Customer. Exactly one of these - // should be specified in a given ingestion event. - - // `customer_id` is the Orb generated identifier for the Customer, - // which is returned from the Create customer API call. - customer_id: string, - - // external_customer_id is an alternate identifier which is associated - // with a Customer at creation time. This is treated as an alias for - // customer_id, and is usually set to an identifier native to your system. - external_customer_id: string, - - // A string name identifying the event, usually a usage - // action. By convention, this should not contain any whitespace. - event_name: string, - - // An ISO 8601 format date with no timezone offset. - // This should represent the time that usage occurred - // and is important to attribute usage to a given - // billing period. See the notes below on determining the timestamp. - // e.g. 2020-12-09T16:09:53Z - timestamp: string, - - // A unique value, generated by the client, that is - // used to de-duplicate events. - // Exactly one event with a given - // idempotency key will be ingested, which allows for - // safe request retries. - idempotency_key: string - - // Optional custom metadata to attach to the event. - // This might include a numeric value used for aggregation, - // or a string/boolean value used for filtering. - // The schema of this dictionary need not be pre-declared, and - // properties can be added at any time. - properties: { - [key: string]?: string | number | boolean, - }, + // customer_id and external_customer_id are used to + // attribute usage to a given Customer. Exactly one of these + // should be specified in a given ingestion event. + + // `customer_id` is the Orb generated identifier for the Customer, + // which is returned from the Create customer API call. + customer_id: string, + + // external_customer_id is an alternate identifier which is associated + // with a Customer at creation time. This is treated as an alias for + // customer_id, and is usually set to an identifier native to your system. + external_customer_id: string, + + // A string name identifying the event, usually a usage + // action. By convention, this should not contain any whitespace. + event_name: string, + + // An ISO 8601 format date with no timezone offset. + // This should represent the time that usage occurred + // and is important to attribute usage to a given + // billing period. See the notes below on determining the timestamp. + // e.g. 2020-12-09T16:09:53Z + timestamp: string, + + // A unique value, generated by the client, that is + // used to de-duplicate events. + // Exactly one event with a given + // idempotency key will be ingested, which allows for + // safe request retries. + idempotency_key: string + + // Optional custom metadata to attach to the event. + // This might include a numeric value used for aggregation, + // or a string/boolean value used for filtering. + // The schema of this dictionary need not be pre-declared, and + // properties can be added at any time. + properties: { + [key: string]?: string | number | boolean, + }, } ``` @@ -785,47 +785,47 @@ async def ingest( Events are the starting point for all usage calculations in the system, and are simple at their core: - ```json + ```ts { - // customer_id and external_customer_id are used to - // attribute usage to a given Customer. Exactly one of these - // should be specified in a given ingestion event. - - // `customer_id` is the Orb generated identifier for the Customer, - // which is returned from the Create customer API call. - customer_id: string, - - // external_customer_id is an alternate identifier which is associated - // with a Customer at creation time. This is treated as an alias for - // customer_id, and is usually set to an identifier native to your system. - external_customer_id: string, - - // A string name identifying the event, usually a usage - // action. By convention, this should not contain any whitespace. - event_name: string, - - // An ISO 8601 format date with no timezone offset. - // This should represent the time that usage occurred - // and is important to attribute usage to a given - // billing period. See the notes below on determining the timestamp. - // e.g. 2020-12-09T16:09:53Z - timestamp: string, - - // A unique value, generated by the client, that is - // used to de-duplicate events. - // Exactly one event with a given - // idempotency key will be ingested, which allows for - // safe request retries. - idempotency_key: string - - // Optional custom metadata to attach to the event. - // This might include a numeric value used for aggregation, - // or a string/boolean value used for filtering. - // The schema of this dictionary need not be pre-declared, and - // properties can be added at any time. - properties: { - [key: string]?: string | number | boolean, - }, + // customer_id and external_customer_id are used to + // attribute usage to a given Customer. Exactly one of these + // should be specified in a given ingestion event. + + // `customer_id` is the Orb generated identifier for the Customer, + // which is returned from the Create customer API call. + customer_id: string, + + // external_customer_id is an alternate identifier which is associated + // with a Customer at creation time. This is treated as an alias for + // customer_id, and is usually set to an identifier native to your system. + external_customer_id: string, + + // A string name identifying the event, usually a usage + // action. By convention, this should not contain any whitespace. + event_name: string, + + // An ISO 8601 format date with no timezone offset. + // This should represent the time that usage occurred + // and is important to attribute usage to a given + // billing period. See the notes below on determining the timestamp. + // e.g. 2020-12-09T16:09:53Z + timestamp: string, + + // A unique value, generated by the client, that is + // used to de-duplicate events. + // Exactly one event with a given + // idempotency key will be ingested, which allows for + // safe request retries. + idempotency_key: string + + // Optional custom metadata to attach to the event. + // This might include a numeric value used for aggregation, + // or a string/boolean value used for filtering. + // The schema of this dictionary need not be pre-declared, and + // properties can be added at any time. + properties: { + [key: string]?: string | number | boolean, + }, } ``` diff --git a/src/orb/resources/invoices.py b/src/orb/resources/invoices.py index 15e022cc..004dab9d 100644 --- a/src/orb/resources/invoices.py +++ b/src/orb/resources/invoices.py @@ -124,7 +124,7 @@ def list( invoice_date_lte: Union[str, datetime, None] | NotGiven = NOT_GIVEN, is_recurring: Optional[bool] | NotGiven = NOT_GIVEN, limit: int | NotGiven = NOT_GIVEN, - status: Optional[Literal["draft", "issued", "paid", "synced", "void"]] | NotGiven = NOT_GIVEN, + status: Optional[List[Literal["draft", "issued", "paid", "synced", "void"]]] | NotGiven = NOT_GIVEN, subscription_id: 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. @@ -513,7 +513,7 @@ def list( invoice_date_lte: Union[str, datetime, None] | NotGiven = NOT_GIVEN, is_recurring: Optional[bool] | NotGiven = NOT_GIVEN, limit: int | NotGiven = NOT_GIVEN, - status: Optional[Literal["draft", "issued", "paid", "synced", "void"]] | NotGiven = NOT_GIVEN, + status: Optional[List[Literal["draft", "issued", "paid", "synced", "void"]]] | NotGiven = NOT_GIVEN, subscription_id: 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. diff --git a/src/orb/resources/plans/plans.py b/src/orb/resources/plans/plans.py index 5f06054c..67a71ac4 100644 --- a/src/orb/resources/plans/plans.py +++ b/src/orb/resources/plans/plans.py @@ -32,7 +32,7 @@ def create( *, currency: str, name: str, - prices: List[object], + prices: List[plan_create_params.Price], default_invoice_memo: Optional[str] | NotGiven = NOT_GIVEN, external_plan_id: Optional[str] | NotGiven = NOT_GIVEN, metadata: Optional[object] | NotGiven = NOT_GIVEN, @@ -273,7 +273,7 @@ async def create( *, currency: str, name: str, - prices: List[object], + prices: List[plan_create_params.Price], default_invoice_memo: Optional[str] | NotGiven = NOT_GIVEN, external_plan_id: Optional[str] | NotGiven = NOT_GIVEN, metadata: Optional[object] | NotGiven = NOT_GIVEN, diff --git a/src/orb/resources/prices/prices.py b/src/orb/resources/prices/prices.py index 26b57375..cc357476 100644 --- a/src/orb/resources/prices/prices.py +++ b/src/orb/resources/prices/prices.py @@ -30,12 +30,12 @@ def __init__(self, client: Orb) -> None: def create( self, *, - cadence: Literal["annual", "monthly", "quarterly"], + cadence: Literal["annual", "monthly", "quarterly", "one_time"], currency: str, item_id: str, model_type: Literal["unit"], name: str, - unit_config: price_create_params.NewUnitPriceUnitConfig, + unit_config: price_create_params.NewFloatingUnitPriceUnitConfig, billable_metric_id: Optional[str] | NotGiven = NOT_GIVEN, billed_in_advance: Optional[bool] | NotGiven = NOT_GIVEN, external_price_id: Optional[str] | NotGiven = NOT_GIVEN, @@ -100,12 +100,12 @@ def create( def create( self, *, - cadence: Literal["annual", "monthly", "quarterly"], + cadence: Literal["annual", "monthly", "quarterly", "one_time"], currency: str, item_id: str, model_type: Literal["package"], name: str, - package_config: price_create_params.NewPackagePricePackageConfig, + package_config: price_create_params.NewFloatingPackagePricePackageConfig, billable_metric_id: Optional[str] | NotGiven = NOT_GIVEN, billed_in_advance: Optional[bool] | NotGiven = NOT_GIVEN, external_price_id: Optional[str] | NotGiven = NOT_GIVEN, @@ -170,10 +170,10 @@ def create( def create( self, *, - cadence: Literal["annual", "monthly", "quarterly"], + cadence: Literal["annual", "monthly", "quarterly", "one_time"], currency: str, item_id: str, - matrix_config: price_create_params.NewMatrixPriceMatrixConfig, + matrix_config: price_create_params.NewFloatingMatrixPriceMatrixConfig, model_type: Literal["matrix"], name: str, billable_metric_id: Optional[str] | NotGiven = NOT_GIVEN, @@ -240,12 +240,12 @@ def create( def create( self, *, - cadence: Literal["annual", "monthly", "quarterly"], + cadence: Literal["annual", "monthly", "quarterly", "one_time"], currency: str, item_id: str, model_type: Literal["tiered"], name: str, - tiered_config: price_create_params.NewTieredPriceTieredConfig, + tiered_config: price_create_params.NewFloatingTieredPriceTieredConfig, billable_metric_id: Optional[str] | NotGiven = NOT_GIVEN, billed_in_advance: Optional[bool] | NotGiven = NOT_GIVEN, external_price_id: Optional[str] | NotGiven = NOT_GIVEN, @@ -310,12 +310,12 @@ def create( def create( self, *, - cadence: Literal["annual", "monthly", "quarterly"], + cadence: Literal["annual", "monthly", "quarterly", "one_time"], currency: str, item_id: str, model_type: Literal["tiered_bps"], name: str, - tiered_bps_config: price_create_params.NewTieredBpsPriceTieredBpsConfig, + tiered_bps_config: price_create_params.NewFloatingTieredBpsPriceTieredBpsConfig, billable_metric_id: Optional[str] | NotGiven = NOT_GIVEN, billed_in_advance: Optional[bool] | NotGiven = NOT_GIVEN, external_price_id: Optional[str] | NotGiven = NOT_GIVEN, @@ -380,8 +380,8 @@ def create( def create( self, *, - bps_config: price_create_params.NewBpsPriceBpsConfig, - cadence: Literal["annual", "monthly", "quarterly"], + bps_config: price_create_params.NewFloatingBpsPriceBpsConfig, + cadence: Literal["annual", "monthly", "quarterly", "one_time"], currency: str, item_id: str, model_type: Literal["bps"], @@ -450,8 +450,8 @@ def create( def create( self, *, - bulk_bps_config: price_create_params.NewBulkBpsPriceBulkBpsConfig, - cadence: Literal["annual", "monthly", "quarterly"], + bulk_bps_config: price_create_params.NewFloatingBulkBpsPriceBulkBpsConfig, + cadence: Literal["annual", "monthly", "quarterly", "one_time"], currency: str, item_id: str, model_type: Literal["bulk_bps"], @@ -520,8 +520,8 @@ def create( def create( self, *, - bulk_config: price_create_params.NewBulkPriceBulkConfig, - cadence: Literal["annual", "monthly", "quarterly"], + bulk_config: price_create_params.NewFloatingBulkPriceBulkConfig, + cadence: Literal["annual", "monthly", "quarterly", "one_time"], currency: str, item_id: str, model_type: Literal["bulk"], @@ -590,7 +590,7 @@ def create( def create( self, *, - cadence: Literal["annual", "monthly", "quarterly"], + cadence: Literal["annual", "monthly", "quarterly", "one_time"], currency: str, item_id: str, model_type: Literal["threshold_total_amount"], @@ -660,7 +660,7 @@ def create( def create( self, *, - cadence: Literal["annual", "monthly", "quarterly"], + cadence: Literal["annual", "monthly", "quarterly", "one_time"], currency: str, item_id: str, model_type: Literal["tiered_package"], @@ -730,7 +730,7 @@ def create( def create( self, *, - cadence: Literal["annual", "monthly", "quarterly"], + cadence: Literal["annual", "monthly", "quarterly", "one_time"], currency: str, item_id: str, model_type: Literal["tiered_with_minimum"], @@ -800,7 +800,7 @@ def create( def create( self, *, - cadence: Literal["annual", "monthly", "quarterly"], + cadence: Literal["annual", "monthly", "quarterly", "one_time"], currency: str, item_id: str, model_type: Literal["package_with_allocation"], @@ -883,7 +883,7 @@ def create( def create( self, *, - cadence: Literal["annual", "monthly", "quarterly"], + cadence: Literal["annual", "monthly", "quarterly", "one_time"], currency: str, item_id: str, model_type: Literal["unit"] @@ -899,19 +899,19 @@ def create( | Literal["tiered_with_minimum"] | Literal["package_with_allocation"], name: str, - unit_config: price_create_params.NewUnitPriceUnitConfig | NotGiven = NOT_GIVEN, + unit_config: price_create_params.NewFloatingUnitPriceUnitConfig | NotGiven = NOT_GIVEN, billable_metric_id: Optional[str] | NotGiven = NOT_GIVEN, billed_in_advance: Optional[bool] | NotGiven = NOT_GIVEN, external_price_id: Optional[str] | NotGiven = NOT_GIVEN, fixed_price_quantity: Optional[float] | NotGiven = NOT_GIVEN, invoice_grouping_key: Optional[str] | NotGiven = NOT_GIVEN, - package_config: price_create_params.NewPackagePricePackageConfig | NotGiven = NOT_GIVEN, - matrix_config: price_create_params.NewMatrixPriceMatrixConfig | NotGiven = NOT_GIVEN, - tiered_config: price_create_params.NewTieredPriceTieredConfig | NotGiven = NOT_GIVEN, - tiered_bps_config: price_create_params.NewTieredBpsPriceTieredBpsConfig | NotGiven = NOT_GIVEN, - bps_config: price_create_params.NewBpsPriceBpsConfig | NotGiven = NOT_GIVEN, - bulk_bps_config: price_create_params.NewBulkBpsPriceBulkBpsConfig | NotGiven = NOT_GIVEN, - bulk_config: price_create_params.NewBulkPriceBulkConfig | NotGiven = NOT_GIVEN, + package_config: price_create_params.NewFloatingPackagePricePackageConfig | NotGiven = NOT_GIVEN, + matrix_config: price_create_params.NewFloatingMatrixPriceMatrixConfig | NotGiven = NOT_GIVEN, + tiered_config: price_create_params.NewFloatingTieredPriceTieredConfig | NotGiven = NOT_GIVEN, + tiered_bps_config: price_create_params.NewFloatingTieredBpsPriceTieredBpsConfig | NotGiven = NOT_GIVEN, + bps_config: price_create_params.NewFloatingBpsPriceBpsConfig | NotGiven = NOT_GIVEN, + bulk_bps_config: price_create_params.NewFloatingBulkBpsPriceBulkBpsConfig | NotGiven = NOT_GIVEN, + bulk_config: price_create_params.NewFloatingBulkPriceBulkConfig | NotGiven = NOT_GIVEN, threshold_total_amount_config: Dict[str, object] | NotGiven = NOT_GIVEN, tiered_package_config: Dict[str, object] | NotGiven = NOT_GIVEN, tiered_with_minimum_config: Dict[str, object] | NotGiven = NOT_GIVEN, @@ -1061,12 +1061,12 @@ def __init__(self, client: AsyncOrb) -> None: async def create( self, *, - cadence: Literal["annual", "monthly", "quarterly"], + cadence: Literal["annual", "monthly", "quarterly", "one_time"], currency: str, item_id: str, model_type: Literal["unit"], name: str, - unit_config: price_create_params.NewUnitPriceUnitConfig, + unit_config: price_create_params.NewFloatingUnitPriceUnitConfig, billable_metric_id: Optional[str] | NotGiven = NOT_GIVEN, billed_in_advance: Optional[bool] | NotGiven = NOT_GIVEN, external_price_id: Optional[str] | NotGiven = NOT_GIVEN, @@ -1131,12 +1131,12 @@ async def create( async def create( self, *, - cadence: Literal["annual", "monthly", "quarterly"], + cadence: Literal["annual", "monthly", "quarterly", "one_time"], currency: str, item_id: str, model_type: Literal["package"], name: str, - package_config: price_create_params.NewPackagePricePackageConfig, + package_config: price_create_params.NewFloatingPackagePricePackageConfig, billable_metric_id: Optional[str] | NotGiven = NOT_GIVEN, billed_in_advance: Optional[bool] | NotGiven = NOT_GIVEN, external_price_id: Optional[str] | NotGiven = NOT_GIVEN, @@ -1201,10 +1201,10 @@ async def create( async def create( self, *, - cadence: Literal["annual", "monthly", "quarterly"], + cadence: Literal["annual", "monthly", "quarterly", "one_time"], currency: str, item_id: str, - matrix_config: price_create_params.NewMatrixPriceMatrixConfig, + matrix_config: price_create_params.NewFloatingMatrixPriceMatrixConfig, model_type: Literal["matrix"], name: str, billable_metric_id: Optional[str] | NotGiven = NOT_GIVEN, @@ -1271,12 +1271,12 @@ async def create( async def create( self, *, - cadence: Literal["annual", "monthly", "quarterly"], + cadence: Literal["annual", "monthly", "quarterly", "one_time"], currency: str, item_id: str, model_type: Literal["tiered"], name: str, - tiered_config: price_create_params.NewTieredPriceTieredConfig, + tiered_config: price_create_params.NewFloatingTieredPriceTieredConfig, billable_metric_id: Optional[str] | NotGiven = NOT_GIVEN, billed_in_advance: Optional[bool] | NotGiven = NOT_GIVEN, external_price_id: Optional[str] | NotGiven = NOT_GIVEN, @@ -1341,12 +1341,12 @@ async def create( async def create( self, *, - cadence: Literal["annual", "monthly", "quarterly"], + cadence: Literal["annual", "monthly", "quarterly", "one_time"], currency: str, item_id: str, model_type: Literal["tiered_bps"], name: str, - tiered_bps_config: price_create_params.NewTieredBpsPriceTieredBpsConfig, + tiered_bps_config: price_create_params.NewFloatingTieredBpsPriceTieredBpsConfig, billable_metric_id: Optional[str] | NotGiven = NOT_GIVEN, billed_in_advance: Optional[bool] | NotGiven = NOT_GIVEN, external_price_id: Optional[str] | NotGiven = NOT_GIVEN, @@ -1411,8 +1411,8 @@ async def create( async def create( self, *, - bps_config: price_create_params.NewBpsPriceBpsConfig, - cadence: Literal["annual", "monthly", "quarterly"], + bps_config: price_create_params.NewFloatingBpsPriceBpsConfig, + cadence: Literal["annual", "monthly", "quarterly", "one_time"], currency: str, item_id: str, model_type: Literal["bps"], @@ -1481,8 +1481,8 @@ async def create( async def create( self, *, - bulk_bps_config: price_create_params.NewBulkBpsPriceBulkBpsConfig, - cadence: Literal["annual", "monthly", "quarterly"], + bulk_bps_config: price_create_params.NewFloatingBulkBpsPriceBulkBpsConfig, + cadence: Literal["annual", "monthly", "quarterly", "one_time"], currency: str, item_id: str, model_type: Literal["bulk_bps"], @@ -1551,8 +1551,8 @@ async def create( async def create( self, *, - bulk_config: price_create_params.NewBulkPriceBulkConfig, - cadence: Literal["annual", "monthly", "quarterly"], + bulk_config: price_create_params.NewFloatingBulkPriceBulkConfig, + cadence: Literal["annual", "monthly", "quarterly", "one_time"], currency: str, item_id: str, model_type: Literal["bulk"], @@ -1621,7 +1621,7 @@ async def create( async def create( self, *, - cadence: Literal["annual", "monthly", "quarterly"], + cadence: Literal["annual", "monthly", "quarterly", "one_time"], currency: str, item_id: str, model_type: Literal["threshold_total_amount"], @@ -1691,7 +1691,7 @@ async def create( async def create( self, *, - cadence: Literal["annual", "monthly", "quarterly"], + cadence: Literal["annual", "monthly", "quarterly", "one_time"], currency: str, item_id: str, model_type: Literal["tiered_package"], @@ -1761,7 +1761,7 @@ async def create( async def create( self, *, - cadence: Literal["annual", "monthly", "quarterly"], + cadence: Literal["annual", "monthly", "quarterly", "one_time"], currency: str, item_id: str, model_type: Literal["tiered_with_minimum"], @@ -1831,7 +1831,7 @@ async def create( async def create( self, *, - cadence: Literal["annual", "monthly", "quarterly"], + cadence: Literal["annual", "monthly", "quarterly", "one_time"], currency: str, item_id: str, model_type: Literal["package_with_allocation"], @@ -1914,7 +1914,7 @@ async def create( async def create( self, *, - cadence: Literal["annual", "monthly", "quarterly"], + cadence: Literal["annual", "monthly", "quarterly", "one_time"], currency: str, item_id: str, model_type: Literal["unit"] @@ -1930,19 +1930,19 @@ async def create( | Literal["tiered_with_minimum"] | Literal["package_with_allocation"], name: str, - unit_config: price_create_params.NewUnitPriceUnitConfig | NotGiven = NOT_GIVEN, + unit_config: price_create_params.NewFloatingUnitPriceUnitConfig | NotGiven = NOT_GIVEN, billable_metric_id: Optional[str] | NotGiven = NOT_GIVEN, billed_in_advance: Optional[bool] | NotGiven = NOT_GIVEN, external_price_id: Optional[str] | NotGiven = NOT_GIVEN, fixed_price_quantity: Optional[float] | NotGiven = NOT_GIVEN, invoice_grouping_key: Optional[str] | NotGiven = NOT_GIVEN, - package_config: price_create_params.NewPackagePricePackageConfig | NotGiven = NOT_GIVEN, - matrix_config: price_create_params.NewMatrixPriceMatrixConfig | NotGiven = NOT_GIVEN, - tiered_config: price_create_params.NewTieredPriceTieredConfig | NotGiven = NOT_GIVEN, - tiered_bps_config: price_create_params.NewTieredBpsPriceTieredBpsConfig | NotGiven = NOT_GIVEN, - bps_config: price_create_params.NewBpsPriceBpsConfig | NotGiven = NOT_GIVEN, - bulk_bps_config: price_create_params.NewBulkBpsPriceBulkBpsConfig | NotGiven = NOT_GIVEN, - bulk_config: price_create_params.NewBulkPriceBulkConfig | NotGiven = NOT_GIVEN, + package_config: price_create_params.NewFloatingPackagePricePackageConfig | NotGiven = NOT_GIVEN, + matrix_config: price_create_params.NewFloatingMatrixPriceMatrixConfig | NotGiven = NOT_GIVEN, + tiered_config: price_create_params.NewFloatingTieredPriceTieredConfig | NotGiven = NOT_GIVEN, + tiered_bps_config: price_create_params.NewFloatingTieredBpsPriceTieredBpsConfig | NotGiven = NOT_GIVEN, + bps_config: price_create_params.NewFloatingBpsPriceBpsConfig | NotGiven = NOT_GIVEN, + bulk_bps_config: price_create_params.NewFloatingBulkBpsPriceBulkBpsConfig | NotGiven = NOT_GIVEN, + bulk_config: price_create_params.NewFloatingBulkPriceBulkConfig | NotGiven = NOT_GIVEN, threshold_total_amount_config: Dict[str, object] | NotGiven = NOT_GIVEN, tiered_package_config: Dict[str, object] | NotGiven = NOT_GIVEN, tiered_with_minimum_config: Dict[str, object] | NotGiven = NOT_GIVEN, diff --git a/src/orb/resources/subscriptions.py b/src/orb/resources/subscriptions.py index c452c275..034de0d8 100644 --- a/src/orb/resources/subscriptions.py +++ b/src/orb/resources/subscriptions.py @@ -120,13 +120,13 @@ def create( ```json { - ... - "id": "price_id", - "model_type": "unit", - "unit_config": { - "unit_amount": "0.50" - } - ... + ... + "id": "price_id", + "model_type": "unit", + "unit_config": { + "unit_amount": "0.50" + } + ... } ``` @@ -140,24 +140,24 @@ def create( ```json { - ... - "id": "price_id", - "model_type": "tiered", - "tiered_config": { - "tiers": [ - { - "first_unit":"1", - "last_unit": "10", - "unit_amount": "0.50" - }, - { - "first_unit": "10", - "last_unit": null, - "unit_amount": "0.10" - } - ] - } - ... + ... + "id": "price_id", + "model_type": "tiered", + "tiered_config": { + "tiers": [ + { + "first_unit":"1", + "last_unit": "10", + "unit_amount": "0.50" + }, + { + "first_unit": "10", + "last_unit": null, + "unit_amount": "0.10" + } + ] + } + ... } ``` @@ -172,22 +172,22 @@ def create( ```json { - ... - "id": "price_id", - "model_type": "bulk", - "bulk_config": { - "tiers": [ - { - "maximum_units": "10", - "unit_amount": "0.50" - }, - { - "maximum_units": "1000", - "unit_amount": "0.40" - } - ] - } - ... + ... + "id": "price_id", + "model_type": "bulk", + "bulk_config": { + "tiers": [ + { + "maximum_units": "10", + "unit_amount": "0.50" + }, + { + "maximum_units": "1000", + "unit_amount": "0.40" + } + ] + } + ... } ``` @@ -199,14 +199,14 @@ def create( ```json { - ... - "id": "price_id", - "model_type": "package", - "package_config": { - "package_amount": "0.80", - "package_size": 10 - } - ... + ... + "id": "price_id", + "model_type": "package", + "package_config": { + "package_amount": "0.80", + "package_size": 10 + } + ... } ``` @@ -219,14 +219,14 @@ def create( ```json { - ... - "id": "price_id" - "model_type": "bps", - "bps_config": { - "bps": 125, - "per_event_cap": "11.00" - } - ... + ... + "id": "price_id" + "model_type": "bps", + "bps_config": { + "bps": 125, + "per_event_cap": "11.00" + } + ... } ``` @@ -241,25 +241,25 @@ def create( ```json { - ... - "id": "price_id" - "model_type": "bulk_bps", - "bulk_bps_config": { - "tiers": [ - { - "minimum_amount": "0.00", - "maximum_amount": "1000000.00", - "bps": 125, - "per_event_cap": "19.00" - }, - { - "minimum_amount":"1000000.00", - "maximum_amount": null, - "bps": 115, - "per_event_cap": "4.00" - } - ] - } + ... + "id": "price_id" + "model_type": "bulk_bps", + "bulk_bps_config": { + "tiers": [ + { + "minimum_amount": "0.00", + "maximum_amount": "1000000.00", + "bps": 125, + "per_event_cap": "19.00" + }, + { + "minimum_amount":"1000000.00", + "maximum_amount": null, + "bps": 115, + "per_event_cap": "4.00" + } + ] + } ... } ``` @@ -276,26 +276,26 @@ def create( ```json { - ... - "id": "price_id" - "model_type": "tiered_bps", - "tiered_bps_config": { - "tiers": [ - { - "minimum_amount": "0.00", - "maximum_amount": "1000000.00", - "bps": 125, - "per_event_cap": "19.00" - }, - { - "minimum_amount":"1000000", - "maximum_amount": null, - "bps": 115, - "per_event_cap": "4.00" - } - ] - } - ... + ... + "id": "price_id" + "model_type": "tiered_bps", + "tiered_bps_config": { + "tiers": [ + { + "minimum_amount": "0.00", + "maximum_amount": "1000000.00", + "bps": 125, + "per_event_cap": "19.00" + }, + { + "minimum_amount":"1000000", + "maximum_amount": null, + "bps": 115, + "per_event_cap": "4.00" + } + ] + } + ... } ``` @@ -311,26 +311,27 @@ def create( `default_unit_amount`. ```json - ... - "model_type": "matrix" - "matrix_config": { - "default_unit_amount": "3.00", - "dimensions": [ - "cluster_name", - "region" - ], - "matrix_values": [ { - "dimension_values": [ - "alpha", - "west" - ], - "unit_amount": "2.00" - }, - ... - ] + ... + "model_type": "matrix", + "matrix_config": { + "default_unit_amount": "3.00", + "dimensions": [ + "cluster_name", + "region" + ], + "matrix_values": [ + { + "dimension_values": [ + "alpha", + "west" + ], + "unit_amount": "2.00" + }, + ... + ] + } } - ... ``` ### Fixed fees @@ -341,14 +342,14 @@ def create( ```json { - ... - "id": "price_id", - "model_type": "unit", - "unit_config": { - "unit_amount": "2.00" - }, - "fixed_price_quantity": 3.0 - ... + ... + "id": "price_id", + "model_type": "unit", + "unit_config": { + "unit_amount": "2.00" + }, + "fixed_price_quantity": 3.0 + ... } ``` @@ -373,14 +374,14 @@ def create( ```json { - ... - "id": "price_id", - "model_type": "unit", - "unit_config": { - "unit_amount": "0.50" - }, - "minimum_amount": "100.00" - ... + ... + "id": "price_id", + "model_type": "unit", + "unit_config": { + "unit_amount": "0.50" + }, + "minimum_amount": "100.00" + ... } ``` @@ -388,14 +389,14 @@ def create( ```json { - ... - "id": "price_id", - "model_type": "unit", - "unit_config": { - "unit_amount": "0.50" - }, - "minimum_amount": null - ... + ... + "id": "price_id", + "model_type": "unit", + "unit_config": { + "unit_amount": "0.50" + }, + "minimum_amount": null + ... } ``` @@ -410,12 +411,12 @@ def create( To add a discount for a specific price, add `discount` to the price in the `price_overrides` object. Discount should be a dictionary of the format: - ```json + ```ts { - "discount_type": "amount" | "percentage" | "usage", - "amount_discount": string, - "percentage_discount": string, - "usage_discount": string + "discount_type": "amount" | "percentage" | "usage", + "amount_discount": string, + "percentage_discount": string, + "usage_discount": string } ``` @@ -426,13 +427,13 @@ def create( ```json { - ... - "id": "price_id", - "model_type": "unit", - "unit_config": { - "unit_amount": "0.50" - }, - "discount": {"discount_type": "amount", "amount_discount": "175"}, + ... + "id": "price_id", + "model_type": "unit", + "unit_config": { + "unit_amount": "0.50" + }, + "discount": {"discount_type": "amount", "amount_discount": "175"}, } ``` @@ -440,11 +441,11 @@ def create( ```json { - "customer_id": "customer_id", - "plan_id": "plan_id", - "discount": null, - "price_overrides": [ ... ] - ... + "customer_id": "customer_id", + "plan_id": "plan_id", + "discount": null, + "price_overrides": [ ... ] + ... } ``` @@ -1716,13 +1717,13 @@ async def create( ```json { - ... - "id": "price_id", - "model_type": "unit", - "unit_config": { - "unit_amount": "0.50" - } - ... + ... + "id": "price_id", + "model_type": "unit", + "unit_config": { + "unit_amount": "0.50" + } + ... } ``` @@ -1736,24 +1737,24 @@ async def create( ```json { - ... - "id": "price_id", - "model_type": "tiered", - "tiered_config": { - "tiers": [ - { - "first_unit":"1", - "last_unit": "10", - "unit_amount": "0.50" - }, - { - "first_unit": "10", - "last_unit": null, - "unit_amount": "0.10" - } - ] - } - ... + ... + "id": "price_id", + "model_type": "tiered", + "tiered_config": { + "tiers": [ + { + "first_unit":"1", + "last_unit": "10", + "unit_amount": "0.50" + }, + { + "first_unit": "10", + "last_unit": null, + "unit_amount": "0.10" + } + ] + } + ... } ``` @@ -1768,22 +1769,22 @@ async def create( ```json { - ... - "id": "price_id", - "model_type": "bulk", - "bulk_config": { - "tiers": [ - { - "maximum_units": "10", - "unit_amount": "0.50" - }, - { - "maximum_units": "1000", - "unit_amount": "0.40" - } - ] - } - ... + ... + "id": "price_id", + "model_type": "bulk", + "bulk_config": { + "tiers": [ + { + "maximum_units": "10", + "unit_amount": "0.50" + }, + { + "maximum_units": "1000", + "unit_amount": "0.40" + } + ] + } + ... } ``` @@ -1795,14 +1796,14 @@ async def create( ```json { - ... - "id": "price_id", - "model_type": "package", - "package_config": { - "package_amount": "0.80", - "package_size": 10 - } - ... + ... + "id": "price_id", + "model_type": "package", + "package_config": { + "package_amount": "0.80", + "package_size": 10 + } + ... } ``` @@ -1815,14 +1816,14 @@ async def create( ```json { - ... - "id": "price_id" - "model_type": "bps", - "bps_config": { - "bps": 125, - "per_event_cap": "11.00" - } - ... + ... + "id": "price_id" + "model_type": "bps", + "bps_config": { + "bps": 125, + "per_event_cap": "11.00" + } + ... } ``` @@ -1837,25 +1838,25 @@ async def create( ```json { - ... - "id": "price_id" - "model_type": "bulk_bps", - "bulk_bps_config": { - "tiers": [ - { - "minimum_amount": "0.00", - "maximum_amount": "1000000.00", - "bps": 125, - "per_event_cap": "19.00" - }, - { - "minimum_amount":"1000000.00", - "maximum_amount": null, - "bps": 115, - "per_event_cap": "4.00" - } - ] - } + ... + "id": "price_id" + "model_type": "bulk_bps", + "bulk_bps_config": { + "tiers": [ + { + "minimum_amount": "0.00", + "maximum_amount": "1000000.00", + "bps": 125, + "per_event_cap": "19.00" + }, + { + "minimum_amount":"1000000.00", + "maximum_amount": null, + "bps": 115, + "per_event_cap": "4.00" + } + ] + } ... } ``` @@ -1872,26 +1873,26 @@ async def create( ```json { - ... - "id": "price_id" - "model_type": "tiered_bps", - "tiered_bps_config": { - "tiers": [ - { - "minimum_amount": "0.00", - "maximum_amount": "1000000.00", - "bps": 125, - "per_event_cap": "19.00" - }, - { - "minimum_amount":"1000000", - "maximum_amount": null, - "bps": 115, - "per_event_cap": "4.00" - } - ] - } - ... + ... + "id": "price_id" + "model_type": "tiered_bps", + "tiered_bps_config": { + "tiers": [ + { + "minimum_amount": "0.00", + "maximum_amount": "1000000.00", + "bps": 125, + "per_event_cap": "19.00" + }, + { + "minimum_amount":"1000000", + "maximum_amount": null, + "bps": 115, + "per_event_cap": "4.00" + } + ] + } + ... } ``` @@ -1907,26 +1908,27 @@ async def create( `default_unit_amount`. ```json - ... - "model_type": "matrix" - "matrix_config": { - "default_unit_amount": "3.00", - "dimensions": [ - "cluster_name", - "region" - ], - "matrix_values": [ { - "dimension_values": [ - "alpha", - "west" - ], - "unit_amount": "2.00" - }, - ... - ] + ... + "model_type": "matrix", + "matrix_config": { + "default_unit_amount": "3.00", + "dimensions": [ + "cluster_name", + "region" + ], + "matrix_values": [ + { + "dimension_values": [ + "alpha", + "west" + ], + "unit_amount": "2.00" + }, + ... + ] + } } - ... ``` ### Fixed fees @@ -1937,14 +1939,14 @@ async def create( ```json { - ... - "id": "price_id", - "model_type": "unit", - "unit_config": { - "unit_amount": "2.00" - }, - "fixed_price_quantity": 3.0 - ... + ... + "id": "price_id", + "model_type": "unit", + "unit_config": { + "unit_amount": "2.00" + }, + "fixed_price_quantity": 3.0 + ... } ``` @@ -1969,14 +1971,14 @@ async def create( ```json { - ... - "id": "price_id", - "model_type": "unit", - "unit_config": { - "unit_amount": "0.50" - }, - "minimum_amount": "100.00" - ... + ... + "id": "price_id", + "model_type": "unit", + "unit_config": { + "unit_amount": "0.50" + }, + "minimum_amount": "100.00" + ... } ``` @@ -1984,14 +1986,14 @@ async def create( ```json { - ... - "id": "price_id", - "model_type": "unit", - "unit_config": { - "unit_amount": "0.50" - }, - "minimum_amount": null - ... + ... + "id": "price_id", + "model_type": "unit", + "unit_config": { + "unit_amount": "0.50" + }, + "minimum_amount": null + ... } ``` @@ -2006,12 +2008,12 @@ async def create( To add a discount for a specific price, add `discount` to the price in the `price_overrides` object. Discount should be a dictionary of the format: - ```json + ```ts { - "discount_type": "amount" | "percentage" | "usage", - "amount_discount": string, - "percentage_discount": string, - "usage_discount": string + "discount_type": "amount" | "percentage" | "usage", + "amount_discount": string, + "percentage_discount": string, + "usage_discount": string } ``` @@ -2022,13 +2024,13 @@ async def create( ```json { - ... - "id": "price_id", - "model_type": "unit", - "unit_config": { - "unit_amount": "0.50" - }, - "discount": {"discount_type": "amount", "amount_discount": "175"}, + ... + "id": "price_id", + "model_type": "unit", + "unit_config": { + "unit_amount": "0.50" + }, + "discount": {"discount_type": "amount", "amount_discount": "175"}, } ``` @@ -2036,11 +2038,11 @@ async def create( ```json { - "customer_id": "customer_id", - "plan_id": "plan_id", - "discount": null, - "price_overrides": [ ... ] - ... + "customer_id": "customer_id", + "plan_id": "plan_id", + "discount": null, + "price_overrides": [ ... ] + ... } ``` diff --git a/src/orb/types/__init__.py b/src/orb/types/__init__.py index 808cd7ff..1fd63097 100644 --- a/src/orb/types/__init__.py +++ b/src/orb/types/__init__.py @@ -5,13 +5,12 @@ from .plan import Plan as Plan from .price import Price as Price from .coupon import Coupon as Coupon +from .shared import Discount as Discount from .invoice import Invoice as Invoice from .customer import Customer as Customer from .credit_note import CreditNote as CreditNote from .subscription import Subscription as Subscription from .subscriptions import Subscriptions as Subscriptions -from .discount_param import DiscountParam as DiscountParam -from .invoice_discount import InvoiceDiscount as InvoiceDiscount from .item_list_params import ItemListParams as ItemListParams from .plan_list_params import PlanListParams as PlanListParams from .price_list_params import PriceListParams as PriceListParams diff --git a/src/orb/types/coupon.py b/src/orb/types/coupon.py index f747d314..983e92f1 100644 --- a/src/orb/types/coupon.py +++ b/src/orb/types/coupon.py @@ -1,11 +1,48 @@ # File generated from our OpenAPI spec by Stainless. -from typing import Optional +from typing import List, Union, Optional from datetime import datetime +from typing_extensions import Literal from .._models import BaseModel -__all__ = ["Coupon"] +__all__ = ["Coupon", "Discount", "DiscountPercentageDiscount", "DiscountAmountDiscount"] + + +class DiscountPercentageDiscount(BaseModel): + applies_to_price_ids: List[str] + """List of price_ids that this discount applies to. + + For plan/plan phase discounts, this can be a subset of prices. + """ + + discount_type: Literal["percentage"] + + percentage_discount: float + """Only available if discount_type is `percentage`. + + This is a number between 0 and 1. + """ + + reason: Optional[str] = None + + +class DiscountAmountDiscount(BaseModel): + amount_discount: str + """Only available if discount_type is `amount`.""" + + applies_to_price_ids: List[str] + """List of price_ids that this discount applies to. + + For plan/plan phase discounts, this can be a subset of prices. + """ + + discount_type: Literal["amount"] + + reason: Optional[str] = None + + +Discount = Union[DiscountPercentageDiscount, DiscountAmountDiscount] class Coupon(BaseModel): @@ -19,7 +56,7 @@ class Coupon(BaseModel): non-null for archived coupons. """ - discount: object + discount: Discount duration_in_months: Optional[int] """ diff --git a/src/orb/types/coupon_create_params.py b/src/orb/types/coupon_create_params.py index bac7be49..401e60f0 100644 --- a/src/orb/types/coupon_create_params.py +++ b/src/orb/types/coupon_create_params.py @@ -2,14 +2,14 @@ from __future__ import annotations -from typing import Optional -from typing_extensions import Required, TypedDict +from typing import List, Union, Optional +from typing_extensions import Literal, Required, TypedDict -__all__ = ["CouponCreateParams"] +__all__ = ["CouponCreateParams", "Discount", "DiscountPercentageDiscount", "DiscountAmountDiscount"] class CouponCreateParams(TypedDict, total=False): - discount: Required[object] + discount: Required[Discount] redemption_code: Required[str] """This string can be used to redeem this coupon for a given subscription.""" @@ -25,3 +25,39 @@ class CouponCreateParams(TypedDict, total=False): The maximum number of redemptions allowed for this coupon before it is exhausted;`null` here means "unlimited". """ + + +class DiscountPercentageDiscount(TypedDict, total=False): + applies_to_price_ids: Required[List[str]] + """List of price_ids that this discount applies to. + + For plan/plan phase discounts, this can be a subset of prices. + """ + + discount_type: Required[Literal["percentage"]] + + percentage_discount: Required[float] + """Only available if discount_type is `percentage`. + + This is a number between 0 and 1. + """ + + reason: Optional[str] + + +class DiscountAmountDiscount(TypedDict, total=False): + amount_discount: Required[str] + """Only available if discount_type is `amount`.""" + + applies_to_price_ids: Required[List[str]] + """List of price_ids that this discount applies to. + + For plan/plan phase discounts, this can be a subset of prices. + """ + + discount_type: Required[Literal["amount"]] + + reason: Optional[str] + + +Discount = Union[DiscountPercentageDiscount, DiscountAmountDiscount] diff --git a/src/orb/types/credit_note.py b/src/orb/types/credit_note.py index 859c3359..42ca8754 100644 --- a/src/orb/types/credit_note.py +++ b/src/orb/types/credit_note.py @@ -6,7 +6,18 @@ from .._models import BaseModel -__all__ = ["CreditNote", "Customer", "LineItem", "LineItemSubLineItem"] +__all__ = [ + "CreditNote", + "Customer", + "Discount", + "DiscountAppliesToPrice", + "LineItem", + "LineItemDiscount", + "LineItemSubLineItem", + "LineItemTaxAmount", + "MaximumAmountAdjustment", + "MaximumAmountAdjustmentAppliesToPrice", +] class Customer(BaseModel): @@ -15,6 +26,40 @@ class Customer(BaseModel): external_customer_id: Optional[str] +class DiscountAppliesToPrice(BaseModel): + id: str + + name: str + + +class Discount(BaseModel): + amount_applied: str + + discount_type: Literal["percentage"] + + percentage_discount: float + + applies_to_prices: Optional[List[DiscountAppliesToPrice]] = None + + reason: Optional[str] = None + + +class LineItemDiscount(BaseModel): + id: str + + amount_applied: str + + applies_to_price_ids: List[str] + + discount_type: Literal["percentage", "amount"] + + percentage_discount: float + + amount_discount: Optional[str] = None + + reason: Optional[str] = None + + class LineItemSubLineItem(BaseModel): amount: str @@ -23,6 +68,17 @@ class LineItemSubLineItem(BaseModel): quantity: Optional[float] +class LineItemTaxAmount(BaseModel): + amount: str + """The amount of additional tax incurred by this tax rate.""" + + tax_rate_description: str + """The human-readable description of the applied tax rate.""" + + tax_rate_percentage: Optional[str] + """The tax rate percentage, out of 100.""" + + class LineItem(BaseModel): id: str """The Orb id of this resource.""" @@ -30,7 +86,7 @@ class LineItem(BaseModel): amount: str """The amount of the line item, including any line item minimums and discounts.""" - discounts: List[object] + discounts: List[LineItemDiscount] """Any line items discounts from the invoice's line item.""" name: str @@ -45,10 +101,28 @@ class LineItem(BaseModel): subtotal: str """The amount of the line item, excluding any line item minimums and discounts.""" - tax_amounts: List[object] + tax_amounts: List[LineItemTaxAmount] """Any tax amounts applied onto the line item.""" +class MaximumAmountAdjustmentAppliesToPrice(BaseModel): + id: str + + name: str + + +class MaximumAmountAdjustment(BaseModel): + amount_applied: str + + discount_type: Literal["percentage"] + + percentage_discount: float + + applies_to_prices: Optional[List[MaximumAmountAdjustmentAppliesToPrice]] = None + + reason: Optional[str] = None + + class CreditNote(BaseModel): id: str """The Orb id of this credit note.""" @@ -64,7 +138,7 @@ class CreditNote(BaseModel): customer: Customer - discounts: List[object] + discounts: List[Discount] """Any discounts applied on the original invoice.""" invoice_id: str @@ -73,7 +147,7 @@ class CreditNote(BaseModel): line_items: List[LineItem] """All of the line items associated with this credit note.""" - maximum_amount_adjustment: Optional[object] + maximum_amount_adjustment: Optional[MaximumAmountAdjustment] """The maximum amount applied on the original invoice""" memo: Optional[str] @@ -82,7 +156,7 @@ class CreditNote(BaseModel): minimum_amount_refunded: Optional[str] """Any credited amount from the applied minimum on the invoice.""" - reason: Literal["Duplicate", "Fraudulent", "Order change", "Product unsatisfactory"] + reason: Optional[Literal["Duplicate", "Fraudulent", "Order change", "Product unsatisfactory"]] subtotal: str """The total prior to any creditable invoice-level discounts or minimums.""" diff --git a/src/orb/types/customer.py b/src/orb/types/customer.py index 7f09aaa5..b24830f7 100644 --- a/src/orb/types/customer.py +++ b/src/orb/types/customer.py @@ -46,9 +46,122 @@ class ShippingAddress(BaseModel): class TaxID(BaseModel): - country: str - - type: str + country: Literal[ + "AE", + "AT", + "AU", + "BE", + "BG", + "BR", + "CA", + "CH", + "CL", + "CY", + "CZ", + "DE", + "DK", + "EE", + "EG", + "ES", + "EU", + "FI", + "FR", + "GB", + "GE", + "GR", + "HK", + "HR", + "HU", + "ID", + "IE", + "IL", + "IN", + "IS", + "IT", + "JP", + "KE", + "KR", + "LI", + "LT", + "LU", + "LV", + "MT", + "MX", + "MY", + "NL", + "NO", + "NZ", + "PH", + "PL", + "PT", + "RO", + "RU", + "SA", + "SE", + "SG", + "SI", + "SK", + "TH", + "TR", + "TW", + "UA", + "US", + "ZA", + ] + + type: Literal[ + "ae_trn", + "eu_vat", + "au_abn", + "au_arn", + "bg_uic", + "br_cnpj", + "br_cpf", + "ca_bn", + "ca_gst_hst", + "ca_pst_bc", + "ca_pst_mb", + "ca_pst_sk", + "ca_qst", + "ch_vat", + "cl_tin", + "eg_tin", + "es_cif", + "eu_oss_vat", + "gb_vat", + "ge_vat", + "hk_br", + "hu_tin", + "id_npwp", + "il_vat", + "in_gst", + "is_vat", + "jp_cn", + "jp_rn", + "jp_trn", + "ke_pin", + "kr_brn", + "li_uid", + "mx_rfc", + "my_frp", + "my_itn", + "my_sst", + "no_vat", + "nz_gst", + "ph_tin", + "ru_inn", + "ru_kpp", + "sa_vat", + "sg_gst", + "sg_uen", + "si_tin", + "th_vat", + "tr_tin", + "tw_vat", + "ua_vat", + "us_ein", + "za_vat", + ] value: str @@ -124,6 +237,92 @@ class Customer(BaseModel): shipping_address: Optional[ShippingAddress] tax_id: Optional[TaxID] + """ + Tax IDs are commonly required to be displayed on customer invoices, which are + added to the headers of invoices. + + ### Supported Tax ID Countries and Types + + | Country | Type | Description | + | -------------------- | ------------ | ------------------------------------------------------------------------------------------------------- | + | Australia | `au_abn` | Australian Business Number (AU ABN) | + | Australia | `au_arn` | Australian Taxation Office Reference Number | + | Austria | `eu_vat` | European VAT number | + | Belgium | `eu_vat` | European VAT number | + | Brazil | `br_cnpj` | Brazilian CNPJ number | + | Brazil | `br_cpf` | Brazilian CPF number | + | Bulgaria | `bg_uic` | Bulgaria Unified Identification Code | + | Bulgaria | `eu_vat` | European VAT number | + | Canada | `ca_bn` | Canadian BN | + | Canada | `ca_gst_hst` | Canadian GST/HST number | + | Canada | `ca_pst_bc` | Canadian PST number (British Columbia) | + | Canada | `ca_pst_mb` | Canadian PST number (Manitoba) | + | Canada | `ca_pst_sk` | Canadian PST number (Saskatchewan) | + | Canada | `ca_qst` | Canadian QST number (Québec) | + | Chile | `cl_tin` | Chilean TIN | + | Croatia | `eu_vat` | European VAT number | + | Cyprus | `eu_vat` | European VAT number | + | Czech Republic | `eu_vat` | European VAT number | + | Denmark | `eu_vat` | European VAT number | + | Egypt | `eg_tin` | Egyptian Tax Identification Number | + | Estonia | `eu_vat` | European VAT number | + | EU | `eu_oss_vat` | European One Stop Shop VAT number for non-Union scheme | + | Finland | `eu_vat` | European VAT number | + | France | `eu_vat` | European VAT number | + | Georgia | `ge_vat` | Georgian VAT | + | Germany | `eu_vat` | European VAT number | + | Greece | `eu_vat` | European VAT number | + | Hong Kong | `hk_br` | Hong Kong BR number | + | Hungary | `eu_vat` | European VAT number | + | Hungary | `hu_tin` | Hungary tax number (adószám) | + | Iceland | `is_vat` | Icelandic VAT | + | India | `in_gst` | Indian GST number | + | Indonesia | `id_npwp` | Indonesian NPWP number | + | Ireland | `eu_vat` | European VAT number | + | Israel | `il_vat` | Israel VAT | + | Italy | `eu_vat` | European VAT number | + | Japan | `jp_cn` | Japanese Corporate Number (_Hōjin Bangō_) | + | Japan | `jp_rn` | Japanese Registered Foreign Businesses' Registration Number (_Tōroku Kokugai Jigyōsha no Tōroku Bangō_) | + | Japan | `jp_trn` | Japanese Tax Registration Number (_Tōroku Bangō_) | + | Kenya | `ke_pin` | Kenya Revenue Authority Personal Identification Number | + | Latvia | `eu_vat` | European VAT number | + | Liechtenstein | `li_uid` | Liechtensteinian UID number | + | Lithuania | `eu_vat` | European VAT number | + | Luxembourg | `eu_vat` | European VAT number | + | Malaysia | `my_frp` | Malaysian FRP number | + | Malaysia | `my_itn` | Malaysian ITN | + | Malaysia | `my_sst` | Malaysian SST number | + | Malta | `eu_vat ` | European VAT number | + | Mexico | `mx_rfc` | Mexican RFC number | + | Netherlands | `eu_vat` | European VAT number | + | New Zealand | `nz_gst` | New Zealand GST number | + | Norway | `no_vat` | Norwegian VAT number | + | Philippines | `ph_tin ` | Philippines Tax Identification Number | + | Poland | `eu_vat` | European VAT number | + | Portugal | `eu_vat` | European VAT number | + | Romania | `eu_vat` | European VAT number | + | Russia | `ru_inn` | Russian INN | + | Russia | `ru_kpp` | Russian KPP | + | Saudi Arabia | `sg_gst` | Singaporean GST | + | Singapore | `sg_uen` | Singaporean UEN | + | Slovakia | `eu_vat` | European VAT number | + | Slovenia | `eu_vat` | European VAT number | + | Slovenia | `si_tin` | Slovenia tax number (davčna številka) | + | South Africa | `za_vat` | South African VAT number | + | South Korea | `kr_brn` | Korean BRN | + | Spain | `es_cif` | Spanish NIF number (previously Spanish CIF number) | + | Spain | `eu_vat` | European VAT number | + | Sweden | `eu_vat` | European VAT number | + | Switzerland | `ch_vat` | Switzerland VAT number | + | Taiwan | `tw_vat` | Taiwanese VAT | + | Thailand | `th_vat` | Thai VAT | + | Turkey | `tr_tin` | Turkish Tax Identification Number | + | Ukraine | `ua_vat` | Ukrainian VAT | + | United Arab Emirates | `ae_trn` | United Arab Emirates TRN | + | United Kingdom | `eu_vat` | Northern Ireland VAT number | + | United Kingdom | `gb_vat` | United Kingdom VAT number | + | United States | `us_ein` | United States EIN | + """ timezone: str """ diff --git a/src/orb/types/customer_create_params.py b/src/orb/types/customer_create_params.py index 58e2ea69..d6ae43b0 100644 --- a/src/orb/types/customer_create_params.py +++ b/src/orb/types/customer_create_params.py @@ -83,6 +83,92 @@ class CustomerCreateParams(TypedDict, total=False): shipping_address: Optional[ShippingAddress] tax_id: Optional[TaxID] + """ + Tax IDs are commonly required to be displayed on customer invoices, which are + added to the headers of invoices. + + ### Supported Tax ID Countries and Types + + | Country | Type | Description | + | -------------------- | ------------ | ------------------------------------------------------------------------------------------------------- | + | Australia | `au_abn` | Australian Business Number (AU ABN) | + | Australia | `au_arn` | Australian Taxation Office Reference Number | + | Austria | `eu_vat` | European VAT number | + | Belgium | `eu_vat` | European VAT number | + | Brazil | `br_cnpj` | Brazilian CNPJ number | + | Brazil | `br_cpf` | Brazilian CPF number | + | Bulgaria | `bg_uic` | Bulgaria Unified Identification Code | + | Bulgaria | `eu_vat` | European VAT number | + | Canada | `ca_bn` | Canadian BN | + | Canada | `ca_gst_hst` | Canadian GST/HST number | + | Canada | `ca_pst_bc` | Canadian PST number (British Columbia) | + | Canada | `ca_pst_mb` | Canadian PST number (Manitoba) | + | Canada | `ca_pst_sk` | Canadian PST number (Saskatchewan) | + | Canada | `ca_qst` | Canadian QST number (Québec) | + | Chile | `cl_tin` | Chilean TIN | + | Croatia | `eu_vat` | European VAT number | + | Cyprus | `eu_vat` | European VAT number | + | Czech Republic | `eu_vat` | European VAT number | + | Denmark | `eu_vat` | European VAT number | + | Egypt | `eg_tin` | Egyptian Tax Identification Number | + | Estonia | `eu_vat` | European VAT number | + | EU | `eu_oss_vat` | European One Stop Shop VAT number for non-Union scheme | + | Finland | `eu_vat` | European VAT number | + | France | `eu_vat` | European VAT number | + | Georgia | `ge_vat` | Georgian VAT | + | Germany | `eu_vat` | European VAT number | + | Greece | `eu_vat` | European VAT number | + | Hong Kong | `hk_br` | Hong Kong BR number | + | Hungary | `eu_vat` | European VAT number | + | Hungary | `hu_tin` | Hungary tax number (adószám) | + | Iceland | `is_vat` | Icelandic VAT | + | India | `in_gst` | Indian GST number | + | Indonesia | `id_npwp` | Indonesian NPWP number | + | Ireland | `eu_vat` | European VAT number | + | Israel | `il_vat` | Israel VAT | + | Italy | `eu_vat` | European VAT number | + | Japan | `jp_cn` | Japanese Corporate Number (_Hōjin Bangō_) | + | Japan | `jp_rn` | Japanese Registered Foreign Businesses' Registration Number (_Tōroku Kokugai Jigyōsha no Tōroku Bangō_) | + | Japan | `jp_trn` | Japanese Tax Registration Number (_Tōroku Bangō_) | + | Kenya | `ke_pin` | Kenya Revenue Authority Personal Identification Number | + | Latvia | `eu_vat` | European VAT number | + | Liechtenstein | `li_uid` | Liechtensteinian UID number | + | Lithuania | `eu_vat` | European VAT number | + | Luxembourg | `eu_vat` | European VAT number | + | Malaysia | `my_frp` | Malaysian FRP number | + | Malaysia | `my_itn` | Malaysian ITN | + | Malaysia | `my_sst` | Malaysian SST number | + | Malta | `eu_vat ` | European VAT number | + | Mexico | `mx_rfc` | Mexican RFC number | + | Netherlands | `eu_vat` | European VAT number | + | New Zealand | `nz_gst` | New Zealand GST number | + | Norway | `no_vat` | Norwegian VAT number | + | Philippines | `ph_tin ` | Philippines Tax Identification Number | + | Poland | `eu_vat` | European VAT number | + | Portugal | `eu_vat` | European VAT number | + | Romania | `eu_vat` | European VAT number | + | Russia | `ru_inn` | Russian INN | + | Russia | `ru_kpp` | Russian KPP | + | Saudi Arabia | `sg_gst` | Singaporean GST | + | Singapore | `sg_uen` | Singaporean UEN | + | Slovakia | `eu_vat` | European VAT number | + | Slovenia | `eu_vat` | European VAT number | + | Slovenia | `si_tin` | Slovenia tax number (davčna številka) | + | South Africa | `za_vat` | South African VAT number | + | South Korea | `kr_brn` | Korean BRN | + | Spain | `es_cif` | Spanish NIF number (previously Spanish CIF number) | + | Spain | `eu_vat` | European VAT number | + | Sweden | `eu_vat` | European VAT number | + | Switzerland | `ch_vat` | Switzerland VAT number | + | Taiwan | `tw_vat` | Taiwanese VAT | + | Thailand | `th_vat` | Thai VAT | + | Turkey | `tr_tin` | Turkish Tax Identification Number | + | Ukraine | `ua_vat` | Ukrainian VAT | + | United Arab Emirates | `ae_trn` | United Arab Emirates TRN | + | United Kingdom | `eu_vat` | Northern Ireland VAT number | + | United Kingdom | `gb_vat` | United Kingdom VAT number | + | United States | `us_ein` | United States EIN | + """ timezone: Optional[str] """ @@ -137,8 +223,125 @@ class ShippingAddress(TypedDict, total=False): class TaxID(TypedDict, total=False): - country: Required[str] - - type: Required[str] + country: Required[ + Literal[ + "AE", + "AT", + "AU", + "BE", + "BG", + "BR", + "CA", + "CH", + "CL", + "CY", + "CZ", + "DE", + "DK", + "EE", + "EG", + "ES", + "EU", + "FI", + "FR", + "GB", + "GE", + "GR", + "HK", + "HR", + "HU", + "ID", + "IE", + "IL", + "IN", + "IS", + "IT", + "JP", + "KE", + "KR", + "LI", + "LT", + "LU", + "LV", + "MT", + "MX", + "MY", + "NL", + "NO", + "NZ", + "PH", + "PL", + "PT", + "RO", + "RU", + "SA", + "SE", + "SG", + "SI", + "SK", + "TH", + "TR", + "TW", + "UA", + "US", + "ZA", + ] + ] + + type: Required[ + Literal[ + "ae_trn", + "eu_vat", + "au_abn", + "au_arn", + "bg_uic", + "br_cnpj", + "br_cpf", + "ca_bn", + "ca_gst_hst", + "ca_pst_bc", + "ca_pst_mb", + "ca_pst_sk", + "ca_qst", + "ch_vat", + "cl_tin", + "eg_tin", + "es_cif", + "eu_oss_vat", + "gb_vat", + "ge_vat", + "hk_br", + "hu_tin", + "id_npwp", + "il_vat", + "in_gst", + "is_vat", + "jp_cn", + "jp_rn", + "jp_trn", + "ke_pin", + "kr_brn", + "li_uid", + "mx_rfc", + "my_frp", + "my_itn", + "my_sst", + "no_vat", + "nz_gst", + "ph_tin", + "ru_inn", + "ru_kpp", + "sa_vat", + "sg_gst", + "sg_uen", + "si_tin", + "th_vat", + "tr_tin", + "tw_vat", + "ua_vat", + "us_ein", + "za_vat", + ] + ] value: Required[str] diff --git a/src/orb/types/customer_update_by_external_id_params.py b/src/orb/types/customer_update_by_external_id_params.py index 46928bc8..60173ee6 100644 --- a/src/orb/types/customer_update_by_external_id_params.py +++ b/src/orb/types/customer_update_by_external_id_params.py @@ -83,6 +83,92 @@ class CustomerUpdateByExternalIDParams(TypedDict, total=False): shipping_address: Optional[ShippingAddress] tax_id: Optional[TaxID] + """ + Tax IDs are commonly required to be displayed on customer invoices, which are + added to the headers of invoices. + + ### Supported Tax ID Countries and Types + + | Country | Type | Description | + | -------------------- | ------------ | ------------------------------------------------------------------------------------------------------- | + | Australia | `au_abn` | Australian Business Number (AU ABN) | + | Australia | `au_arn` | Australian Taxation Office Reference Number | + | Austria | `eu_vat` | European VAT number | + | Belgium | `eu_vat` | European VAT number | + | Brazil | `br_cnpj` | Brazilian CNPJ number | + | Brazil | `br_cpf` | Brazilian CPF number | + | Bulgaria | `bg_uic` | Bulgaria Unified Identification Code | + | Bulgaria | `eu_vat` | European VAT number | + | Canada | `ca_bn` | Canadian BN | + | Canada | `ca_gst_hst` | Canadian GST/HST number | + | Canada | `ca_pst_bc` | Canadian PST number (British Columbia) | + | Canada | `ca_pst_mb` | Canadian PST number (Manitoba) | + | Canada | `ca_pst_sk` | Canadian PST number (Saskatchewan) | + | Canada | `ca_qst` | Canadian QST number (Québec) | + | Chile | `cl_tin` | Chilean TIN | + | Croatia | `eu_vat` | European VAT number | + | Cyprus | `eu_vat` | European VAT number | + | Czech Republic | `eu_vat` | European VAT number | + | Denmark | `eu_vat` | European VAT number | + | Egypt | `eg_tin` | Egyptian Tax Identification Number | + | Estonia | `eu_vat` | European VAT number | + | EU | `eu_oss_vat` | European One Stop Shop VAT number for non-Union scheme | + | Finland | `eu_vat` | European VAT number | + | France | `eu_vat` | European VAT number | + | Georgia | `ge_vat` | Georgian VAT | + | Germany | `eu_vat` | European VAT number | + | Greece | `eu_vat` | European VAT number | + | Hong Kong | `hk_br` | Hong Kong BR number | + | Hungary | `eu_vat` | European VAT number | + | Hungary | `hu_tin` | Hungary tax number (adószám) | + | Iceland | `is_vat` | Icelandic VAT | + | India | `in_gst` | Indian GST number | + | Indonesia | `id_npwp` | Indonesian NPWP number | + | Ireland | `eu_vat` | European VAT number | + | Israel | `il_vat` | Israel VAT | + | Italy | `eu_vat` | European VAT number | + | Japan | `jp_cn` | Japanese Corporate Number (_Hōjin Bangō_) | + | Japan | `jp_rn` | Japanese Registered Foreign Businesses' Registration Number (_Tōroku Kokugai Jigyōsha no Tōroku Bangō_) | + | Japan | `jp_trn` | Japanese Tax Registration Number (_Tōroku Bangō_) | + | Kenya | `ke_pin` | Kenya Revenue Authority Personal Identification Number | + | Latvia | `eu_vat` | European VAT number | + | Liechtenstein | `li_uid` | Liechtensteinian UID number | + | Lithuania | `eu_vat` | European VAT number | + | Luxembourg | `eu_vat` | European VAT number | + | Malaysia | `my_frp` | Malaysian FRP number | + | Malaysia | `my_itn` | Malaysian ITN | + | Malaysia | `my_sst` | Malaysian SST number | + | Malta | `eu_vat ` | European VAT number | + | Mexico | `mx_rfc` | Mexican RFC number | + | Netherlands | `eu_vat` | European VAT number | + | New Zealand | `nz_gst` | New Zealand GST number | + | Norway | `no_vat` | Norwegian VAT number | + | Philippines | `ph_tin ` | Philippines Tax Identification Number | + | Poland | `eu_vat` | European VAT number | + | Portugal | `eu_vat` | European VAT number | + | Romania | `eu_vat` | European VAT number | + | Russia | `ru_inn` | Russian INN | + | Russia | `ru_kpp` | Russian KPP | + | Saudi Arabia | `sg_gst` | Singaporean GST | + | Singapore | `sg_uen` | Singaporean UEN | + | Slovakia | `eu_vat` | European VAT number | + | Slovenia | `eu_vat` | European VAT number | + | Slovenia | `si_tin` | Slovenia tax number (davčna številka) | + | South Africa | `za_vat` | South African VAT number | + | South Korea | `kr_brn` | Korean BRN | + | Spain | `es_cif` | Spanish NIF number (previously Spanish CIF number) | + | Spain | `eu_vat` | European VAT number | + | Sweden | `eu_vat` | European VAT number | + | Switzerland | `ch_vat` | Switzerland VAT number | + | Taiwan | `tw_vat` | Taiwanese VAT | + | Thailand | `th_vat` | Thai VAT | + | Turkey | `tr_tin` | Turkish Tax Identification Number | + | Ukraine | `ua_vat` | Ukrainian VAT | + | United Arab Emirates | `ae_trn` | United Arab Emirates TRN | + | United Kingdom | `eu_vat` | Northern Ireland VAT number | + | United Kingdom | `gb_vat` | United Kingdom VAT number | + | United States | `us_ein` | United States EIN | + """ class AccountingSyncConfigurationAccountingProvider(TypedDict, total=False): @@ -130,8 +216,125 @@ class ShippingAddress(TypedDict, total=False): class TaxID(TypedDict, total=False): - country: Required[str] - - type: Required[str] + country: Required[ + Literal[ + "AE", + "AT", + "AU", + "BE", + "BG", + "BR", + "CA", + "CH", + "CL", + "CY", + "CZ", + "DE", + "DK", + "EE", + "EG", + "ES", + "EU", + "FI", + "FR", + "GB", + "GE", + "GR", + "HK", + "HR", + "HU", + "ID", + "IE", + "IL", + "IN", + "IS", + "IT", + "JP", + "KE", + "KR", + "LI", + "LT", + "LU", + "LV", + "MT", + "MX", + "MY", + "NL", + "NO", + "NZ", + "PH", + "PL", + "PT", + "RO", + "RU", + "SA", + "SE", + "SG", + "SI", + "SK", + "TH", + "TR", + "TW", + "UA", + "US", + "ZA", + ] + ] + + type: Required[ + Literal[ + "ae_trn", + "eu_vat", + "au_abn", + "au_arn", + "bg_uic", + "br_cnpj", + "br_cpf", + "ca_bn", + "ca_gst_hst", + "ca_pst_bc", + "ca_pst_mb", + "ca_pst_sk", + "ca_qst", + "ch_vat", + "cl_tin", + "eg_tin", + "es_cif", + "eu_oss_vat", + "gb_vat", + "ge_vat", + "hk_br", + "hu_tin", + "id_npwp", + "il_vat", + "in_gst", + "is_vat", + "jp_cn", + "jp_rn", + "jp_trn", + "ke_pin", + "kr_brn", + "li_uid", + "mx_rfc", + "my_frp", + "my_itn", + "my_sst", + "no_vat", + "nz_gst", + "ph_tin", + "ru_inn", + "ru_kpp", + "sa_vat", + "sg_gst", + "sg_uen", + "si_tin", + "th_vat", + "tr_tin", + "tw_vat", + "ua_vat", + "us_ein", + "za_vat", + ] + ] value: Required[str] diff --git a/src/orb/types/customer_update_params.py b/src/orb/types/customer_update_params.py index 730f4c65..b8c4286b 100644 --- a/src/orb/types/customer_update_params.py +++ b/src/orb/types/customer_update_params.py @@ -83,6 +83,92 @@ class CustomerUpdateParams(TypedDict, total=False): shipping_address: Optional[ShippingAddress] tax_id: Optional[TaxID] + """ + Tax IDs are commonly required to be displayed on customer invoices, which are + added to the headers of invoices. + + ### Supported Tax ID Countries and Types + + | Country | Type | Description | + | -------------------- | ------------ | ------------------------------------------------------------------------------------------------------- | + | Australia | `au_abn` | Australian Business Number (AU ABN) | + | Australia | `au_arn` | Australian Taxation Office Reference Number | + | Austria | `eu_vat` | European VAT number | + | Belgium | `eu_vat` | European VAT number | + | Brazil | `br_cnpj` | Brazilian CNPJ number | + | Brazil | `br_cpf` | Brazilian CPF number | + | Bulgaria | `bg_uic` | Bulgaria Unified Identification Code | + | Bulgaria | `eu_vat` | European VAT number | + | Canada | `ca_bn` | Canadian BN | + | Canada | `ca_gst_hst` | Canadian GST/HST number | + | Canada | `ca_pst_bc` | Canadian PST number (British Columbia) | + | Canada | `ca_pst_mb` | Canadian PST number (Manitoba) | + | Canada | `ca_pst_sk` | Canadian PST number (Saskatchewan) | + | Canada | `ca_qst` | Canadian QST number (Québec) | + | Chile | `cl_tin` | Chilean TIN | + | Croatia | `eu_vat` | European VAT number | + | Cyprus | `eu_vat` | European VAT number | + | Czech Republic | `eu_vat` | European VAT number | + | Denmark | `eu_vat` | European VAT number | + | Egypt | `eg_tin` | Egyptian Tax Identification Number | + | Estonia | `eu_vat` | European VAT number | + | EU | `eu_oss_vat` | European One Stop Shop VAT number for non-Union scheme | + | Finland | `eu_vat` | European VAT number | + | France | `eu_vat` | European VAT number | + | Georgia | `ge_vat` | Georgian VAT | + | Germany | `eu_vat` | European VAT number | + | Greece | `eu_vat` | European VAT number | + | Hong Kong | `hk_br` | Hong Kong BR number | + | Hungary | `eu_vat` | European VAT number | + | Hungary | `hu_tin` | Hungary tax number (adószám) | + | Iceland | `is_vat` | Icelandic VAT | + | India | `in_gst` | Indian GST number | + | Indonesia | `id_npwp` | Indonesian NPWP number | + | Ireland | `eu_vat` | European VAT number | + | Israel | `il_vat` | Israel VAT | + | Italy | `eu_vat` | European VAT number | + | Japan | `jp_cn` | Japanese Corporate Number (_Hōjin Bangō_) | + | Japan | `jp_rn` | Japanese Registered Foreign Businesses' Registration Number (_Tōroku Kokugai Jigyōsha no Tōroku Bangō_) | + | Japan | `jp_trn` | Japanese Tax Registration Number (_Tōroku Bangō_) | + | Kenya | `ke_pin` | Kenya Revenue Authority Personal Identification Number | + | Latvia | `eu_vat` | European VAT number | + | Liechtenstein | `li_uid` | Liechtensteinian UID number | + | Lithuania | `eu_vat` | European VAT number | + | Luxembourg | `eu_vat` | European VAT number | + | Malaysia | `my_frp` | Malaysian FRP number | + | Malaysia | `my_itn` | Malaysian ITN | + | Malaysia | `my_sst` | Malaysian SST number | + | Malta | `eu_vat ` | European VAT number | + | Mexico | `mx_rfc` | Mexican RFC number | + | Netherlands | `eu_vat` | European VAT number | + | New Zealand | `nz_gst` | New Zealand GST number | + | Norway | `no_vat` | Norwegian VAT number | + | Philippines | `ph_tin ` | Philippines Tax Identification Number | + | Poland | `eu_vat` | European VAT number | + | Portugal | `eu_vat` | European VAT number | + | Romania | `eu_vat` | European VAT number | + | Russia | `ru_inn` | Russian INN | + | Russia | `ru_kpp` | Russian KPP | + | Saudi Arabia | `sg_gst` | Singaporean GST | + | Singapore | `sg_uen` | Singaporean UEN | + | Slovakia | `eu_vat` | European VAT number | + | Slovenia | `eu_vat` | European VAT number | + | Slovenia | `si_tin` | Slovenia tax number (davčna številka) | + | South Africa | `za_vat` | South African VAT number | + | South Korea | `kr_brn` | Korean BRN | + | Spain | `es_cif` | Spanish NIF number (previously Spanish CIF number) | + | Spain | `eu_vat` | European VAT number | + | Sweden | `eu_vat` | European VAT number | + | Switzerland | `ch_vat` | Switzerland VAT number | + | Taiwan | `tw_vat` | Taiwanese VAT | + | Thailand | `th_vat` | Thai VAT | + | Turkey | `tr_tin` | Turkish Tax Identification Number | + | Ukraine | `ua_vat` | Ukrainian VAT | + | United Arab Emirates | `ae_trn` | United Arab Emirates TRN | + | United Kingdom | `eu_vat` | Northern Ireland VAT number | + | United Kingdom | `gb_vat` | United Kingdom VAT number | + | United States | `us_ein` | United States EIN | + """ class AccountingSyncConfigurationAccountingProvider(TypedDict, total=False): @@ -130,8 +216,125 @@ class ShippingAddress(TypedDict, total=False): class TaxID(TypedDict, total=False): - country: Required[str] - - type: Required[str] + country: Required[ + Literal[ + "AE", + "AT", + "AU", + "BE", + "BG", + "BR", + "CA", + "CH", + "CL", + "CY", + "CZ", + "DE", + "DK", + "EE", + "EG", + "ES", + "EU", + "FI", + "FR", + "GB", + "GE", + "GR", + "HK", + "HR", + "HU", + "ID", + "IE", + "IL", + "IN", + "IS", + "IT", + "JP", + "KE", + "KR", + "LI", + "LT", + "LU", + "LV", + "MT", + "MX", + "MY", + "NL", + "NO", + "NZ", + "PH", + "PL", + "PT", + "RO", + "RU", + "SA", + "SE", + "SG", + "SI", + "SK", + "TH", + "TR", + "TW", + "UA", + "US", + "ZA", + ] + ] + + type: Required[ + Literal[ + "ae_trn", + "eu_vat", + "au_abn", + "au_arn", + "bg_uic", + "br_cnpj", + "br_cpf", + "ca_bn", + "ca_gst_hst", + "ca_pst_bc", + "ca_pst_mb", + "ca_pst_sk", + "ca_qst", + "ch_vat", + "cl_tin", + "eg_tin", + "es_cif", + "eu_oss_vat", + "gb_vat", + "ge_vat", + "hk_br", + "hu_tin", + "id_npwp", + "il_vat", + "in_gst", + "is_vat", + "jp_cn", + "jp_rn", + "jp_trn", + "ke_pin", + "kr_brn", + "li_uid", + "mx_rfc", + "my_frp", + "my_itn", + "my_sst", + "no_vat", + "nz_gst", + "ph_tin", + "ru_inn", + "ru_kpp", + "sa_vat", + "sg_gst", + "sg_uen", + "si_tin", + "th_vat", + "tr_tin", + "tw_vat", + "ua_vat", + "us_ein", + "za_vat", + ] + ] value: Required[str] diff --git a/src/orb/types/customers/balance_transaction_create_response.py b/src/orb/types/customers/balance_transaction_create_response.py index 9fc78d23..a5707cd4 100644 --- a/src/orb/types/customers/balance_transaction_create_response.py +++ b/src/orb/types/customers/balance_transaction_create_response.py @@ -23,7 +23,16 @@ class BalanceTransactionCreateResponse(BaseModel): id: str """A unique id for this transaction.""" - action: Literal["applied_to_invoice", "prorated_refund", "manual_adjustment"] + action: Literal[ + "applied_to_invoice", + "manual_adjustment", + "prorated_refund", + "revert_prorated_refund", + "return_from_voiding", + "credit_note_applied", + "credit_note_voided", + "overpayment_refund", + ] amount: str """The value of the amount changed in the transaction.""" diff --git a/src/orb/types/customers/balance_transaction_list_response.py b/src/orb/types/customers/balance_transaction_list_response.py index fe987ed1..20ad3f49 100644 --- a/src/orb/types/customers/balance_transaction_list_response.py +++ b/src/orb/types/customers/balance_transaction_list_response.py @@ -23,7 +23,16 @@ class BalanceTransactionListResponse(BaseModel): id: str """A unique id for this transaction.""" - action: Literal["applied_to_invoice", "prorated_refund", "manual_adjustment"] + action: Literal[ + "applied_to_invoice", + "manual_adjustment", + "prorated_refund", + "revert_prorated_refund", + "return_from_voiding", + "credit_note_applied", + "credit_note_voided", + "overpayment_refund", + ] amount: str """The value of the amount changed in the transaction.""" diff --git a/src/orb/types/customers/usage_update_by_external_id_params.py b/src/orb/types/customers/usage_update_by_external_id_params.py index 85ab0fa8..99eeb64c 100644 --- a/src/orb/types/customers/usage_update_by_external_id_params.py +++ b/src/orb/types/customers/usage_update_by_external_id_params.py @@ -2,16 +2,30 @@ from __future__ import annotations -from typing import Union, Optional +from typing import List, Union, Optional from datetime import datetime from typing_extensions import Required, Annotated, TypedDict from ..._utils import PropertyInfo -__all__ = ["UsageUpdateByExternalIDParams"] +__all__ = ["UsageUpdateByExternalIDParams", "Event"] class UsageUpdateByExternalIDParams(TypedDict, total=False): + events: Required[List[Event]] + """Events to update""" + + timeframe_end: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] + """This bound is exclusive (i.e. events before this timestamp will be updated)""" + + timeframe_start: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] + """This bound is inclusive (i.e. + + events with this timestamp onward, inclusive will be updated) + """ + + +class Event(TypedDict, total=False): event_name: Required[str] """A name to meaningfully identify the action or event type.""" @@ -29,15 +43,6 @@ class UsageUpdateByExternalIDParams(TypedDict, total=False): particularly important to attribute usage to a given billing period. """ - timeframe_end: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] - """This bound is exclusive (i.e. events before this timestamp will be updated)""" - - timeframe_start: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] - """This bound is inclusive (i.e. - - events with this timestamp onward, inclusive will be updated) - """ - customer_id: Optional[str] """The Orb Customer identifier""" diff --git a/src/orb/types/customers/usage_update_params.py b/src/orb/types/customers/usage_update_params.py index 934f87f5..e6d71faa 100644 --- a/src/orb/types/customers/usage_update_params.py +++ b/src/orb/types/customers/usage_update_params.py @@ -2,16 +2,30 @@ from __future__ import annotations -from typing import Union, Optional +from typing import List, Union, Optional from datetime import datetime from typing_extensions import Required, Annotated, TypedDict from ..._utils import PropertyInfo -__all__ = ["UsageUpdateParams"] +__all__ = ["UsageUpdateParams", "Event"] class UsageUpdateParams(TypedDict, total=False): + events: Required[List[Event]] + """Events to update""" + + timeframe_end: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] + """This bound is exclusive (i.e. events before this timestamp will be updated)""" + + timeframe_start: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] + """This bound is inclusive (i.e. + + events with this timestamp onward, inclusive will be updated) + """ + + +class Event(TypedDict, total=False): event_name: Required[str] """A name to meaningfully identify the action or event type.""" @@ -29,15 +43,6 @@ class UsageUpdateParams(TypedDict, total=False): particularly important to attribute usage to a given billing period. """ - timeframe_end: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] - """This bound is exclusive (i.e. events before this timestamp will be updated)""" - - timeframe_start: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] - """This bound is inclusive (i.e. - - events with this timestamp onward, inclusive will be updated) - """ - customer_id: Optional[str] """The Orb Customer identifier""" diff --git a/src/orb/types/discount_param.py b/src/orb/types/discount_param.py deleted file mode 100644 index ff43d2d1..00000000 --- a/src/orb/types/discount_param.py +++ /dev/null @@ -1,36 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. - -from __future__ import annotations - -from typing import List, Optional -from typing_extensions import Literal, Required, TypedDict - -__all__ = ["DiscountParam"] - - -class DiscountParam(TypedDict, total=False): - discount_type: Required[Literal["percentage", "trial", "usage", "amount"]] - - amount_discount: Optional[str] - """Only available if discount_type is `amount`.""" - - applies_to_price_ids: Optional[List[str]] - """List of price_ids that this discount applies to. - - For plan/plan phase discounts, this can be a subset of prices. - """ - - percentage_discount: Optional[float] - """Only available if discount_type is `percentage`. - - This is a number between 0 and 1. - """ - - trial_amount_discount: Optional[str] - """Only available if discount_type is `trial`""" - - usage_discount: Optional[float] - """Only available if discount_type is `usage`. - - Number of usage units that this discount is for - """ diff --git a/src/orb/types/invoice.py b/src/orb/types/invoice.py index 52465c98..7cfacb27 100644 --- a/src/orb/types/invoice.py +++ b/src/orb/types/invoice.py @@ -5,8 +5,8 @@ from typing_extensions import Literal from .price import Price +from .shared import Discount from .._models import BaseModel -from .invoice_discount import InvoiceDiscount __all__ = [ "Invoice", @@ -112,7 +112,16 @@ class CustomerBalanceTransaction(BaseModel): id: str """A unique id for this transaction.""" - action: Literal["applied_to_invoice", "prorated_refund", "manual_adjustment"] + action: Literal[ + "applied_to_invoice", + "manual_adjustment", + "prorated_refund", + "revert_prorated_refund", + "return_from_voiding", + "credit_note_applied", + "credit_note_voided", + "overpayment_refund", + ] amount: str """The value of the amount changed in the transaction.""" @@ -143,9 +152,122 @@ class CustomerBalanceTransaction(BaseModel): class CustomerTaxID(BaseModel): - country: str - - type: str + country: Literal[ + "AE", + "AT", + "AU", + "BE", + "BG", + "BR", + "CA", + "CH", + "CL", + "CY", + "CZ", + "DE", + "DK", + "EE", + "EG", + "ES", + "EU", + "FI", + "FR", + "GB", + "GE", + "GR", + "HK", + "HR", + "HU", + "ID", + "IE", + "IL", + "IN", + "IS", + "IT", + "JP", + "KE", + "KR", + "LI", + "LT", + "LU", + "LV", + "MT", + "MX", + "MY", + "NL", + "NO", + "NZ", + "PH", + "PL", + "PT", + "RO", + "RU", + "SA", + "SE", + "SG", + "SI", + "SK", + "TH", + "TR", + "TW", + "UA", + "US", + "ZA", + ] + + type: Literal[ + "ae_trn", + "eu_vat", + "au_abn", + "au_arn", + "bg_uic", + "br_cnpj", + "br_cpf", + "ca_bn", + "ca_gst_hst", + "ca_pst_bc", + "ca_pst_mb", + "ca_pst_sk", + "ca_qst", + "ch_vat", + "cl_tin", + "eg_tin", + "es_cif", + "eu_oss_vat", + "gb_vat", + "ge_vat", + "hk_br", + "hu_tin", + "id_npwp", + "il_vat", + "in_gst", + "is_vat", + "jp_cn", + "jp_rn", + "jp_trn", + "ke_pin", + "kr_brn", + "li_uid", + "mx_rfc", + "my_frp", + "my_itn", + "my_sst", + "no_vat", + "nz_gst", + "ph_tin", + "ru_inn", + "ru_kpp", + "sa_vat", + "sg_gst", + "sg_uen", + "si_tin", + "th_vat", + "tr_tin", + "tw_vat", + "ua_vat", + "us_ein", + "za_vat", + ] value: str @@ -272,7 +394,7 @@ class LineItem(BaseModel): amount: str """The final amount after any discounts or minimums.""" - discount: Optional[InvoiceDiscount] + discount: Optional[Discount] end_date: datetime """The end date of the range of time applied for this line item's price.""" @@ -618,10 +740,96 @@ class Invoice(BaseModel): customer_balance_transactions: List[CustomerBalanceTransaction] customer_tax_id: Optional[CustomerTaxID] - - discount: Optional[InvoiceDiscount] - - discounts: List[InvoiceDiscount] + """ + Tax IDs are commonly required to be displayed on customer invoices, which are + added to the headers of invoices. + + ### Supported Tax ID Countries and Types + + | Country | Type | Description | + | -------------------- | ------------ | ------------------------------------------------------------------------------------------------------- | + | Australia | `au_abn` | Australian Business Number (AU ABN) | + | Australia | `au_arn` | Australian Taxation Office Reference Number | + | Austria | `eu_vat` | European VAT number | + | Belgium | `eu_vat` | European VAT number | + | Brazil | `br_cnpj` | Brazilian CNPJ number | + | Brazil | `br_cpf` | Brazilian CPF number | + | Bulgaria | `bg_uic` | Bulgaria Unified Identification Code | + | Bulgaria | `eu_vat` | European VAT number | + | Canada | `ca_bn` | Canadian BN | + | Canada | `ca_gst_hst` | Canadian GST/HST number | + | Canada | `ca_pst_bc` | Canadian PST number (British Columbia) | + | Canada | `ca_pst_mb` | Canadian PST number (Manitoba) | + | Canada | `ca_pst_sk` | Canadian PST number (Saskatchewan) | + | Canada | `ca_qst` | Canadian QST number (Québec) | + | Chile | `cl_tin` | Chilean TIN | + | Croatia | `eu_vat` | European VAT number | + | Cyprus | `eu_vat` | European VAT number | + | Czech Republic | `eu_vat` | European VAT number | + | Denmark | `eu_vat` | European VAT number | + | Egypt | `eg_tin` | Egyptian Tax Identification Number | + | Estonia | `eu_vat` | European VAT number | + | EU | `eu_oss_vat` | European One Stop Shop VAT number for non-Union scheme | + | Finland | `eu_vat` | European VAT number | + | France | `eu_vat` | European VAT number | + | Georgia | `ge_vat` | Georgian VAT | + | Germany | `eu_vat` | European VAT number | + | Greece | `eu_vat` | European VAT number | + | Hong Kong | `hk_br` | Hong Kong BR number | + | Hungary | `eu_vat` | European VAT number | + | Hungary | `hu_tin` | Hungary tax number (adószám) | + | Iceland | `is_vat` | Icelandic VAT | + | India | `in_gst` | Indian GST number | + | Indonesia | `id_npwp` | Indonesian NPWP number | + | Ireland | `eu_vat` | European VAT number | + | Israel | `il_vat` | Israel VAT | + | Italy | `eu_vat` | European VAT number | + | Japan | `jp_cn` | Japanese Corporate Number (_Hōjin Bangō_) | + | Japan | `jp_rn` | Japanese Registered Foreign Businesses' Registration Number (_Tōroku Kokugai Jigyōsha no Tōroku Bangō_) | + | Japan | `jp_trn` | Japanese Tax Registration Number (_Tōroku Bangō_) | + | Kenya | `ke_pin` | Kenya Revenue Authority Personal Identification Number | + | Latvia | `eu_vat` | European VAT number | + | Liechtenstein | `li_uid` | Liechtensteinian UID number | + | Lithuania | `eu_vat` | European VAT number | + | Luxembourg | `eu_vat` | European VAT number | + | Malaysia | `my_frp` | Malaysian FRP number | + | Malaysia | `my_itn` | Malaysian ITN | + | Malaysia | `my_sst` | Malaysian SST number | + | Malta | `eu_vat ` | European VAT number | + | Mexico | `mx_rfc` | Mexican RFC number | + | Netherlands | `eu_vat` | European VAT number | + | New Zealand | `nz_gst` | New Zealand GST number | + | Norway | `no_vat` | Norwegian VAT number | + | Philippines | `ph_tin ` | Philippines Tax Identification Number | + | Poland | `eu_vat` | European VAT number | + | Portugal | `eu_vat` | European VAT number | + | Romania | `eu_vat` | European VAT number | + | Russia | `ru_inn` | Russian INN | + | Russia | `ru_kpp` | Russian KPP | + | Saudi Arabia | `sg_gst` | Singaporean GST | + | Singapore | `sg_uen` | Singaporean UEN | + | Slovakia | `eu_vat` | European VAT number | + | Slovenia | `eu_vat` | European VAT number | + | Slovenia | `si_tin` | Slovenia tax number (davčna številka) | + | South Africa | `za_vat` | South African VAT number | + | South Korea | `kr_brn` | Korean BRN | + | Spain | `es_cif` | Spanish NIF number (previously Spanish CIF number) | + | Spain | `eu_vat` | European VAT number | + | Sweden | `eu_vat` | European VAT number | + | Switzerland | `ch_vat` | Switzerland VAT number | + | Taiwan | `tw_vat` | Taiwanese VAT | + | Thailand | `th_vat` | Thai VAT | + | Turkey | `tr_tin` | Turkish Tax Identification Number | + | Ukraine | `ua_vat` | Ukrainian VAT | + | United Arab Emirates | `ae_trn` | United Arab Emirates TRN | + | United Kingdom | `eu_vat` | Northern Ireland VAT number | + | United Kingdom | `gb_vat` | United Kingdom VAT number | + | United States | `us_ein` | United States EIN | + """ + + discount: Optional[Discount] + + discounts: List[Discount] due_date: datetime """When the invoice payment is due.""" diff --git a/src/orb/types/invoice_fetch_upcoming_response.py b/src/orb/types/invoice_fetch_upcoming_response.py index b305d003..3b88d748 100644 --- a/src/orb/types/invoice_fetch_upcoming_response.py +++ b/src/orb/types/invoice_fetch_upcoming_response.py @@ -5,8 +5,8 @@ from typing_extensions import Literal from .price import Price +from .shared import Discount from .._models import BaseModel -from .invoice_discount import InvoiceDiscount __all__ = [ "InvoiceFetchUpcomingResponse", @@ -112,7 +112,16 @@ class CustomerBalanceTransaction(BaseModel): id: str """A unique id for this transaction.""" - action: Literal["applied_to_invoice", "prorated_refund", "manual_adjustment"] + action: Literal[ + "applied_to_invoice", + "manual_adjustment", + "prorated_refund", + "revert_prorated_refund", + "return_from_voiding", + "credit_note_applied", + "credit_note_voided", + "overpayment_refund", + ] amount: str """The value of the amount changed in the transaction.""" @@ -143,9 +152,122 @@ class CustomerBalanceTransaction(BaseModel): class CustomerTaxID(BaseModel): - country: str - - type: str + country: Literal[ + "AE", + "AT", + "AU", + "BE", + "BG", + "BR", + "CA", + "CH", + "CL", + "CY", + "CZ", + "DE", + "DK", + "EE", + "EG", + "ES", + "EU", + "FI", + "FR", + "GB", + "GE", + "GR", + "HK", + "HR", + "HU", + "ID", + "IE", + "IL", + "IN", + "IS", + "IT", + "JP", + "KE", + "KR", + "LI", + "LT", + "LU", + "LV", + "MT", + "MX", + "MY", + "NL", + "NO", + "NZ", + "PH", + "PL", + "PT", + "RO", + "RU", + "SA", + "SE", + "SG", + "SI", + "SK", + "TH", + "TR", + "TW", + "UA", + "US", + "ZA", + ] + + type: Literal[ + "ae_trn", + "eu_vat", + "au_abn", + "au_arn", + "bg_uic", + "br_cnpj", + "br_cpf", + "ca_bn", + "ca_gst_hst", + "ca_pst_bc", + "ca_pst_mb", + "ca_pst_sk", + "ca_qst", + "ch_vat", + "cl_tin", + "eg_tin", + "es_cif", + "eu_oss_vat", + "gb_vat", + "ge_vat", + "hk_br", + "hu_tin", + "id_npwp", + "il_vat", + "in_gst", + "is_vat", + "jp_cn", + "jp_rn", + "jp_trn", + "ke_pin", + "kr_brn", + "li_uid", + "mx_rfc", + "my_frp", + "my_itn", + "my_sst", + "no_vat", + "nz_gst", + "ph_tin", + "ru_inn", + "ru_kpp", + "sa_vat", + "sg_gst", + "sg_uen", + "si_tin", + "th_vat", + "tr_tin", + "tw_vat", + "ua_vat", + "us_ein", + "za_vat", + ] value: str @@ -272,7 +394,7 @@ class LineItem(BaseModel): amount: str """The final amount after any discounts or minimums.""" - discount: Optional[InvoiceDiscount] + discount: Optional[Discount] end_date: datetime """The end date of the range of time applied for this line item's price.""" @@ -618,10 +740,96 @@ class InvoiceFetchUpcomingResponse(BaseModel): customer_balance_transactions: List[CustomerBalanceTransaction] customer_tax_id: Optional[CustomerTaxID] - - discount: Optional[InvoiceDiscount] - - discounts: List[InvoiceDiscount] + """ + Tax IDs are commonly required to be displayed on customer invoices, which are + added to the headers of invoices. + + ### Supported Tax ID Countries and Types + + | Country | Type | Description | + | -------------------- | ------------ | ------------------------------------------------------------------------------------------------------- | + | Australia | `au_abn` | Australian Business Number (AU ABN) | + | Australia | `au_arn` | Australian Taxation Office Reference Number | + | Austria | `eu_vat` | European VAT number | + | Belgium | `eu_vat` | European VAT number | + | Brazil | `br_cnpj` | Brazilian CNPJ number | + | Brazil | `br_cpf` | Brazilian CPF number | + | Bulgaria | `bg_uic` | Bulgaria Unified Identification Code | + | Bulgaria | `eu_vat` | European VAT number | + | Canada | `ca_bn` | Canadian BN | + | Canada | `ca_gst_hst` | Canadian GST/HST number | + | Canada | `ca_pst_bc` | Canadian PST number (British Columbia) | + | Canada | `ca_pst_mb` | Canadian PST number (Manitoba) | + | Canada | `ca_pst_sk` | Canadian PST number (Saskatchewan) | + | Canada | `ca_qst` | Canadian QST number (Québec) | + | Chile | `cl_tin` | Chilean TIN | + | Croatia | `eu_vat` | European VAT number | + | Cyprus | `eu_vat` | European VAT number | + | Czech Republic | `eu_vat` | European VAT number | + | Denmark | `eu_vat` | European VAT number | + | Egypt | `eg_tin` | Egyptian Tax Identification Number | + | Estonia | `eu_vat` | European VAT number | + | EU | `eu_oss_vat` | European One Stop Shop VAT number for non-Union scheme | + | Finland | `eu_vat` | European VAT number | + | France | `eu_vat` | European VAT number | + | Georgia | `ge_vat` | Georgian VAT | + | Germany | `eu_vat` | European VAT number | + | Greece | `eu_vat` | European VAT number | + | Hong Kong | `hk_br` | Hong Kong BR number | + | Hungary | `eu_vat` | European VAT number | + | Hungary | `hu_tin` | Hungary tax number (adószám) | + | Iceland | `is_vat` | Icelandic VAT | + | India | `in_gst` | Indian GST number | + | Indonesia | `id_npwp` | Indonesian NPWP number | + | Ireland | `eu_vat` | European VAT number | + | Israel | `il_vat` | Israel VAT | + | Italy | `eu_vat` | European VAT number | + | Japan | `jp_cn` | Japanese Corporate Number (_Hōjin Bangō_) | + | Japan | `jp_rn` | Japanese Registered Foreign Businesses' Registration Number (_Tōroku Kokugai Jigyōsha no Tōroku Bangō_) | + | Japan | `jp_trn` | Japanese Tax Registration Number (_Tōroku Bangō_) | + | Kenya | `ke_pin` | Kenya Revenue Authority Personal Identification Number | + | Latvia | `eu_vat` | European VAT number | + | Liechtenstein | `li_uid` | Liechtensteinian UID number | + | Lithuania | `eu_vat` | European VAT number | + | Luxembourg | `eu_vat` | European VAT number | + | Malaysia | `my_frp` | Malaysian FRP number | + | Malaysia | `my_itn` | Malaysian ITN | + | Malaysia | `my_sst` | Malaysian SST number | + | Malta | `eu_vat ` | European VAT number | + | Mexico | `mx_rfc` | Mexican RFC number | + | Netherlands | `eu_vat` | European VAT number | + | New Zealand | `nz_gst` | New Zealand GST number | + | Norway | `no_vat` | Norwegian VAT number | + | Philippines | `ph_tin ` | Philippines Tax Identification Number | + | Poland | `eu_vat` | European VAT number | + | Portugal | `eu_vat` | European VAT number | + | Romania | `eu_vat` | European VAT number | + | Russia | `ru_inn` | Russian INN | + | Russia | `ru_kpp` | Russian KPP | + | Saudi Arabia | `sg_gst` | Singaporean GST | + | Singapore | `sg_uen` | Singaporean UEN | + | Slovakia | `eu_vat` | European VAT number | + | Slovenia | `eu_vat` | European VAT number | + | Slovenia | `si_tin` | Slovenia tax number (davčna številka) | + | South Africa | `za_vat` | South African VAT number | + | South Korea | `kr_brn` | Korean BRN | + | Spain | `es_cif` | Spanish NIF number (previously Spanish CIF number) | + | Spain | `eu_vat` | European VAT number | + | Sweden | `eu_vat` | European VAT number | + | Switzerland | `ch_vat` | Switzerland VAT number | + | Taiwan | `tw_vat` | Taiwanese VAT | + | Thailand | `th_vat` | Thai VAT | + | Turkey | `tr_tin` | Turkish Tax Identification Number | + | Ukraine | `ua_vat` | Ukrainian VAT | + | United Arab Emirates | `ae_trn` | United Arab Emirates TRN | + | United Kingdom | `eu_vat` | Northern Ireland VAT number | + | United Kingdom | `gb_vat` | United Kingdom VAT number | + | United States | `us_ein` | United States EIN | + """ + + discount: Optional[Discount] + + discounts: List[Discount] due_date: datetime """When the invoice payment is due.""" diff --git a/src/orb/types/invoice_line_item_create_response.py b/src/orb/types/invoice_line_item_create_response.py index 51c3241e..76d62553 100644 --- a/src/orb/types/invoice_line_item_create_response.py +++ b/src/orb/types/invoice_line_item_create_response.py @@ -5,8 +5,8 @@ from typing_extensions import Literal from .price import Price +from .shared import Discount from .._models import BaseModel -from .invoice_discount import InvoiceDiscount __all__ = [ "InvoiceLineItemCreateResponse", @@ -145,7 +145,7 @@ class InvoiceLineItemCreateResponse(BaseModel): amount: str """The final amount after any discounts or minimums.""" - discount: Optional[InvoiceDiscount] + discount: Optional[Discount] end_date: datetime """The end date of the range of time applied for this line item's price.""" diff --git a/src/orb/types/invoice_list_params.py b/src/orb/types/invoice_list_params.py index e34056f6..dcb49667 100644 --- a/src/orb/types/invoice_list_params.py +++ b/src/orb/types/invoice_list_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Union, Optional +from typing import List, Union, Optional from datetime import date, datetime from typing_extensions import Literal, Annotated, TypedDict @@ -52,6 +52,8 @@ class InvoiceListParams(TypedDict, total=False): limit: int """The number of items to fetch. Defaults to 20.""" - status: Optional[Literal["draft", "issued", "paid", "synced", "void"]] + status: Annotated[ + Optional[List[Literal["draft", "issued", "paid", "synced", "void"]]], PropertyInfo(alias="status[]") + ] subscription_id: Optional[str] diff --git a/src/orb/types/plan.py b/src/orb/types/plan.py index 56a14c64..614bbd21 100644 --- a/src/orb/types/plan.py +++ b/src/orb/types/plan.py @@ -5,8 +5,8 @@ from typing_extensions import Literal from .price import Price +from .shared import Discount from .._models import BaseModel -from .invoice_discount import InvoiceDiscount __all__ = [ "Plan", @@ -83,7 +83,7 @@ class PlanPhase(BaseModel): description: Optional[str] - discount: Optional[InvoiceDiscount] + discount: Optional[Discount] duration: Optional[int] """How many terms of length `duration_unit` this phase is active for. @@ -148,7 +148,7 @@ class Plan(BaseModel): description: str - discount: Optional[InvoiceDiscount] + discount: Optional[Discount] external_plan_id: Optional[str] """ diff --git a/src/orb/types/plan_create_params.py b/src/orb/types/plan_create_params.py index d92492b6..c954a864 100644 --- a/src/orb/types/plan_create_params.py +++ b/src/orb/types/plan_create_params.py @@ -2,10 +2,38 @@ from __future__ import annotations -from typing import List, Optional -from typing_extensions import Required, TypedDict +from typing import Dict, List, Union, Optional +from typing_extensions import Literal, Required, TypedDict -__all__ = ["PlanCreateParams"] +__all__ = [ + "PlanCreateParams", + "Price", + "PriceNewPlanUnitPrice", + "PriceNewPlanUnitPriceUnitConfig", + "PriceNewPlanPackagePrice", + "PriceNewPlanPackagePricePackageConfig", + "PriceNewPlanMatrixPrice", + "PriceNewPlanMatrixPriceMatrixConfig", + "PriceNewPlanMatrixPriceMatrixConfigMatrixValue", + "PriceNewPlanTieredPrice", + "PriceNewPlanTieredPriceTieredConfig", + "PriceNewPlanTieredPriceTieredConfigTier", + "PriceNewPlanTieredBpsPrice", + "PriceNewPlanTieredBpsPriceTieredBpsConfig", + "PriceNewPlanTieredBpsPriceTieredBpsConfigTier", + "PriceNewPlanBpsPrice", + "PriceNewPlanBpsPriceBpsConfig", + "PriceNewPlanBulkBpsPrice", + "PriceNewPlanBulkBpsPriceBulkBpsConfig", + "PriceNewPlanBulkBpsPriceBulkBpsConfigTier", + "PriceNewPlanBulkPrice", + "PriceNewPlanBulkPriceBulkConfig", + "PriceNewPlanBulkPriceBulkConfigTier", + "PriceNewPlanThresholdTotalAmountPrice", + "PriceNewPlanTieredPackagePrice", + "PriceNewPlanTieredWithMinimumPrice", + "PriceNewPlanPackageWithAllocationPrice", +] class PlanCreateParams(TypedDict, total=False): @@ -17,7 +45,7 @@ class PlanCreateParams(TypedDict, total=False): name: Required[str] - prices: Required[List[object]] + prices: Required[List[Price]] """Prices for this plan. If the plan has phases, this includes prices across all phases of the plan. @@ -38,3 +66,617 @@ class PlanCreateParams(TypedDict, total=False): date for the invoice. If you intend the invoice to be due on issue, set this to 0. """ + + +class PriceNewPlanUnitPriceUnitConfig(TypedDict, total=False): + unit_amount: Required[str] + """Rate per unit of usage""" + + scaling_factor: Optional[float] + """Multiplier to scale rated quantity by""" + + +class PriceNewPlanUnitPrice(TypedDict, total=False): + cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + """The cadence to bill for this price on.""" + + item_id: Required[str] + """The id of the item the plan will be associated with.""" + + model_type: Required[Literal["unit"]] + + name: Required[str] + """The name of the price.""" + + unit_config: Required[PriceNewPlanUnitPriceUnitConfig] + + billable_metric_id: Optional[str] + """The id of the billable metric for the price. + + Only needed if the price is usage-based. + """ + + billed_in_advance: Optional[bool] + """ + If the Price represents a fixed cost, the price will be billed in-advance if + this is true, and in-arrears if this is false. + """ + + external_price_id: Optional[str] + """An alias for the price.""" + + fixed_price_quantity: Optional[float] + """ + If the Price represents a fixed cost, this represents the quantity of units + applied. + """ + + invoice_grouping_key: Optional[str] + """The property used to group this price on an invoice""" + + +class PriceNewPlanPackagePricePackageConfig(TypedDict, total=False): + package_amount: Required[str] + """A currency amount to rate usage by""" + + package_size: Optional[int] + """An integer amount to represent package size. + + For example, 1000 here would divide usage by 1000 before multiplying by + package_amount in rating + """ + + +class PriceNewPlanPackagePrice(TypedDict, total=False): + cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + """The cadence to bill for this price on.""" + + item_id: Required[str] + """The id of the item the plan will be associated with.""" + + model_type: Required[Literal["package"]] + + name: Required[str] + """The name of the price.""" + + package_config: Required[PriceNewPlanPackagePricePackageConfig] + + billable_metric_id: Optional[str] + """The id of the billable metric for the price. + + Only needed if the price is usage-based. + """ + + billed_in_advance: Optional[bool] + """ + If the Price represents a fixed cost, the price will be billed in-advance if + this is true, and in-arrears if this is false. + """ + + external_price_id: Optional[str] + """An alias for the price.""" + + fixed_price_quantity: Optional[float] + """ + If the Price represents a fixed cost, this represents the quantity of units + applied. + """ + + invoice_grouping_key: Optional[str] + """The property used to group this price on an invoice""" + + +class PriceNewPlanMatrixPriceMatrixConfigMatrixValue(TypedDict, total=False): + dimension_values: Required[List[Optional[str]]] + """One or two matrix keys to filter usage to this Matrix value by. + + For example, ["region", "tier"] could be used to filter cloud usage by a cloud + region and an instance tier. + """ + + unit_amount: Required[str] + """Unit price for the specified dimension_values""" + + scaling_factor: Optional[float] + """Optional multiplier to scale rated quantities by""" + + +class PriceNewPlanMatrixPriceMatrixConfig(TypedDict, total=False): + default_unit_amount: Required[str] + """Default per unit rate for any usage not bucketed into a specified matrix_value""" + + dimensions: Required[List[Optional[str]]] + """One or two event property values to evaluate matrix groups by""" + + matrix_values: Required[List[PriceNewPlanMatrixPriceMatrixConfigMatrixValue]] + """Matrix values for specified matrix grouping keys""" + + scaling_factor: Optional[float] + """ + Default optional multiplier to scale rated quantities that fall into the default + bucket by + """ + + +class PriceNewPlanMatrixPrice(TypedDict, total=False): + cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + """The cadence to bill for this price on.""" + + item_id: Required[str] + """The id of the item the plan will be associated with.""" + + matrix_config: Required[PriceNewPlanMatrixPriceMatrixConfig] + + model_type: Required[Literal["matrix"]] + + name: Required[str] + """The name of the price.""" + + billable_metric_id: Optional[str] + """The id of the billable metric for the price. + + Only needed if the price is usage-based. + """ + + billed_in_advance: Optional[bool] + """ + If the Price represents a fixed cost, the price will be billed in-advance if + this is true, and in-arrears if this is false. + """ + + external_price_id: Optional[str] + """An alias for the price.""" + + fixed_price_quantity: Optional[float] + """ + If the Price represents a fixed cost, this represents the quantity of units + applied. + """ + + invoice_grouping_key: Optional[str] + """The property used to group this price on an invoice""" + + +class PriceNewPlanTieredPriceTieredConfigTier(TypedDict, total=False): + first_unit: Required[float] + """Inclusive tier starting value""" + + unit_amount: Required[str] + """Amount per unit""" + + last_unit: Optional[float] + """Exclusive tier ending value. If null, this is treated as the last tier""" + + +class PriceNewPlanTieredPriceTieredConfig(TypedDict, total=False): + tiers: Required[List[PriceNewPlanTieredPriceTieredConfigTier]] + """Tiers for rating based on total usage quantities into the specified tier""" + + +class PriceNewPlanTieredPrice(TypedDict, total=False): + cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + """The cadence to bill for this price on.""" + + item_id: Required[str] + """The id of the item the plan will be associated with.""" + + model_type: Required[Literal["tiered"]] + + name: Required[str] + """The name of the price.""" + + tiered_config: Required[PriceNewPlanTieredPriceTieredConfig] + + billable_metric_id: Optional[str] + """The id of the billable metric for the price. + + Only needed if the price is usage-based. + """ + + billed_in_advance: Optional[bool] + """ + If the Price represents a fixed cost, the price will be billed in-advance if + this is true, and in-arrears if this is false. + """ + + external_price_id: Optional[str] + """An alias for the price.""" + + fixed_price_quantity: Optional[float] + """ + If the Price represents a fixed cost, this represents the quantity of units + applied. + """ + + invoice_grouping_key: Optional[str] + """The property used to group this price on an invoice""" + + +class PriceNewPlanTieredBpsPriceTieredBpsConfigTier(TypedDict, total=False): + bps: Required[float] + """Per-event basis point rate""" + + minimum_amount: Required[str] + """Inclusive tier starting value""" + + maximum_amount: Optional[str] + """Exclusive tier ending value""" + + per_unit_maximum: Optional[str] + """Per unit maximum to charge""" + + +class PriceNewPlanTieredBpsPriceTieredBpsConfig(TypedDict, total=False): + tiers: Required[List[PriceNewPlanTieredBpsPriceTieredBpsConfigTier]] + """ + Tiers for a Graduated BPS pricing model, where usage is bucketed into specified + tiers + """ + + +class PriceNewPlanTieredBpsPrice(TypedDict, total=False): + cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + """The cadence to bill for this price on.""" + + item_id: Required[str] + """The id of the item the plan will be associated with.""" + + model_type: Required[Literal["tiered_bps"]] + + name: Required[str] + """The name of the price.""" + + tiered_bps_config: Required[PriceNewPlanTieredBpsPriceTieredBpsConfig] + + billable_metric_id: Optional[str] + """The id of the billable metric for the price. + + Only needed if the price is usage-based. + """ + + billed_in_advance: Optional[bool] + """ + If the Price represents a fixed cost, the price will be billed in-advance if + this is true, and in-arrears if this is false. + """ + + external_price_id: Optional[str] + """An alias for the price.""" + + fixed_price_quantity: Optional[float] + """ + If the Price represents a fixed cost, this represents the quantity of units + applied. + """ + + invoice_grouping_key: Optional[str] + """The property used to group this price on an invoice""" + + +class PriceNewPlanBpsPriceBpsConfig(TypedDict, total=False): + bps: Required[float] + """Basis point take rate per event""" + + per_unit_maximum: Optional[str] + """Optional currency amount maximum to cap spend per event""" + + +class PriceNewPlanBpsPrice(TypedDict, total=False): + bps_config: Required[PriceNewPlanBpsPriceBpsConfig] + + cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + """The cadence to bill for this price on.""" + + item_id: Required[str] + """The id of the item the plan will be associated with.""" + + model_type: Required[Literal["bps"]] + + name: Required[str] + """The name of the price.""" + + billable_metric_id: Optional[str] + """The id of the billable metric for the price. + + Only needed if the price is usage-based. + """ + + billed_in_advance: Optional[bool] + """ + If the Price represents a fixed cost, the price will be billed in-advance if + this is true, and in-arrears if this is false. + """ + + external_price_id: Optional[str] + """An alias for the price.""" + + fixed_price_quantity: Optional[float] + """ + If the Price represents a fixed cost, this represents the quantity of units + applied. + """ + + invoice_grouping_key: Optional[str] + """The property used to group this price on an invoice""" + + +class PriceNewPlanBulkBpsPriceBulkBpsConfigTier(TypedDict, total=False): + bps: Required[float] + """Basis points to rate on""" + + maximum_amount: Optional[str] + """Upper bound for tier""" + + per_unit_maximum: Optional[str] + """The maximum amount to charge for any one event""" + + +class PriceNewPlanBulkBpsPriceBulkBpsConfig(TypedDict, total=False): + tiers: Required[List[PriceNewPlanBulkBpsPriceBulkBpsConfigTier]] + """ + Tiers for a bulk BPS pricing model where all usage is aggregated to a single + tier based on total volume + """ + + +class PriceNewPlanBulkBpsPrice(TypedDict, total=False): + bulk_bps_config: Required[PriceNewPlanBulkBpsPriceBulkBpsConfig] + + cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + """The cadence to bill for this price on.""" + + item_id: Required[str] + """The id of the item the plan will be associated with.""" + + model_type: Required[Literal["bulk_bps"]] + + name: Required[str] + """The name of the price.""" + + billable_metric_id: Optional[str] + """The id of the billable metric for the price. + + Only needed if the price is usage-based. + """ + + billed_in_advance: Optional[bool] + """ + If the Price represents a fixed cost, the price will be billed in-advance if + this is true, and in-arrears if this is false. + """ + + external_price_id: Optional[str] + """An alias for the price.""" + + fixed_price_quantity: Optional[float] + """ + If the Price represents a fixed cost, this represents the quantity of units + applied. + """ + + invoice_grouping_key: Optional[str] + """The property used to group this price on an invoice""" + + +class PriceNewPlanBulkPriceBulkConfigTier(TypedDict, total=False): + unit_amount: Required[str] + """Amount per unit""" + + maximum_units: Optional[float] + """Upper bound for this tier""" + + +class PriceNewPlanBulkPriceBulkConfig(TypedDict, total=False): + tiers: Required[List[PriceNewPlanBulkPriceBulkConfigTier]] + """Bulk tiers for rating based on total usage volume""" + + +class PriceNewPlanBulkPrice(TypedDict, total=False): + bulk_config: Required[PriceNewPlanBulkPriceBulkConfig] + + cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + """The cadence to bill for this price on.""" + + item_id: Required[str] + """The id of the item the plan will be associated with.""" + + model_type: Required[Literal["bulk"]] + + name: Required[str] + """The name of the price.""" + + billable_metric_id: Optional[str] + """The id of the billable metric for the price. + + Only needed if the price is usage-based. + """ + + billed_in_advance: Optional[bool] + """ + If the Price represents a fixed cost, the price will be billed in-advance if + this is true, and in-arrears if this is false. + """ + + external_price_id: Optional[str] + """An alias for the price.""" + + fixed_price_quantity: Optional[float] + """ + If the Price represents a fixed cost, this represents the quantity of units + applied. + """ + + invoice_grouping_key: Optional[str] + """The property used to group this price on an invoice""" + + +class PriceNewPlanThresholdTotalAmountPrice(TypedDict, total=False): + cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + """The cadence to bill for this price on.""" + + item_id: Required[str] + """The id of the item the plan will be associated with.""" + + model_type: Required[Literal["threshold_total_amount"]] + + name: Required[str] + """The name of the price.""" + + threshold_total_amount_config: Required[Dict[str, object]] + + billable_metric_id: Optional[str] + """The id of the billable metric for the price. + + Only needed if the price is usage-based. + """ + + billed_in_advance: Optional[bool] + """ + If the Price represents a fixed cost, the price will be billed in-advance if + this is true, and in-arrears if this is false. + """ + + external_price_id: Optional[str] + """An alias for the price.""" + + fixed_price_quantity: Optional[float] + """ + If the Price represents a fixed cost, this represents the quantity of units + applied. + """ + + invoice_grouping_key: Optional[str] + """The property used to group this price on an invoice""" + + +class PriceNewPlanTieredPackagePrice(TypedDict, total=False): + cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + """The cadence to bill for this price on.""" + + item_id: Required[str] + """The id of the item the plan will be associated with.""" + + model_type: Required[Literal["tiered_package"]] + + name: Required[str] + """The name of the price.""" + + tiered_package_config: Required[Dict[str, object]] + + billable_metric_id: Optional[str] + """The id of the billable metric for the price. + + Only needed if the price is usage-based. + """ + + billed_in_advance: Optional[bool] + """ + If the Price represents a fixed cost, the price will be billed in-advance if + this is true, and in-arrears if this is false. + """ + + external_price_id: Optional[str] + """An alias for the price.""" + + fixed_price_quantity: Optional[float] + """ + If the Price represents a fixed cost, this represents the quantity of units + applied. + """ + + invoice_grouping_key: Optional[str] + """The property used to group this price on an invoice""" + + +class PriceNewPlanTieredWithMinimumPrice(TypedDict, total=False): + cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + """The cadence to bill for this price on.""" + + item_id: Required[str] + """The id of the item the plan will be associated with.""" + + model_type: Required[Literal["tiered_with_minimum"]] + + name: Required[str] + """The name of the price.""" + + tiered_with_minimum_config: Required[Dict[str, object]] + + billable_metric_id: Optional[str] + """The id of the billable metric for the price. + + Only needed if the price is usage-based. + """ + + billed_in_advance: Optional[bool] + """ + If the Price represents a fixed cost, the price will be billed in-advance if + this is true, and in-arrears if this is false. + """ + + external_price_id: Optional[str] + """An alias for the price.""" + + fixed_price_quantity: Optional[float] + """ + If the Price represents a fixed cost, this represents the quantity of units + applied. + """ + + invoice_grouping_key: Optional[str] + """The property used to group this price on an invoice""" + + +class PriceNewPlanPackageWithAllocationPrice(TypedDict, total=False): + cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + """The cadence to bill for this price on.""" + + item_id: Required[str] + """The id of the item the plan will be associated with.""" + + model_type: Required[Literal["package_with_allocation"]] + + name: Required[str] + """The name of the price.""" + + package_with_allocation_config: Required[Dict[str, object]] + + billable_metric_id: Optional[str] + """The id of the billable metric for the price. + + Only needed if the price is usage-based. + """ + + billed_in_advance: Optional[bool] + """ + If the Price represents a fixed cost, the price will be billed in-advance if + this is true, and in-arrears if this is false. + """ + + external_price_id: Optional[str] + """An alias for the price.""" + + fixed_price_quantity: Optional[float] + """ + If the Price represents a fixed cost, this represents the quantity of units + applied. + """ + + invoice_grouping_key: Optional[str] + """The property used to group this price on an invoice""" + + +Price = Union[ + PriceNewPlanUnitPrice, + PriceNewPlanPackagePrice, + PriceNewPlanMatrixPrice, + PriceNewPlanTieredPrice, + PriceNewPlanTieredBpsPrice, + PriceNewPlanBpsPrice, + PriceNewPlanBulkBpsPrice, + PriceNewPlanBulkPrice, + PriceNewPlanThresholdTotalAmountPrice, + PriceNewPlanTieredPackagePrice, + PriceNewPlanTieredWithMinimumPrice, + PriceNewPlanPackageWithAllocationPrice, +] diff --git a/src/orb/types/price.py b/src/orb/types/price.py index c52141ff..acd0fc55 100644 --- a/src/orb/types/price.py +++ b/src/orb/types/price.py @@ -6,8 +6,8 @@ from pydantic import Field as FieldInfo +from .shared import Discount from .._models import BaseModel -from .invoice_discount import InvoiceDiscount __all__ = [ "Price", @@ -164,7 +164,7 @@ class UnitPrice(BaseModel): unit_config: UnitPriceUnitConfig - discount: Optional[InvoiceDiscount] = None + discount: Optional[Discount] = None maximum: Optional[UnitPriceMaximum] = None @@ -246,7 +246,7 @@ class PackagePrice(BaseModel): price_type: Literal["usage_price", "fixed_price"] - discount: Optional[InvoiceDiscount] = None + discount: Optional[Discount] = None maximum: Optional[PackagePriceMaximum] = None @@ -348,7 +348,7 @@ class MatrixPrice(BaseModel): price_type: Literal["usage_price", "fixed_price"] - discount: Optional[InvoiceDiscount] = None + discount: Optional[Discount] = None maximum: Optional[MatrixPriceMaximum] = None @@ -434,7 +434,7 @@ class TieredPrice(BaseModel): tiered_config: TieredPriceTieredConfig - discount: Optional[InvoiceDiscount] = None + discount: Optional[Discount] = None maximum: Optional[TieredPriceMaximum] = None @@ -526,7 +526,7 @@ class TieredBpsPrice(BaseModel): tiered_bps_config: TieredBpsPriceTieredBpsConfig - discount: Optional[InvoiceDiscount] = None + discount: Optional[Discount] = None maximum: Optional[TieredBpsPriceMaximum] = None @@ -604,7 +604,7 @@ class BpsPrice(BaseModel): price_type: Literal["usage_price", "fixed_price"] - discount: Optional[InvoiceDiscount] = None + discount: Optional[Discount] = None maximum: Optional[BpsPriceMaximum] = None @@ -693,7 +693,7 @@ class BulkBpsPrice(BaseModel): price_type: Literal["usage_price", "fixed_price"] - discount: Optional[InvoiceDiscount] = None + discount: Optional[Discount] = None maximum: Optional[BulkBpsPriceMaximum] = None @@ -776,7 +776,7 @@ class BulkPrice(BaseModel): price_type: Literal["usage_price", "fixed_price"] - discount: Optional[InvoiceDiscount] = None + discount: Optional[Discount] = None maximum: Optional[BulkPriceMaximum] = None @@ -846,7 +846,7 @@ class TestRatingFunctionPrice(BaseModel): test_rating_function_config: Dict[str, object] - discount: Optional[InvoiceDiscount] = None + discount: Optional[Discount] = None maximum: Optional[TestRatingFunctionPriceMaximum] = None @@ -916,7 +916,7 @@ class FivetranExamplePrice(BaseModel): price_type: Literal["usage_price", "fixed_price"] - discount: Optional[InvoiceDiscount] = None + discount: Optional[Discount] = None maximum: Optional[FivetranExamplePriceMaximum] = None @@ -986,7 +986,7 @@ class ThresholdTotalAmountPrice(BaseModel): threshold_total_amount_config: Dict[str, object] - discount: Optional[InvoiceDiscount] = None + discount: Optional[Discount] = None maximum: Optional[ThresholdTotalAmountPriceMaximum] = None @@ -1056,7 +1056,7 @@ class TieredPackagePrice(BaseModel): tiered_package_config: Dict[str, object] - discount: Optional[InvoiceDiscount] = None + discount: Optional[Discount] = None maximum: Optional[TieredPackagePriceMaximum] = None @@ -1126,7 +1126,7 @@ class TieredWithMinimumPrice(BaseModel): tiered_with_minimum_config: Dict[str, object] - discount: Optional[InvoiceDiscount] = None + discount: Optional[Discount] = None maximum: Optional[TieredWithMinimumPriceMaximum] = None @@ -1196,7 +1196,7 @@ class PackageWithAllocationPrice(BaseModel): price_type: Literal["usage_price", "fixed_price"] - discount: Optional[InvoiceDiscount] = None + discount: Optional[Discount] = None maximum: Optional[PackageWithAllocationPriceMaximum] = None diff --git a/src/orb/types/price_create_params.py b/src/orb/types/price_create_params.py index 5aa306d6..49891dd8 100644 --- a/src/orb/types/price_create_params.py +++ b/src/orb/types/price_create_params.py @@ -7,36 +7,36 @@ __all__ = [ "PriceCreateParams", - "NewUnitPrice", - "NewUnitPriceUnitConfig", - "NewPackagePrice", - "NewPackagePricePackageConfig", - "NewMatrixPrice", - "NewMatrixPriceMatrixConfig", - "NewMatrixPriceMatrixConfigMatrixValue", - "NewTieredPrice", - "NewTieredPriceTieredConfig", - "NewTieredPriceTieredConfigTier", - "NewTieredBpsPrice", - "NewTieredBpsPriceTieredBpsConfig", - "NewTieredBpsPriceTieredBpsConfigTier", - "NewBpsPrice", - "NewBpsPriceBpsConfig", - "NewBulkBpsPrice", - "NewBulkBpsPriceBulkBpsConfig", - "NewBulkBpsPriceBulkBpsConfigTier", - "NewBulkPrice", - "NewBulkPriceBulkConfig", - "NewBulkPriceBulkConfigTier", - "NewThresholdTotalAmountPrice", - "NewTieredPackagePrice", - "NewTieredWithMinimumPrice", - "NewPackageWithAllocationPrice", + "NewFloatingUnitPrice", + "NewFloatingUnitPriceUnitConfig", + "NewFloatingPackagePrice", + "NewFloatingPackagePricePackageConfig", + "NewFloatingMatrixPrice", + "NewFloatingMatrixPriceMatrixConfig", + "NewFloatingMatrixPriceMatrixConfigMatrixValue", + "NewFloatingTieredPrice", + "NewFloatingTieredPriceTieredConfig", + "NewFloatingTieredPriceTieredConfigTier", + "NewFloatingTieredBpsPrice", + "NewFloatingTieredBpsPriceTieredBpsConfig", + "NewFloatingTieredBpsPriceTieredBpsConfigTier", + "NewFloatingBpsPrice", + "NewFloatingBpsPriceBpsConfig", + "NewFloatingBulkBpsPrice", + "NewFloatingBulkBpsPriceBulkBpsConfig", + "NewFloatingBulkBpsPriceBulkBpsConfigTier", + "NewFloatingBulkPrice", + "NewFloatingBulkPriceBulkConfig", + "NewFloatingBulkPriceBulkConfigTier", + "NewFloatingThresholdTotalAmountPrice", + "NewFloatingTieredPackagePrice", + "NewFloatingTieredWithMinimumPrice", + "NewFloatingPackageWithAllocationPrice", ] -class NewUnitPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly"]] +class NewFloatingUnitPrice(TypedDict, total=False): + cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -50,7 +50,7 @@ class NewUnitPrice(TypedDict, total=False): name: Required[str] """The name of the price.""" - unit_config: Required[NewUnitPriceUnitConfig] + unit_config: Required[NewFloatingUnitPriceUnitConfig] billable_metric_id: Optional[str] """The id of the billable metric for the price. @@ -77,7 +77,7 @@ class NewUnitPrice(TypedDict, total=False): """The property used to group this price on an invoice""" -class NewUnitPriceUnitConfig(TypedDict, total=False): +class NewFloatingUnitPriceUnitConfig(TypedDict, total=False): unit_amount: Required[str] """Rate per unit of usage""" @@ -85,8 +85,8 @@ class NewUnitPriceUnitConfig(TypedDict, total=False): """Multiplier to scale rated quantity by""" -class NewPackagePrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly"]] +class NewFloatingPackagePrice(TypedDict, total=False): + cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -100,7 +100,7 @@ class NewPackagePrice(TypedDict, total=False): name: Required[str] """The name of the price.""" - package_config: Required[NewPackagePricePackageConfig] + package_config: Required[NewFloatingPackagePricePackageConfig] billable_metric_id: Optional[str] """The id of the billable metric for the price. @@ -127,7 +127,7 @@ class NewPackagePrice(TypedDict, total=False): """The property used to group this price on an invoice""" -class NewPackagePricePackageConfig(TypedDict, total=False): +class NewFloatingPackagePricePackageConfig(TypedDict, total=False): package_amount: Required[str] """A currency amount to rate usage by""" @@ -139,8 +139,8 @@ class NewPackagePricePackageConfig(TypedDict, total=False): """ -class NewMatrixPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly"]] +class NewFloatingMatrixPrice(TypedDict, total=False): + cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -149,7 +149,7 @@ class NewMatrixPrice(TypedDict, total=False): item_id: Required[str] """The id of the item the plan will be associated with.""" - matrix_config: Required[NewMatrixPriceMatrixConfig] + matrix_config: Required[NewFloatingMatrixPriceMatrixConfig] model_type: Required[Literal["matrix"]] @@ -181,7 +181,7 @@ class NewMatrixPrice(TypedDict, total=False): """The property used to group this price on an invoice""" -class NewMatrixPriceMatrixConfigMatrixValue(TypedDict, total=False): +class NewFloatingMatrixPriceMatrixConfigMatrixValue(TypedDict, total=False): dimension_values: Required[List[Optional[str]]] """One or two matrix keys to filter usage to this Matrix value by. @@ -196,14 +196,14 @@ class NewMatrixPriceMatrixConfigMatrixValue(TypedDict, total=False): """Optional multiplier to scale rated quantities by""" -class NewMatrixPriceMatrixConfig(TypedDict, total=False): +class NewFloatingMatrixPriceMatrixConfig(TypedDict, total=False): default_unit_amount: Required[str] """Default per unit rate for any usage not bucketed into a specified matrix_value""" dimensions: Required[List[Optional[str]]] """One or two event property values to evaluate matrix groups by""" - matrix_values: Required[List[NewMatrixPriceMatrixConfigMatrixValue]] + matrix_values: Required[List[NewFloatingMatrixPriceMatrixConfigMatrixValue]] """Matrix values for specified matrix grouping keys""" scaling_factor: Optional[float] @@ -213,8 +213,8 @@ class NewMatrixPriceMatrixConfig(TypedDict, total=False): """ -class NewTieredPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly"]] +class NewFloatingTieredPrice(TypedDict, total=False): + cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -228,7 +228,7 @@ class NewTieredPrice(TypedDict, total=False): name: Required[str] """The name of the price.""" - tiered_config: Required[NewTieredPriceTieredConfig] + tiered_config: Required[NewFloatingTieredPriceTieredConfig] billable_metric_id: Optional[str] """The id of the billable metric for the price. @@ -255,7 +255,7 @@ class NewTieredPrice(TypedDict, total=False): """The property used to group this price on an invoice""" -class NewTieredPriceTieredConfigTier(TypedDict, total=False): +class NewFloatingTieredPriceTieredConfigTier(TypedDict, total=False): first_unit: Required[float] """Inclusive tier starting value""" @@ -266,13 +266,13 @@ class NewTieredPriceTieredConfigTier(TypedDict, total=False): """Exclusive tier ending value. If null, this is treated as the last tier""" -class NewTieredPriceTieredConfig(TypedDict, total=False): - tiers: Required[List[NewTieredPriceTieredConfigTier]] +class NewFloatingTieredPriceTieredConfig(TypedDict, total=False): + tiers: Required[List[NewFloatingTieredPriceTieredConfigTier]] """Tiers for rating based on total usage quantities into the specified tier""" -class NewTieredBpsPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly"]] +class NewFloatingTieredBpsPrice(TypedDict, total=False): + cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -286,7 +286,7 @@ class NewTieredBpsPrice(TypedDict, total=False): name: Required[str] """The name of the price.""" - tiered_bps_config: Required[NewTieredBpsPriceTieredBpsConfig] + tiered_bps_config: Required[NewFloatingTieredBpsPriceTieredBpsConfig] billable_metric_id: Optional[str] """The id of the billable metric for the price. @@ -313,7 +313,7 @@ class NewTieredBpsPrice(TypedDict, total=False): """The property used to group this price on an invoice""" -class NewTieredBpsPriceTieredBpsConfigTier(TypedDict, total=False): +class NewFloatingTieredBpsPriceTieredBpsConfigTier(TypedDict, total=False): bps: Required[float] """Per-event basis point rate""" @@ -327,18 +327,18 @@ class NewTieredBpsPriceTieredBpsConfigTier(TypedDict, total=False): """Per unit maximum to charge""" -class NewTieredBpsPriceTieredBpsConfig(TypedDict, total=False): - tiers: Required[List[NewTieredBpsPriceTieredBpsConfigTier]] +class NewFloatingTieredBpsPriceTieredBpsConfig(TypedDict, total=False): + tiers: Required[List[NewFloatingTieredBpsPriceTieredBpsConfigTier]] """ Tiers for a Graduated BPS pricing model, where usage is bucketed into specified tiers """ -class NewBpsPrice(TypedDict, total=False): - bps_config: Required[NewBpsPriceBpsConfig] +class NewFloatingBpsPrice(TypedDict, total=False): + bps_config: Required[NewFloatingBpsPriceBpsConfig] - cadence: Required[Literal["annual", "monthly", "quarterly"]] + cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -377,7 +377,7 @@ class NewBpsPrice(TypedDict, total=False): """The property used to group this price on an invoice""" -class NewBpsPriceBpsConfig(TypedDict, total=False): +class NewFloatingBpsPriceBpsConfig(TypedDict, total=False): bps: Required[float] """Basis point take rate per event""" @@ -385,10 +385,10 @@ class NewBpsPriceBpsConfig(TypedDict, total=False): """Optional currency amount maximum to cap spend per event""" -class NewBulkBpsPrice(TypedDict, total=False): - bulk_bps_config: Required[NewBulkBpsPriceBulkBpsConfig] +class NewFloatingBulkBpsPrice(TypedDict, total=False): + bulk_bps_config: Required[NewFloatingBulkBpsPriceBulkBpsConfig] - cadence: Required[Literal["annual", "monthly", "quarterly"]] + cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -427,7 +427,7 @@ class NewBulkBpsPrice(TypedDict, total=False): """The property used to group this price on an invoice""" -class NewBulkBpsPriceBulkBpsConfigTier(TypedDict, total=False): +class NewFloatingBulkBpsPriceBulkBpsConfigTier(TypedDict, total=False): bps: Required[float] """Basis points to rate on""" @@ -438,18 +438,18 @@ class NewBulkBpsPriceBulkBpsConfigTier(TypedDict, total=False): """The maximum amount to charge for any one event""" -class NewBulkBpsPriceBulkBpsConfig(TypedDict, total=False): - tiers: Required[List[NewBulkBpsPriceBulkBpsConfigTier]] +class NewFloatingBulkBpsPriceBulkBpsConfig(TypedDict, total=False): + tiers: Required[List[NewFloatingBulkBpsPriceBulkBpsConfigTier]] """ Tiers for a bulk BPS pricing model where all usage is aggregated to a single tier based on total volume """ -class NewBulkPrice(TypedDict, total=False): - bulk_config: Required[NewBulkPriceBulkConfig] +class NewFloatingBulkPrice(TypedDict, total=False): + bulk_config: Required[NewFloatingBulkPriceBulkConfig] - cadence: Required[Literal["annual", "monthly", "quarterly"]] + cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -488,7 +488,7 @@ class NewBulkPrice(TypedDict, total=False): """The property used to group this price on an invoice""" -class NewBulkPriceBulkConfigTier(TypedDict, total=False): +class NewFloatingBulkPriceBulkConfigTier(TypedDict, total=False): unit_amount: Required[str] """Amount per unit""" @@ -496,13 +496,13 @@ class NewBulkPriceBulkConfigTier(TypedDict, total=False): """Upper bound for this tier""" -class NewBulkPriceBulkConfig(TypedDict, total=False): - tiers: Required[List[NewBulkPriceBulkConfigTier]] +class NewFloatingBulkPriceBulkConfig(TypedDict, total=False): + tiers: Required[List[NewFloatingBulkPriceBulkConfigTier]] """Bulk tiers for rating based on total usage volume""" -class NewThresholdTotalAmountPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly"]] +class NewFloatingThresholdTotalAmountPrice(TypedDict, total=False): + cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -543,8 +543,8 @@ class NewThresholdTotalAmountPrice(TypedDict, total=False): """The property used to group this price on an invoice""" -class NewTieredPackagePrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly"]] +class NewFloatingTieredPackagePrice(TypedDict, total=False): + cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -585,8 +585,8 @@ class NewTieredPackagePrice(TypedDict, total=False): """The property used to group this price on an invoice""" -class NewTieredWithMinimumPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly"]] +class NewFloatingTieredWithMinimumPrice(TypedDict, total=False): + cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -627,8 +627,8 @@ class NewTieredWithMinimumPrice(TypedDict, total=False): """The property used to group this price on an invoice""" -class NewPackageWithAllocationPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly"]] +class NewFloatingPackageWithAllocationPrice(TypedDict, total=False): + cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -670,16 +670,16 @@ class NewPackageWithAllocationPrice(TypedDict, total=False): PriceCreateParams = Union[ - NewUnitPrice, - NewPackagePrice, - NewMatrixPrice, - NewTieredPrice, - NewTieredBpsPrice, - NewBpsPrice, - NewBulkBpsPrice, - NewBulkPrice, - NewThresholdTotalAmountPrice, - NewTieredPackagePrice, - NewTieredWithMinimumPrice, - NewPackageWithAllocationPrice, + NewFloatingUnitPrice, + NewFloatingPackagePrice, + NewFloatingMatrixPrice, + NewFloatingTieredPrice, + NewFloatingTieredBpsPrice, + NewFloatingBpsPrice, + NewFloatingBulkBpsPrice, + NewFloatingBulkPrice, + NewFloatingThresholdTotalAmountPrice, + NewFloatingTieredPackagePrice, + NewFloatingTieredWithMinimumPrice, + NewFloatingPackageWithAllocationPrice, ] diff --git a/src/orb/types/shared/__init__.py b/src/orb/types/shared/__init__.py new file mode 100644 index 00000000..41bf8251 --- /dev/null +++ b/src/orb/types/shared/__init__.py @@ -0,0 +1,3 @@ +# File generated from our OpenAPI spec by Stainless. + +from .discount import Discount as Discount diff --git a/src/orb/types/invoice_discount.py b/src/orb/types/shared/discount.py similarity index 78% rename from src/orb/types/invoice_discount.py rename to src/orb/types/shared/discount.py index 44af4db5..46112d7d 100644 --- a/src/orb/types/invoice_discount.py +++ b/src/orb/types/shared/discount.py @@ -3,9 +3,9 @@ from typing import List, Union, Optional from typing_extensions import Literal -from .._models import BaseModel +from ..._models import BaseModel -__all__ = ["InvoiceDiscount", "PercentageDiscount", "TrialDiscount", "UsageDiscount", "AmountDiscount"] +__all__ = ["Discount", "PercentageDiscount", "TrialDiscount", "UsageDiscount", "AmountDiscount"] class PercentageDiscount(BaseModel): @@ -18,10 +18,12 @@ class PercentageDiscount(BaseModel): discount_type: Literal["percentage"] percentage_discount: float + """Only available if discount_type is `percentage`. + + This is a number between 0 and 1. """ - Only available if discount_type is `percentage`.This is a number between 0 - and 1. - """ + + reason: Optional[str] = None class TrialDiscount(BaseModel): @@ -33,6 +35,8 @@ class TrialDiscount(BaseModel): discount_type: Literal["trial"] + reason: Optional[str] = None + trial_amount_discount: Optional[str] = None """Only available if discount_type is `trial`""" @@ -55,6 +59,8 @@ class UsageDiscount(BaseModel): Number of usage units that this discount is for """ + reason: Optional[str] = None + class AmountDiscount(BaseModel): amount_discount: str @@ -68,5 +74,7 @@ class AmountDiscount(BaseModel): discount_type: Literal["amount"] + reason: Optional[str] = None + -InvoiceDiscount = Union[PercentageDiscount, TrialDiscount, UsageDiscount, AmountDiscount] +Discount = Union[PercentageDiscount, TrialDiscount, UsageDiscount, AmountDiscount] diff --git a/src/orb/types/shared_params/__init__.py b/src/orb/types/shared_params/__init__.py new file mode 100644 index 00000000..41bf8251 --- /dev/null +++ b/src/orb/types/shared_params/__init__.py @@ -0,0 +1,3 @@ +# File generated from our OpenAPI spec by Stainless. + +from .discount import Discount as Discount diff --git a/src/orb/types/shared_params/discount.py b/src/orb/types/shared_params/discount.py new file mode 100644 index 00000000..f1edba1c --- /dev/null +++ b/src/orb/types/shared_params/discount.py @@ -0,0 +1,80 @@ +# File generated from our OpenAPI spec by Stainless. + +from __future__ import annotations + +from typing import List, Union, Optional +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["Discount", "PercentageDiscount", "TrialDiscount", "UsageDiscount", "AmountDiscount"] + + +class PercentageDiscount(TypedDict, total=False): + applies_to_price_ids: Required[List[str]] + """List of price_ids that this discount applies to. + + For plan/plan phase discounts, this can be a subset of prices. + """ + + discount_type: Required[Literal["percentage"]] + + percentage_discount: Required[float] + """Only available if discount_type is `percentage`. + + This is a number between 0 and 1. + """ + + reason: Optional[str] + + +class TrialDiscount(TypedDict, total=False): + applies_to_price_ids: Required[List[str]] + """List of price_ids that this discount applies to. + + For plan/plan phase discounts, this can be a subset of prices. + """ + + discount_type: Required[Literal["trial"]] + + reason: Optional[str] + + trial_amount_discount: Optional[str] + """Only available if discount_type is `trial`""" + + trial_percentage_discount: Optional[float] + """Only available if discount_type is `trial`""" + + +class UsageDiscount(TypedDict, total=False): + applies_to_price_ids: Required[List[str]] + """List of price_ids that this discount applies to. + + For plan/plan phase discounts, this can be a subset of prices. + """ + + discount_type: Required[Literal["usage"]] + + usage_discount: Required[float] + """Only available if discount_type is `usage`. + + Number of usage units that this discount is for + """ + + reason: Optional[str] + + +class AmountDiscount(TypedDict, total=False): + amount_discount: Required[str] + """Only available if discount_type is `amount`.""" + + applies_to_price_ids: Required[List[str]] + """List of price_ids that this discount applies to. + + For plan/plan phase discounts, this can be a subset of prices. + """ + + discount_type: Required[Literal["amount"]] + + reason: Optional[str] + + +Discount = Union[PercentageDiscount, TrialDiscount, UsageDiscount, AmountDiscount] diff --git a/src/orb/types/subscription.py b/src/orb/types/subscription.py index d01418a3..1b44ff62 100644 --- a/src/orb/types/subscription.py +++ b/src/orb/types/subscription.py @@ -1,7 +1,7 @@ # File generated from our OpenAPI spec by Stainless. from typing import List, Union, Optional -from datetime import date, datetime +from datetime import datetime from typing_extensions import Literal from .plan import Plan @@ -146,7 +146,7 @@ class MinimumInterval(BaseModel): class PriceIntervalFixedFeeQuantityTransition(BaseModel): - effective_date: date + effective_date: datetime price_id: str diff --git a/src/orb/types/subscription_create_params.py b/src/orb/types/subscription_create_params.py index a287c888..55e88b41 100644 --- a/src/orb/types/subscription_create_params.py +++ b/src/orb/types/subscription_create_params.py @@ -7,38 +7,51 @@ from typing_extensions import Literal, Required, Annotated, TypedDict from .._utils import PropertyInfo -from .discount_param import DiscountParam __all__ = [ "SubscriptionCreateParams", "PriceOverride", "PriceOverrideOverrideUnitPrice", "PriceOverrideOverrideUnitPriceUnitConfig", + "PriceOverrideOverrideUnitPriceDiscount", "PriceOverrideOverridePackagePrice", "PriceOverrideOverridePackagePricePackageConfig", + "PriceOverrideOverridePackagePriceDiscount", "PriceOverrideOverrideMatrixPrice", "PriceOverrideOverrideMatrixPriceMatrixConfig", "PriceOverrideOverrideMatrixPriceMatrixConfigMatrixValue", + "PriceOverrideOverrideMatrixPriceDiscount", "PriceOverrideOverrideTieredPrice", "PriceOverrideOverrideTieredPriceTieredConfig", "PriceOverrideOverrideTieredPriceTieredConfigTier", + "PriceOverrideOverrideTieredPriceDiscount", "PriceOverrideOverrideTieredBpsPrice", "PriceOverrideOverrideTieredBpsPriceTieredBpsConfig", "PriceOverrideOverrideTieredBpsPriceTieredBpsConfigTier", + "PriceOverrideOverrideTieredBpsPriceDiscount", "PriceOverrideOverrideBpsPrice", "PriceOverrideOverrideBpsPriceBpsConfig", + "PriceOverrideOverrideBpsPriceDiscount", "PriceOverrideOverrideBulkBpsPrice", "PriceOverrideOverrideBulkBpsPriceBulkBpsConfig", "PriceOverrideOverrideBulkBpsPriceBulkBpsConfigTier", + "PriceOverrideOverrideBulkBpsPriceDiscount", "PriceOverrideOverrideBulkPrice", "PriceOverrideOverrideBulkPriceBulkConfig", "PriceOverrideOverrideBulkPriceBulkConfigTier", + "PriceOverrideOverrideBulkPriceDiscount", "PriceOverrideOverrideTestRatingFunctionPrice", + "PriceOverrideOverrideTestRatingFunctionPriceDiscount", "PriceOverrideOverrideFivetranExamplePrice", + "PriceOverrideOverrideFivetranExamplePriceDiscount", "PriceOverrideOverrideThresholdTotalAmountPrice", + "PriceOverrideOverrideThresholdTotalAmountPriceDiscount", "PriceOverrideOverrideTieredPackagePrice", + "PriceOverrideOverrideTieredPackagePriceDiscount", "PriceOverrideOverrideTieredWithMinimumPrice", + "PriceOverrideOverrideTieredWithMinimumPriceDiscount", "PriceOverrideOverridePackageWithAllocationPrice", + "PriceOverrideOverridePackageWithAllocationPriceDiscount", ] @@ -101,6 +114,34 @@ class PriceOverrideOverrideUnitPriceUnitConfig(TypedDict, total=False): """Multiplier to scale rated quantity by""" +class PriceOverrideOverrideUnitPriceDiscount(TypedDict, total=False): + discount_type: Required[Literal["percentage", "trial", "usage", "amount"]] + + amount_discount: Optional[str] + """Only available if discount_type is `amount`.""" + + applies_to_price_ids: Optional[List[str]] + """List of price_ids that this discount applies to. + + For plan/plan phase discounts, this can be a subset of prices. + """ + + percentage_discount: Optional[float] + """Only available if discount_type is `percentage`. + + This is a number between 0 and 1. + """ + + trial_amount_discount: Optional[str] + """Only available if discount_type is `trial`""" + + usage_discount: Optional[float] + """Only available if discount_type is `usage`. + + Number of usage units that this discount is for + """ + + class PriceOverrideOverrideUnitPrice(TypedDict, total=False): id: Required[str] @@ -108,7 +149,7 @@ class PriceOverrideOverrideUnitPrice(TypedDict, total=False): unit_config: Required[PriceOverrideOverrideUnitPriceUnitConfig] - discount: Optional[DiscountParam] + discount: Optional[PriceOverrideOverrideUnitPriceDiscount] """The subscription's override discount for the plan.""" fixed_price_quantity: Optional[float] @@ -133,6 +174,34 @@ class PriceOverrideOverridePackagePricePackageConfig(TypedDict, total=False): """ +class PriceOverrideOverridePackagePriceDiscount(TypedDict, total=False): + discount_type: Required[Literal["percentage", "trial", "usage", "amount"]] + + amount_discount: Optional[str] + """Only available if discount_type is `amount`.""" + + applies_to_price_ids: Optional[List[str]] + """List of price_ids that this discount applies to. + + For plan/plan phase discounts, this can be a subset of prices. + """ + + percentage_discount: Optional[float] + """Only available if discount_type is `percentage`. + + This is a number between 0 and 1. + """ + + trial_amount_discount: Optional[str] + """Only available if discount_type is `trial`""" + + usage_discount: Optional[float] + """Only available if discount_type is `usage`. + + Number of usage units that this discount is for + """ + + class PriceOverrideOverridePackagePrice(TypedDict, total=False): id: Required[str] @@ -140,7 +209,7 @@ class PriceOverrideOverridePackagePrice(TypedDict, total=False): package_config: Required[PriceOverrideOverridePackagePricePackageConfig] - discount: Optional[DiscountParam] + discount: Optional[PriceOverrideOverridePackagePriceDiscount] """The subscription's override discount for the plan.""" fixed_price_quantity: Optional[float] @@ -185,6 +254,34 @@ class PriceOverrideOverrideMatrixPriceMatrixConfig(TypedDict, total=False): """ +class PriceOverrideOverrideMatrixPriceDiscount(TypedDict, total=False): + discount_type: Required[Literal["percentage", "trial", "usage", "amount"]] + + amount_discount: Optional[str] + """Only available if discount_type is `amount`.""" + + applies_to_price_ids: Optional[List[str]] + """List of price_ids that this discount applies to. + + For plan/plan phase discounts, this can be a subset of prices. + """ + + percentage_discount: Optional[float] + """Only available if discount_type is `percentage`. + + This is a number between 0 and 1. + """ + + trial_amount_discount: Optional[str] + """Only available if discount_type is `trial`""" + + usage_discount: Optional[float] + """Only available if discount_type is `usage`. + + Number of usage units that this discount is for + """ + + class PriceOverrideOverrideMatrixPrice(TypedDict, total=False): id: Required[str] @@ -192,7 +289,7 @@ class PriceOverrideOverrideMatrixPrice(TypedDict, total=False): model_type: Required[Literal["matrix"]] - discount: Optional[DiscountParam] + discount: Optional[PriceOverrideOverrideMatrixPriceDiscount] """The subscription's override discount for the plan.""" fixed_price_quantity: Optional[float] @@ -221,6 +318,34 @@ class PriceOverrideOverrideTieredPriceTieredConfig(TypedDict, total=False): """Tiers for rating based on total usage quantities into the specified tier""" +class PriceOverrideOverrideTieredPriceDiscount(TypedDict, total=False): + discount_type: Required[Literal["percentage", "trial", "usage", "amount"]] + + amount_discount: Optional[str] + """Only available if discount_type is `amount`.""" + + applies_to_price_ids: Optional[List[str]] + """List of price_ids that this discount applies to. + + For plan/plan phase discounts, this can be a subset of prices. + """ + + percentage_discount: Optional[float] + """Only available if discount_type is `percentage`. + + This is a number between 0 and 1. + """ + + trial_amount_discount: Optional[str] + """Only available if discount_type is `trial`""" + + usage_discount: Optional[float] + """Only available if discount_type is `usage`. + + Number of usage units that this discount is for + """ + + class PriceOverrideOverrideTieredPrice(TypedDict, total=False): id: Required[str] @@ -228,7 +353,7 @@ class PriceOverrideOverrideTieredPrice(TypedDict, total=False): tiered_config: Required[PriceOverrideOverrideTieredPriceTieredConfig] - discount: Optional[DiscountParam] + discount: Optional[PriceOverrideOverrideTieredPriceDiscount] """The subscription's override discount for the plan.""" fixed_price_quantity: Optional[float] @@ -263,6 +388,34 @@ class PriceOverrideOverrideTieredBpsPriceTieredBpsConfig(TypedDict, total=False) """ +class PriceOverrideOverrideTieredBpsPriceDiscount(TypedDict, total=False): + discount_type: Required[Literal["percentage", "trial", "usage", "amount"]] + + amount_discount: Optional[str] + """Only available if discount_type is `amount`.""" + + applies_to_price_ids: Optional[List[str]] + """List of price_ids that this discount applies to. + + For plan/plan phase discounts, this can be a subset of prices. + """ + + percentage_discount: Optional[float] + """Only available if discount_type is `percentage`. + + This is a number between 0 and 1. + """ + + trial_amount_discount: Optional[str] + """Only available if discount_type is `trial`""" + + usage_discount: Optional[float] + """Only available if discount_type is `usage`. + + Number of usage units that this discount is for + """ + + class PriceOverrideOverrideTieredBpsPrice(TypedDict, total=False): id: Required[str] @@ -270,7 +423,7 @@ class PriceOverrideOverrideTieredBpsPrice(TypedDict, total=False): tiered_bps_config: Required[PriceOverrideOverrideTieredBpsPriceTieredBpsConfig] - discount: Optional[DiscountParam] + discount: Optional[PriceOverrideOverrideTieredBpsPriceDiscount] """The subscription's override discount for the plan.""" fixed_price_quantity: Optional[float] @@ -291,6 +444,34 @@ class PriceOverrideOverrideBpsPriceBpsConfig(TypedDict, total=False): """Optional currency amount maximum to cap spend per event""" +class PriceOverrideOverrideBpsPriceDiscount(TypedDict, total=False): + discount_type: Required[Literal["percentage", "trial", "usage", "amount"]] + + amount_discount: Optional[str] + """Only available if discount_type is `amount`.""" + + applies_to_price_ids: Optional[List[str]] + """List of price_ids that this discount applies to. + + For plan/plan phase discounts, this can be a subset of prices. + """ + + percentage_discount: Optional[float] + """Only available if discount_type is `percentage`. + + This is a number between 0 and 1. + """ + + trial_amount_discount: Optional[str] + """Only available if discount_type is `trial`""" + + usage_discount: Optional[float] + """Only available if discount_type is `usage`. + + Number of usage units that this discount is for + """ + + class PriceOverrideOverrideBpsPrice(TypedDict, total=False): id: Required[str] @@ -298,7 +479,7 @@ class PriceOverrideOverrideBpsPrice(TypedDict, total=False): model_type: Required[Literal["bps"]] - discount: Optional[DiscountParam] + discount: Optional[PriceOverrideOverrideBpsPriceDiscount] """The subscription's override discount for the plan.""" fixed_price_quantity: Optional[float] @@ -330,6 +511,34 @@ class PriceOverrideOverrideBulkBpsPriceBulkBpsConfig(TypedDict, total=False): """ +class PriceOverrideOverrideBulkBpsPriceDiscount(TypedDict, total=False): + discount_type: Required[Literal["percentage", "trial", "usage", "amount"]] + + amount_discount: Optional[str] + """Only available if discount_type is `amount`.""" + + applies_to_price_ids: Optional[List[str]] + """List of price_ids that this discount applies to. + + For plan/plan phase discounts, this can be a subset of prices. + """ + + percentage_discount: Optional[float] + """Only available if discount_type is `percentage`. + + This is a number between 0 and 1. + """ + + trial_amount_discount: Optional[str] + """Only available if discount_type is `trial`""" + + usage_discount: Optional[float] + """Only available if discount_type is `usage`. + + Number of usage units that this discount is for + """ + + class PriceOverrideOverrideBulkBpsPrice(TypedDict, total=False): id: Required[str] @@ -337,7 +546,7 @@ class PriceOverrideOverrideBulkBpsPrice(TypedDict, total=False): model_type: Required[Literal["bulk_bps"]] - discount: Optional[DiscountParam] + discount: Optional[PriceOverrideOverrideBulkBpsPriceDiscount] """The subscription's override discount for the plan.""" fixed_price_quantity: Optional[float] @@ -363,6 +572,34 @@ class PriceOverrideOverrideBulkPriceBulkConfig(TypedDict, total=False): """Bulk tiers for rating based on total usage volume""" +class PriceOverrideOverrideBulkPriceDiscount(TypedDict, total=False): + discount_type: Required[Literal["percentage", "trial", "usage", "amount"]] + + amount_discount: Optional[str] + """Only available if discount_type is `amount`.""" + + applies_to_price_ids: Optional[List[str]] + """List of price_ids that this discount applies to. + + For plan/plan phase discounts, this can be a subset of prices. + """ + + percentage_discount: Optional[float] + """Only available if discount_type is `percentage`. + + This is a number between 0 and 1. + """ + + trial_amount_discount: Optional[str] + """Only available if discount_type is `trial`""" + + usage_discount: Optional[float] + """Only available if discount_type is `usage`. + + Number of usage units that this discount is for + """ + + class PriceOverrideOverrideBulkPrice(TypedDict, total=False): id: Required[str] @@ -370,7 +607,7 @@ class PriceOverrideOverrideBulkPrice(TypedDict, total=False): model_type: Required[Literal["bulk"]] - discount: Optional[DiscountParam] + discount: Optional[PriceOverrideOverrideBulkPriceDiscount] """The subscription's override discount for the plan.""" fixed_price_quantity: Optional[float] @@ -383,6 +620,34 @@ class PriceOverrideOverrideBulkPrice(TypedDict, total=False): """The subscription's override minimum amount for the plan.""" +class PriceOverrideOverrideTestRatingFunctionPriceDiscount(TypedDict, total=False): + discount_type: Required[Literal["percentage", "trial", "usage", "amount"]] + + amount_discount: Optional[str] + """Only available if discount_type is `amount`.""" + + applies_to_price_ids: Optional[List[str]] + """List of price_ids that this discount applies to. + + For plan/plan phase discounts, this can be a subset of prices. + """ + + percentage_discount: Optional[float] + """Only available if discount_type is `percentage`. + + This is a number between 0 and 1. + """ + + trial_amount_discount: Optional[str] + """Only available if discount_type is `trial`""" + + usage_discount: Optional[float] + """Only available if discount_type is `usage`. + + Number of usage units that this discount is for + """ + + class PriceOverrideOverrideTestRatingFunctionPrice(TypedDict, total=False): id: Required[str] @@ -390,7 +655,7 @@ class PriceOverrideOverrideTestRatingFunctionPrice(TypedDict, total=False): test_rating_function_config: Required[Dict[str, object]] - discount: Optional[DiscountParam] + discount: Optional[PriceOverrideOverrideTestRatingFunctionPriceDiscount] """The subscription's override discount for the plan.""" fixed_price_quantity: Optional[float] @@ -403,6 +668,34 @@ class PriceOverrideOverrideTestRatingFunctionPrice(TypedDict, total=False): """The subscription's override minimum amount for the plan.""" +class PriceOverrideOverrideFivetranExamplePriceDiscount(TypedDict, total=False): + discount_type: Required[Literal["percentage", "trial", "usage", "amount"]] + + amount_discount: Optional[str] + """Only available if discount_type is `amount`.""" + + applies_to_price_ids: Optional[List[str]] + """List of price_ids that this discount applies to. + + For plan/plan phase discounts, this can be a subset of prices. + """ + + percentage_discount: Optional[float] + """Only available if discount_type is `percentage`. + + This is a number between 0 and 1. + """ + + trial_amount_discount: Optional[str] + """Only available if discount_type is `trial`""" + + usage_discount: Optional[float] + """Only available if discount_type is `usage`. + + Number of usage units that this discount is for + """ + + class PriceOverrideOverrideFivetranExamplePrice(TypedDict, total=False): id: Required[str] @@ -410,7 +703,7 @@ class PriceOverrideOverrideFivetranExamplePrice(TypedDict, total=False): model_type: Required[Literal["fivetran_example"]] - discount: Optional[DiscountParam] + discount: Optional[PriceOverrideOverrideFivetranExamplePriceDiscount] """The subscription's override discount for the plan.""" fixed_price_quantity: Optional[float] @@ -423,6 +716,34 @@ class PriceOverrideOverrideFivetranExamplePrice(TypedDict, total=False): """The subscription's override minimum amount for the plan.""" +class PriceOverrideOverrideThresholdTotalAmountPriceDiscount(TypedDict, total=False): + discount_type: Required[Literal["percentage", "trial", "usage", "amount"]] + + amount_discount: Optional[str] + """Only available if discount_type is `amount`.""" + + applies_to_price_ids: Optional[List[str]] + """List of price_ids that this discount applies to. + + For plan/plan phase discounts, this can be a subset of prices. + """ + + percentage_discount: Optional[float] + """Only available if discount_type is `percentage`. + + This is a number between 0 and 1. + """ + + trial_amount_discount: Optional[str] + """Only available if discount_type is `trial`""" + + usage_discount: Optional[float] + """Only available if discount_type is `usage`. + + Number of usage units that this discount is for + """ + + class PriceOverrideOverrideThresholdTotalAmountPrice(TypedDict, total=False): id: Required[str] @@ -430,7 +751,7 @@ class PriceOverrideOverrideThresholdTotalAmountPrice(TypedDict, total=False): threshold_total_amount_config: Required[Dict[str, object]] - discount: Optional[DiscountParam] + discount: Optional[PriceOverrideOverrideThresholdTotalAmountPriceDiscount] """The subscription's override discount for the plan.""" fixed_price_quantity: Optional[float] @@ -443,6 +764,34 @@ class PriceOverrideOverrideThresholdTotalAmountPrice(TypedDict, total=False): """The subscription's override minimum amount for the plan.""" +class PriceOverrideOverrideTieredPackagePriceDiscount(TypedDict, total=False): + discount_type: Required[Literal["percentage", "trial", "usage", "amount"]] + + amount_discount: Optional[str] + """Only available if discount_type is `amount`.""" + + applies_to_price_ids: Optional[List[str]] + """List of price_ids that this discount applies to. + + For plan/plan phase discounts, this can be a subset of prices. + """ + + percentage_discount: Optional[float] + """Only available if discount_type is `percentage`. + + This is a number between 0 and 1. + """ + + trial_amount_discount: Optional[str] + """Only available if discount_type is `trial`""" + + usage_discount: Optional[float] + """Only available if discount_type is `usage`. + + Number of usage units that this discount is for + """ + + class PriceOverrideOverrideTieredPackagePrice(TypedDict, total=False): id: Required[str] @@ -450,7 +799,7 @@ class PriceOverrideOverrideTieredPackagePrice(TypedDict, total=False): tiered_package_config: Required[Dict[str, object]] - discount: Optional[DiscountParam] + discount: Optional[PriceOverrideOverrideTieredPackagePriceDiscount] """The subscription's override discount for the plan.""" fixed_price_quantity: Optional[float] @@ -463,6 +812,34 @@ class PriceOverrideOverrideTieredPackagePrice(TypedDict, total=False): """The subscription's override minimum amount for the plan.""" +class PriceOverrideOverrideTieredWithMinimumPriceDiscount(TypedDict, total=False): + discount_type: Required[Literal["percentage", "trial", "usage", "amount"]] + + amount_discount: Optional[str] + """Only available if discount_type is `amount`.""" + + applies_to_price_ids: Optional[List[str]] + """List of price_ids that this discount applies to. + + For plan/plan phase discounts, this can be a subset of prices. + """ + + percentage_discount: Optional[float] + """Only available if discount_type is `percentage`. + + This is a number between 0 and 1. + """ + + trial_amount_discount: Optional[str] + """Only available if discount_type is `trial`""" + + usage_discount: Optional[float] + """Only available if discount_type is `usage`. + + Number of usage units that this discount is for + """ + + class PriceOverrideOverrideTieredWithMinimumPrice(TypedDict, total=False): id: Required[str] @@ -470,7 +847,7 @@ class PriceOverrideOverrideTieredWithMinimumPrice(TypedDict, total=False): tiered_with_minimum_config: Required[Dict[str, object]] - discount: Optional[DiscountParam] + discount: Optional[PriceOverrideOverrideTieredWithMinimumPriceDiscount] """The subscription's override discount for the plan.""" fixed_price_quantity: Optional[float] @@ -483,6 +860,34 @@ class PriceOverrideOverrideTieredWithMinimumPrice(TypedDict, total=False): """The subscription's override minimum amount for the plan.""" +class PriceOverrideOverridePackageWithAllocationPriceDiscount(TypedDict, total=False): + discount_type: Required[Literal["percentage", "trial", "usage", "amount"]] + + amount_discount: Optional[str] + """Only available if discount_type is `amount`.""" + + applies_to_price_ids: Optional[List[str]] + """List of price_ids that this discount applies to. + + For plan/plan phase discounts, this can be a subset of prices. + """ + + percentage_discount: Optional[float] + """Only available if discount_type is `percentage`. + + This is a number between 0 and 1. + """ + + trial_amount_discount: Optional[str] + """Only available if discount_type is `trial`""" + + usage_discount: Optional[float] + """Only available if discount_type is `usage`. + + Number of usage units that this discount is for + """ + + class PriceOverrideOverridePackageWithAllocationPrice(TypedDict, total=False): id: Required[str] @@ -490,7 +895,7 @@ class PriceOverrideOverridePackageWithAllocationPrice(TypedDict, total=False): package_with_allocation_config: Required[Dict[str, object]] - discount: Optional[DiscountParam] + discount: Optional[PriceOverrideOverridePackageWithAllocationPriceDiscount] """The subscription's override discount for the plan.""" fixed_price_quantity: Optional[float] diff --git a/src/orb/types/subscription_price_intervals_params.py b/src/orb/types/subscription_price_intervals_params.py index ecdddd84..164b9226 100644 --- a/src/orb/types/subscription_price_intervals_params.py +++ b/src/orb/types/subscription_price_intervals_params.py @@ -3,7 +3,7 @@ from __future__ import annotations from typing import Dict, List, Union, Optional -from datetime import date, datetime +from datetime import datetime from typing_extensions import Literal, Required, Annotated, TypedDict from .._utils import PropertyInfo @@ -17,31 +17,31 @@ "AddDiscountUsageDiscountCreationParams", "AddFixedFeeQuantityTransition", "AddPrice", - "AddPriceNewUnitPrice", - "AddPriceNewUnitPriceUnitConfig", - "AddPriceNewPackagePrice", - "AddPriceNewPackagePricePackageConfig", - "AddPriceNewMatrixPrice", - "AddPriceNewMatrixPriceMatrixConfig", - "AddPriceNewMatrixPriceMatrixConfigMatrixValue", - "AddPriceNewTieredPrice", - "AddPriceNewTieredPriceTieredConfig", - "AddPriceNewTieredPriceTieredConfigTier", - "AddPriceNewTieredBpsPrice", - "AddPriceNewTieredBpsPriceTieredBpsConfig", - "AddPriceNewTieredBpsPriceTieredBpsConfigTier", - "AddPriceNewBpsPrice", - "AddPriceNewBpsPriceBpsConfig", - "AddPriceNewBulkBpsPrice", - "AddPriceNewBulkBpsPriceBulkBpsConfig", - "AddPriceNewBulkBpsPriceBulkBpsConfigTier", - "AddPriceNewBulkPrice", - "AddPriceNewBulkPriceBulkConfig", - "AddPriceNewBulkPriceBulkConfigTier", - "AddPriceNewThresholdTotalAmountPrice", - "AddPriceNewTieredPackagePrice", - "AddPriceNewTieredWithMinimumPrice", - "AddPriceNewPackageWithAllocationPrice", + "AddPriceNewFloatingUnitPrice", + "AddPriceNewFloatingUnitPriceUnitConfig", + "AddPriceNewFloatingPackagePrice", + "AddPriceNewFloatingPackagePricePackageConfig", + "AddPriceNewFloatingMatrixPrice", + "AddPriceNewFloatingMatrixPriceMatrixConfig", + "AddPriceNewFloatingMatrixPriceMatrixConfigMatrixValue", + "AddPriceNewFloatingTieredPrice", + "AddPriceNewFloatingTieredPriceTieredConfig", + "AddPriceNewFloatingTieredPriceTieredConfigTier", + "AddPriceNewFloatingTieredBpsPrice", + "AddPriceNewFloatingTieredBpsPriceTieredBpsConfig", + "AddPriceNewFloatingTieredBpsPriceTieredBpsConfigTier", + "AddPriceNewFloatingBpsPrice", + "AddPriceNewFloatingBpsPriceBpsConfig", + "AddPriceNewFloatingBulkBpsPrice", + "AddPriceNewFloatingBulkBpsPriceBulkBpsConfig", + "AddPriceNewFloatingBulkBpsPriceBulkBpsConfigTier", + "AddPriceNewFloatingBulkPrice", + "AddPriceNewFloatingBulkPriceBulkConfig", + "AddPriceNewFloatingBulkPriceBulkConfigTier", + "AddPriceNewFloatingThresholdTotalAmountPrice", + "AddPriceNewFloatingTieredPackagePrice", + "AddPriceNewFloatingTieredWithMinimumPrice", + "AddPriceNewFloatingPackageWithAllocationPrice", "Edit", "EditFixedFeeQuantityTransition", ] @@ -90,14 +90,14 @@ class AddDiscountUsageDiscountCreationParams(TypedDict, total=False): class AddFixedFeeQuantityTransition(TypedDict, total=False): - effective_date: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + effective_date: Required[Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]] """The date that the fixed fee quantity transition should take effect.""" quantity: Required[int] """The quantity of the fixed fee quantity transition.""" -class AddPriceNewUnitPriceUnitConfig(TypedDict, total=False): +class AddPriceNewFloatingUnitPriceUnitConfig(TypedDict, total=False): unit_amount: Required[str] """Rate per unit of usage""" @@ -105,8 +105,8 @@ class AddPriceNewUnitPriceUnitConfig(TypedDict, total=False): """Multiplier to scale rated quantity by""" -class AddPriceNewUnitPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly"]] +class AddPriceNewFloatingUnitPrice(TypedDict, total=False): + cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -120,7 +120,7 @@ class AddPriceNewUnitPrice(TypedDict, total=False): name: Required[str] """The name of the price.""" - unit_config: Required[AddPriceNewUnitPriceUnitConfig] + unit_config: Required[AddPriceNewFloatingUnitPriceUnitConfig] billable_metric_id: Optional[str] """The id of the billable metric for the price. @@ -147,7 +147,7 @@ class AddPriceNewUnitPrice(TypedDict, total=False): """The property used to group this price on an invoice""" -class AddPriceNewPackagePricePackageConfig(TypedDict, total=False): +class AddPriceNewFloatingPackagePricePackageConfig(TypedDict, total=False): package_amount: Required[str] """A currency amount to rate usage by""" @@ -159,8 +159,8 @@ class AddPriceNewPackagePricePackageConfig(TypedDict, total=False): """ -class AddPriceNewPackagePrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly"]] +class AddPriceNewFloatingPackagePrice(TypedDict, total=False): + cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -174,7 +174,7 @@ class AddPriceNewPackagePrice(TypedDict, total=False): name: Required[str] """The name of the price.""" - package_config: Required[AddPriceNewPackagePricePackageConfig] + package_config: Required[AddPriceNewFloatingPackagePricePackageConfig] billable_metric_id: Optional[str] """The id of the billable metric for the price. @@ -201,7 +201,7 @@ class AddPriceNewPackagePrice(TypedDict, total=False): """The property used to group this price on an invoice""" -class AddPriceNewMatrixPriceMatrixConfigMatrixValue(TypedDict, total=False): +class AddPriceNewFloatingMatrixPriceMatrixConfigMatrixValue(TypedDict, total=False): dimension_values: Required[List[Optional[str]]] """One or two matrix keys to filter usage to this Matrix value by. @@ -216,14 +216,14 @@ class AddPriceNewMatrixPriceMatrixConfigMatrixValue(TypedDict, total=False): """Optional multiplier to scale rated quantities by""" -class AddPriceNewMatrixPriceMatrixConfig(TypedDict, total=False): +class AddPriceNewFloatingMatrixPriceMatrixConfig(TypedDict, total=False): default_unit_amount: Required[str] """Default per unit rate for any usage not bucketed into a specified matrix_value""" dimensions: Required[List[Optional[str]]] """One or two event property values to evaluate matrix groups by""" - matrix_values: Required[List[AddPriceNewMatrixPriceMatrixConfigMatrixValue]] + matrix_values: Required[List[AddPriceNewFloatingMatrixPriceMatrixConfigMatrixValue]] """Matrix values for specified matrix grouping keys""" scaling_factor: Optional[float] @@ -233,8 +233,8 @@ class AddPriceNewMatrixPriceMatrixConfig(TypedDict, total=False): """ -class AddPriceNewMatrixPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly"]] +class AddPriceNewFloatingMatrixPrice(TypedDict, total=False): + cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -243,7 +243,7 @@ class AddPriceNewMatrixPrice(TypedDict, total=False): item_id: Required[str] """The id of the item the plan will be associated with.""" - matrix_config: Required[AddPriceNewMatrixPriceMatrixConfig] + matrix_config: Required[AddPriceNewFloatingMatrixPriceMatrixConfig] model_type: Required[Literal["matrix"]] @@ -275,7 +275,7 @@ class AddPriceNewMatrixPrice(TypedDict, total=False): """The property used to group this price on an invoice""" -class AddPriceNewTieredPriceTieredConfigTier(TypedDict, total=False): +class AddPriceNewFloatingTieredPriceTieredConfigTier(TypedDict, total=False): first_unit: Required[float] """Inclusive tier starting value""" @@ -286,13 +286,13 @@ class AddPriceNewTieredPriceTieredConfigTier(TypedDict, total=False): """Exclusive tier ending value. If null, this is treated as the last tier""" -class AddPriceNewTieredPriceTieredConfig(TypedDict, total=False): - tiers: Required[List[AddPriceNewTieredPriceTieredConfigTier]] +class AddPriceNewFloatingTieredPriceTieredConfig(TypedDict, total=False): + tiers: Required[List[AddPriceNewFloatingTieredPriceTieredConfigTier]] """Tiers for rating based on total usage quantities into the specified tier""" -class AddPriceNewTieredPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly"]] +class AddPriceNewFloatingTieredPrice(TypedDict, total=False): + cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -306,7 +306,7 @@ class AddPriceNewTieredPrice(TypedDict, total=False): name: Required[str] """The name of the price.""" - tiered_config: Required[AddPriceNewTieredPriceTieredConfig] + tiered_config: Required[AddPriceNewFloatingTieredPriceTieredConfig] billable_metric_id: Optional[str] """The id of the billable metric for the price. @@ -333,7 +333,7 @@ class AddPriceNewTieredPrice(TypedDict, total=False): """The property used to group this price on an invoice""" -class AddPriceNewTieredBpsPriceTieredBpsConfigTier(TypedDict, total=False): +class AddPriceNewFloatingTieredBpsPriceTieredBpsConfigTier(TypedDict, total=False): bps: Required[float] """Per-event basis point rate""" @@ -347,16 +347,16 @@ class AddPriceNewTieredBpsPriceTieredBpsConfigTier(TypedDict, total=False): """Per unit maximum to charge""" -class AddPriceNewTieredBpsPriceTieredBpsConfig(TypedDict, total=False): - tiers: Required[List[AddPriceNewTieredBpsPriceTieredBpsConfigTier]] +class AddPriceNewFloatingTieredBpsPriceTieredBpsConfig(TypedDict, total=False): + tiers: Required[List[AddPriceNewFloatingTieredBpsPriceTieredBpsConfigTier]] """ Tiers for a Graduated BPS pricing model, where usage is bucketed into specified tiers """ -class AddPriceNewTieredBpsPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly"]] +class AddPriceNewFloatingTieredBpsPrice(TypedDict, total=False): + cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -370,7 +370,7 @@ class AddPriceNewTieredBpsPrice(TypedDict, total=False): name: Required[str] """The name of the price.""" - tiered_bps_config: Required[AddPriceNewTieredBpsPriceTieredBpsConfig] + tiered_bps_config: Required[AddPriceNewFloatingTieredBpsPriceTieredBpsConfig] billable_metric_id: Optional[str] """The id of the billable metric for the price. @@ -397,7 +397,7 @@ class AddPriceNewTieredBpsPrice(TypedDict, total=False): """The property used to group this price on an invoice""" -class AddPriceNewBpsPriceBpsConfig(TypedDict, total=False): +class AddPriceNewFloatingBpsPriceBpsConfig(TypedDict, total=False): bps: Required[float] """Basis point take rate per event""" @@ -405,10 +405,10 @@ class AddPriceNewBpsPriceBpsConfig(TypedDict, total=False): """Optional currency amount maximum to cap spend per event""" -class AddPriceNewBpsPrice(TypedDict, total=False): - bps_config: Required[AddPriceNewBpsPriceBpsConfig] +class AddPriceNewFloatingBpsPrice(TypedDict, total=False): + bps_config: Required[AddPriceNewFloatingBpsPriceBpsConfig] - cadence: Required[Literal["annual", "monthly", "quarterly"]] + cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -447,7 +447,7 @@ class AddPriceNewBpsPrice(TypedDict, total=False): """The property used to group this price on an invoice""" -class AddPriceNewBulkBpsPriceBulkBpsConfigTier(TypedDict, total=False): +class AddPriceNewFloatingBulkBpsPriceBulkBpsConfigTier(TypedDict, total=False): bps: Required[float] """Basis points to rate on""" @@ -458,18 +458,18 @@ class AddPriceNewBulkBpsPriceBulkBpsConfigTier(TypedDict, total=False): """The maximum amount to charge for any one event""" -class AddPriceNewBulkBpsPriceBulkBpsConfig(TypedDict, total=False): - tiers: Required[List[AddPriceNewBulkBpsPriceBulkBpsConfigTier]] +class AddPriceNewFloatingBulkBpsPriceBulkBpsConfig(TypedDict, total=False): + tiers: Required[List[AddPriceNewFloatingBulkBpsPriceBulkBpsConfigTier]] """ Tiers for a bulk BPS pricing model where all usage is aggregated to a single tier based on total volume """ -class AddPriceNewBulkBpsPrice(TypedDict, total=False): - bulk_bps_config: Required[AddPriceNewBulkBpsPriceBulkBpsConfig] +class AddPriceNewFloatingBulkBpsPrice(TypedDict, total=False): + bulk_bps_config: Required[AddPriceNewFloatingBulkBpsPriceBulkBpsConfig] - cadence: Required[Literal["annual", "monthly", "quarterly"]] + cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -508,7 +508,7 @@ class AddPriceNewBulkBpsPrice(TypedDict, total=False): """The property used to group this price on an invoice""" -class AddPriceNewBulkPriceBulkConfigTier(TypedDict, total=False): +class AddPriceNewFloatingBulkPriceBulkConfigTier(TypedDict, total=False): unit_amount: Required[str] """Amount per unit""" @@ -516,15 +516,15 @@ class AddPriceNewBulkPriceBulkConfigTier(TypedDict, total=False): """Upper bound for this tier""" -class AddPriceNewBulkPriceBulkConfig(TypedDict, total=False): - tiers: Required[List[AddPriceNewBulkPriceBulkConfigTier]] +class AddPriceNewFloatingBulkPriceBulkConfig(TypedDict, total=False): + tiers: Required[List[AddPriceNewFloatingBulkPriceBulkConfigTier]] """Bulk tiers for rating based on total usage volume""" -class AddPriceNewBulkPrice(TypedDict, total=False): - bulk_config: Required[AddPriceNewBulkPriceBulkConfig] +class AddPriceNewFloatingBulkPrice(TypedDict, total=False): + bulk_config: Required[AddPriceNewFloatingBulkPriceBulkConfig] - cadence: Required[Literal["annual", "monthly", "quarterly"]] + cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -563,8 +563,8 @@ class AddPriceNewBulkPrice(TypedDict, total=False): """The property used to group this price on an invoice""" -class AddPriceNewThresholdTotalAmountPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly"]] +class AddPriceNewFloatingThresholdTotalAmountPrice(TypedDict, total=False): + cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -605,8 +605,8 @@ class AddPriceNewThresholdTotalAmountPrice(TypedDict, total=False): """The property used to group this price on an invoice""" -class AddPriceNewTieredPackagePrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly"]] +class AddPriceNewFloatingTieredPackagePrice(TypedDict, total=False): + cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -647,8 +647,8 @@ class AddPriceNewTieredPackagePrice(TypedDict, total=False): """The property used to group this price on an invoice""" -class AddPriceNewTieredWithMinimumPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly"]] +class AddPriceNewFloatingTieredWithMinimumPrice(TypedDict, total=False): + cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -689,8 +689,8 @@ class AddPriceNewTieredWithMinimumPrice(TypedDict, total=False): """The property used to group this price on an invoice""" -class AddPriceNewPackageWithAllocationPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly"]] +class AddPriceNewFloatingPackageWithAllocationPrice(TypedDict, total=False): + cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -732,18 +732,18 @@ class AddPriceNewPackageWithAllocationPrice(TypedDict, total=False): AddPrice = Union[ - AddPriceNewUnitPrice, - AddPriceNewPackagePrice, - AddPriceNewMatrixPrice, - AddPriceNewTieredPrice, - AddPriceNewTieredBpsPrice, - AddPriceNewBpsPrice, - AddPriceNewBulkBpsPrice, - AddPriceNewBulkPrice, - AddPriceNewThresholdTotalAmountPrice, - AddPriceNewTieredPackagePrice, - AddPriceNewTieredWithMinimumPrice, - AddPriceNewPackageWithAllocationPrice, + AddPriceNewFloatingUnitPrice, + AddPriceNewFloatingPackagePrice, + AddPriceNewFloatingMatrixPrice, + AddPriceNewFloatingTieredPrice, + AddPriceNewFloatingTieredBpsPrice, + AddPriceNewFloatingBpsPrice, + AddPriceNewFloatingBulkBpsPrice, + AddPriceNewFloatingBulkPrice, + AddPriceNewFloatingThresholdTotalAmountPrice, + AddPriceNewFloatingTieredPackagePrice, + AddPriceNewFloatingTieredWithMinimumPrice, + AddPriceNewFloatingPackageWithAllocationPrice, ] @@ -793,7 +793,7 @@ class Add(TypedDict, total=False): class EditFixedFeeQuantityTransition(TypedDict, total=False): - effective_date: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + effective_date: Required[Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]] """The date that the fixed fee quantity transition should take effect.""" quantity: Required[int] @@ -804,6 +804,13 @@ class Edit(TypedDict, total=False): price_interval_id: Required[str] """The id of the price interval to edit.""" + billing_cycle_day: Optional[int] + """The updated billing cycle day for this price interval. + + If not specified, the billing cycle day will not be updated. Note that + overlapping price intervals must have the same billing cycle day. + """ + end_date: Annotated[ Union[Union[str, datetime], Literal["start_of_term", "end_of_term"], None], PropertyInfo(format="iso8601") ] @@ -820,7 +827,7 @@ class Edit(TypedDict, total=False): """ start_date: Annotated[ - Union[Union[str, datetime], Literal["start_of_term", "end_of_term"], None], PropertyInfo(format="iso8601") + Union[Union[str, datetime], Literal["start_of_term", "end_of_term"]], PropertyInfo(format="iso8601") ] """The updated start date of this price interval. diff --git a/src/orb/types/subscription_schedule_plan_change_params.py b/src/orb/types/subscription_schedule_plan_change_params.py index d4138e86..1bde23da 100644 --- a/src/orb/types/subscription_schedule_plan_change_params.py +++ b/src/orb/types/subscription_schedule_plan_change_params.py @@ -5,38 +5,50 @@ from typing import Dict, List, Union, Optional from typing_extensions import Literal, Required, TypedDict -from .discount_param import DiscountParam - __all__ = [ "SubscriptionSchedulePlanChangeParams", "PriceOverride", "PriceOverrideOverrideUnitPrice", "PriceOverrideOverrideUnitPriceUnitConfig", + "PriceOverrideOverrideUnitPriceDiscount", "PriceOverrideOverridePackagePrice", "PriceOverrideOverridePackagePricePackageConfig", + "PriceOverrideOverridePackagePriceDiscount", "PriceOverrideOverrideMatrixPrice", "PriceOverrideOverrideMatrixPriceMatrixConfig", "PriceOverrideOverrideMatrixPriceMatrixConfigMatrixValue", + "PriceOverrideOverrideMatrixPriceDiscount", "PriceOverrideOverrideTieredPrice", "PriceOverrideOverrideTieredPriceTieredConfig", "PriceOverrideOverrideTieredPriceTieredConfigTier", + "PriceOverrideOverrideTieredPriceDiscount", "PriceOverrideOverrideTieredBpsPrice", "PriceOverrideOverrideTieredBpsPriceTieredBpsConfig", "PriceOverrideOverrideTieredBpsPriceTieredBpsConfigTier", + "PriceOverrideOverrideTieredBpsPriceDiscount", "PriceOverrideOverrideBpsPrice", "PriceOverrideOverrideBpsPriceBpsConfig", + "PriceOverrideOverrideBpsPriceDiscount", "PriceOverrideOverrideBulkBpsPrice", "PriceOverrideOverrideBulkBpsPriceBulkBpsConfig", "PriceOverrideOverrideBulkBpsPriceBulkBpsConfigTier", + "PriceOverrideOverrideBulkBpsPriceDiscount", "PriceOverrideOverrideBulkPrice", "PriceOverrideOverrideBulkPriceBulkConfig", "PriceOverrideOverrideBulkPriceBulkConfigTier", + "PriceOverrideOverrideBulkPriceDiscount", "PriceOverrideOverrideTestRatingFunctionPrice", + "PriceOverrideOverrideTestRatingFunctionPriceDiscount", "PriceOverrideOverrideFivetranExamplePrice", + "PriceOverrideOverrideFivetranExamplePriceDiscount", "PriceOverrideOverrideThresholdTotalAmountPrice", + "PriceOverrideOverrideThresholdTotalAmountPriceDiscount", "PriceOverrideOverrideTieredPackagePrice", + "PriceOverrideOverrideTieredPackagePriceDiscount", "PriceOverrideOverrideTieredWithMinimumPrice", + "PriceOverrideOverrideTieredWithMinimumPriceDiscount", "PriceOverrideOverridePackageWithAllocationPrice", + "PriceOverrideOverridePackageWithAllocationPriceDiscount", ] @@ -107,6 +119,34 @@ class PriceOverrideOverrideUnitPriceUnitConfig(TypedDict, total=False): """Multiplier to scale rated quantity by""" +class PriceOverrideOverrideUnitPriceDiscount(TypedDict, total=False): + discount_type: Required[Literal["percentage", "trial", "usage", "amount"]] + + amount_discount: Optional[str] + """Only available if discount_type is `amount`.""" + + applies_to_price_ids: Optional[List[str]] + """List of price_ids that this discount applies to. + + For plan/plan phase discounts, this can be a subset of prices. + """ + + percentage_discount: Optional[float] + """Only available if discount_type is `percentage`. + + This is a number between 0 and 1. + """ + + trial_amount_discount: Optional[str] + """Only available if discount_type is `trial`""" + + usage_discount: Optional[float] + """Only available if discount_type is `usage`. + + Number of usage units that this discount is for + """ + + class PriceOverrideOverrideUnitPrice(TypedDict, total=False): id: Required[str] @@ -114,7 +154,7 @@ class PriceOverrideOverrideUnitPrice(TypedDict, total=False): unit_config: Required[PriceOverrideOverrideUnitPriceUnitConfig] - discount: Optional[DiscountParam] + discount: Optional[PriceOverrideOverrideUnitPriceDiscount] """The subscription's override discount for the plan.""" fixed_price_quantity: Optional[float] @@ -139,6 +179,34 @@ class PriceOverrideOverridePackagePricePackageConfig(TypedDict, total=False): """ +class PriceOverrideOverridePackagePriceDiscount(TypedDict, total=False): + discount_type: Required[Literal["percentage", "trial", "usage", "amount"]] + + amount_discount: Optional[str] + """Only available if discount_type is `amount`.""" + + applies_to_price_ids: Optional[List[str]] + """List of price_ids that this discount applies to. + + For plan/plan phase discounts, this can be a subset of prices. + """ + + percentage_discount: Optional[float] + """Only available if discount_type is `percentage`. + + This is a number between 0 and 1. + """ + + trial_amount_discount: Optional[str] + """Only available if discount_type is `trial`""" + + usage_discount: Optional[float] + """Only available if discount_type is `usage`. + + Number of usage units that this discount is for + """ + + class PriceOverrideOverridePackagePrice(TypedDict, total=False): id: Required[str] @@ -146,7 +214,7 @@ class PriceOverrideOverridePackagePrice(TypedDict, total=False): package_config: Required[PriceOverrideOverridePackagePricePackageConfig] - discount: Optional[DiscountParam] + discount: Optional[PriceOverrideOverridePackagePriceDiscount] """The subscription's override discount for the plan.""" fixed_price_quantity: Optional[float] @@ -191,6 +259,34 @@ class PriceOverrideOverrideMatrixPriceMatrixConfig(TypedDict, total=False): """ +class PriceOverrideOverrideMatrixPriceDiscount(TypedDict, total=False): + discount_type: Required[Literal["percentage", "trial", "usage", "amount"]] + + amount_discount: Optional[str] + """Only available if discount_type is `amount`.""" + + applies_to_price_ids: Optional[List[str]] + """List of price_ids that this discount applies to. + + For plan/plan phase discounts, this can be a subset of prices. + """ + + percentage_discount: Optional[float] + """Only available if discount_type is `percentage`. + + This is a number between 0 and 1. + """ + + trial_amount_discount: Optional[str] + """Only available if discount_type is `trial`""" + + usage_discount: Optional[float] + """Only available if discount_type is `usage`. + + Number of usage units that this discount is for + """ + + class PriceOverrideOverrideMatrixPrice(TypedDict, total=False): id: Required[str] @@ -198,7 +294,7 @@ class PriceOverrideOverrideMatrixPrice(TypedDict, total=False): model_type: Required[Literal["matrix"]] - discount: Optional[DiscountParam] + discount: Optional[PriceOverrideOverrideMatrixPriceDiscount] """The subscription's override discount for the plan.""" fixed_price_quantity: Optional[float] @@ -227,6 +323,34 @@ class PriceOverrideOverrideTieredPriceTieredConfig(TypedDict, total=False): """Tiers for rating based on total usage quantities into the specified tier""" +class PriceOverrideOverrideTieredPriceDiscount(TypedDict, total=False): + discount_type: Required[Literal["percentage", "trial", "usage", "amount"]] + + amount_discount: Optional[str] + """Only available if discount_type is `amount`.""" + + applies_to_price_ids: Optional[List[str]] + """List of price_ids that this discount applies to. + + For plan/plan phase discounts, this can be a subset of prices. + """ + + percentage_discount: Optional[float] + """Only available if discount_type is `percentage`. + + This is a number between 0 and 1. + """ + + trial_amount_discount: Optional[str] + """Only available if discount_type is `trial`""" + + usage_discount: Optional[float] + """Only available if discount_type is `usage`. + + Number of usage units that this discount is for + """ + + class PriceOverrideOverrideTieredPrice(TypedDict, total=False): id: Required[str] @@ -234,7 +358,7 @@ class PriceOverrideOverrideTieredPrice(TypedDict, total=False): tiered_config: Required[PriceOverrideOverrideTieredPriceTieredConfig] - discount: Optional[DiscountParam] + discount: Optional[PriceOverrideOverrideTieredPriceDiscount] """The subscription's override discount for the plan.""" fixed_price_quantity: Optional[float] @@ -269,6 +393,34 @@ class PriceOverrideOverrideTieredBpsPriceTieredBpsConfig(TypedDict, total=False) """ +class PriceOverrideOverrideTieredBpsPriceDiscount(TypedDict, total=False): + discount_type: Required[Literal["percentage", "trial", "usage", "amount"]] + + amount_discount: Optional[str] + """Only available if discount_type is `amount`.""" + + applies_to_price_ids: Optional[List[str]] + """List of price_ids that this discount applies to. + + For plan/plan phase discounts, this can be a subset of prices. + """ + + percentage_discount: Optional[float] + """Only available if discount_type is `percentage`. + + This is a number between 0 and 1. + """ + + trial_amount_discount: Optional[str] + """Only available if discount_type is `trial`""" + + usage_discount: Optional[float] + """Only available if discount_type is `usage`. + + Number of usage units that this discount is for + """ + + class PriceOverrideOverrideTieredBpsPrice(TypedDict, total=False): id: Required[str] @@ -276,7 +428,7 @@ class PriceOverrideOverrideTieredBpsPrice(TypedDict, total=False): tiered_bps_config: Required[PriceOverrideOverrideTieredBpsPriceTieredBpsConfig] - discount: Optional[DiscountParam] + discount: Optional[PriceOverrideOverrideTieredBpsPriceDiscount] """The subscription's override discount for the plan.""" fixed_price_quantity: Optional[float] @@ -297,6 +449,34 @@ class PriceOverrideOverrideBpsPriceBpsConfig(TypedDict, total=False): """Optional currency amount maximum to cap spend per event""" +class PriceOverrideOverrideBpsPriceDiscount(TypedDict, total=False): + discount_type: Required[Literal["percentage", "trial", "usage", "amount"]] + + amount_discount: Optional[str] + """Only available if discount_type is `amount`.""" + + applies_to_price_ids: Optional[List[str]] + """List of price_ids that this discount applies to. + + For plan/plan phase discounts, this can be a subset of prices. + """ + + percentage_discount: Optional[float] + """Only available if discount_type is `percentage`. + + This is a number between 0 and 1. + """ + + trial_amount_discount: Optional[str] + """Only available if discount_type is `trial`""" + + usage_discount: Optional[float] + """Only available if discount_type is `usage`. + + Number of usage units that this discount is for + """ + + class PriceOverrideOverrideBpsPrice(TypedDict, total=False): id: Required[str] @@ -304,7 +484,7 @@ class PriceOverrideOverrideBpsPrice(TypedDict, total=False): model_type: Required[Literal["bps"]] - discount: Optional[DiscountParam] + discount: Optional[PriceOverrideOverrideBpsPriceDiscount] """The subscription's override discount for the plan.""" fixed_price_quantity: Optional[float] @@ -336,6 +516,34 @@ class PriceOverrideOverrideBulkBpsPriceBulkBpsConfig(TypedDict, total=False): """ +class PriceOverrideOverrideBulkBpsPriceDiscount(TypedDict, total=False): + discount_type: Required[Literal["percentage", "trial", "usage", "amount"]] + + amount_discount: Optional[str] + """Only available if discount_type is `amount`.""" + + applies_to_price_ids: Optional[List[str]] + """List of price_ids that this discount applies to. + + For plan/plan phase discounts, this can be a subset of prices. + """ + + percentage_discount: Optional[float] + """Only available if discount_type is `percentage`. + + This is a number between 0 and 1. + """ + + trial_amount_discount: Optional[str] + """Only available if discount_type is `trial`""" + + usage_discount: Optional[float] + """Only available if discount_type is `usage`. + + Number of usage units that this discount is for + """ + + class PriceOverrideOverrideBulkBpsPrice(TypedDict, total=False): id: Required[str] @@ -343,7 +551,7 @@ class PriceOverrideOverrideBulkBpsPrice(TypedDict, total=False): model_type: Required[Literal["bulk_bps"]] - discount: Optional[DiscountParam] + discount: Optional[PriceOverrideOverrideBulkBpsPriceDiscount] """The subscription's override discount for the plan.""" fixed_price_quantity: Optional[float] @@ -369,6 +577,34 @@ class PriceOverrideOverrideBulkPriceBulkConfig(TypedDict, total=False): """Bulk tiers for rating based on total usage volume""" +class PriceOverrideOverrideBulkPriceDiscount(TypedDict, total=False): + discount_type: Required[Literal["percentage", "trial", "usage", "amount"]] + + amount_discount: Optional[str] + """Only available if discount_type is `amount`.""" + + applies_to_price_ids: Optional[List[str]] + """List of price_ids that this discount applies to. + + For plan/plan phase discounts, this can be a subset of prices. + """ + + percentage_discount: Optional[float] + """Only available if discount_type is `percentage`. + + This is a number between 0 and 1. + """ + + trial_amount_discount: Optional[str] + """Only available if discount_type is `trial`""" + + usage_discount: Optional[float] + """Only available if discount_type is `usage`. + + Number of usage units that this discount is for + """ + + class PriceOverrideOverrideBulkPrice(TypedDict, total=False): id: Required[str] @@ -376,7 +612,7 @@ class PriceOverrideOverrideBulkPrice(TypedDict, total=False): model_type: Required[Literal["bulk"]] - discount: Optional[DiscountParam] + discount: Optional[PriceOverrideOverrideBulkPriceDiscount] """The subscription's override discount for the plan.""" fixed_price_quantity: Optional[float] @@ -389,6 +625,34 @@ class PriceOverrideOverrideBulkPrice(TypedDict, total=False): """The subscription's override minimum amount for the plan.""" +class PriceOverrideOverrideTestRatingFunctionPriceDiscount(TypedDict, total=False): + discount_type: Required[Literal["percentage", "trial", "usage", "amount"]] + + amount_discount: Optional[str] + """Only available if discount_type is `amount`.""" + + applies_to_price_ids: Optional[List[str]] + """List of price_ids that this discount applies to. + + For plan/plan phase discounts, this can be a subset of prices. + """ + + percentage_discount: Optional[float] + """Only available if discount_type is `percentage`. + + This is a number between 0 and 1. + """ + + trial_amount_discount: Optional[str] + """Only available if discount_type is `trial`""" + + usage_discount: Optional[float] + """Only available if discount_type is `usage`. + + Number of usage units that this discount is for + """ + + class PriceOverrideOverrideTestRatingFunctionPrice(TypedDict, total=False): id: Required[str] @@ -396,7 +660,7 @@ class PriceOverrideOverrideTestRatingFunctionPrice(TypedDict, total=False): test_rating_function_config: Required[Dict[str, object]] - discount: Optional[DiscountParam] + discount: Optional[PriceOverrideOverrideTestRatingFunctionPriceDiscount] """The subscription's override discount for the plan.""" fixed_price_quantity: Optional[float] @@ -409,6 +673,34 @@ class PriceOverrideOverrideTestRatingFunctionPrice(TypedDict, total=False): """The subscription's override minimum amount for the plan.""" +class PriceOverrideOverrideFivetranExamplePriceDiscount(TypedDict, total=False): + discount_type: Required[Literal["percentage", "trial", "usage", "amount"]] + + amount_discount: Optional[str] + """Only available if discount_type is `amount`.""" + + applies_to_price_ids: Optional[List[str]] + """List of price_ids that this discount applies to. + + For plan/plan phase discounts, this can be a subset of prices. + """ + + percentage_discount: Optional[float] + """Only available if discount_type is `percentage`. + + This is a number between 0 and 1. + """ + + trial_amount_discount: Optional[str] + """Only available if discount_type is `trial`""" + + usage_discount: Optional[float] + """Only available if discount_type is `usage`. + + Number of usage units that this discount is for + """ + + class PriceOverrideOverrideFivetranExamplePrice(TypedDict, total=False): id: Required[str] @@ -416,7 +708,7 @@ class PriceOverrideOverrideFivetranExamplePrice(TypedDict, total=False): model_type: Required[Literal["fivetran_example"]] - discount: Optional[DiscountParam] + discount: Optional[PriceOverrideOverrideFivetranExamplePriceDiscount] """The subscription's override discount for the plan.""" fixed_price_quantity: Optional[float] @@ -429,6 +721,34 @@ class PriceOverrideOverrideFivetranExamplePrice(TypedDict, total=False): """The subscription's override minimum amount for the plan.""" +class PriceOverrideOverrideThresholdTotalAmountPriceDiscount(TypedDict, total=False): + discount_type: Required[Literal["percentage", "trial", "usage", "amount"]] + + amount_discount: Optional[str] + """Only available if discount_type is `amount`.""" + + applies_to_price_ids: Optional[List[str]] + """List of price_ids that this discount applies to. + + For plan/plan phase discounts, this can be a subset of prices. + """ + + percentage_discount: Optional[float] + """Only available if discount_type is `percentage`. + + This is a number between 0 and 1. + """ + + trial_amount_discount: Optional[str] + """Only available if discount_type is `trial`""" + + usage_discount: Optional[float] + """Only available if discount_type is `usage`. + + Number of usage units that this discount is for + """ + + class PriceOverrideOverrideThresholdTotalAmountPrice(TypedDict, total=False): id: Required[str] @@ -436,7 +756,7 @@ class PriceOverrideOverrideThresholdTotalAmountPrice(TypedDict, total=False): threshold_total_amount_config: Required[Dict[str, object]] - discount: Optional[DiscountParam] + discount: Optional[PriceOverrideOverrideThresholdTotalAmountPriceDiscount] """The subscription's override discount for the plan.""" fixed_price_quantity: Optional[float] @@ -449,6 +769,34 @@ class PriceOverrideOverrideThresholdTotalAmountPrice(TypedDict, total=False): """The subscription's override minimum amount for the plan.""" +class PriceOverrideOverrideTieredPackagePriceDiscount(TypedDict, total=False): + discount_type: Required[Literal["percentage", "trial", "usage", "amount"]] + + amount_discount: Optional[str] + """Only available if discount_type is `amount`.""" + + applies_to_price_ids: Optional[List[str]] + """List of price_ids that this discount applies to. + + For plan/plan phase discounts, this can be a subset of prices. + """ + + percentage_discount: Optional[float] + """Only available if discount_type is `percentage`. + + This is a number between 0 and 1. + """ + + trial_amount_discount: Optional[str] + """Only available if discount_type is `trial`""" + + usage_discount: Optional[float] + """Only available if discount_type is `usage`. + + Number of usage units that this discount is for + """ + + class PriceOverrideOverrideTieredPackagePrice(TypedDict, total=False): id: Required[str] @@ -456,7 +804,7 @@ class PriceOverrideOverrideTieredPackagePrice(TypedDict, total=False): tiered_package_config: Required[Dict[str, object]] - discount: Optional[DiscountParam] + discount: Optional[PriceOverrideOverrideTieredPackagePriceDiscount] """The subscription's override discount for the plan.""" fixed_price_quantity: Optional[float] @@ -469,6 +817,34 @@ class PriceOverrideOverrideTieredPackagePrice(TypedDict, total=False): """The subscription's override minimum amount for the plan.""" +class PriceOverrideOverrideTieredWithMinimumPriceDiscount(TypedDict, total=False): + discount_type: Required[Literal["percentage", "trial", "usage", "amount"]] + + amount_discount: Optional[str] + """Only available if discount_type is `amount`.""" + + applies_to_price_ids: Optional[List[str]] + """List of price_ids that this discount applies to. + + For plan/plan phase discounts, this can be a subset of prices. + """ + + percentage_discount: Optional[float] + """Only available if discount_type is `percentage`. + + This is a number between 0 and 1. + """ + + trial_amount_discount: Optional[str] + """Only available if discount_type is `trial`""" + + usage_discount: Optional[float] + """Only available if discount_type is `usage`. + + Number of usage units that this discount is for + """ + + class PriceOverrideOverrideTieredWithMinimumPrice(TypedDict, total=False): id: Required[str] @@ -476,7 +852,7 @@ class PriceOverrideOverrideTieredWithMinimumPrice(TypedDict, total=False): tiered_with_minimum_config: Required[Dict[str, object]] - discount: Optional[DiscountParam] + discount: Optional[PriceOverrideOverrideTieredWithMinimumPriceDiscount] """The subscription's override discount for the plan.""" fixed_price_quantity: Optional[float] @@ -489,6 +865,34 @@ class PriceOverrideOverrideTieredWithMinimumPrice(TypedDict, total=False): """The subscription's override minimum amount for the plan.""" +class PriceOverrideOverridePackageWithAllocationPriceDiscount(TypedDict, total=False): + discount_type: Required[Literal["percentage", "trial", "usage", "amount"]] + + amount_discount: Optional[str] + """Only available if discount_type is `amount`.""" + + applies_to_price_ids: Optional[List[str]] + """List of price_ids that this discount applies to. + + For plan/plan phase discounts, this can be a subset of prices. + """ + + percentage_discount: Optional[float] + """Only available if discount_type is `percentage`. + + This is a number between 0 and 1. + """ + + trial_amount_discount: Optional[str] + """Only available if discount_type is `trial`""" + + usage_discount: Optional[float] + """Only available if discount_type is `usage`. + + Number of usage units that this discount is for + """ + + class PriceOverrideOverridePackageWithAllocationPrice(TypedDict, total=False): id: Required[str] @@ -496,7 +900,7 @@ class PriceOverrideOverridePackageWithAllocationPrice(TypedDict, total=False): package_with_allocation_config: Required[Dict[str, object]] - discount: Optional[DiscountParam] + discount: Optional[PriceOverrideOverridePackageWithAllocationPriceDiscount] """The subscription's override discount for the plan.""" fixed_price_quantity: Optional[float] diff --git a/tests/api_resources/customers/test_usage.py b/tests/api_resources/customers/test_usage.py index dd85913c..98be172a 100644 --- a/tests/api_resources/customers/test_usage.py +++ b/tests/api_resources/customers/test_usage.py @@ -24,9 +24,23 @@ class TestUsage: def test_method_update(self, client: Orb) -> None: usage = client.customers.usage.update( "string", - event_name="string", - properties={}, - timestamp=parse_datetime("2020-12-09T16:09:53Z"), + events=[ + { + "event_name": "string", + "timestamp": parse_datetime("2020-12-09T16:09:53Z"), + "properties": {}, + }, + { + "event_name": "string", + "timestamp": parse_datetime("2020-12-09T16:09:53Z"), + "properties": {}, + }, + { + "event_name": "string", + "timestamp": parse_datetime("2020-12-09T16:09:53Z"), + "properties": {}, + }, + ], ) assert_matches_type(UsageUpdateResponse, usage, path=["response"]) @@ -34,13 +48,31 @@ def test_method_update(self, client: Orb) -> None: def test_method_update_with_all_params(self, client: Orb) -> None: usage = client.customers.usage.update( "string", - event_name="string", - properties={}, - timestamp=parse_datetime("2020-12-09T16:09:53Z"), + events=[ + { + "customer_id": "string", + "external_customer_id": "string", + "event_name": "string", + "timestamp": parse_datetime("2020-12-09T16:09:53Z"), + "properties": {}, + }, + { + "customer_id": "string", + "external_customer_id": "string", + "event_name": "string", + "timestamp": parse_datetime("2020-12-09T16:09:53Z"), + "properties": {}, + }, + { + "customer_id": "string", + "external_customer_id": "string", + "event_name": "string", + "timestamp": parse_datetime("2020-12-09T16:09:53Z"), + "properties": {}, + }, + ], timeframe_end=parse_datetime("2019-12-27T18:11:19.117Z"), timeframe_start=parse_datetime("2019-12-27T18:11:19.117Z"), - customer_id="string", - external_customer_id="string", ) assert_matches_type(UsageUpdateResponse, usage, path=["response"]) @@ -48,9 +80,23 @@ def test_method_update_with_all_params(self, client: Orb) -> None: def test_method_update_by_external_id(self, client: Orb) -> None: usage = client.customers.usage.update_by_external_id( "string", - event_name="string", - properties={}, - timestamp=parse_datetime("2020-12-09T16:09:53Z"), + events=[ + { + "event_name": "string", + "timestamp": parse_datetime("2020-12-09T16:09:53Z"), + "properties": {}, + }, + { + "event_name": "string", + "timestamp": parse_datetime("2020-12-09T16:09:53Z"), + "properties": {}, + }, + { + "event_name": "string", + "timestamp": parse_datetime("2020-12-09T16:09:53Z"), + "properties": {}, + }, + ], ) assert_matches_type(UsageUpdateByExternalIDResponse, usage, path=["response"]) @@ -58,13 +104,31 @@ def test_method_update_by_external_id(self, client: Orb) -> None: def test_method_update_by_external_id_with_all_params(self, client: Orb) -> None: usage = client.customers.usage.update_by_external_id( "string", - event_name="string", - properties={}, - timestamp=parse_datetime("2020-12-09T16:09:53Z"), + events=[ + { + "customer_id": "string", + "external_customer_id": "string", + "event_name": "string", + "timestamp": parse_datetime("2020-12-09T16:09:53Z"), + "properties": {}, + }, + { + "customer_id": "string", + "external_customer_id": "string", + "event_name": "string", + "timestamp": parse_datetime("2020-12-09T16:09:53Z"), + "properties": {}, + }, + { + "customer_id": "string", + "external_customer_id": "string", + "event_name": "string", + "timestamp": parse_datetime("2020-12-09T16:09:53Z"), + "properties": {}, + }, + ], timeframe_end=parse_datetime("2019-12-27T18:11:19.117Z"), timeframe_start=parse_datetime("2019-12-27T18:11:19.117Z"), - customer_id="string", - external_customer_id="string", ) assert_matches_type(UsageUpdateByExternalIDResponse, usage, path=["response"]) @@ -78,9 +142,23 @@ class TestAsyncUsage: async def test_method_update(self, client: AsyncOrb) -> None: usage = await client.customers.usage.update( "string", - event_name="string", - properties={}, - timestamp=parse_datetime("2020-12-09T16:09:53Z"), + events=[ + { + "event_name": "string", + "timestamp": parse_datetime("2020-12-09T16:09:53Z"), + "properties": {}, + }, + { + "event_name": "string", + "timestamp": parse_datetime("2020-12-09T16:09:53Z"), + "properties": {}, + }, + { + "event_name": "string", + "timestamp": parse_datetime("2020-12-09T16:09:53Z"), + "properties": {}, + }, + ], ) assert_matches_type(UsageUpdateResponse, usage, path=["response"]) @@ -88,13 +166,31 @@ async def test_method_update(self, client: AsyncOrb) -> None: async def test_method_update_with_all_params(self, client: AsyncOrb) -> None: usage = await client.customers.usage.update( "string", - event_name="string", - properties={}, - timestamp=parse_datetime("2020-12-09T16:09:53Z"), + events=[ + { + "customer_id": "string", + "external_customer_id": "string", + "event_name": "string", + "timestamp": parse_datetime("2020-12-09T16:09:53Z"), + "properties": {}, + }, + { + "customer_id": "string", + "external_customer_id": "string", + "event_name": "string", + "timestamp": parse_datetime("2020-12-09T16:09:53Z"), + "properties": {}, + }, + { + "customer_id": "string", + "external_customer_id": "string", + "event_name": "string", + "timestamp": parse_datetime("2020-12-09T16:09:53Z"), + "properties": {}, + }, + ], timeframe_end=parse_datetime("2019-12-27T18:11:19.117Z"), timeframe_start=parse_datetime("2019-12-27T18:11:19.117Z"), - customer_id="string", - external_customer_id="string", ) assert_matches_type(UsageUpdateResponse, usage, path=["response"]) @@ -102,9 +198,23 @@ async def test_method_update_with_all_params(self, client: AsyncOrb) -> None: async def test_method_update_by_external_id(self, client: AsyncOrb) -> None: usage = await client.customers.usage.update_by_external_id( "string", - event_name="string", - properties={}, - timestamp=parse_datetime("2020-12-09T16:09:53Z"), + events=[ + { + "event_name": "string", + "timestamp": parse_datetime("2020-12-09T16:09:53Z"), + "properties": {}, + }, + { + "event_name": "string", + "timestamp": parse_datetime("2020-12-09T16:09:53Z"), + "properties": {}, + }, + { + "event_name": "string", + "timestamp": parse_datetime("2020-12-09T16:09:53Z"), + "properties": {}, + }, + ], ) assert_matches_type(UsageUpdateByExternalIDResponse, usage, path=["response"]) @@ -112,12 +222,30 @@ async def test_method_update_by_external_id(self, client: AsyncOrb) -> None: async def test_method_update_by_external_id_with_all_params(self, client: AsyncOrb) -> None: usage = await client.customers.usage.update_by_external_id( "string", - event_name="string", - properties={}, - timestamp=parse_datetime("2020-12-09T16:09:53Z"), + events=[ + { + "customer_id": "string", + "external_customer_id": "string", + "event_name": "string", + "timestamp": parse_datetime("2020-12-09T16:09:53Z"), + "properties": {}, + }, + { + "customer_id": "string", + "external_customer_id": "string", + "event_name": "string", + "timestamp": parse_datetime("2020-12-09T16:09:53Z"), + "properties": {}, + }, + { + "customer_id": "string", + "external_customer_id": "string", + "event_name": "string", + "timestamp": parse_datetime("2020-12-09T16:09:53Z"), + "properties": {}, + }, + ], timeframe_end=parse_datetime("2019-12-27T18:11:19.117Z"), timeframe_start=parse_datetime("2019-12-27T18:11:19.117Z"), - customer_id="string", - external_customer_id="string", ) assert_matches_type(UsageUpdateByExternalIDResponse, usage, path=["response"]) diff --git a/tests/api_resources/test_coupons.py b/tests/api_resources/test_coupons.py index 8a81811d..e474488e 100644 --- a/tests/api_resources/test_coupons.py +++ b/tests/api_resources/test_coupons.py @@ -23,7 +23,11 @@ class TestCoupons: @parametrize def test_method_create(self, client: Orb) -> None: coupon = client.coupons.create( - discount={}, + discount={ + "discount_type": "percentage", + "applies_to_price_ids": ["h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl"], + "percentage_discount": 0.15, + }, redemption_code="HALFOFF", ) assert_matches_type(Coupon, coupon, path=["response"]) @@ -31,7 +35,12 @@ def test_method_create(self, client: Orb) -> None: @parametrize def test_method_create_with_all_params(self, client: Orb) -> None: coupon = client.coupons.create( - discount={}, + discount={ + "discount_type": "percentage", + "applies_to_price_ids": ["h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl"], + "reason": "string", + "percentage_discount": 0.15, + }, redemption_code="HALFOFF", duration_in_months=12, max_redemptions=0, @@ -76,7 +85,11 @@ class TestAsyncCoupons: @parametrize async def test_method_create(self, client: AsyncOrb) -> None: coupon = await client.coupons.create( - discount={}, + discount={ + "discount_type": "percentage", + "applies_to_price_ids": ["h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl"], + "percentage_discount": 0.15, + }, redemption_code="HALFOFF", ) assert_matches_type(Coupon, coupon, path=["response"]) @@ -84,7 +97,12 @@ async def test_method_create(self, client: AsyncOrb) -> None: @parametrize async def test_method_create_with_all_params(self, client: AsyncOrb) -> None: coupon = await client.coupons.create( - discount={}, + discount={ + "discount_type": "percentage", + "applies_to_price_ids": ["h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl"], + "reason": "string", + "percentage_discount": 0.15, + }, redemption_code="HALFOFF", duration_in_months=12, max_redemptions=0, diff --git a/tests/api_resources/test_customers.py b/tests/api_resources/test_customers.py index 49aa4bad..0df8914a 100644 --- a/tests/api_resources/test_customers.py +++ b/tests/api_resources/test_customers.py @@ -77,8 +77,8 @@ def test_method_create_with_all_params(self, client: Orb) -> None: "country": "string", }, tax_id={ - "country": "string", - "type": "string", + "country": "AE", + "type": "ae_trn", "value": "string", }, timezone="string", @@ -141,8 +141,8 @@ def test_method_update_with_all_params(self, client: Orb) -> None: "country": "string", }, tax_id={ - "country": "string", - "type": "string", + "country": "AE", + "type": "ae_trn", "value": "string", }, ) @@ -242,8 +242,8 @@ def test_method_update_by_external_id_with_all_params(self, client: Orb) -> None "country": "string", }, tax_id={ - "country": "string", - "type": "string", + "country": "AE", + "type": "ae_trn", "value": "string", }, ) @@ -311,8 +311,8 @@ async def test_method_create_with_all_params(self, client: AsyncOrb) -> None: "country": "string", }, tax_id={ - "country": "string", - "type": "string", + "country": "AE", + "type": "ae_trn", "value": "string", }, timezone="string", @@ -375,8 +375,8 @@ async def test_method_update_with_all_params(self, client: AsyncOrb) -> None: "country": "string", }, tax_id={ - "country": "string", - "type": "string", + "country": "AE", + "type": "ae_trn", "value": "string", }, ) @@ -476,8 +476,8 @@ async def test_method_update_by_external_id_with_all_params(self, client: AsyncO "country": "string", }, tax_id={ - "country": "string", - "type": "string", + "country": "AE", + "type": "ae_trn", "value": "string", }, ) diff --git a/tests/api_resources/test_invoices.py b/tests/api_resources/test_invoices.py index e2d5c1c8..9df38d76 100644 --- a/tests/api_resources/test_invoices.py +++ b/tests/api_resources/test_invoices.py @@ -25,7 +25,7 @@ class TestInvoices: def test_method_create(self, client: Orb) -> None: invoice = client.invoices.create( currency="USD", - invoice_date=parse_datetime("2022-05-01T07:00:00+00:00"), + invoice_date=parse_datetime("2019-12-27T18:11:19.117Z"), line_items=[ { "start_date": parse_date("2023-09-22"), @@ -63,7 +63,7 @@ def test_method_create(self, client: Orb) -> None: def test_method_create_with_all_params(self, client: Orb) -> None: invoice = client.invoices.create( currency="USD", - invoice_date=parse_datetime("2022-05-01T07:00:00+00:00"), + invoice_date=parse_datetime("2019-12-27T18:11:19.117Z"), line_items=[ { "start_date": parse_date("2023-09-22"), @@ -135,7 +135,7 @@ def test_method_list_with_all_params(self, client: Orb) -> None: invoice_date_lte=parse_datetime("2019-12-27T18:11:19.117Z"), is_recurring=True, limit=0, - status="draft", + status=["draft", "issued", "paid"], subscription_id="string", ) assert_matches_type(SyncPage[Invoice], invoice, path=["response"]) @@ -193,7 +193,7 @@ class TestAsyncInvoices: async def test_method_create(self, client: AsyncOrb) -> None: invoice = await client.invoices.create( currency="USD", - invoice_date=parse_datetime("2022-05-01T07:00:00+00:00"), + invoice_date=parse_datetime("2019-12-27T18:11:19.117Z"), line_items=[ { "start_date": parse_date("2023-09-22"), @@ -231,7 +231,7 @@ async def test_method_create(self, client: AsyncOrb) -> None: async def test_method_create_with_all_params(self, client: AsyncOrb) -> None: invoice = await client.invoices.create( currency="USD", - invoice_date=parse_datetime("2022-05-01T07:00:00+00:00"), + invoice_date=parse_datetime("2019-12-27T18:11:19.117Z"), line_items=[ { "start_date": parse_date("2023-09-22"), @@ -303,7 +303,7 @@ async def test_method_list_with_all_params(self, client: AsyncOrb) -> None: invoice_date_lte=parse_datetime("2019-12-27T18:11:19.117Z"), is_recurring=True, limit=0, - status="draft", + status=["draft", "issued", "paid"], subscription_id="string", ) assert_matches_type(AsyncPage[Invoice], invoice, path=["response"]) diff --git a/tests/api_resources/test_plans.py b/tests/api_resources/test_plans.py index 76392c97..3062fc22 100644 --- a/tests/api_resources/test_plans.py +++ b/tests/api_resources/test_plans.py @@ -26,7 +26,15 @@ def test_method_create(self, client: Orb) -> None: plan = client.plans.create( currency="string", name="string", - prices=[{}], + prices=[ + { + "name": "Annual fee", + "item_id": "string", + "cadence": "annual", + "model_type": "unit", + "unit_config": {"unit_amount": "string"}, + } + ], ) assert_matches_type(Plan, plan, path=["response"]) @@ -35,7 +43,23 @@ def test_method_create_with_all_params(self, client: Orb) -> None: plan = client.plans.create( currency="string", name="string", - prices=[{}], + prices=[ + { + "external_price_id": "string", + "name": "Annual fee", + "billable_metric_id": "string", + "item_id": "string", + "billed_in_advance": True, + "fixed_price_quantity": 0, + "invoice_grouping_key": "string", + "cadence": "annual", + "model_type": "unit", + "unit_config": { + "unit_amount": "string", + "scaling_factor": 0, + }, + } + ], default_invoice_memo="string", external_plan_id="string", metadata={}, @@ -95,7 +119,15 @@ async def test_method_create(self, client: AsyncOrb) -> None: plan = await client.plans.create( currency="string", name="string", - prices=[{}], + prices=[ + { + "name": "Annual fee", + "item_id": "string", + "cadence": "annual", + "model_type": "unit", + "unit_config": {"unit_amount": "string"}, + } + ], ) assert_matches_type(Plan, plan, path=["response"]) @@ -104,7 +136,23 @@ async def test_method_create_with_all_params(self, client: AsyncOrb) -> None: plan = await client.plans.create( currency="string", name="string", - prices=[{}], + prices=[ + { + "external_price_id": "string", + "name": "Annual fee", + "billable_metric_id": "string", + "item_id": "string", + "billed_in_advance": True, + "fixed_price_quantity": 0, + "invoice_grouping_key": "string", + "cadence": "annual", + "model_type": "unit", + "unit_config": { + "unit_amount": "string", + "scaling_factor": 0, + }, + } + ], default_invoice_memo="string", external_plan_id="string", metadata={}, diff --git a/tests/api_resources/test_subscriptions.py b/tests/api_resources/test_subscriptions.py index 7fcae038..66e8517a 100644 --- a/tests/api_resources/test_subscriptions.py +++ b/tests/api_resources/test_subscriptions.py @@ -245,7 +245,6 @@ def test_method_price_intervals_with_all_params(self, client: Orb) -> None: "price": { "external_price_id": "string", "name": "Annual fee", - "currency": "string", "billable_metric_id": "string", "item_id": "string", "billed_in_advance": True, @@ -257,21 +256,22 @@ def test_method_price_intervals_with_all_params(self, client: Orb) -> None: "unit_amount": "string", "scaling_factor": 0, }, + "currency": "string", }, - "start_date": parse_datetime("2019-12-27T18:11:19.117Z"), - "end_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "start_date": parse_datetime("2023-05-01"), + "end_date": parse_datetime("2023-07-10"), "fixed_fee_quantity_transitions": [ { "quantity": 5, - "effective_date": parse_date("2023-05-01"), + "effective_date": parse_datetime("2023-05-01"), }, { "quantity": 5, - "effective_date": parse_date("2023-05-01"), + "effective_date": parse_datetime("2023-05-01"), }, { "quantity": 5, - "effective_date": parse_date("2023-05-01"), + "effective_date": parse_datetime("2023-05-01"), }, ], "discounts": [ @@ -297,7 +297,6 @@ def test_method_price_intervals_with_all_params(self, client: Orb) -> None: "price": { "external_price_id": "string", "name": "Annual fee", - "currency": "string", "billable_metric_id": "string", "item_id": "string", "billed_in_advance": True, @@ -309,21 +308,22 @@ def test_method_price_intervals_with_all_params(self, client: Orb) -> None: "unit_amount": "string", "scaling_factor": 0, }, + "currency": "string", }, - "start_date": parse_datetime("2019-12-27T18:11:19.117Z"), - "end_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "start_date": parse_datetime("2023-05-01"), + "end_date": parse_datetime("2023-07-10"), "fixed_fee_quantity_transitions": [ { "quantity": 5, - "effective_date": parse_date("2023-05-01"), + "effective_date": parse_datetime("2023-05-01"), }, { "quantity": 5, - "effective_date": parse_date("2023-05-01"), + "effective_date": parse_datetime("2023-05-01"), }, { "quantity": 5, - "effective_date": parse_date("2023-05-01"), + "effective_date": parse_datetime("2023-05-01"), }, ], "discounts": [ @@ -349,7 +349,6 @@ def test_method_price_intervals_with_all_params(self, client: Orb) -> None: "price": { "external_price_id": "string", "name": "Annual fee", - "currency": "string", "billable_metric_id": "string", "item_id": "string", "billed_in_advance": True, @@ -361,21 +360,22 @@ def test_method_price_intervals_with_all_params(self, client: Orb) -> None: "unit_amount": "string", "scaling_factor": 0, }, + "currency": "string", }, - "start_date": parse_datetime("2019-12-27T18:11:19.117Z"), - "end_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "start_date": parse_datetime("2023-05-01"), + "end_date": parse_datetime("2023-07-10"), "fixed_fee_quantity_transitions": [ { "quantity": 5, - "effective_date": parse_date("2023-05-01"), + "effective_date": parse_datetime("2023-05-01"), }, { "quantity": 5, - "effective_date": parse_date("2023-05-01"), + "effective_date": parse_datetime("2023-05-01"), }, { "quantity": 5, - "effective_date": parse_date("2023-05-01"), + "effective_date": parse_datetime("2023-05-01"), }, ], "discounts": [ @@ -404,17 +404,18 @@ def test_method_price_intervals_with_all_params(self, client: Orb) -> None: "fixed_fee_quantity_transitions": [ { "quantity": 5, - "effective_date": parse_date("2023-05-01"), + "effective_date": parse_datetime("2023-05-01"), }, { "quantity": 5, - "effective_date": parse_date("2023-05-01"), + "effective_date": parse_datetime("2023-05-01"), }, { "quantity": 5, - "effective_date": parse_date("2023-05-01"), + "effective_date": parse_datetime("2023-05-01"), }, ], + "billing_cycle_day": 0, }, { "price_interval_id": "sdfs6wdjvn7ujokd", @@ -423,17 +424,18 @@ def test_method_price_intervals_with_all_params(self, client: Orb) -> None: "fixed_fee_quantity_transitions": [ { "quantity": 5, - "effective_date": parse_date("2023-05-01"), + "effective_date": parse_datetime("2023-05-01"), }, { "quantity": 5, - "effective_date": parse_date("2023-05-01"), + "effective_date": parse_datetime("2023-05-01"), }, { "quantity": 5, - "effective_date": parse_date("2023-05-01"), + "effective_date": parse_datetime("2023-05-01"), }, ], + "billing_cycle_day": 0, }, { "price_interval_id": "sdfs6wdjvn7ujokd", @@ -442,17 +444,18 @@ def test_method_price_intervals_with_all_params(self, client: Orb) -> None: "fixed_fee_quantity_transitions": [ { "quantity": 5, - "effective_date": parse_date("2023-05-01"), + "effective_date": parse_datetime("2023-05-01"), }, { "quantity": 5, - "effective_date": parse_date("2023-05-01"), + "effective_date": parse_datetime("2023-05-01"), }, { "quantity": 5, - "effective_date": parse_date("2023-05-01"), + "effective_date": parse_datetime("2023-05-01"), }, ], + "billing_cycle_day": 0, }, ], ) @@ -825,7 +828,6 @@ async def test_method_price_intervals_with_all_params(self, client: AsyncOrb) -> "price": { "external_price_id": "string", "name": "Annual fee", - "currency": "string", "billable_metric_id": "string", "item_id": "string", "billed_in_advance": True, @@ -837,21 +839,22 @@ async def test_method_price_intervals_with_all_params(self, client: AsyncOrb) -> "unit_amount": "string", "scaling_factor": 0, }, + "currency": "string", }, - "start_date": parse_datetime("2019-12-27T18:11:19.117Z"), - "end_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "start_date": parse_datetime("2023-05-01"), + "end_date": parse_datetime("2023-07-10"), "fixed_fee_quantity_transitions": [ { "quantity": 5, - "effective_date": parse_date("2023-05-01"), + "effective_date": parse_datetime("2023-05-01"), }, { "quantity": 5, - "effective_date": parse_date("2023-05-01"), + "effective_date": parse_datetime("2023-05-01"), }, { "quantity": 5, - "effective_date": parse_date("2023-05-01"), + "effective_date": parse_datetime("2023-05-01"), }, ], "discounts": [ @@ -877,7 +880,6 @@ async def test_method_price_intervals_with_all_params(self, client: AsyncOrb) -> "price": { "external_price_id": "string", "name": "Annual fee", - "currency": "string", "billable_metric_id": "string", "item_id": "string", "billed_in_advance": True, @@ -889,21 +891,22 @@ async def test_method_price_intervals_with_all_params(self, client: AsyncOrb) -> "unit_amount": "string", "scaling_factor": 0, }, + "currency": "string", }, - "start_date": parse_datetime("2019-12-27T18:11:19.117Z"), - "end_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "start_date": parse_datetime("2023-05-01"), + "end_date": parse_datetime("2023-07-10"), "fixed_fee_quantity_transitions": [ { "quantity": 5, - "effective_date": parse_date("2023-05-01"), + "effective_date": parse_datetime("2023-05-01"), }, { "quantity": 5, - "effective_date": parse_date("2023-05-01"), + "effective_date": parse_datetime("2023-05-01"), }, { "quantity": 5, - "effective_date": parse_date("2023-05-01"), + "effective_date": parse_datetime("2023-05-01"), }, ], "discounts": [ @@ -929,7 +932,6 @@ async def test_method_price_intervals_with_all_params(self, client: AsyncOrb) -> "price": { "external_price_id": "string", "name": "Annual fee", - "currency": "string", "billable_metric_id": "string", "item_id": "string", "billed_in_advance": True, @@ -941,21 +943,22 @@ async def test_method_price_intervals_with_all_params(self, client: AsyncOrb) -> "unit_amount": "string", "scaling_factor": 0, }, + "currency": "string", }, - "start_date": parse_datetime("2019-12-27T18:11:19.117Z"), - "end_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "start_date": parse_datetime("2023-05-01"), + "end_date": parse_datetime("2023-07-10"), "fixed_fee_quantity_transitions": [ { "quantity": 5, - "effective_date": parse_date("2023-05-01"), + "effective_date": parse_datetime("2023-05-01"), }, { "quantity": 5, - "effective_date": parse_date("2023-05-01"), + "effective_date": parse_datetime("2023-05-01"), }, { "quantity": 5, - "effective_date": parse_date("2023-05-01"), + "effective_date": parse_datetime("2023-05-01"), }, ], "discounts": [ @@ -984,17 +987,18 @@ async def test_method_price_intervals_with_all_params(self, client: AsyncOrb) -> "fixed_fee_quantity_transitions": [ { "quantity": 5, - "effective_date": parse_date("2023-05-01"), + "effective_date": parse_datetime("2023-05-01"), }, { "quantity": 5, - "effective_date": parse_date("2023-05-01"), + "effective_date": parse_datetime("2023-05-01"), }, { "quantity": 5, - "effective_date": parse_date("2023-05-01"), + "effective_date": parse_datetime("2023-05-01"), }, ], + "billing_cycle_day": 0, }, { "price_interval_id": "sdfs6wdjvn7ujokd", @@ -1003,17 +1007,18 @@ async def test_method_price_intervals_with_all_params(self, client: AsyncOrb) -> "fixed_fee_quantity_transitions": [ { "quantity": 5, - "effective_date": parse_date("2023-05-01"), + "effective_date": parse_datetime("2023-05-01"), }, { "quantity": 5, - "effective_date": parse_date("2023-05-01"), + "effective_date": parse_datetime("2023-05-01"), }, { "quantity": 5, - "effective_date": parse_date("2023-05-01"), + "effective_date": parse_datetime("2023-05-01"), }, ], + "billing_cycle_day": 0, }, { "price_interval_id": "sdfs6wdjvn7ujokd", @@ -1022,17 +1027,18 @@ async def test_method_price_intervals_with_all_params(self, client: AsyncOrb) -> "fixed_fee_quantity_transitions": [ { "quantity": 5, - "effective_date": parse_date("2023-05-01"), + "effective_date": parse_datetime("2023-05-01"), }, { "quantity": 5, - "effective_date": parse_date("2023-05-01"), + "effective_date": parse_datetime("2023-05-01"), }, { "quantity": 5, - "effective_date": parse_date("2023-05-01"), + "effective_date": parse_datetime("2023-05-01"), }, ], + "billing_cycle_day": 0, }, ], )