RAPTOR v18.4: Исправлена отчетность, активированы выходные
This commit is contained in:
40
invest-python-master/examples/users/pay_in.py
Normal file
40
invest-python-master/examples/users/pay_in.py
Normal file
@@ -0,0 +1,40 @@
|
||||
import os
|
||||
|
||||
from _decimal import Decimal
|
||||
|
||||
from t_tech.invest import AccountType, Client
|
||||
from t_tech.invest.schemas import PayInRequest
|
||||
from t_tech.invest.utils import decimal_to_money
|
||||
|
||||
|
||||
def main():
|
||||
token = os.environ["INVEST_TOKEN"]
|
||||
|
||||
with Client(token) as client:
|
||||
accounts = [
|
||||
i
|
||||
for i in client.users.get_accounts().accounts
|
||||
if i.type == AccountType.ACCOUNT_TYPE_TINKOFF
|
||||
]
|
||||
|
||||
bank_accounts = client.users.get_bank_accounts().bank_accounts
|
||||
|
||||
if len(accounts) < 1 or len(bank_accounts) < 1:
|
||||
print("Недостаточно счетов для демонстрации")
|
||||
return
|
||||
|
||||
from_account_id = bank_accounts[0].id
|
||||
to_account_id = accounts[0].id
|
||||
|
||||
client.users.pay_in(
|
||||
PayInRequest(
|
||||
from_account_id=from_account_id,
|
||||
to_account_id=to_account_id,
|
||||
amount=decimal_to_money(Decimal(1), "rub"),
|
||||
)
|
||||
)
|
||||
print("Пополнение выполнено")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user