From 79e9f298cdde16df5ea511c5b2adb25bcb44ce45 Mon Sep 17 00:00:00 2001 From: cb-alish Date: Thu, 30 Jul 2026 14:36:37 +0530 Subject: [PATCH] Releasing v3.27.0 --- CHANGELOG.md | 58 ++++++++ README.md | 43 +++--- VERSION | 2 +- chargebee/main.py | 2 + chargebee/models/__init__.py | 4 + chargebee/models/alert/operations.py | 1 + chargebee/models/alert/responses.py | 3 +- chargebee/models/credit_unit/__init__.py | 2 + chargebee/models/credit_unit/operations.py | 132 ++++++++++++++++++ chargebee/models/credit_unit/responses.py | 55 ++++++++ chargebee/models/enums.py | 25 ++++ chargebee/models/estimate/operations.py | 1 + chargebee/models/grant_block/operations.py | 23 +-- chargebee/models/grant_block/responses.py | 9 +- .../ledger_account_balance/responses.py | 2 + chargebee/models/ledger_entry/__init__.py | 2 + chargebee/models/ledger_entry/operations.py | 24 ++++ chargebee/models/ledger_entry/responses.py | 23 +++ .../models/ledger_operation/operations.py | 39 +++++- .../models/ledger_operation/responses.py | 25 +++- chargebee/models/payment_intent/operations.py | 4 + chargebee/models/subscription/operations.py | 1 + chargebee/version.py | 2 +- 23 files changed, 431 insertions(+), 51 deletions(-) create mode 100644 chargebee/models/credit_unit/__init__.py create mode 100644 chargebee/models/credit_unit/operations.py create mode 100644 chargebee/models/credit_unit/responses.py create mode 100644 chargebee/models/ledger_entry/__init__.py create mode 100644 chargebee/models/ledger_entry/operations.py create mode 100644 chargebee/models/ledger_entry/responses.py diff --git a/CHANGELOG.md b/CHANGELOG.md index 6775dae..ec6eaf9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,61 @@ +### v3.27.0 (2026-07-30) +* * * +### New Resources: +- [`CreditUnit`](https://apidocs.chargebee.com/docs/api/credit_units) has been added. +- [`LedgerEntry`](https://apidocs.chargebee.com/docs/api/ledger_entries) has been added. + + +### New Actions: +- [`allocate`](https://apidocs.chargebee.com/docs/api/ledger_operations/allocate) has been added to [`LedgerOperation`](https://apidocs.chargebee.com/docs/api/ledger_operations). + + +### New Attributes: +- [`unit_id`](https://apidocs.chargebee.com/docs/api/alerts/alert-object#unit_id) has been added to [`Alert`](https://apidocs.chargebee.com/docs/api/alerts). +- [`subscription_id`](https://apidocs.chargebee.com/docs/api/grant_blocks/grant-block-object#subscription_id) has been added to [`GrantBlock`](https://apidocs.chargebee.com/docs/api/grant_blocks). +- [`modified_at`](https://apidocs.chargebee.com/docs/api/grant_blocks/grant-block-object#modified_at) has been added to [`GrantBlock`](https://apidocs.chargebee.com/docs/api/grant_blocks). +- [`resource_version`](https://apidocs.chargebee.com/docs/api/grant_blocks/grant-block-object#resource_version) has been added to [`GrantBlock`](https://apidocs.chargebee.com/docs/api/grant_blocks). +- [`created_at`](https://apidocs.chargebee.com/docs/api/ledger_account_balances/ledger-account-balance-object#created_at) has been added to [`LedgerAccountBalance`](https://apidocs.chargebee.com/docs/api/ledger_account_balances). +- [`resource_version`](https://apidocs.chargebee.com/docs/api/ledger_account_balances/ledger-account-balance-object#resource_version) has been added to [`LedgerAccountBalance`](https://apidocs.chargebee.com/docs/api/ledger_account_balances). + + +### New Parameters: +- [`account_type`](https://apidocs.chargebee.com/docs/api/grant_blocks/list-grant-blocks#account_type) has been added as query parameter to [`list_grant_blocks`](https://apidocs.chargebee.com/docs/api/grant_blocks/list-grant-blocks) in [`GrantBlock`](https://apidocs.chargebee.com/docs/api/grant_blocks). +- [`unit_id`](https://apidocs.chargebee.com/docs/api/alerts/create-an-alert#unit_id) has been added as request body parameter to [`create_an_alert`](https://apidocs.chargebee.com/docs/api/alerts/create-an-alert) in [`Alert`](https://apidocs.chargebee.com/docs/api/alerts). +- [`include_cancellation_day_in_billing`](https://apidocs.chargebee.com/docs/api/estimates/cancel-subscription-for-items-estimate#include_cancellation_day_in_billing) has been added as request body parameter to [`cancel_subscription_for_items_estimate`](https://apidocs.chargebee.com/docs/api/estimates/cancel-subscription-for-items-estimate) in [`Estimate`](https://apidocs.chargebee.com/docs/api/estimates). +- [`subscription_id`](https://apidocs.chargebee.com/docs/api/ledger_operations/allocate#subscription_id) has been added as request body parameter to [`allocate`](https://apidocs.chargebee.com/docs/api/ledger_operations/allocate) in [`LedgerOperation`](https://apidocs.chargebee.com/docs/api/ledger_operations). +- [`unit_id`](https://apidocs.chargebee.com/docs/api/ledger_operations/allocate#unit_id) has been added as request body parameter to [`allocate`](https://apidocs.chargebee.com/docs/api/ledger_operations/allocate) in [`LedgerOperation`](https://apidocs.chargebee.com/docs/api/ledger_operations). +- [`amount`](https://apidocs.chargebee.com/docs/api/ledger_operations/allocate#amount) has been added as request body parameter to [`allocate`](https://apidocs.chargebee.com/docs/api/ledger_operations/allocate) in [`LedgerOperation`](https://apidocs.chargebee.com/docs/api/ledger_operations). +- [`expires_at`](https://apidocs.chargebee.com/docs/api/ledger_operations/allocate#expires_at) has been added as request body parameter to [`allocate`](https://apidocs.chargebee.com/docs/api/ledger_operations/allocate) in [`LedgerOperation`](https://apidocs.chargebee.com/docs/api/ledger_operations). +- [`metadata`](https://apidocs.chargebee.com/docs/api/ledger_operations/allocate#metadata) has been added as request body parameter to [`allocate`](https://apidocs.chargebee.com/docs/api/ledger_operations/allocate) in [`LedgerOperation`](https://apidocs.chargebee.com/docs/api/ledger_operations). +- [`include_cancellation_day_in_billing`](https://apidocs.chargebee.com/docs/api/subscriptions/cancel-subscription-for-items#include_cancellation_day_in_billing) has been added as request body parameter to [`cancel_subscription_for_items`](https://apidocs.chargebee.com/docs/api/subscriptions/cancel-subscription-for-items) in [`Subscription`](https://apidocs.chargebee.com/docs/api/subscriptions). + + +### New Events: +- [`grant_blocks_created`](https://apidocs.chargebee.com/docs/api/events/webhook/grant_blocks_created) has been added. +- [`ledger_updated`](https://apidocs.chargebee.com/docs/api/events/webhook/ledger_updated) has been added. +- [`ledger_account_balance_updated`](https://apidocs.chargebee.com/docs/api/events/webhook/ledger_account_balance_updated) has been added. +- [`grant_blocks_updated`](https://apidocs.chargebee.com/docs/api/events/webhook/grant_blocks_updated) has been added. + + +### New Enums: +- `ledger_account_balance_updated`, `grant_blocks_created`, `grant_blocks_updated`, and `ledger_updated` have been added as new values enum `EventType`. +- `dana`, `touch_n_go`, `tamara`, and `qpay` have been added as new values enum `PaymentMethod`. +- `dana`, `touch_n_go`, `tamara`, and `qpay` have been added as new values enum `PaymentMethodType`. +- `dana`, `touch_n_go`, `tamara`, `qpay`, `credit_balance_dropped`, `credit`, `debit`, `hold`, and `unhold` have been added as new values enum `Type`. +- `active` and `archived` have been added as new values to enum attribute [`status`](https://apidocs.chargebee.com/docs/api/credit_units/credit-unit-object#status) in [`CreditUnit`](https://apidocs.chargebee.com/docs/api/credit_units). +- `grant_renewal` and `subscription_renewed` have been added as new values to enum attribute [`grant_source`](https://apidocs.chargebee.com/docs/api/grant_blocks/grant-block-object#grant_source) in [`GrantBlock`](https://apidocs.chargebee.com/docs/api/grant_blocks). +- `provisioned` and `overdraft` have been added as new values to enum attribute [`account_type`](https://apidocs.chargebee.com/docs/api/ledger_entries/ledger-entry-object#account_type) in [`LedgerEntry`](https://apidocs.chargebee.com/docs/api/ledger_entries). +- `credit_unit` has been added as a new value to enum attribute [`unit_type`](https://apidocs.chargebee.com/docs/api/ledger_entries/ledger-entry-object#unit_type) in [`LedgerEntry`](https://apidocs.chargebee.com/docs/api/ledger_entries). +- `dana`, `touch_n_go`, `tamara`, and `qpay` have been added as new values to enum attribute [`payment_method_type`](https://apidocs.chargebee.com/docs/api/payment_intents/payment-intent-object#payment_method_type) in [`PaymentIntent`](https://apidocs.chargebee.com/docs/api/payment_intents). +- `dana`, `touch_n_go`, `tamara`, and `qpay` have been added as new values to enum attribute [`active_payment_attempt.payment_method_type`](https://apidocs.chargebee.com/docs/api/payment_intents/payment-intent-object#active_payment_attempt_payment_method_type) in [`PaymentIntent`](https://apidocs.chargebee.com/docs/api/payment_intents). +- `archived` and `active` have been added as new values to enum query parameter `status.in` in [`list_credit_units`](https://apidocs.chargebee.com/docs/api/credit_units/list-credit-units) of [`CreditUnit`](https://apidocs.chargebee.com/docs/api/credit_units). +- `archived` and `active` have been added as new values to enum query parameter `status.is` in [`list_credit_units`](https://apidocs.chargebee.com/docs/api/credit_units/list-credit-units) of [`CreditUnit`](https://apidocs.chargebee.com/docs/api/credit_units). +- `provisioned` and `overdraft` have been added as new values to enum query parameter `account_type.is` in [`list_grant_blocks`](https://apidocs.chargebee.com/docs/api/grant_blocks/list-grant-blocks) of [`GrantBlock`](https://apidocs.chargebee.com/docs/api/grant_blocks). +- `dana`, `touch_n_go`, `tamara`, and `qpay` have been added as new values to enum request body parameter `payment_method_type` in [`update_a_payment_intent`](https://apidocs.chargebee.com/docs/api/payment_intents/update-a-payment-intent) of [`PaymentIntent`](https://apidocs.chargebee.com/docs/api/payment_intents). +- `dana`, `touch_n_go`, `tamara`, and `qpay` have been added as new values to enum request body parameter `payment_method_type` in [`create_a_payment_intent`](https://apidocs.chargebee.com/docs/api/payment_intents/create-a-payment-intent) of [`PaymentIntent`](https://apidocs.chargebee.com/docs/api/payment_intents). + + + ### v3.26.0 (2026-07-21) * * * ### New Resources: diff --git a/README.md b/README.md index 1f247f6..abe3244 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,7 @@ The package needs to be configured with your site's API key, which is available ### Configuring chargebee client ```python from chargebee import Chargebee + cb_client = Chargebee(api_key="", site="") ``` @@ -46,6 +47,7 @@ cb_client = Chargebee(api_key="", site="") ```python from chargebee import Chargebee + cb_client = Chargebee(api_key="api_key", site="site") cb_client.update_read_timeout_secs(3000) cb_client.update_connect_timeout_secs(5000) @@ -55,6 +57,7 @@ cb_client.update_connect_timeout_secs(5000) ```python from chargebee import Chargebee + cb_client = Chargebee(api_key="api_key", site="site") cb_client.update_export_retry_delay_ms(3000) cb_client.update_time_travel_retry_delay_ms(5000) @@ -99,9 +102,7 @@ When configured to use the async client, all model methods return a coroutine, w ```python async def get_customers(): response = await cb_client.Customer.list( - cb_client.Customer.ListParams( - first_name=Filters.StringFilter(IS="John") - ) + cb_client.Customer.ListParams(first_name=Filters.StringFilter(IS="John")) ) return response ``` @@ -110,6 +111,7 @@ Note: The async methods will have to be wrapped in an event loop during invocati ```python import asyncio + response = asyncio.run(get_customers()) ``` @@ -121,9 +123,7 @@ For pagination, `offset` is the parameter that is being used. The value used for from chargebee import Filters response = cb_client.Customer.list( - cb_client.Customer.ListParams( - first_name=Filters.StringFilter(IS="John") - ) + cb_client.Customer.ListParams(first_name=Filters.StringFilter(IS="John")) ) offset = response.next_offset print(offset) @@ -193,15 +193,15 @@ response = cb_client.Customer.create( ), ), None, - { - "chargebee-idempotency-key": "<>" - }, # Replace <> with a unique string + {"chargebee-idempotency-key": "<>"}, # Replace <> with a unique string ) customer = response.customer card = response.card responseHeaders = response.headers # Retrieves response headers print(responseHeaders) -idempotencyReplayedValue = response.is_idempotency_replayed # Retrieves Idempotency replayed header value +idempotencyReplayedValue = ( + response.is_idempotency_replayed +) # Retrieves Idempotency replayed header value print(idempotencyReplayedValue) ``` @@ -244,17 +244,11 @@ You can enable and configure the retry logic by passing a `retryConfig` object w from chargebee import Chargebee from chargebee.retry_config import RetryConfig -retry_config = RetryConfig( - enabled=True, - max_retries=5, - delay_ms=1000, - retry_on=[500] -) +retry_config = RetryConfig(enabled=True, max_retries=5, delay_ms=1000, retry_on=[500]) cb_client = Chargebee(api_key="api_key", site="site") cb_client.update_retry_config(retry_config) # ... your Chargebee API operations ... - ``` #### Example: Rate Limit retry logic @@ -265,17 +259,11 @@ You can enable and configure the retry logic for rate-limit by passing a `retryC from chargebee import Chargebee from chargebee.retry_config import RetryConfig -retry_config = RetryConfig( - enabled=True, - max_retries=5, - delay_ms=1000, - retry_on=[429] -) +retry_config = RetryConfig(enabled=True, max_retries=5, delay_ms=1000, retry_on=[429]) cb_client = Chargebee(api_key="api_key", site="site") cb_client.update_retry_config(retry_config) # ... your Chargebee API operations ... - ``` ### Telemetry (OpenTelemetry) @@ -314,7 +302,12 @@ trace.set_tracer_provider(provider) ``` ```python -from chargebee import Chargebee, RequestTelemetryContext, RequestTelemetryResult, TelemetryAdapter +from chargebee import ( + Chargebee, + RequestTelemetryContext, + RequestTelemetryResult, + TelemetryAdapter, +) from opentelemetry import trace from opentelemetry.trace import SpanKind, Status, StatusCode diff --git a/VERSION b/VERSION index 419ede3..8c53120 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.26.0 +3.27.0 diff --git a/chargebee/main.py b/chargebee/main.py index 16d1167..fd85630 100644 --- a/chargebee/main.py +++ b/chargebee/main.py @@ -64,6 +64,7 @@ def __init__( self.CpqQuoteSignature = chargebee.CpqQuoteSignature(self.env) self.CreditNote = chargebee.CreditNote(self.env) self.CreditNoteEstimate = chargebee.CreditNoteEstimate(self.env) + self.CreditUnit = chargebee.CreditUnit(self.env) self.Currency = chargebee.Currency(self.env) self.Customer = chargebee.Customer(self.env) self.CustomerEntitlement = chargebee.CustomerEntitlement(self.env) @@ -95,6 +96,7 @@ def __init__( self.ItemFamily = chargebee.ItemFamily(self.env) self.ItemPrice = chargebee.ItemPrice(self.env) self.LedgerAccountBalance = chargebee.LedgerAccountBalance(self.env) + self.LedgerEntry = chargebee.LedgerEntry(self.env) self.LedgerOperation = chargebee.LedgerOperation(self.env) self.Metadata = chargebee.Metadata(self.env) self.Meter = chargebee.Meter(self.env) diff --git a/chargebee/models/__init__.py b/chargebee/models/__init__.py index 4d44ad4..aeebdb8 100644 --- a/chargebee/models/__init__.py +++ b/chargebee/models/__init__.py @@ -144,6 +144,8 @@ from chargebee.models.credit_note_estimate.operations import CreditNoteEstimate +from chargebee.models.credit_unit.operations import CreditUnit + from chargebee.models.currency.operations import Currency from chargebee.models.customer.operations import Customer @@ -206,6 +208,8 @@ from chargebee.models.ledger_account_balance.operations import LedgerAccountBalance +from chargebee.models.ledger_entry.operations import LedgerEntry + from chargebee.models.ledger_operation.operations import LedgerOperation from chargebee.models.metadata.operations import Metadata diff --git a/chargebee/models/alert/operations.py b/chargebee/models/alert/operations.py index 98c2031..b86d0c9 100644 --- a/chargebee/models/alert/operations.py +++ b/chargebee/models/alert/operations.py @@ -58,6 +58,7 @@ class CreateParams(TypedDict): description: NotRequired[str] metered_feature_id: NotRequired[str] currency_code: NotRequired[str] + unit_id: NotRequired[str] subscription_id: NotRequired[str] threshold: NotRequired["Alert.CreateThresholdParams"] meta: NotRequired[str] diff --git a/chargebee/models/alert/responses.py b/chargebee/models/alert/responses.py index 3def7ec..1e17918 100644 --- a/chargebee/models/alert/responses.py +++ b/chargebee/models/alert/responses.py @@ -28,12 +28,13 @@ class AlertResponse(Model): description: str = None metered_feature_id: str = None currency_code: str = None + unit_id: str = None subscription_id: str = None status: str = None meta: str = None created_at: int = None updated_at: int = None - threshold: List[ThresholdResponse] = None + threshold: ThresholdResponse = None filter_conditions: List[FilterConditionResponse] = None diff --git a/chargebee/models/credit_unit/__init__.py b/chargebee/models/credit_unit/__init__.py new file mode 100644 index 0000000..f3cc6d8 --- /dev/null +++ b/chargebee/models/credit_unit/__init__.py @@ -0,0 +1,2 @@ +from .operations import CreditUnit +from .responses import CreditUnitResponse diff --git a/chargebee/models/credit_unit/operations.py b/chargebee/models/credit_unit/operations.py new file mode 100644 index 0000000..6ace768 --- /dev/null +++ b/chargebee/models/credit_unit/operations.py @@ -0,0 +1,132 @@ +from .responses import * +from chargebee import request, environment +from typing import TypedDict, Required, NotRequired, Dict, List, Any, cast +from enum import Enum +from chargebee.filters import Filters + + +@dataclass +class CreditUnit: + env: environment.Environment + + class Status(Enum): + ACTIVE = "active" + ARCHIVED = "archived" + + def __str__(self): + return self.value + + class ListParams(TypedDict): + limit: NotRequired[int] + offset: NotRequired[str] + status: NotRequired[Filters.EnumFilter] + id: NotRequired[Filters.StringFilter] + + class CreateParams(TypedDict): + id: Required[str] + name: Required[str] + is_unlimited: Required[bool] + overdraft_amount: NotRequired[str] + external_name: NotRequired[str] + + class UpdateParams(TypedDict): + name: NotRequired[str] + external_name: NotRequired[str] + + def list(self, params: ListParams = None, headers=None) -> ListResponse: + jsonKeys = {} + options = {} + return request.send_list_request( + "get", + request.uri_path("credit_units"), + self.env, + cast(Dict[Any, Any], params), + headers, + ListResponse, + None, + False, + jsonKeys, + options, + resource="creditUnit", + operation="list", + ) + + def create(self, params: CreateParams, headers=None) -> CreateResponse: + jsonKeys = {} + options = { + "isIdempotent": True, + } + return request.send( + "post", + request.uri_path("credit_units"), + self.env, + cast(Dict[Any, Any], params), + headers, + CreateResponse, + None, + False, + jsonKeys, + options, + resource="creditUnit", + operation="create", + ) + + def update(self, id, params: UpdateParams = None, headers=None) -> UpdateResponse: + jsonKeys = {} + options = { + "isIdempotent": True, + } + return request.send( + "post", + request.uri_path("credit_units", id), + self.env, + cast(Dict[Any, Any], params), + headers, + UpdateResponse, + None, + False, + jsonKeys, + options, + resource="creditUnit", + operation="update", + ) + + def archive(self, id, headers=None) -> ArchiveResponse: + jsonKeys = {} + options = { + "isIdempotent": True, + } + return request.send( + "post", + request.uri_path("credit_units", id, "archive_command"), + self.env, + None, + headers, + ArchiveResponse, + None, + False, + jsonKeys, + options, + resource="creditUnit", + operation="archive", + ) + + def reactivate(self, id, headers=None) -> ReactivateResponse: + jsonKeys = {} + options = { + "isIdempotent": True, + } + return request.send( + "post", + request.uri_path("credit_units", id, "reactivate_command"), + self.env, + None, + headers, + ReactivateResponse, + None, + False, + jsonKeys, + options, + resource="creditUnit", + operation="reactivate", + ) diff --git a/chargebee/models/credit_unit/responses.py b/chargebee/models/credit_unit/responses.py new file mode 100644 index 0000000..992eb7d --- /dev/null +++ b/chargebee/models/credit_unit/responses.py @@ -0,0 +1,55 @@ +from dataclasses import dataclass +from chargebee.model import Model +from typing import Dict, List, Any +from chargebee.response import Response + + +@dataclass +class CreditUnitResponse(Model): + raw_data: Dict[Any, Any] = None + id: str = None + name: str = None + external_name: str = None + status: str = None + resource_version: int = None + updated_at: int = None + created_at: int = None + created_by: str = None + updated_by: str = None + is_unlimited: bool = None + overdraft_amount: str = None + + +@dataclass +class ListCreditUnitResponse: + credit_unit: CreditUnitResponse + + +@dataclass +class ListResponse(Response): + list: List[ListCreditUnitResponse] + next_offset: str = None + + +@dataclass +class CreateResponse(Response): + is_idempotency_replayed: bool + credit_unit: CreditUnitResponse + + +@dataclass +class UpdateResponse(Response): + is_idempotency_replayed: bool + credit_unit: CreditUnitResponse + + +@dataclass +class ArchiveResponse(Response): + is_idempotency_replayed: bool + credit_unit: CreditUnitResponse + + +@dataclass +class ReactivateResponse(Response): + is_idempotency_replayed: bool + credit_unit: CreditUnitResponse diff --git a/chargebee/models/enums.py b/chargebee/models/enums.py index 4635fce..9f946b9 100644 --- a/chargebee/models/enums.py +++ b/chargebee/models/enums.py @@ -590,6 +590,10 @@ class EnabledEvents(Enum): ALERT_STATUS_CHANGED = "alert_status_changed" OMNICHANNEL_SUBSCRIPTION_ITEM_UPDATED = "omnichannel_subscription_item_updated" OMNICHANNEL_SUBSCRIPTION_ITEM_RECOVERED = "omnichannel_subscription_item_recovered" + LEDGER_ACCOUNT_BALANCE_UPDATED = "ledger_account_balance_updated" + GRANT_BLOCKS_CREATED = "grant_blocks_created" + GRANT_BLOCKS_UPDATED = "grant_blocks_updated" + LEDGER_UPDATED = "ledger_updated" PLAN_CREATED = "plan_created" PLAN_UPDATED = "plan_updated" PLAN_DELETED = "plan_deleted" @@ -945,6 +949,10 @@ class EventType(Enum): ALERT_STATUS_CHANGED = "alert_status_changed" OMNICHANNEL_SUBSCRIPTION_ITEM_UPDATED = "omnichannel_subscription_item_updated" OMNICHANNEL_SUBSCRIPTION_ITEM_RECOVERED = "omnichannel_subscription_item_recovered" + LEDGER_ACCOUNT_BALANCE_UPDATED = "ledger_account_balance_updated" + GRANT_BLOCKS_CREATED = "grant_blocks_created" + GRANT_BLOCKS_UPDATED = "grant_blocks_updated" + LEDGER_UPDATED = "ledger_updated" PLAN_CREATED = "plan_created" PLAN_UPDATED = "plan_updated" PLAN_DELETED = "plan_deleted" @@ -1180,6 +1188,10 @@ class PaymentMethod(Enum): BANK_TRANSFER = "bank_transfer" OTHER = "other" CUSTOM = "custom" + DANA = "dana" + TOUCH_N_GO = "touch_n_go" + TAMARA = "tamara" + QPAY = "qpay" CHARGEBACK = "chargeback" CARD = "card" AMAZON_PAYMENTS = "amazon_payments" @@ -1298,6 +1310,10 @@ class PaymentMethodType(Enum): PAYNOW = "paynow" BIZUM = "bizum" PROMPTPAY = "promptpay" + DANA = "dana" + TOUCH_N_GO = "touch_n_go" + TAMARA = "tamara" + QPAY = "qpay" def __str__(self): return self.value @@ -1590,6 +1606,10 @@ class Type(Enum): PAYNOW = "paynow" BIZUM = "bizum" PROMPTPAY = "promptpay" + DANA = "dana" + TOUCH_N_GO = "touch_n_go" + TAMARA = "tamara" + QPAY = "qpay" FREE_TRIAL = "free_trial" PAY_UP_FRONT = "pay_up_front" PAY_AS_YOU_GO = "pay_as_you_go" @@ -1597,6 +1617,11 @@ class Type(Enum): COMPOUND = "compound" USAGE_EXCEEDED = "usage_exceeded" SPEND_EXCEEDED = "spend_exceeded" + CREDIT_BALANCE_DROPPED = "credit_balance_dropped" + CREDIT = "credit" + DEBIT = "debit" + HOLD = "hold" + UNHOLD = "unhold" def __str__(self): return self.value diff --git a/chargebee/models/estimate/operations.py b/chargebee/models/estimate/operations.py index 47231e8..897b427 100644 --- a/chargebee/models/estimate/operations.py +++ b/chargebee/models/estimate/operations.py @@ -1003,6 +1003,7 @@ class CancelSubscriptionForItemsParams(TypedDict): subscription_items: NotRequired[ List["Estimate.CancelSubscriptionForItemsSubscriptionItemParams"] ] + include_cancellation_day_in_billing: NotRequired[bool] cancel_reason_code: NotRequired[str] class PauseSubscriptionParams(TypedDict): diff --git a/chargebee/models/grant_block/operations.py b/chargebee/models/grant_block/operations.py index ae8e55d..5679476 100644 --- a/chargebee/models/grant_block/operations.py +++ b/chargebee/models/grant_block/operations.py @@ -9,16 +9,6 @@ class GrantBlock: env: environment.Environment - class GrantSource(Enum): - SUBSCRIPTION_CREATED = "subscription_created" - SUBSCRIPTION_CHANGED = "subscription_changed" - TOP_UP = "top_up" - PROMOTIONAL_GRANTS = "promotional_grants" - ROLLOVER = "rollover" - - def __str__(self): - return self.value - class AccountType(Enum): PROVISIONED = "provisioned" OVERDRAFT = "overdraft" @@ -32,11 +22,24 @@ class UnitType(Enum): def __str__(self): return self.value + class GrantSource(Enum): + SUBSCRIPTION_CREATED = "subscription_created" + SUBSCRIPTION_CHANGED = "subscription_changed" + TOP_UP = "top_up" + PROMOTIONAL_GRANTS = "promotional_grants" + ROLLOVER = "rollover" + GRANT_RENEWAL = "grant_renewal" + SUBSCRIPTION_RENEWED = "subscription_renewed" + + def __str__(self): + return self.value + class ListGrantBlocksParams(TypedDict): limit: NotRequired[int] offset: NotRequired[str] subscription_id: Required[Filters.StringFilter] unit_id: NotRequired[Filters.StringFilter] + account_type: NotRequired[Filters.EnumFilter] effective_from: NotRequired[Filters.TimestampFilter] expires_at: NotRequired[Filters.TimestampFilter] created_at: NotRequired[Filters.TimestampFilter] diff --git a/chargebee/models/grant_block/responses.py b/chargebee/models/grant_block/responses.py index bff011d..af79dd7 100644 --- a/chargebee/models/grant_block/responses.py +++ b/chargebee/models/grant_block/responses.py @@ -8,6 +8,10 @@ class GrantBlockResponse(Model): raw_data: Dict[Any, Any] = None id: str = None + subscription_id: str = None + account_type: str = None + unit_id: str = None + unit_type: str = None granted_amount: str = None effective_from: int = None expires_at: int = None @@ -21,9 +25,8 @@ class GrantBlockResponse(Model): status: str = None grant_source: str = None created_at: int = None - account_type: str = None - unit_id: str = None - unit_type: str = None + modified_at: int = None + resource_version: int = None metadata: Dict[Any, Any] = None diff --git a/chargebee/models/ledger_account_balance/responses.py b/chargebee/models/ledger_account_balance/responses.py index 004e5d7..eaa92f4 100644 --- a/chargebee/models/ledger_account_balance/responses.py +++ b/chargebee/models/ledger_account_balance/responses.py @@ -29,7 +29,9 @@ class LedgerAccountBalanceResponse(Model): subscription_id: str = None unit_id: str = None unit_type: str = None + created_at: int = None modified_at: int = None + resource_version: int = None provisioned_balance: ProvisionedBalanceResponse = None overdraft_balance: OverdraftBalanceResponse = None diff --git a/chargebee/models/ledger_entry/__init__.py b/chargebee/models/ledger_entry/__init__.py new file mode 100644 index 0000000..75b95ed --- /dev/null +++ b/chargebee/models/ledger_entry/__init__.py @@ -0,0 +1,2 @@ +from .operations import LedgerEntry +from .responses import LedgerEntryResponse diff --git a/chargebee/models/ledger_entry/operations.py b/chargebee/models/ledger_entry/operations.py new file mode 100644 index 0000000..4a6004c --- /dev/null +++ b/chargebee/models/ledger_entry/operations.py @@ -0,0 +1,24 @@ +from .responses import * +from chargebee import request, environment +from typing import TypedDict, Required, NotRequired, Dict, List, Any, cast +from enum import Enum + + +@dataclass +class LedgerEntry: + env: environment.Environment + + class AccountType(Enum): + PROVISIONED = "provisioned" + OVERDRAFT = "overdraft" + + def __str__(self): + return self.value + + class UnitType(Enum): + CREDIT_UNIT = "credit_unit" + + def __str__(self): + return self.value + + pass diff --git a/chargebee/models/ledger_entry/responses.py b/chargebee/models/ledger_entry/responses.py new file mode 100644 index 0000000..d83b113 --- /dev/null +++ b/chargebee/models/ledger_entry/responses.py @@ -0,0 +1,23 @@ +from dataclasses import dataclass +from chargebee.model import Model +from typing import Dict, List, Any + + +@dataclass +class LedgerEntryResponse(Model): + raw_data: Dict[Any, Any] = None + id: str = None + subscription_id: str = None + account_type: str = None + unit_id: str = None + unit_type: str = None + amount: str = None + grant_block_start_balance: str = None + grant_block_end_balance: str = None + account_start_balance: str = None + account_end_balance: str = None + type: str = None + ledger_operation_id: str = None + grant_block_id: str = None + created_at: int = None + modified_at: int = None diff --git a/chargebee/models/ledger_operation/operations.py b/chargebee/models/ledger_operation/operations.py index d1c7a3c..11e2160 100644 --- a/chargebee/models/ledger_operation/operations.py +++ b/chargebee/models/ledger_operation/operations.py @@ -9,6 +9,12 @@ class LedgerOperation: env: environment.Environment + class UnitType(Enum): + CREDIT_UNIT = "credit_unit" + + def __str__(self): + return self.value + class Type(Enum): ALLOCATION = "allocation" CAPTURE = "capture" @@ -23,12 +29,6 @@ class Type(Enum): def __str__(self): return self.value - class UnitType(Enum): - CREDIT_UNIT = "credit_unit" - - def __str__(self): - return self.value - class ListLedgerOperationsParams(TypedDict): limit: NotRequired[int] offset: NotRequired[str] @@ -68,6 +68,13 @@ class ReleaseAuthorizationParams(TypedDict): ledger_operation_timestamp: Required[int] metadata: NotRequired[Dict[Any, Any]] + class AllocateParams(TypedDict): + subscription_id: Required[str] + unit_id: Required[str] + amount: Required[str] + expires_at: Required[int] + metadata: NotRequired[Dict[Any, Any]] + def retrieve_ledger_operation( self, id, headers=None ) -> RetrieveLedgerOperationResponse: @@ -191,3 +198,23 @@ def release_authorization( resource="ledgerOperation", operation="releaseAuthorization", ) + + def allocate(self, params: AllocateParams, headers=None) -> AllocateResponse: + jsonKeys = { + "metadata": 0, + } + options = {} + return request.send( + "post", + request.uri_path("ledger_operations", "allocate"), + self.env, + cast(Dict[Any, Any], params), + headers, + AllocateResponse, + None, + True, + jsonKeys, + options, + resource="ledgerOperation", + operation="allocate", + ) diff --git a/chargebee/models/ledger_operation/responses.py b/chargebee/models/ledger_operation/responses.py index e97cfe3..06e1210 100644 --- a/chargebee/models/ledger_operation/responses.py +++ b/chargebee/models/ledger_operation/responses.py @@ -2,13 +2,16 @@ from chargebee.model import Model from typing import Dict, List, Any from chargebee.response import Response -from chargebee.models import ledger_account_balance +from chargebee.models import ledger_account_balance, grant_block, ledger_entry @dataclass class LedgerOperationResponse(Model): raw_data: Dict[Any, Any] = None id: str = None + subscription_id: str = None + unit_id: str = None + unit_type: str = None type: str = None amount: str = None provisioned_start_balance: str = None @@ -20,9 +23,6 @@ class LedgerOperationResponse(Model): auto_release_timestamp: int = None created_at: int = None modified_at: int = None - subscription_id: str = None - unit_id: str = None - unit_type: str = None metadata: Dict[Any, Any] = None @@ -47,6 +47,8 @@ class CaptureResponse(Response): is_idempotency_replayed: bool ledger_operation: LedgerOperationResponse ledger_account_balance: "ledger_account_balance.LedgerAccountBalanceResponse" + grant_blocks: List["grant_block.GrantBlockResponse"] + ledger_entries: List["ledger_entry.LedgerEntryResponse"] @dataclass @@ -54,6 +56,8 @@ class AuthorizeResponse(Response): is_idempotency_replayed: bool ledger_operation: LedgerOperationResponse ledger_account_balance: "ledger_account_balance.LedgerAccountBalanceResponse" + grant_blocks: List["grant_block.GrantBlockResponse"] + ledger_entries: List["ledger_entry.LedgerEntryResponse"] @dataclass @@ -61,6 +65,8 @@ class CaptureAuthorizationResponse(Response): is_idempotency_replayed: bool ledger_operation: LedgerOperationResponse ledger_account_balance: "ledger_account_balance.LedgerAccountBalanceResponse" + grant_blocks: List["grant_block.GrantBlockResponse"] + ledger_entries: List["ledger_entry.LedgerEntryResponse"] @dataclass @@ -68,3 +74,14 @@ class ReleaseAuthorizationResponse(Response): is_idempotency_replayed: bool ledger_operation: LedgerOperationResponse ledger_account_balance: "ledger_account_balance.LedgerAccountBalanceResponse" + grant_blocks: List["grant_block.GrantBlockResponse"] + ledger_entries: List["ledger_entry.LedgerEntryResponse"] + + +@dataclass +class AllocateResponse(Response): + is_idempotency_replayed: bool + ledger_account_balance: "ledger_account_balance.LedgerAccountBalanceResponse" + ledger_operations: List[LedgerOperationResponse] + grant_blocks: List["grant_block.GrantBlockResponse"] + ledger_entries: List["ledger_entry.LedgerEntryResponse"] diff --git a/chargebee/models/payment_intent/operations.py b/chargebee/models/payment_intent/operations.py index 1adeeb7..60198b6 100644 --- a/chargebee/models/payment_intent/operations.py +++ b/chargebee/models/payment_intent/operations.py @@ -68,6 +68,10 @@ class PaymentMethodType(Enum): PAYNOW = "paynow" BIZUM = "bizum" PROMPTPAY = "promptpay" + DANA = "dana" + TOUCH_N_GO = "touch_n_go" + TAMARA = "tamara" + QPAY = "qpay" def __str__(self): return self.value diff --git a/chargebee/models/subscription/operations.py b/chargebee/models/subscription/operations.py index 0357b6e..1d2dd53 100644 --- a/chargebee/models/subscription/operations.py +++ b/chargebee/models/subscription/operations.py @@ -1729,6 +1729,7 @@ class CancelForItemsParams(TypedDict): subscription_items: NotRequired[ List["Subscription.CancelForItemsSubscriptionItemParams"] ] + include_cancellation_day_in_billing: NotRequired[bool] cancel_reason_code: NotRequired[str] decommissioned: NotRequired[bool] diff --git a/chargebee/version.py b/chargebee/version.py index f0be154..4daebf6 100644 --- a/chargebee/version.py +++ b/chargebee/version.py @@ -1 +1 @@ -VERSION = "3.26.0" +VERSION = "3.27.0"