Skip to content

feat(api): add currency fields #119

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright 2023 Orb
Copyright 2024 Orb

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
16 changes: 16 additions & 0 deletions src/orb/resources/customers/credits/credits.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ def list(
self,
customer_id: Optional[str],
*,
currency: Optional[str] | NotGiven = NOT_GIVEN,
cursor: Optional[str] | NotGiven = NOT_GIVEN,
limit: int | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
Expand All @@ -57,6 +58,8 @@ def list(
Returns a paginated list of unexpired, non-zero credit blocks for a customer.

Args:
currency: The ledger currency or custom pricing unit to use.

cursor: Cursor for pagination. This can be populated by the `next_cursor` value returned
from the initial request.

Expand All @@ -80,6 +83,7 @@ def list(
timeout=timeout,
query=maybe_transform(
{
"currency": currency,
"cursor": cursor,
"limit": limit,
},
Expand All @@ -93,6 +97,7 @@ def list_by_external_id(
self,
external_customer_id: Optional[str],
*,
currency: Optional[str] | NotGiven = NOT_GIVEN,
cursor: Optional[str] | NotGiven = NOT_GIVEN,
limit: int | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
Expand All @@ -106,6 +111,8 @@ def list_by_external_id(
Returns a paginated list of unexpired, non-zero credit blocks for a customer.

Args:
currency: The ledger currency or custom pricing unit to use.

cursor: Cursor for pagination. This can be populated by the `next_cursor` value returned
from the initial request.

Expand All @@ -129,6 +136,7 @@ def list_by_external_id(
timeout=timeout,
query=maybe_transform(
{
"currency": currency,
"cursor": cursor,
"limit": limit,
},
Expand All @@ -152,6 +160,7 @@ def list(
self,
customer_id: Optional[str],
*,
currency: Optional[str] | NotGiven = NOT_GIVEN,
cursor: Optional[str] | NotGiven = NOT_GIVEN,
limit: int | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
Expand All @@ -165,6 +174,8 @@ def list(
Returns a paginated list of unexpired, non-zero credit blocks for a customer.

Args:
currency: The ledger currency or custom pricing unit to use.

cursor: Cursor for pagination. This can be populated by the `next_cursor` value returned
from the initial request.

Expand All @@ -188,6 +199,7 @@ def list(
timeout=timeout,
query=maybe_transform(
{
"currency": currency,
"cursor": cursor,
"limit": limit,
},
Expand All @@ -201,6 +213,7 @@ def list_by_external_id(
self,
external_customer_id: Optional[str],
*,
currency: Optional[str] | NotGiven = NOT_GIVEN,
cursor: Optional[str] | NotGiven = NOT_GIVEN,
limit: int | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
Expand All @@ -214,6 +227,8 @@ def list_by_external_id(
Returns a paginated list of unexpired, non-zero credit blocks for a customer.

Args:
currency: The ledger currency or custom pricing unit to use.

cursor: Cursor for pagination. This can be populated by the `next_cursor` value returned
from the initial request.

Expand All @@ -237,6 +252,7 @@ def list_by_external_id(
timeout=timeout,
query=maybe_transform(
{
"currency": currency,
"cursor": cursor,
"limit": limit,
},
Expand Down
96 changes: 96 additions & 0 deletions src/orb/resources/customers/credits/ledger.py

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions src/orb/resources/customers/customers.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ def create(

| Country | Type | Description |
| -------------------- | ------------ | ------------------------------------------------------------------------------------------------------- |
| Andorra | `ad_nrt` | Andorran NRT number |
| Australia | `au_abn` | Australian Business Number (AU ABN) |
| Australia | `au_arn` | Australian Taxation Office Reference Number |
| Austria | `eu_vat` | European VAT number |
Expand Down Expand Up @@ -336,6 +337,7 @@ def update(

| Country | Type | Description |
| -------------------- | ------------ | ------------------------------------------------------------------------------------------------------- |
| Andorra | `ad_nrt` | Andorran NRT number |
| Australia | `au_abn` | Australian Business Number (AU ABN) |
| Australia | `au_arn` | Australian Taxation Office Reference Number |
| Austria | `eu_vat` | European VAT number |
Expand Down Expand Up @@ -712,6 +714,7 @@ def update_by_external_id(

| Country | Type | Description |
| -------------------- | ------------ | ------------------------------------------------------------------------------------------------------- |
| Andorra | `ad_nrt` | Andorran NRT number |
| Australia | `au_abn` | Australian Business Number (AU ABN) |
| Australia | `au_arn` | Australian Taxation Office Reference Number |
| Austria | `eu_vat` | European VAT number |
Expand Down Expand Up @@ -929,6 +932,7 @@ async def create(

| Country | Type | Description |
| -------------------- | ------------ | ------------------------------------------------------------------------------------------------------- |
| Andorra | `ad_nrt` | Andorran NRT number |
| Australia | `au_abn` | Australian Business Number (AU ABN) |
| Australia | `au_arn` | Australian Taxation Office Reference Number |
| Austria | `eu_vat` | European VAT number |
Expand Down Expand Up @@ -1126,6 +1130,7 @@ async def update(

| Country | Type | Description |
| -------------------- | ------------ | ------------------------------------------------------------------------------------------------------- |
| Andorra | `ad_nrt` | Andorran NRT number |
| Australia | `au_abn` | Australian Business Number (AU ABN) |
| Australia | `au_arn` | Australian Taxation Office Reference Number |
| Austria | `eu_vat` | European VAT number |
Expand Down Expand Up @@ -1502,6 +1507,7 @@ async def update_by_external_id(

| Country | Type | Description |
| -------------------- | ------------ | ------------------------------------------------------------------------------------------------------- |
| Andorra | `ad_nrt` | Andorran NRT number |
| Australia | `au_abn` | Australian Business Number (AU ABN) |
| Australia | `au_arn` | Australian Taxation Office Reference Number |
| Austria | `eu_vat` | European VAT number |
Expand Down
8 changes: 4 additions & 4 deletions src/orb/resources/plans/plans.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ def create(
This endpoint allows creation of plans including their prices.

Args:
currency: An ISO 4217 currency string or custom pricing unit (`credits`) for this plan's
prices.
currency: An ISO 4217 currency string for invoices generated by subscriptions on this
plan.

prices: Prices for this plan. If the plan has phases, this includes prices across all
phases of the plan.
Expand Down Expand Up @@ -310,8 +310,8 @@ async def create(
This endpoint allows creation of plans including their prices.

Args:
currency: An ISO 4217 currency string or custom pricing unit (`credits`) for this plan's
prices.
currency: An ISO 4217 currency string for invoices generated by subscriptions on this
plan.

prices: Prices for this plan. If the plan has phases, this includes prices across all
phases of the plan.
Expand Down
3 changes: 3 additions & 0 deletions src/orb/types/customer.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class ShippingAddress(BaseModel):

class TaxID(BaseModel):
country: Literal[
"AD",
"AE",
"AT",
"AU",
Expand Down Expand Up @@ -110,6 +111,7 @@ class TaxID(BaseModel):
]

type: Literal[
"ad_nrt",
"ae_trn",
"eu_vat",
"au_abn",
Expand Down Expand Up @@ -251,6 +253,7 @@ class Customer(BaseModel):

| Country | Type | Description |
| -------------------- | ------------ | ------------------------------------------------------------------------------------------------------- |
| Andorra | `ad_nrt` | Andorran NRT number |
| Australia | `au_abn` | Australian Business Number (AU ABN) |
| Australia | `au_arn` | Australian Taxation Office Reference Number |
| Austria | `eu_vat` | European VAT number |
Expand Down
3 changes: 3 additions & 0 deletions src/orb/types/customer_create_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ class CustomerCreateParams(TypedDict, total=False):

| Country | Type | Description |
| -------------------- | ------------ | ------------------------------------------------------------------------------------------------------- |
| Andorra | `ad_nrt` | Andorran NRT number |
| Australia | `au_abn` | Australian Business Number (AU ABN) |
| Australia | `au_arn` | Australian Taxation Office Reference Number |
| Austria | `eu_vat` | European VAT number |
Expand Down Expand Up @@ -226,6 +227,7 @@ class ShippingAddress(TypedDict, total=False):
class TaxID(TypedDict, total=False):
country: Required[
Literal[
"AD",
"AE",
"AT",
"AU",
Expand Down Expand Up @@ -291,6 +293,7 @@ class TaxID(TypedDict, total=False):

type: Required[
Literal[
"ad_nrt",
"ae_trn",
"eu_vat",
"au_abn",
Expand Down
3 changes: 3 additions & 0 deletions src/orb/types/customer_update_by_external_id_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ class CustomerUpdateByExternalIDParams(TypedDict, total=False):

| Country | Type | Description |
| -------------------- | ------------ | ------------------------------------------------------------------------------------------------------- |
| Andorra | `ad_nrt` | Andorran NRT number |
| Australia | `au_abn` | Australian Business Number (AU ABN) |
| Australia | `au_arn` | Australian Taxation Office Reference Number |
| Austria | `eu_vat` | European VAT number |
Expand Down Expand Up @@ -212,6 +213,7 @@ class ShippingAddress(TypedDict, total=False):
class TaxID(TypedDict, total=False):
country: Required[
Literal[
"AD",
"AE",
"AT",
"AU",
Expand Down Expand Up @@ -277,6 +279,7 @@ class TaxID(TypedDict, total=False):

type: Required[
Literal[
"ad_nrt",
"ae_trn",
"eu_vat",
"au_abn",
Expand Down
3 changes: 3 additions & 0 deletions src/orb/types/customer_update_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ class CustomerUpdateParams(TypedDict, total=False):

| Country | Type | Description |
| -------------------- | ------------ | ------------------------------------------------------------------------------------------------------- |
| Andorra | `ad_nrt` | Andorran NRT number |
| Australia | `au_abn` | Australian Business Number (AU ABN) |
| Australia | `au_arn` | Australian Taxation Office Reference Number |
| Austria | `eu_vat` | European VAT number |
Expand Down Expand Up @@ -212,6 +213,7 @@ class ShippingAddress(TypedDict, total=False):
class TaxID(TypedDict, total=False):
country: Required[
Literal[
"AD",
"AE",
"AT",
"AU",
Expand Down Expand Up @@ -277,6 +279,7 @@ class TaxID(TypedDict, total=False):

type: Required[
Literal[
"ad_nrt",
"ae_trn",
"eu_vat",
"au_abn",
Expand Down
3 changes: 3 additions & 0 deletions src/orb/types/customers/credit_list_by_external_id_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@


class CreditListByExternalIDParams(TypedDict, total=False):
currency: Optional[str]
"""The ledger currency or custom pricing unit to use."""

cursor: Optional[str]
"""Cursor for pagination.

Expand Down
3 changes: 3 additions & 0 deletions src/orb/types/customers/credit_list_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@


class CreditListParams(TypedDict, total=False):
currency: Optional[str]
"""The ledger currency or custom pricing unit to use."""

cursor: Optional[str]
"""Cursor for pagination.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ class AddIncrementCreditLedgerEntryRequestParams(TypedDict, total=False):

entry_type: Required[Literal["increment"]]

currency: Optional[str]
"""The currency or custom pricing unit to use for this ledger entry.

If this is a real-world currency, it must match the customer's invoicing
currency.
"""

description: Optional[str]
"""Optional metadata that can be specified when adding ledger results via the API.

Expand Down Expand Up @@ -96,6 +103,13 @@ class AddDecrementCreditLedgerEntryRequestParams(TypedDict, total=False):

entry_type: Required[Literal["decrement"]]

currency: Optional[str]
"""The currency or custom pricing unit to use for this ledger entry.

If this is a real-world currency, it must match the customer's invoicing
currency.
"""

description: Optional[str]
"""Optional metadata that can be specified when adding ledger results via the API.

Expand Down Expand Up @@ -139,6 +153,13 @@ class AddExpirationChangeCreditLedgerEntryRequestParams(TypedDict, total=False):
between multiple blocks with the same `expiry_date`.
"""

currency: Optional[str]
"""The currency or custom pricing unit to use for this ledger entry.

If this is a real-world currency, it must match the customer's invoicing
currency.
"""

description: Optional[str]
"""Optional metadata that can be specified when adding ledger results via the API.

Expand Down Expand Up @@ -166,6 +187,13 @@ class AddVoidCreditLedgerEntryRequestParams(TypedDict, total=False):

entry_type: Required[Literal["void"]]

currency: Optional[str]
"""The currency or custom pricing unit to use for this ledger entry.

If this is a real-world currency, it must match the customer's invoicing
currency.
"""

description: Optional[str]
"""Optional metadata that can be specified when adding ledger results via the API.

Expand Down Expand Up @@ -196,6 +224,13 @@ class AddAmendmentCreditLedgerEntryRequestParams(TypedDict, total=False):

entry_type: Required[Literal["amendment"]]

currency: Optional[str]
"""The currency or custom pricing unit to use for this ledger entry.

If this is a real-world currency, it must match the customer's invoicing
currency.
"""

description: Optional[str]
"""Optional metadata that can be specified when adding ledger results via the API.

Expand Down
Loading