Депозиты (tbank.deposit)

Депозитные счета компании: карточка депозита (баланс, ставка, условия, автопролонгация), открытие нового депозита и пополнение.

  • Хост: secured-openapi.tbank.ru, требуется mTLS-сертификат (cert).

  • Суммы: Decimal в валюте депозита. Провод: camelCase.

  • Клиенты: tbank.deposit.DepositClient (async) и tbank.deposit.sync.DepositClient (sync).

from decimal import Decimal
from tbank.deposit import DepositClient
from tbank.deposit.models import OpenDepositRequest, ReplenishDepositRequest
from tbank.deposit.enums import Capitalisation, Currency, PayFrequency

client = DepositClient(
    token="business-token",
    cert=("client.pem", "client-key.pem"),
)

# карточка депозита
details = await client.get_deposit_details("D-АГ-123")
print(details.balance.amount, details.account_info.rate)
print(details.account_info.replenish.is_accessible)

# открыть депозит
opened = await client.open_deposit(OpenDepositRequest(
    term=181,
    capitalisation=Capitalisation.DEPOSIT,
    currency=Currency.RUB,
    is_replenish_available=True,
    is_withdraw_available=False,
    pay_frequency=PayFrequency.MATURITY,
))
print(opened.open_id, opened.application_id)

# пополнить депозит с расчётного счёта
await client.replenish_deposit(ReplenishDepositRequest(
    deposit_agreement="D-АГ-123",
    source_agreement="40702810000000000000",
    amount=Decimal("50000"),
))

Клиент

class tbank.deposit.aio.DepositClient(token, *, base_url=None, sandbox=False, cert=None, verify=True, retry=None, transport=None)[исходный код]

Базовые классы: BaseAsyncClient

Асинхронный клиент депозитов: карточка счёта, открытие и пополнение.

Домен работает на secured-хосте и требует mTLS-сертификата (cert). Суммы — Decimal в валюте депозита. Провод — camelCase.

Параметры:
decimal_body: ClassVar[bool] = True

True → тело парсится с parse_float=Decimal (точные денежные суммы).

async get_deposit_details(agreement_number)[исходный код]

Карточка депозита: баланс, договор, ставка, условия.

Параметры:

agreement_number (str)

Тип результата:

DepositAccountDetails

async open_deposit(request)[исходный код]

Открыть депозит. Возвращает идентификаторы процесса и заявки.

Параметры:

request (OpenDepositRequest)

Тип результата:

OpenDepositResult

async replenish_deposit(request)[исходный код]

Пополнить депозит с указанного счёта-источника.

Параметры:

request (ReplenishDepositRequest)

Тип результата:

None

Модели

class tbank.deposit.models.DepositModel[исходный код]

Базовые классы: BaseModel

Базовая модель домена: snake_case в Python, camelCase на проводе.

model_config = {'alias_generator': <function to_camel>, 'extra': 'ignore', 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class tbank.deposit.models.DepositBalance(*, amount, currencyCode, paidAmount, lockedAmount, fineAmount=None)[исходный код]

Базовые классы: DepositModel

Параметры:
model_config = {'alias_generator': <function to_camel>, 'extra': 'ignore', 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class tbank.deposit.models.AutoProlongation(*, status)[исходный код]

Базовые классы: DepositModel

Параметры:

status (AutoProlongationStatus)

model_config = {'alias_generator': <function to_camel>, 'extra': 'ignore', 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class tbank.deposit.models.DepositAgreementInfo(*, agreementNumber, interestAgreementNumber, autoProlongation, attachedAgreementNumber=None, activationDate=None, endingDate=None, closingDate=None, prolongationDate=None)[исходный код]

Базовые классы: DepositModel

Параметры:
  • agreementNumber (str)

  • interestAgreementNumber (str)

  • autoProlongation (AutoProlongation)

  • attachedAgreementNumber (str | None)

  • activationDate (date | None)

  • endingDate (date | None)

  • closingDate (date | None)

  • prolongationDate (date | None)

model_config = {'alias_generator': <function to_camel>, 'extra': 'ignore', 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class tbank.deposit.models.CapitalisationInfo(*, type)[исходный код]

Базовые классы: DepositModel

Параметры:

type (Capitalisation)

model_config = {'alias_generator': <function to_camel>, 'extra': 'ignore', 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class tbank.deposit.models.WithdrawInfo(*, isAccessible, minSum=None)[исходный код]

Базовые классы: DepositModel

Параметры:
model_config = {'alias_generator': <function to_camel>, 'extra': 'ignore', 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class tbank.deposit.models.ReplenishInfo(*, isAccessible)[исходный код]

Базовые классы: DepositModel

Параметры:

isAccessible (bool)

model_config = {'alias_generator': <function to_camel>, 'extra': 'ignore', 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class tbank.deposit.models.DepositAccountInfo(*, accountNumber, status, rate, capitalisation, minAmount, maxCurrent, maxAmount, withdraw, replenish, payFrequency, openDate=None, name=None)[исходный код]

Базовые классы: DepositModel

Параметры:
model_config = {'alias_generator': <function to_camel>, 'extra': 'ignore', 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class tbank.deposit.models.DepositAccountDetails(*, product, period, balance, agreementInfo, accountInfo)[исходный код]

Базовые классы: DepositModel

Полная карточка депозита.

Параметры:
model_config = {'alias_generator': <function to_camel>, 'extra': 'ignore', 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class tbank.deposit.models.OpenDepositRequest(*, term, capitalisation, currency, isReplenishAvailable, isWithdrawAvailable, payFrequency, linkedAccount=None)[исходный код]

Базовые классы: DepositModel

Параметры:
model_config = {'alias_generator': <function to_camel>, 'extra': 'ignore', 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class tbank.deposit.models.OpenDepositResult(*, openId, applicationId)[исходный код]

Базовые классы: DepositModel

Параметры:
  • openId (str)

  • applicationId (str)

model_config = {'alias_generator': <function to_camel>, 'extra': 'ignore', 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class tbank.deposit.models.ReplenishDepositRequest(*, depositAgreement, sourceAgreement, amount)[исходный код]

Базовые классы: DepositModel

Параметры:
  • depositAgreement (str)

  • sourceAgreement (str)

  • amount (Annotated[Decimal, PlainSerializer(func=~tbank.deposit.models.<lambda>, return_type=float, when_used=json)])

model_config = {'alias_generator': <function to_camel>, 'extra': 'ignore', 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

Перечисления

class tbank.deposit.enums.Currency(*values)[исходный код]

Базовые классы: str, Enum

Валюта депозита.

RUB = 'RUB'
RUR = 'RUR'
USD = 'USD'
EUR = 'EUR'
GBP = 'GBP'
CNY = 'CNY'
class tbank.deposit.enums.Capitalisation(*values)[исходный код]

Базовые классы: str, Enum

Признак капитализации процентов.

DEPOSIT = 'DEPOSIT'
ACCOUNT = 'ACCOUNT'
class tbank.deposit.enums.PayFrequency(*values)[исходный код]

Базовые классы: str, Enum

Периодичность выплаты процентов.

NORMAL = 'NORMAL'
MATURITY = 'MATURITY'
class tbank.deposit.enums.AutoProlongationStatus(*values)[исходный код]

Базовые классы: str, Enum

Статус автопролонгации депозита.

INACTIVE = 'INACTIVE'
ACTIVE = 'ACTIVE'
INACCESSIBLE = 'INACCESSIBLE'
class tbank.deposit.enums.DepositAccountStatus(*values)[исходный код]

Базовые классы: str, Enum

Статус депозитного счёта.

OPENED = 'OPENED'
CLOSED = 'CLOSED'
INACTIVE = 'INACTIVE'