inttegro.balance_transaction
Models, requests, and enums for the Inttegro balance transaction resource.
The primary returned object is inttegro.balance_transaction.BalanceTransaction. Related request types, nested response shapes, and string-backed enums are exported from this singular namespace. Public members load lazily, so importing one resource does not eagerly import the entire SDK.
1"""Models, requests, and enums for the Inttegro balance transaction resource. 2 3The primary returned object is ``inttegro.balance_transaction.BalanceTransaction``. Related request types, nested response shapes, and string-backed enums are exported from this singular namespace. Public members load lazily, so importing one resource does not eagerly import the entire SDK.""" 4 5from importlib import import_module 6from typing import TYPE_CHECKING, Any 7 8if TYPE_CHECKING: 9 from .allocation import Allocation as Allocation 10 from .allocation_use import AllocationUse as AllocationUse 11 from .amount import Amount as Amount 12 from .balance_transaction import BalanceTransaction as BalanceTransaction 13 from .lookup_request import LookupRequest as LookupRequest 14 from .page import Page as Page 15 from .page_request import PageRequest as PageRequest 16 from .page_response import PageResponse as PageResponse 17 from .response import Response as Response 18 from .type import Type as Type 19 20 21_EXPORTS: dict[str, tuple[str, str]] = { 22 "Allocation": ("inttegro.balance_transaction.allocation", "Allocation"), 23 "AllocationUse": ("inttegro.balance_transaction.allocation_use", "AllocationUse"), 24 "Amount": ("inttegro.balance_transaction.amount", "Amount"), 25 "BalanceTransaction": ("inttegro.balance_transaction.balance_transaction", "BalanceTransaction"), 26 "LookupRequest": ("inttegro.balance_transaction.lookup_request", "LookupRequest"), 27 "Page": ("inttegro.balance_transaction.page", "Page"), 28 "PageRequest": ("inttegro.balance_transaction.page_request", "PageRequest"), 29 "PageResponse": ("inttegro.balance_transaction.page_response", "PageResponse"), 30 "Response": ("inttegro.balance_transaction.response", "Response"), 31 "Type": ("inttegro.balance_transaction.type", "Type"), 32} 33 34__all__ = [ 35 "Allocation", 36 "AllocationUse", 37 "Amount", 38 "BalanceTransaction", 39 "LookupRequest", 40 "Page", 41 "PageRequest", 42 "PageResponse", 43 "Response", 44 "Type", 45] 46 47 48def __getattr__(name: str) -> Any: 49 """Load a public resource type on first access.""" 50 try: 51 module_name, attribute_name = _EXPORTS[name] 52 except KeyError: 53 raise AttributeError(f"module {__name__!r} has no attribute {name!r}") from None 54 value = getattr(import_module(module_name), attribute_name) 55 globals()[name] = value 56 return value
11@dataclass(frozen=True, slots=True, init=False, repr=False, eq=False) 12class Allocation(ApiModel): 13 """Caller-safe allocation of part of a payment balance transaction. 14 15 Exactly one of ``refund`` and ``payout`` is present, matching ``type``. 16 """ 17 18 id: str = field(init=False) 19 type: Literal["payout", "refund"] = field(init=False) 20 status: Literal["pending", "completed"] = field(init=False) 21 refund: AllocationUse | None = field(init=False) 22 payout: AllocationUse | None = field(init=False) 23 created_at: datetime = field(init=False) 24 updated_at: datetime = field(init=False) 25 completed_at: datetime | None = field(init=False)
Caller-safe allocation of part of a payment balance transaction.
9@dataclass(frozen=True, slots=True, init=False, repr=False, eq=False) 10class AllocationUse(ApiModel): 11 """Refund or payout reference and the amount consumed from one transaction.""" 12 13 id: str = field(init=False) 14 amount: BalanceTransactionAmount = field(init=False)
Refund or payout reference and the amount consumed from one transaction.
12@dataclass(frozen=True, slots=True, init=False, repr=False, eq=False) 13class Amount(ApiModel): 14 """Typed amount data in the balance transaction resource namespace. 15 16 Instances are immutable API responses. ``from_dict()`` decodes nested 17 objects, string-backed enums, and timezone-aware ISO-8601 timestamps; 18 ``to_dict()`` returns the corresponding JSON-compatible wire shape. 19 Fields not returned by the API remain absent and can still be queried 20 through mapping-style access. 21 22 API contract schema: ``BalanceTransactionAmount``. 23 """ 24 currency: str = field(init=False) 25 """Currency code as stored on the transaction. Required. Python type: ``str``; wire name: ``currency``; JSON type: string""" 26 value: int = field(init=False) 27 """Unsigned amount in the currency's smallest unit. Required. Python type: ``int``; wire name: ``value``; JSON type: integer. Constraints: minimum 0"""
Typed amount data in the balance transaction resource namespace.
Instances are immutable API responses. from_dict() decodes nested
objects, string-backed enums, and timezone-aware ISO-8601 timestamps;
to_dict() returns the corresponding JSON-compatible wire shape.
Fields not returned by the API remain absent and can still be queried
through mapping-style access.
API contract schema: BalanceTransactionAmount.
Currency code as stored on the transaction. Required. Python type: str; wire name: currency; JSON type: string
Unsigned amount in the currency's smallest unit. Required. Python type: int; wire name: value; JSON type: integer. Constraints: minimum 0
14@dataclass(frozen=True, slots=True, init=False, repr=False, eq=False) 15class BalanceTransaction(ApiModel): 16 """Merchant balance entry caused by a payment or refund. `type` describes the semantic source, not direction. A payment transaction contains `payment_id`; a refund transaction contains `refund_id`. Exactly one matching reference is present. 17 18 Instances are immutable API responses. ``from_dict()`` decodes nested 19 objects, string-backed enums, and timezone-aware ISO-8601 timestamps; 20 ``to_dict()`` returns the corresponding JSON-compatible wire shape. 21 Fields not returned by the API remain absent and can still be queried 22 through mapping-style access. 23 """ 24 amount: BalanceTransactionAmount = field(init=False) 25 """Monetary amount, represented by a currency and an integer minor-unit value. Required. Python type: ``BalanceTransactionAmount``; wire name: ``amount``; JSON type: object (BalanceTransactionAmount)""" 26 available_at: datetime | None = field(init=False) 27 """Timestamp for available at. Optional; nullable. Python type: ``datetime | None``; wire name: ``available_at``; JSON type: string (date-time)""" 28 claimed_at: datetime | None = field(init=False) 29 """Timestamp for claimed at. Optional; nullable. Python type: ``datetime | None``; wire name: ``claimed_at``; JSON type: string (date-time)""" 30 created_at: datetime = field(init=False) 31 """When the balance transaction was created. Required. Python type: ``datetime``; wire name: ``created_at``; JSON type: string (date-time)""" 32 id: str = field(init=False) 33 """Unique identifier for this balance transaction. Required. Python type: ``str``; wire name: ``id``; JSON type: string""" 34 order_id: str | None = field(init=False) 35 """Identifier of the related order. Omitted for payout debits. Optional; nullable. Python type: ``str | None``; wire name: ``order_id``; JSON type: string""" 36 paid_at: datetime | None = field(init=False) 37 """When payment completed successfully. Optional; nullable. Python type: ``datetime | None``; wire name: ``paid_at``; JSON type: string (date-time)""" 38 payment_id: str | None = field(init=False) 39 """Present when `type` is `payment`; omitted when `type` is `refund`. Optional; nullable. Python type: ``str | None``; wire name: ``payment_id``; JSON type: string""" 40 payout_id: str | None = field(init=False) 41 """Identifier of the related payout. Optional; nullable. Python type: ``str | None``; wire name: ``payout_id``; JSON type: string""" 42 refund_id: str | None = field(init=False) 43 """Present when `type` is `refund`; omitted when `type` is `payment`. Optional; nullable. Python type: ``str | None``; wire name: ``refund_id``; JSON type: string""" 44 type: Literal['payment', 'refund', 'payout'] = field(init=False) 45 """Semantic source or cause of the transaction, not its direction. Required. Python type: ``Literal['payment', 'refund', 'payout']``; wire name: ``type``; JSON type: string.""" 46 payout_configuration: PaymentPayoutConfiguration | None = field(init=False) 47 """The payout configuration associated with this balance transaction. Optional; nullable. Python type: ``PaymentPayoutConfiguration | None``; wire name: ``payout_configuration``; JSON type: object""" 48 allocations: list[BalanceTransactionAllocation] | None = field(init=False) 49 """All current pending and completed allocations. Released allocations are omitted. Python type: ``list[BalanceTransactionAllocation] | None``; wire name: ``allocations``; JSON type: array""" 50 available_amount: BalanceTransactionAmount | None = field(init=False) 51 """Amount still available for a refund or payout. Python type: ``BalanceTransactionAmount | None``; wire name: ``available_amount``; JSON type: object""" 52 pending_amount: BalanceTransactionAmount | None = field(init=False) 53 """Amount reserved by unresolved refunds and payouts. Python type: ``BalanceTransactionAmount | None``; wire name: ``pending_amount``; JSON type: object""" 54 spent_amount: BalanceTransactionAmount | None = field(init=False) 55 """Amount permanently consumed by completed allocations. Python type: ``BalanceTransactionAmount | None``; wire name: ``spent_amount``; JSON type: object"""
Merchant balance entry caused by a payment or refund. type describes the semantic source, not direction. A payment transaction contains payment_id; a refund transaction contains refund_id. Exactly one matching reference is present.
Instances are immutable API responses. from_dict() decodes nested
objects, string-backed enums, and timezone-aware ISO-8601 timestamps;
to_dict() returns the corresponding JSON-compatible wire shape.
Fields not returned by the API remain absent and can still be queried
through mapping-style access.
Monetary amount, represented by a currency and an integer minor-unit value. Required. Python type: BalanceTransactionAmount; wire name: amount; JSON type: object (BalanceTransactionAmount)
Timestamp for available at. Optional; nullable. Python type: datetime | None; wire name: available_at; JSON type: string (date-time)
Timestamp for claimed at. Optional; nullable. Python type: datetime | None; wire name: claimed_at; JSON type: string (date-time)
When the balance transaction was created. Required. Python type: datetime; wire name: created_at; JSON type: string (date-time)
Unique identifier for this balance transaction. Required. Python type: str; wire name: id; JSON type: string
Identifier of the related order. Omitted for payout debits. Optional; nullable. Python type: str | None; wire name: order_id; JSON type: string
When payment completed successfully. Optional; nullable. Python type: datetime | None; wire name: paid_at; JSON type: string (date-time)
Present when type is payment; omitted when type is refund. Optional; nullable. Python type: str | None; wire name: payment_id; JSON type: string
Identifier of the related payout. Optional; nullable. Python type: str | None; wire name: payout_id; JSON type: string
Semantic source or cause of the transaction, not its direction. Required. Python type: Literal['payment', 'refund', 'payout']; wire name: type; JSON type: string.
The payout configuration associated with this balance transaction. Optional; nullable. Python type: PaymentPayoutConfiguration | None; wire name: payout_configuration; JSON type: object
All current pending and completed allocations. Released allocations are omitted. Python type: list[BalanceTransactionAllocation] | None; wire name: allocations; JSON type: array
Amount still available for a refund or payout. Python type: BalanceTransactionAmount | None; wire name: available_amount; JSON type: object
Amount reserved by unresolved refunds and payouts. Python type: BalanceTransactionAmount | None; wire name: pending_amount; JSON type: object
Amount permanently consumed by completed allocations. Python type: BalanceTransactionAmount | None; wire name: spent_amount; JSON type: object
12@dataclass(frozen=True, slots=True, kw_only=True) 13class LookupRequest(ApiRequest): 14 """Parameters accepted by the lookup request operation. 15 16 This is an immutable, keyword-only request object. ``to_dict()`` uses 17 the documented wire names, omits fields left as ``UNSET``, serializes 18 string-backed enums by value, and requires timezone-aware datetimes. 19 20 API contract schema: ``LookupBalanceTransactionRequest``. 21 """ 22 transaction_id: str 23 """ID of the OTP transaction to lookup (with ot_ prefix). Required. Python type: ``str``; wire name: ``transaction_id``; JSON type: string"""
Parameters accepted by the lookup request operation.
This is an immutable, keyword-only request object. to_dict() uses
the documented wire names, omits fields left as UNSET, serializes
string-backed enums by value, and requires timezone-aware datetimes.
API contract schema: LookupBalanceTransactionRequest.
ID of the OTP transaction to lookup (with ot_ prefix). Required. Python type: str; wire name: transaction_id; JSON type: string
12@dataclass(frozen=True, slots=True, init=False, repr=False, eq=False) 13class Page(ApiModel): 14 """One page of page resources. 15 16 Instances are immutable API responses. ``from_dict()`` decodes nested 17 objects, string-backed enums, and timezone-aware ISO-8601 timestamps; 18 ``to_dict()`` returns the corresponding JSON-compatible wire shape. 19 Fields not returned by the API remain absent and can still be queried 20 through mapping-style access. 21 22 API contract schema: ``BalanceTransactionPage``. 23 """ 24 number: int = field(init=False) 25 """Human-readable number assigned to the page. Required. Python type: ``int``; wire name: ``number``; JSON type: integer""" 26 size: int = field(init=False) 27 """Numeric size used by this operation. Required. Python type: ``int``; wire name: ``size``; JSON type: integer. Constraints: minimum 0""" 28 transactions: list[BalanceTransaction] | None = field(init=False) 29 """Newest transactions first. Omitted when the page is empty. Optional; nullable. Python type: ``list[BalanceTransaction] | None``; wire name: ``transactions``; JSON type: array of object (BalanceTransaction) values"""
One page of page resources.
Instances are immutable API responses. from_dict() decodes nested
objects, string-backed enums, and timezone-aware ISO-8601 timestamps;
to_dict() returns the corresponding JSON-compatible wire shape.
Fields not returned by the API remain absent and can still be queried
through mapping-style access.
API contract schema: BalanceTransactionPage.
Human-readable number assigned to the page. Required. Python type: int; wire name: number; JSON type: integer
Numeric size used by this operation. Required. Python type: int; wire name: size; JSON type: integer. Constraints: minimum 0
Newest transactions first. Omitted when the page is empty. Optional; nullable. Python type: list[BalanceTransaction] | None; wire name: transactions; JSON type: array of object (BalanceTransaction) values
12@dataclass(frozen=True, slots=True, kw_only=True) 13class PageRequest(ApiRequest): 14 """Parameters accepted by the page request operation. 15 16 This is an immutable, keyword-only request object. ``to_dict()`` uses 17 the documented wire names, omits fields left as ``UNSET``, serializes 18 string-backed enums by value, and requires timezone-aware datetimes. 19 20 API contract schema: ``PageBalanceTransactionsRequest``. 21 """ 22 page_number: int 23 """The page number associated with this page request. Required. Python type: ``int``; wire name: ``page_number``; JSON type: integer. Constraints: minimum 1; maximum 10""" 24 page_size: int 25 """The page size associated with this page request. Required. Python type: ``int``; wire name: ``page_size``; JSON type: integer. Constraints: minimum 1; maximum 256"""
Parameters accepted by the page request operation.
This is an immutable, keyword-only request object. to_dict() uses
the documented wire names, omits fields left as UNSET, serializes
string-backed enums by value, and requires timezone-aware datetimes.
API contract schema: PageBalanceTransactionsRequest.
The page number associated with this page request. Required. Python type: int; wire name: page_number; JSON type: integer. Constraints: minimum 1; maximum 10
The page size associated with this page request. Required. Python type: int; wire name: page_size; JSON type: integer. Constraints: minimum 1; maximum 256
12@dataclass(frozen=True, slots=True, init=False, repr=False, eq=False) 13class PageResponse(ApiModel): 14 """Typed response returned by the page operation. 15 16 Instances are immutable API responses. ``from_dict()`` decodes nested 17 objects, string-backed enums, and timezone-aware ISO-8601 timestamps; 18 ``to_dict()`` returns the corresponding JSON-compatible wire shape. 19 Fields not returned by the API remain absent and can still be queried 20 through mapping-style access. 21 22 API contract schema: ``BalanceTransactionPageResponse``. 23 """ 24 page: BalanceTransactionPage = field(init=False) 25 """Numeric page used by this operation. Required. Python type: ``BalanceTransactionPage``; wire name: ``page``; JSON type: object"""
Typed response returned by the page operation.
Instances are immutable API responses. from_dict() decodes nested
objects, string-backed enums, and timezone-aware ISO-8601 timestamps;
to_dict() returns the corresponding JSON-compatible wire shape.
Fields not returned by the API remain absent and can still be queried
through mapping-style access.
API contract schema: BalanceTransactionPageResponse.
12@dataclass(frozen=True, slots=True, init=False, repr=False, eq=False) 13class Response(ApiModel): 14 """Typed response returned by the response operation. 15 16 Instances are immutable API responses. ``from_dict()`` decodes nested 17 objects, string-backed enums, and timezone-aware ISO-8601 timestamps; 18 ``to_dict()`` returns the corresponding JSON-compatible wire shape. 19 Fields not returned by the API remain absent and can still be queried 20 through mapping-style access. 21 22 API contract schema: ``BalanceTransactionResponse``. 23 """ 24 transaction: BalanceTransaction = field(init=False) 25 """Merchant balance entry caused by a payment or refund. `type` describes the semantic source, not direction. A payment transaction contains `payment_id`; a refund transaction contains `refund_id`. Exactly one matching reference is present. Required. Python type: ``BalanceTransaction``; wire name: ``transaction``; JSON type: object (BalanceTransaction)"""
Typed response returned by the response operation.
Instances are immutable API responses. from_dict() decodes nested
objects, string-backed enums, and timezone-aware ISO-8601 timestamps;
to_dict() returns the corresponding JSON-compatible wire shape.
Fields not returned by the API remain absent and can still be queried
through mapping-style access.
API contract schema: BalanceTransactionResponse.
Merchant balance entry caused by a payment or refund. type describes the semantic source, not direction. A payment transaction contains payment_id; a refund transaction contains refund_id. Exactly one matching reference is present. Required. Python type: BalanceTransaction; wire name: transaction; JSON type: object (BalanceTransaction)
11class Type(WireEnum): 12 """Semantic source or cause of the transaction, not its direction. 13 14 Members are strings as well as enum values, so they compare naturally 15 with API payloads and serialize to the lowercase wire value shown below. 16 17 API contract schema: ``BalanceTransactionType``. 18 """ 19 PAYMENT = "payment" 20 """Wire value ``payment`` (payment) for semantic source or cause of the transaction, not its direction""" 21 REFUND = "refund" 22 """Wire value ``refund`` (refund) for semantic source or cause of the transaction, not its direction""" 23 PAYOUT = "payout" 24 """Wire value ``payout`` for an immutable successful-payout debit"""
Semantic source or cause of the transaction, not its direction.
Members are strings as well as enum values, so they compare naturally with API payloads and serialize to the lowercase wire value shown below.
API contract schema: BalanceTransactionType.
Wire value payment (payment) for semantic source or cause of the transaction, not its direction
Wire value refund (refund) for semantic source or cause of the transaction, not its direction