-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexamples.py
More file actions
81 lines (58 loc) · 2.13 KB
/
examples.py
File metadata and controls
81 lines (58 loc) · 2.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
import asyncio
from dataclasses import fields
from aioyoomoney import *
def get_token(client_id: str, redirect_uri: str, client_secret: str):
token = authorize(
client_id=client_id,
redirect_uri=redirect_uri,
client_secret=client_secret,
scope=[
"account-info",
"operation-history",
"operation-details",
"incoming-transfers",
"payment-p2p",
]
)
print(token)
return token
async def get_operation_history(token: str):
client = Client(token)
history = await client.operation_history()
print("Next record:", history.next_record)
for operation in history.operations:
for field in fields(operation):
if field.name != "kwargs":
print(field.name, '->', operation[field.name])
for key, value in operation.kwargs.items():
print(key, '->', value)
print("================================")
async def get_operation_details(token: str):
client = Client(token)
history = await client.operation_history()
for operation in history.operations:
operation = await client.operation_details(operation.operation_id)
for field in fields(operation):
if field.name != "kwargs":
print(field.name, '->', operation[field.name])
for key, value in operation.kwargs.items():
print(key, '->', value)
print("================================")
async def client_info(token: str):
client = Client(token)
account = await client.account_info()
print(f"Account: {account.id}")
print(f"Balance: {account.balance}")
print(f"Currency: {account.currency}")
print(f"Account Status: {account.account_status}")
print(f"Account Type: {account.account_type}")
print(f"Balance Details: {account.balance_details}")
print(f"Cards Linked: {account.cards_linked}")
async def quickpay(receiver: str, sum: int, label: str = None):
async with Quickpay(
receiver=receiver,
sum=sum,
label=label
) as quickpay:
print(quickpay.url)
# asyncio.run(quickpay())