xync-client 0.0.137__py3-none-any.whl → 0.0.139__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of xync-client might be problematic. Click here for more details.
- xync_client/Abc/PmAgent.py +5 -7
- xync_client/Bybit/InAgent.py +4 -4
- xync_client/Bybit/agent.py +89 -7
- xync_client/Pms/Payeer/__init__.py +21 -6
- xync_client/Pms/Volet/__init__.py +60 -7
- xync_client/Pms/Volet/api.py +16 -13
- {xync_client-0.0.137.dist-info → xync_client-0.0.139.dist-info}/METADATA +1 -1
- {xync_client-0.0.137.dist-info → xync_client-0.0.139.dist-info}/RECORD +10 -10
- {xync_client-0.0.137.dist-info → xync_client-0.0.139.dist-info}/WHEEL +0 -0
- {xync_client-0.0.137.dist-info → xync_client-0.0.139.dist-info}/top_level.txt +0 -0
xync_client/Abc/PmAgent.py
CHANGED
|
@@ -39,11 +39,6 @@ class PmAgentClient(metaclass=ABCMeta):
|
|
|
39
39
|
self.bot = FileClient(TOKEN)
|
|
40
40
|
await self.bot.start()
|
|
41
41
|
|
|
42
|
-
self.agent = await PmAgent.get_or_none(**dct).prefetch_related("user__username__session")
|
|
43
|
-
if not self.agent:
|
|
44
|
-
await self.bot.send(f"No active users with agent for {self.norm}!", self.uid)
|
|
45
|
-
raise Exception(f"No active users for {self.norm}!")
|
|
46
|
-
|
|
47
42
|
self.browser = await pw.chromium.launch(channel="chromium-headless-shell", headless=not headed)
|
|
48
43
|
context = await self.browser.new_context(storage_state=self.agent.state)
|
|
49
44
|
self.page = await context.new_page()
|
|
@@ -59,6 +54,8 @@ class PmAgentClient(metaclass=ABCMeta):
|
|
|
59
54
|
self._is_started = True
|
|
60
55
|
return self
|
|
61
56
|
|
|
57
|
+
def get_topup(self, tid: str) -> dict: ...
|
|
58
|
+
|
|
62
59
|
async def _idle(self): # todo: не мешать другим процессам, обновлять на другой вкладке?
|
|
63
60
|
while (await User.get(username_id=self.uid)).status >= UserStatus.ACTIVE:
|
|
64
61
|
await self.page.wait_for_timeout(30 * 1000)
|
|
@@ -90,5 +87,6 @@ class PmAgentClient(metaclass=ABCMeta):
|
|
|
90
87
|
@abstractmethod # видео входа в аккаунт, и переход в историю поступлений за последние сутки (минимум)
|
|
91
88
|
async def proof(self) -> bytes: ...
|
|
92
89
|
|
|
93
|
-
def __init__(self,
|
|
94
|
-
self.
|
|
90
|
+
def __init__(self, agent: PmAgent):
|
|
91
|
+
self.agent = agent
|
|
92
|
+
self.uid = agent.user.username_id
|
xync_client/Bybit/InAgent.py
CHANGED
|
@@ -98,7 +98,7 @@ class InAgentClient(BaseInAgentClient):
|
|
|
98
98
|
await self.money_upd(order_db)
|
|
99
99
|
if upd.side: # я покупатель - ждем мою оплату
|
|
100
100
|
dest = order.paymentTermList[0].accountNo
|
|
101
|
-
if not re.match(r"^([Pp])\d{
|
|
101
|
+
if not re.match(r"^([PpРр])\d{7,10}\b", dest):
|
|
102
102
|
continue
|
|
103
103
|
await order_db.fetch_related("ad__pair_side__pair", "cred__pmcur__cur")
|
|
104
104
|
await self.send_payment(order_db, dest)
|
|
@@ -234,7 +234,7 @@ class InAgentClient(BaseInAgentClient):
|
|
|
234
234
|
).prefetch_related("ad__pair_side__pair", "cred__pmcur__cur"):
|
|
235
235
|
im_taker = order_db.taker_id == self.agent_client.actor.id
|
|
236
236
|
im_buyer = order_db.ad.pair_side.is_sell == im_taker
|
|
237
|
-
if order_db.ad.auto_msg != upd.message and upd.roleType
|
|
237
|
+
if order_db.ad.auto_msg != upd.message and upd.roleType == "user":
|
|
238
238
|
msg, _ = await models.Msg.update_or_create(
|
|
239
239
|
{
|
|
240
240
|
"to_maker": upd.userId == self.agent_client.actor.exid and im_taker,
|
|
@@ -245,8 +245,8 @@ class InAgentClient(BaseInAgentClient):
|
|
|
245
245
|
)
|
|
246
246
|
if not upd.message:
|
|
247
247
|
...
|
|
248
|
-
if im_buyer and re.match(r"^
|
|
249
|
-
await self.send_payment(order_db,
|
|
248
|
+
if im_buyer and (g := re.match(r"^[PpРр]\d{7,10}\b", upd.message)):
|
|
249
|
+
await self.send_payment(order_db, g.group())
|
|
250
250
|
case "READ":
|
|
251
251
|
upd = Read.model_validate(data["data"])
|
|
252
252
|
# if upd.status not in (StatusWs.created, StatusWs.canceled, 10, StatusWs.completed):
|
xync_client/Bybit/agent.py
CHANGED
|
@@ -7,12 +7,14 @@ from datetime import datetime, timedelta, timezone
|
|
|
7
7
|
from difflib import SequenceMatcher
|
|
8
8
|
from enum import IntEnum
|
|
9
9
|
from http.client import HTTPException
|
|
10
|
+
from math import floor
|
|
10
11
|
from typing import Literal
|
|
11
12
|
|
|
12
13
|
import pyotp
|
|
13
14
|
from asyncpg import ConnectionDoesNotExistError
|
|
14
15
|
from bybit_p2p import P2P
|
|
15
16
|
from bybit_p2p._exceptions import FailedRequestError
|
|
17
|
+
from payeer_api import PayeerAPI
|
|
16
18
|
from pyro_client.client.file import FileClient
|
|
17
19
|
from tortoise import BaseDBAsyncClient
|
|
18
20
|
from tortoise.exceptions import IntegrityError
|
|
@@ -88,6 +90,8 @@ class AgentClient(BaseAgentClient): # Bybit client
|
|
|
88
90
|
def __init__(self, actor: Actor, bot: FileClient, **kwargs):
|
|
89
91
|
super().__init__(actor, bot, **kwargs)
|
|
90
92
|
self.api = P2P(testnet=False, api_key=actor.agent.auth["key"], api_secret=actor.agent.auth["sec"])
|
|
93
|
+
self.hist: dict = None
|
|
94
|
+
self.completed_orders: list[int] = None
|
|
91
95
|
|
|
92
96
|
""" Private METHs"""
|
|
93
97
|
|
|
@@ -448,9 +452,28 @@ class AgentClient(BaseAgentClient): # Bybit client
|
|
|
448
452
|
if not ad_db:
|
|
449
453
|
...
|
|
450
454
|
ecredex: CredEpyd = order.confirmedPayTerm
|
|
455
|
+
|
|
451
456
|
if ecredex.paymentType == 0 and im_maker and order.side:
|
|
452
457
|
ecredex = order.paymentTermList[0]
|
|
453
458
|
if ecredex.paymentType:
|
|
459
|
+
if ecredex.paymentType == 51:
|
|
460
|
+
ecredex.accountNo = ecredex.accountNo.replace("p", "P").replace("р", "P").replace("Р", "P")
|
|
461
|
+
if not re.match(r"^([Pp])\d{7,10}$", ecredex.accountNo):
|
|
462
|
+
msgs = self.api.get_chat_messages(orderId=order.id, size=100)["result"]["result"]
|
|
463
|
+
msgs = [m["message"] for m in msgs if m["roleType"] == "user" and m["userId"] == order.targetUserId]
|
|
464
|
+
msgs = [g.group() for m in msgs if (g := re.match(r"([PpРр])\d{7,10}\b", m))]
|
|
465
|
+
crd = await models.Cred.get_or_none(
|
|
466
|
+
detail=ecredex.accountNo, credexs__exid=ecredex.id, credexs__ex=self.ex_client.ex
|
|
467
|
+
)
|
|
468
|
+
if not msgs and re.match(r"^\d{7,10}$", ecredex.accountNo):
|
|
469
|
+
ecredex.accountNo = "P" + ecredex.accountNo
|
|
470
|
+
elif msgs:
|
|
471
|
+
ecredex.accountNo = msgs[-1]
|
|
472
|
+
else:
|
|
473
|
+
...
|
|
474
|
+
if crd:
|
|
475
|
+
crd.detail = ecredex.accountNo
|
|
476
|
+
await crd.save(update_fields=["detail"])
|
|
454
477
|
if not (credex := await models.CredEx.get_or_none(exid=ecredex.id, ex=self.ex_client.ex)):
|
|
455
478
|
# cur_id = await Cur.get(ticker=ad.currencyId).values_list('id', flat=True)
|
|
456
479
|
# await self.cred_epyd2db(ecredex, ad_db.maker.person_id, cur_id)
|
|
@@ -504,16 +527,55 @@ class AgentClient(BaseAgentClient): # Bybit client
|
|
|
504
527
|
"amount": float(order.amount) * 10**cur_scale,
|
|
505
528
|
"quantity": float(order.quantity) * 10**coin_scale,
|
|
506
529
|
"status": OrderStatus[Status(order.status).name],
|
|
507
|
-
"created_at":
|
|
508
|
-
"payed_at": order.transferDate != "0" and
|
|
509
|
-
"confirmed_at": Status(order.status) == Status.completed and
|
|
510
|
-
"appealed_at": order.status == 30 and
|
|
530
|
+
"created_at": ms2utc(order.createDate),
|
|
531
|
+
"payed_at": order.transferDate != "0" and ms2utc(order.transferDate) or None,
|
|
532
|
+
"confirmed_at": Status(order.status) == Status.completed and ms2utc(order.transferDate) or None,
|
|
533
|
+
"appealed_at": order.status == 30 and ms2utc(order.transferDate) or None,
|
|
511
534
|
"cred_id": ecredex.paymentType and credex.cred_id or None,
|
|
512
535
|
"taker": taker,
|
|
513
536
|
"ad": ad_db,
|
|
514
537
|
},
|
|
515
538
|
exid=order.id,
|
|
516
539
|
)
|
|
540
|
+
if order.status == Status.completed and ecredex.paymentType == 51:
|
|
541
|
+
await odb.fetch_related("cred", "transfer")
|
|
542
|
+
if odb.cred.detail != ecredex.accountNo:
|
|
543
|
+
...
|
|
544
|
+
frm = (odb.created_at + timedelta(minutes=180 - 1)).isoformat(sep=" ").split("+")[0]
|
|
545
|
+
to = ((odb.payed_at or odb.created_at) + timedelta(minutes=180 + 30)).isoformat(sep=" ").split("+")[0]
|
|
546
|
+
tsa = [
|
|
547
|
+
t
|
|
548
|
+
for tid, t in self.hist.items()
|
|
549
|
+
if (ecredex.accountNo == t["to"] and t["from"] != "@merchant" and frm < t["date"] < to)
|
|
550
|
+
]
|
|
551
|
+
buyer_person = (
|
|
552
|
+
self.actor.person
|
|
553
|
+
if not order.side
|
|
554
|
+
else await self.person_upsert(order.buyerRealName, int(order.targetUserId))
|
|
555
|
+
)
|
|
556
|
+
ts = [t for t in tsa if floor(fa := float(order.amount)) <= float(t["creditedAmount"]) <= round(fa)]
|
|
557
|
+
if len(ts) != 1:
|
|
558
|
+
if len(tsa) > 1:
|
|
559
|
+
summ = sum(float(t["creditedAmount"]) for t in tsa)
|
|
560
|
+
if floor(fa) <= summ <= round(fa):
|
|
561
|
+
for tr in tsa:
|
|
562
|
+
am = int(float(tr["creditedAmount"]) * 100)
|
|
563
|
+
await models.Transfer.create(
|
|
564
|
+
pmid=tr["id"], order=odb, amount=am, sender_acc=tr["from"], created_at=tr["date"]
|
|
565
|
+
)
|
|
566
|
+
else:
|
|
567
|
+
bcred, _ = await models.Cred.get_or_create(
|
|
568
|
+
{"detail": ts[0]["from"]}, person=buyer_person, pmcur_id=odb.cred.pmcur_id
|
|
569
|
+
)
|
|
570
|
+
am = int(float(ts[0]["creditedAmount"]) * 100)
|
|
571
|
+
try:
|
|
572
|
+
await models.Transfer.create(
|
|
573
|
+
pmid=ts[0]["id"], order=odb, amount=am, sender_acc=ts[0]["from"], created_at=ts[0]["date"]
|
|
574
|
+
)
|
|
575
|
+
except IntegrityError as e:
|
|
576
|
+
logging.error(e)
|
|
577
|
+
...
|
|
578
|
+
|
|
517
579
|
await odb.fetch_related("ad")
|
|
518
580
|
return odb
|
|
519
581
|
|
|
@@ -531,8 +593,8 @@ class AgentClient(BaseAgentClient): # Bybit client
|
|
|
531
593
|
page=page,
|
|
532
594
|
# status=status, # 50 - завершено
|
|
533
595
|
# tokenId=token_id,
|
|
534
|
-
beginTime=begin_time,
|
|
535
|
-
endTime=end_time,
|
|
596
|
+
# beginTime=begin_time,
|
|
597
|
+
# endTime=end_time,
|
|
536
598
|
# side=side, # 1 - продажа, 0 - покупка
|
|
537
599
|
size=30,
|
|
538
600
|
)
|
|
@@ -542,6 +604,8 @@ class AgentClient(BaseAgentClient): # Bybit client
|
|
|
542
604
|
await self.get_api_orders(page, begin_time, end_time) # , status, side, token_id)
|
|
543
605
|
ords = {int(o["id"]): OrderItem.model_validate(o) for o in lst["result"]["items"]}
|
|
544
606
|
for oid, o in ords.items():
|
|
607
|
+
if o.status != Status.completed.value or oid in self.completed_orders:
|
|
608
|
+
continue
|
|
545
609
|
fo = self.api.get_order_details(orderId=o.id)
|
|
546
610
|
order = OrderFull.model_validate(fo["result"])
|
|
547
611
|
order_db = await self.create_order(order)
|
|
@@ -565,6 +629,10 @@ class AgentClient(BaseAgentClient): # Bybit client
|
|
|
565
629
|
if len(ords) == 30:
|
|
566
630
|
await self.get_api_orders(page + 1, begin_time, end_time, status, side, token_id)
|
|
567
631
|
|
|
632
|
+
# async def order_stat(self, papi: PayeerAPI):
|
|
633
|
+
# for t in papi.history():
|
|
634
|
+
# os = self.api.get_orders(page=1, size=30)
|
|
635
|
+
|
|
568
636
|
async def mad_upd(self, mad: Ad, attrs: dict, cxids: list[str]):
|
|
569
637
|
if not [setattr(mad, k, v) for k, v in attrs.items() if getattr(mad, k) != v]:
|
|
570
638
|
print(end="v" if mad.side else "^", flush=True)
|
|
@@ -1117,6 +1185,10 @@ class AgentClient(BaseAgentClient): # Bybit client
|
|
|
1117
1185
|
self.tree = tree
|
|
1118
1186
|
|
|
1119
1187
|
|
|
1188
|
+
def ms2utc(msk_ts_str: str):
|
|
1189
|
+
return datetime.fromtimestamp(int(msk_ts_str) / 1000, timezone(timedelta(hours=3), name="MSK"))
|
|
1190
|
+
|
|
1191
|
+
|
|
1120
1192
|
def get_sim(s1, s2) -> int:
|
|
1121
1193
|
sim = int((SequenceMatcher(None, s1, s2).ratio() - 0.6) * 10_000)
|
|
1122
1194
|
return sim if sim > 0 else 0
|
|
@@ -1236,7 +1308,17 @@ async def main():
|
|
|
1236
1308
|
if ct := set(cl.tree.keys()) & a:
|
|
1237
1309
|
logging.exception(f"cycle cids: {ct}")
|
|
1238
1310
|
|
|
1239
|
-
|
|
1311
|
+
pauth = (await models.PmAgent[1]).auth
|
|
1312
|
+
papi = PayeerAPI(pauth["email"], pauth["api_id"], pauth["api_sec"])
|
|
1313
|
+
hist: dict = papi.history(count=1000)
|
|
1314
|
+
hist |= papi.history(count=1000, append=list(hist.keys())[-1])
|
|
1315
|
+
hist |= papi.history(count=1000, append=list(hist.keys())[-1])
|
|
1316
|
+
cl.hist = hist
|
|
1317
|
+
|
|
1318
|
+
cl.completed_orders = await models.Order.filter(status=OrderStatus.completed, transfer__isnull=False).values_list(
|
|
1319
|
+
"exid", flat=True
|
|
1320
|
+
)
|
|
1321
|
+
await cl.get_api_orders() # 43, 1741294800000, 1749157199999)
|
|
1240
1322
|
|
|
1241
1323
|
races = await models.Race.filter(started=True).prefetch_related(
|
|
1242
1324
|
"road__ad__pair_side__pair__cur",
|
|
@@ -19,7 +19,7 @@ from cryptography.hazmat.primitives.ciphers.modes import CBC
|
|
|
19
19
|
from payeer_api import PayeerAPI
|
|
20
20
|
from playwright.async_api import async_playwright, Playwright, Error
|
|
21
21
|
from playwright._impl._errors import TimeoutError
|
|
22
|
-
from xync_schema.models import TopUp, TopUpAble
|
|
22
|
+
from xync_schema.models import TopUp, TopUpAble, PmAgent
|
|
23
23
|
|
|
24
24
|
from xync_client.loader import TORM
|
|
25
25
|
|
|
@@ -65,11 +65,10 @@ class Client(PmAgentClient):
|
|
|
65
65
|
pages: type(StrEnum) = Pages
|
|
66
66
|
api: PayeerAPI
|
|
67
67
|
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
def __init__(self, agent: PmAgent):
|
|
69
|
+
super().__init__(agent)
|
|
70
70
|
if api_id := self.agent.auth.get("api_id"):
|
|
71
71
|
self.api = PayeerAPI(self.agent.auth["email"], api_id, self.agent.auth["api_sec"])
|
|
72
|
-
return self
|
|
73
72
|
|
|
74
73
|
async def _login(self):
|
|
75
74
|
await login(self.agent)
|
|
@@ -81,7 +80,7 @@ class Client(PmAgentClient):
|
|
|
81
80
|
def form_redirect(topup: TopUp) -> tuple[str, dict | None]:
|
|
82
81
|
m_shop = str(topup.topupable.auth["id"])
|
|
83
82
|
m_orderid = str(topup.id)
|
|
84
|
-
m_amount =
|
|
83
|
+
m_amount = "{0:.2f}".format(topup.amount * 0.01)
|
|
85
84
|
m_curr = topup.cur.ticker
|
|
86
85
|
m_desc = b64encode(b"XyncPay top up").decode()
|
|
87
86
|
m_key = topup.topupable.auth["sec"]
|
|
@@ -121,6 +120,17 @@ class Client(PmAgentClient):
|
|
|
121
120
|
url = "https://payeer.com/merchant/?" + urlencode(params)
|
|
122
121
|
return url, None
|
|
123
122
|
|
|
123
|
+
def get_topup(self, tid: str) -> dict:
|
|
124
|
+
hi = self.api.get_history_info(tid)
|
|
125
|
+
ti = self.api.shop_order_info(hi["params"]["SHOP_ID"], hi["params"]["ORDER_ID"])["info"]
|
|
126
|
+
return ti["status"] == "execute" and {
|
|
127
|
+
"pmid": ti["id"],
|
|
128
|
+
"from_acc": hi["params"]["ACCOUNT_NUMBER"],
|
|
129
|
+
"oid": hi["params"]["ORDER_ID"],
|
|
130
|
+
"amount": int(float(ti["sumOut"]) * 100),
|
|
131
|
+
"ts": datetime.strptime(ti["dateCreate"], "%d.%m.%Y %H:%M:%S") - timedelta(hours=3),
|
|
132
|
+
}
|
|
133
|
+
|
|
124
134
|
async def send(self, dest: str, amount: int, cur: str) -> tuple[int, bytes, int] | int:
|
|
125
135
|
self.last_active = datetime.now()
|
|
126
136
|
page = self.page
|
|
@@ -204,8 +214,13 @@ async def main(uid: int):
|
|
|
204
214
|
from x_model import init_db
|
|
205
215
|
|
|
206
216
|
_ = await init_db(TORM, True)
|
|
217
|
+
agent = await PmAgent.get_or_none(pm__norm="payeer", user__username_id=uid).prefetch_related(
|
|
218
|
+
"user__username__session", "pm"
|
|
219
|
+
)
|
|
220
|
+
if not agent:
|
|
221
|
+
raise Exception(f"No active user #{uid} with agent for volet!")
|
|
222
|
+
pyr = agent.client()
|
|
207
223
|
playwright: Playwright = await async_playwright().start()
|
|
208
|
-
pyr = Client(uid)
|
|
209
224
|
try:
|
|
210
225
|
dest, amount, cur = "P79619335", 4, "RUB"
|
|
211
226
|
ta = await TopUpAble.get(pm__norm="payeer")
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import logging
|
|
2
2
|
import re
|
|
3
3
|
from asyncio import run, ensure_future
|
|
4
|
+
from decimal import Decimal
|
|
4
5
|
from enum import StrEnum
|
|
6
|
+
from hashlib import sha256
|
|
5
7
|
from typing import Literal
|
|
6
8
|
|
|
7
9
|
from playwright.async_api import async_playwright, Page, Locator, Position, Playwright # , FloatRect
|
|
@@ -12,8 +14,9 @@ from playwright._impl._errors import TimeoutError
|
|
|
12
14
|
from pyro_client.client.bot import BotClient
|
|
13
15
|
from pyro_client.client.user import UserClient
|
|
14
16
|
from xync_schema.enums import UserStatus
|
|
15
|
-
from xync_schema.models import Cur, User, PmAgent, Cred, PmCur, Fiat
|
|
17
|
+
from xync_schema.models import Cur, User, PmAgent, Cred, PmCur, Fiat, TopUp
|
|
16
18
|
|
|
19
|
+
from xync_client.Abc.PmAgent import PmAgentClient
|
|
17
20
|
from xync_client.Gmail import GmClient
|
|
18
21
|
from xync_client.Pms.Volet.api import APIClient
|
|
19
22
|
from xync_client.loader import TOKEN
|
|
@@ -57,7 +60,16 @@ def parse_transaction_info(text: str) -> dict[str, str] | None:
|
|
|
57
60
|
return None
|
|
58
61
|
|
|
59
62
|
|
|
60
|
-
class Client:
|
|
63
|
+
class Client(PmAgentClient):
|
|
64
|
+
async def _login(self):
|
|
65
|
+
pass
|
|
66
|
+
|
|
67
|
+
async def check_in(self, amount: int | Decimal | float, cur: str, tid: str | int = None) -> float | None:
|
|
68
|
+
pass
|
|
69
|
+
|
|
70
|
+
async def proof(self) -> bytes:
|
|
71
|
+
pass
|
|
72
|
+
|
|
61
73
|
uid: int
|
|
62
74
|
agent: PmAgent
|
|
63
75
|
bot: UserClient
|
|
@@ -65,15 +77,50 @@ class Client:
|
|
|
65
77
|
page: Page
|
|
66
78
|
gmail: GmClient
|
|
67
79
|
|
|
68
|
-
def __init__(self,
|
|
69
|
-
|
|
70
|
-
self.gmail = GmClient(uid)
|
|
80
|
+
def __init__(self, agent: PmAgent):
|
|
81
|
+
super().__init__(agent)
|
|
82
|
+
self.gmail = GmClient(self.uid)
|
|
83
|
+
self.api = APIClient(self.agent.auth["api"], self.agent.auth["password"], self.agent.auth["login"])
|
|
84
|
+
|
|
85
|
+
@staticmethod
|
|
86
|
+
def form_redirect(topup: TopUp) -> tuple[str, dict | None]:
|
|
87
|
+
ac_account_email = topup.topupable.auth["ac_account_email"]
|
|
88
|
+
ac_sci_name = topup.topupable.auth["ac_sci_name"]
|
|
89
|
+
ac_order_id = str(topup.id)
|
|
90
|
+
ac_amount = "{0:.2f}".format(topup.amount * 0.01)
|
|
91
|
+
ac_currency = topup.cur.ticker
|
|
92
|
+
ac_comments = "XyncPay top up"
|
|
93
|
+
secret = topup.topupable.auth["secret"]
|
|
94
|
+
data = [ac_account_email, ac_sci_name, ac_amount, ac_currency, secret, ac_order_id]
|
|
95
|
+
|
|
96
|
+
ac_sign = sha256(":".join(data).encode()).hexdigest()
|
|
97
|
+
|
|
98
|
+
params = {
|
|
99
|
+
"ac_account_email": ac_account_email,
|
|
100
|
+
"ac_sci_name": ac_sci_name,
|
|
101
|
+
"ac_amount": ac_amount,
|
|
102
|
+
"ac_currency": ac_currency,
|
|
103
|
+
"ac_order_id": ac_order_id,
|
|
104
|
+
"ac_sign": ac_sign,
|
|
105
|
+
"ac_comments": ac_comments,
|
|
106
|
+
}
|
|
107
|
+
url = "https://account.volet.com/sci/"
|
|
108
|
+
return url, params
|
|
109
|
+
|
|
110
|
+
def get_topup(self, tid: str) -> dict:
|
|
111
|
+
t = self.api.check_by_id(tid)
|
|
112
|
+
return t["status"] == "COMPLETED" and {
|
|
113
|
+
"pmid": t["id"],
|
|
114
|
+
"from_acc": t["walletSrcId"],
|
|
115
|
+
"oid": t["orderId"],
|
|
116
|
+
"amount": int(t["amount"] * 100),
|
|
117
|
+
"ts": t["updatedTime"],
|
|
118
|
+
}
|
|
71
119
|
|
|
72
120
|
async def start(self, pw: Playwright, headed: bool = False):
|
|
73
121
|
self.agent = await PmAgent.get(
|
|
74
122
|
user__username_id=self.uid, user__status__gte=UserStatus.PAY, pm__norm="volet"
|
|
75
123
|
).prefetch_related("user__gmail", "user__username__session")
|
|
76
|
-
self.api = APIClient(self.agent.auth["api"], self.agent.auth["password"], self.agent.auth["login"])
|
|
77
124
|
# await self.upd_balances()
|
|
78
125
|
bot = await BotClient(TOKEN)
|
|
79
126
|
self.bot = await UserClient(self.uid, bot)
|
|
@@ -223,7 +270,13 @@ async def _test():
|
|
|
223
270
|
logging.basicConfig(level=logging.DEBUG)
|
|
224
271
|
uid = 193017646
|
|
225
272
|
playwright: Playwright = await async_playwright().start()
|
|
226
|
-
|
|
273
|
+
agent = await PmAgent.get_or_none(pm__norm="volet", user__username_id=uid).prefetch_related(
|
|
274
|
+
"user__username__session"
|
|
275
|
+
)
|
|
276
|
+
if not agent:
|
|
277
|
+
raise Exception(f"No active user #{uid} with agent for volet!")
|
|
278
|
+
|
|
279
|
+
va = agent.client()
|
|
227
280
|
try:
|
|
228
281
|
await va.start(playwright)
|
|
229
282
|
await va.send("alena.artemeva25@gmail.com", 7.98)
|
xync_client/Pms/Volet/api.py
CHANGED
|
@@ -9,6 +9,8 @@ from zeep.client import Client
|
|
|
9
9
|
|
|
10
10
|
from xync_client.loader import TORM
|
|
11
11
|
|
|
12
|
+
period = 5
|
|
13
|
+
|
|
12
14
|
|
|
13
15
|
class APIClient:
|
|
14
16
|
wsdl = "https://wallet.advcash.com/wsm/merchantWebService?wsdl"
|
|
@@ -83,25 +85,26 @@ class APIClient:
|
|
|
83
85
|
params.update(walletId=to)
|
|
84
86
|
return self.make_request("sendMoney", params)
|
|
85
87
|
|
|
88
|
+
async def check_by_amount(self, amount: decimal, cur: str = "RUB", timeout: int = 5 * 60, past: int = 0):
|
|
89
|
+
hist: list = self.make_request("history", {"transactionDirection": "INCOMING", "count": 3, "from": 0})
|
|
90
|
+
if int(hist[0].amount) == int(amount):
|
|
91
|
+
return hist[0]
|
|
92
|
+
await sleep(period)
|
|
93
|
+
past += period
|
|
94
|
+
if past < timeout:
|
|
95
|
+
return await self.check_by_amount(amount, cur, timeout, past)
|
|
96
|
+
return False
|
|
86
97
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
async def check_payment(cl: APIClient, amount: decimal, cur: str = "RUB", timeout: int = 5 * 60, past: int = 0):
|
|
91
|
-
hist: list = cl.make_request("history", {"transactionDirection": "INCOMING", "count": 3, "from": 0})
|
|
92
|
-
if int(hist[0].amount) == int(amount):
|
|
93
|
-
return hist[0]
|
|
94
|
-
await sleep(period)
|
|
95
|
-
past += period
|
|
96
|
-
if past < timeout:
|
|
97
|
-
return await check_payment(cl, amount, cur, timeout, past)
|
|
98
|
-
return False
|
|
98
|
+
def check_by_id(self, tid: str):
|
|
99
|
+
t: dict = self.make_request("findTransaction", tid)
|
|
100
|
+
return t
|
|
99
101
|
|
|
100
102
|
|
|
101
103
|
async def main():
|
|
102
104
|
_ = await init_db(TORM, True)
|
|
103
105
|
cl = APIClient("main", "mixfixX98", "mixartemev@gmail.com")
|
|
104
|
-
b = cl.get_balances()
|
|
106
|
+
# b = cl.get_balances()
|
|
107
|
+
b = cl.check_by_id("ce9a52be-8085-431e-8e6e-b0be427c6c55")
|
|
105
108
|
cl.make_request("history", {"transactionDirection": "INCOMING", "count": 100, "from": 0})
|
|
106
109
|
print(b)
|
|
107
110
|
|
|
@@ -10,7 +10,7 @@ xync_client/Abc/Ex.py,sha256=n41-XCjoIV-KpC_lK3jO049tQKbFmE0eDU3SDlgZTws,12986
|
|
|
10
10
|
xync_client/Abc/Exception.py,sha256=Sts7RpP370NBdjaH_cyXDdHtjge8zXNUGWCrKw49Zyk,482
|
|
11
11
|
xync_client/Abc/InAgent.py,sha256=svKGATUM0c9YIDDEVLc-NxpUNWqZoVr5PjxoxK64RKs,650
|
|
12
12
|
xync_client/Abc/Order.py,sha256=7-FGIJu5z9aYi0A_eJV4F-cp_6Mz_izNpefexDQZvHw,2428
|
|
13
|
-
xync_client/Abc/PmAgent.py,sha256=
|
|
13
|
+
xync_client/Abc/PmAgent.py,sha256=bvBHzzfg5-X6-JSPS0WGC6d69Cr57GWlMFKBq7x1yJw,4024
|
|
14
14
|
xync_client/Abc/xtype.py,sha256=o1JEzWmEXCPddtlqWZ6HRTZTKX6SAnvsztbASj21zOQ,2584
|
|
15
15
|
xync_client/Binance/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
16
16
|
xync_client/Binance/binance_async.py,sha256=LP2DZaHwkfsp_4Tjvetb-1ntjQtJfODF0OgZpoPx4KU,2688
|
|
@@ -34,8 +34,8 @@ xync_client/BitGet/agent.py,sha256=YVs3bDY0OcEJGU7m2A8chzO6PFhWDnQQrA-E6MVkBBg,3
|
|
|
34
34
|
xync_client/BitGet/ex.py,sha256=nAexKRkguIhq4fYP1tkIaou6oBFjjV2xwlajlJ-9DAE,3757
|
|
35
35
|
xync_client/BitGet/etype/ad.py,sha256=fysSW47wGYjSOPUqY864z857AJz4gjN-nOkI1Jxd27U,1838
|
|
36
36
|
xync_client/BitPapa/ex.py,sha256=U-RRB_RSOtErfRgxOZYWegZ_td_uZO37YKo3Jxchf_w,912
|
|
37
|
-
xync_client/Bybit/InAgent.py,sha256=
|
|
38
|
-
xync_client/Bybit/agent.py,sha256=
|
|
37
|
+
xync_client/Bybit/InAgent.py,sha256=EzxMwbSVPv5CKGWzILSwKMEvuIzIl4wtdaPNbkhrln0,25294
|
|
38
|
+
xync_client/Bybit/agent.py,sha256=wpFGareRojeG0nW1mBrtxU9HJlQjStsexdTRMm_3s_w,61753
|
|
39
39
|
xync_client/Bybit/ex.py,sha256=DgPOmnjphcSCSsO4ZQjnIlWICNzdtKhNIpVsU93s99k,4707
|
|
40
40
|
xync_client/Bybit/order.py,sha256=H4UIb8hxFGnw1hZuSbr0yZ4qeaCOIZOMc6jEst0ycBs,1713
|
|
41
41
|
xync_client/Bybit/web_earn.py,sha256=qjqS10xlFc8r40IhDdPZ0LxA2dFEGbvBGXdsrUUJCMo,3019
|
|
@@ -72,14 +72,14 @@ xync_client/Pms/Alfa/state.json,sha256=MKE6vl-JsJO9PNCVqoQgBgYZTgYkHCas7USwl8QFt
|
|
|
72
72
|
xync_client/Pms/MTS/__init__.py,sha256=P_E7W46IZEk8RsEgl7H1xV3JplMT5l9vYQYTYyNbyQ8,2101
|
|
73
73
|
xync_client/Pms/Ozon/__init__.py,sha256=EvQZDSPv0fOT2hNCTP44nXHOIEQvP5bQf_7HVLiZc2I,4123
|
|
74
74
|
xync_client/Pms/Payeer/.gitignore,sha256=sWORdRp8ROppV2CsMEDJ3M_SokrNWCf8b1hlaNs64hg,12
|
|
75
|
-
xync_client/Pms/Payeer/__init__.py,sha256=
|
|
75
|
+
xync_client/Pms/Payeer/__init__.py,sha256=xN3L-IURWJ6oYXq85qu34u0OZEQOXkshgeEuMG29qg8,9584
|
|
76
76
|
xync_client/Pms/Payeer/api.py,sha256=bb8qrlPYyWafel1VR-2nate6xBeRZAVciFJblHygfAs,549
|
|
77
77
|
xync_client/Pms/Payeer/login.py,sha256=W5FAA0reW5x2hSh8sBIWmR38VcYhwvrn1R64IAtWHVw,2921
|
|
78
78
|
xync_client/Pms/Sber/__init__.py,sha256=dxQfd9ZPhFTc_C4xrwaxrV6p0SijDCLNzBeUv3oQG38,4926
|
|
79
79
|
xync_client/Pms/Sber/utils.py,sha256=gIeJspwvoBbOBt-fjxwW4WDHPoL2Evs8LVufsjrFOfo,1870
|
|
80
80
|
xync_client/Pms/Tinkoff/__init__.py,sha256=ZyLvBEUn-vh-85oPUUDS586AHgvx3c-mkQE3yBQtbw8,5580
|
|
81
|
-
xync_client/Pms/Volet/__init__.py,sha256=
|
|
82
|
-
xync_client/Pms/Volet/api.py,sha256=
|
|
81
|
+
xync_client/Pms/Volet/__init__.py,sha256=fHS_0mvih0KRnczh303vmM208IMXwJTbaJMXo60LvHk,11386
|
|
82
|
+
xync_client/Pms/Volet/api.py,sha256=okqppqT7M5E6sswu-xz3L4Y9-ngefBPbFtywRi6A7Xo,3595
|
|
83
83
|
xync_client/Pms/Volet/pl.py,sha256=l7lvUrpjFoObXPHaseOIAcSbkNqJdpy6OLDutxYJH3U,2451
|
|
84
84
|
xync_client/Pms/Volet/_todo_req/req.mjs,sha256=ut3Jw37rL5lY7SskjZ9f1l0VE33tuP-PZEYUTcJMc2I,817
|
|
85
85
|
xync_client/Pms/Volet/_todo_req/req.py,sha256=mKvdPrb-lkQ98Ws92_oBKu5yqyU8Krxy9XwuIhdsBao,1570
|
|
@@ -95,7 +95,7 @@ xync_client/TgWallet/order.py,sha256=BOmBx5WWfJv0-_-A8DcR-Xd8utqO_VTmSqSegm0cteQ
|
|
|
95
95
|
xync_client/TgWallet/pyd.py,sha256=Ys3E8b3RLuyQ26frWT0F0BorkNxVpxnd18tY4Gp9dik,5636
|
|
96
96
|
xync_client/TgWallet/pyro.py,sha256=2K7QWdo48k4MbbgQt90gdz_HiPck69Njm4xaMjIVgoo,1440
|
|
97
97
|
xync_client/TgWallet/web.py,sha256=kDcv9SKKQPe91mw1qJBpbuyKYCAmZdfdHJylHumLBVU,1608
|
|
98
|
-
xync_client-0.0.
|
|
99
|
-
xync_client-0.0.
|
|
100
|
-
xync_client-0.0.
|
|
101
|
-
xync_client-0.0.
|
|
98
|
+
xync_client-0.0.139.dist-info/METADATA,sha256=9rxN-VreJl1QAUz5lI4LtIr40e1J2BzTPDFRZNpopXQ,1037
|
|
99
|
+
xync_client-0.0.139.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
100
|
+
xync_client-0.0.139.dist-info/top_level.txt,sha256=bmYEVIIrD3v7yFwH-X15pEfRvzhuAdfsAZ2igvNI4O8,12
|
|
101
|
+
xync_client-0.0.139.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|