xync-client 0.0.155__py3-none-any.whl → 0.0.162__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.
- xync_client/Abc/AdLoader.py +0 -294
- xync_client/Abc/Agent.py +326 -51
- xync_client/Abc/Ex.py +421 -12
- xync_client/Abc/Order.py +7 -14
- xync_client/Abc/xtype.py +35 -3
- xync_client/Bybit/InAgent.py +18 -447
- xync_client/Bybit/agent.py +531 -431
- xync_client/Bybit/etype/__init__.py +0 -0
- xync_client/Bybit/etype/ad.py +47 -34
- xync_client/Bybit/etype/order.py +34 -49
- xync_client/Bybit/ex.py +20 -46
- xync_client/Bybit/order.py +14 -12
- xync_client/Htx/agent.py +82 -40
- xync_client/Htx/etype/ad.py +22 -5
- xync_client/Htx/etype/order.py +194 -0
- xync_client/Htx/ex.py +16 -16
- xync_client/Mexc/agent.py +196 -13
- xync_client/Mexc/api.py +955 -336
- xync_client/Mexc/etype/ad.py +52 -1
- xync_client/Mexc/etype/order.py +131 -416
- xync_client/Mexc/ex.py +29 -19
- xync_client/Okx/1.py +14 -0
- xync_client/Okx/agent.py +39 -0
- xync_client/Okx/ex.py +8 -8
- xync_client/Pms/Payeer/agent.py +396 -0
- xync_client/Pms/Payeer/login.py +1 -63
- xync_client/Pms/Payeer/trade.py +58 -0
- xync_client/Pms/Volet/{__init__.py → agent.py} +1 -2
- xync_client/loader.py +1 -0
- {xync_client-0.0.155.dist-info → xync_client-0.0.162.dist-info}/METADATA +2 -1
- {xync_client-0.0.155.dist-info → xync_client-0.0.162.dist-info}/RECORD +33 -29
- xync_client/Pms/Payeer/__init__.py +0 -262
- xync_client/Pms/Payeer/api.py +0 -25
- {xync_client-0.0.155.dist-info → xync_client-0.0.162.dist-info}/WHEEL +0 -0
- {xync_client-0.0.155.dist-info → xync_client-0.0.162.dist-info}/top_level.txt +0 -0
|
@@ -10,7 +10,6 @@ from PGram import Bot
|
|
|
10
10
|
from playwright.async_api import async_playwright, Page, Locator, Position, Playwright, Browser # , FloatRect
|
|
11
11
|
from pyotp import TOTP
|
|
12
12
|
|
|
13
|
-
# noinspection PyProtectedMember
|
|
14
13
|
from playwright._impl._errors import TimeoutError
|
|
15
14
|
from pyro_client.client.user import UserClient
|
|
16
15
|
from pyrogram.handlers import MessageHandler
|
|
@@ -268,7 +267,7 @@ async def _test():
|
|
|
268
267
|
playwright: Playwright = await async_playwright().start()
|
|
269
268
|
|
|
270
269
|
try:
|
|
271
|
-
o = await models.Order.create(ad_id=7, exid=1, amount=900, cred_id=522, taker_id=
|
|
270
|
+
o = await models.Order.create(ad_id=7, exid=1, amount=900, cred_id=522, taker_id=1794)
|
|
272
271
|
await o.fetch_related("cred__pmcur__cur", "ad")
|
|
273
272
|
pma = await models.PmAgent.get(
|
|
274
273
|
active=True,
|
xync_client/loader.py
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: xync-client
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.162
|
|
4
4
|
Author-email: Mike Artemiev <mixartemev@gmail.com>
|
|
5
5
|
Project-URL: Homepage, https://gitlab.com/XyncNet/client
|
|
6
6
|
Project-URL: Repository, https://gitlab.com/XyncNet/client
|
|
7
7
|
Requires-Python: >=3.11
|
|
8
8
|
Requires-Dist: asynchuobi
|
|
9
|
+
Requires-Dist: blackboxprotobuf
|
|
9
10
|
Requires-Dist: bs4
|
|
10
11
|
Requires-Dist: bybit-p2p
|
|
11
12
|
Requires-Dist: google-api-python-client
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
xync_client/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
2
|
xync_client/details.py,sha256=21itVPCgAtaYRR1H9J9oYudj95gafcFjExUN6QL17OI,1330
|
|
3
|
-
xync_client/loader.py,sha256=
|
|
3
|
+
xync_client/loader.py,sha256=DA6lHUxGidULjpHyKGS1POc5r11rlOThQRdueOgr04A,617
|
|
4
4
|
xync_client/pm_unifier.py,sha256=DYkFYXzmhVEh8WJvI---3Geas34mZ83cT1O-88D68YQ,6568
|
|
5
|
-
xync_client/Abc/AdLoader.py,sha256=
|
|
6
|
-
xync_client/Abc/Agent.py,sha256=
|
|
5
|
+
xync_client/Abc/AdLoader.py,sha256=PkVl6CwRvXkL7dd9HA124hBgXVMOQiXac73rYKL0PIk,67
|
|
6
|
+
xync_client/Abc/Agent.py,sha256=IN3CsgXdzQ9L0dtkConnVLnqVLhLYfLQ19bwJDCl7_c,23296
|
|
7
7
|
xync_client/Abc/Asset.py,sha256=hlgyFaU9byr2N2r8Heh-_ICx49SKuKxfRTUA4yQWmEw,454
|
|
8
8
|
xync_client/Abc/Auth.py,sha256=OPQXN7_XYQZP9431ylFksd6JDusbKG8N_1g6CXTZ6yY,1495
|
|
9
9
|
xync_client/Abc/BaseTest.py,sha256=vaAs5Z4HYV7k_C3zQz6JKO75s2hXtVbBI3-0Srkzv5Q,2388
|
|
10
|
-
xync_client/Abc/Ex.py,sha256=
|
|
10
|
+
xync_client/Abc/Ex.py,sha256=TaRbQpl9hQmTzYxGkweYaYPuYMmFQ3UwRM77AeRhBYU,32743
|
|
11
11
|
xync_client/Abc/Exception.py,sha256=Sts7RpP370NBdjaH_cyXDdHtjge8zXNUGWCrKw49Zyk,482
|
|
12
12
|
xync_client/Abc/HasAbotUid.py,sha256=LsTHHjMHBauCwJoqgDa9Lx4R6xsDOHfsN4jM539Bpqg,279
|
|
13
13
|
xync_client/Abc/InAgent.py,sha256=8BnZ7VzWLIJY93xnNTqlpY3JdarQkkpRRjDDEALaVAA,303
|
|
14
|
-
xync_client/Abc/Order.py,sha256=
|
|
14
|
+
xync_client/Abc/Order.py,sha256=TJhCvE9FZ_29KIKvDPO1sJxTj2tYxIQar5yFgUaP22Q,2226
|
|
15
15
|
xync_client/Abc/PmAgent.py,sha256=Xl-0-KMwcTp_7qIt7NV7-aD22j955tFYFqcHHbmGMTQ,4193
|
|
16
|
-
xync_client/Abc/xtype.py,sha256=
|
|
16
|
+
xync_client/Abc/xtype.py,sha256=rp-to40BqNgT76zj5jyIdzLeRRHwpa6-fdD3OKJUXT4,4030
|
|
17
17
|
xync_client/Binance/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
18
18
|
xync_client/Binance/binance_async.py,sha256=LP2DZaHwkfsp_4Tjvetb-1ntjQtJfODF0OgZpoPx4KU,2688
|
|
19
19
|
xync_client/Binance/earn_api.py,sha256=hvk0MaVTLszIglQXVhbUjGcaHfbF9Ul7FFXmy94U2so,4411
|
|
@@ -36,39 +36,43 @@ xync_client/BitGet/agent.py,sha256=YVs3bDY0OcEJGU7m2A8chzO6PFhWDnQQrA-E6MVkBBg,3
|
|
|
36
36
|
xync_client/BitGet/ex.py,sha256=uEvvXuLaJv8o8BFi0bMA3XyBuTfVDWagAjLOHZl-xlE,3765
|
|
37
37
|
xync_client/BitGet/etype/ad.py,sha256=fysSW47wGYjSOPUqY864z857AJz4gjN-nOkI1Jxd27U,1838
|
|
38
38
|
xync_client/BitPapa/ex.py,sha256=U-RRB_RSOtErfRgxOZYWegZ_td_uZO37YKo3Jxchf_w,912
|
|
39
|
-
xync_client/Bybit/InAgent.py,sha256=
|
|
40
|
-
xync_client/Bybit/agent.py,sha256=
|
|
41
|
-
xync_client/Bybit/ex.py,sha256=
|
|
42
|
-
xync_client/Bybit/order.py,sha256=
|
|
39
|
+
xync_client/Bybit/InAgent.py,sha256=HJzy-avXlGu7yh11WqYmx8whTGKU3HTng2dtkbLtTCQ,1234
|
|
40
|
+
xync_client/Bybit/agent.py,sha256=MyZRc5sbbuivw8N1LeFcjwba4AJytplStFldku_ESaM,66356
|
|
41
|
+
xync_client/Bybit/ex.py,sha256=W_bYXafNR3aWdx0qpr06bGHl52xGBaKKcABleveHXng,4468
|
|
42
|
+
xync_client/Bybit/order.py,sha256=qDE6WDlpbYDdVJeIG33bIOPuMfgBBhbaVOR8LJa8Bms,2006
|
|
43
43
|
xync_client/Bybit/web_earn.py,sha256=qjqS10xlFc8r40IhDdPZ0LxA2dFEGbvBGXdsrUUJCMo,3019
|
|
44
44
|
xync_client/Bybit/web_p2p.py,sha256=sAXzK03t6jwDnz4rrvP2IzI0KxfKa7C_5GuzH1HwLuA,11768
|
|
45
45
|
xync_client/Bybit/ws.py,sha256=OQjZHo_MiAH1dlOs3c-aUZBKyqToNTmH560udh6RYDE,1431
|
|
46
|
-
xync_client/Bybit/etype/
|
|
46
|
+
xync_client/Bybit/etype/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
47
|
+
xync_client/Bybit/etype/ad.py,sha256=qGCVc9eqc7lRRk0Hh3gD5i3HY0TXX-JdNY91VDoNg1I,5830
|
|
47
48
|
xync_client/Bybit/etype/cred.py,sha256=CH6xqHh1214bLhHy_K9eVBb1SJVhWBfGb0l3LtBf3fU,1701
|
|
48
|
-
xync_client/Bybit/etype/order.py,sha256=
|
|
49
|
+
xync_client/Bybit/etype/order.py,sha256=FAQ8ILI1E_Ow25KF8a9hinbI6kXY-t0aC0Xnrp4069o,7908
|
|
49
50
|
xync_client/Gate/ex.py,sha256=QbhB3u7TWnvVGD-AknB2nay6KZjEXQ-1JT9UacX4sWI,3735
|
|
50
51
|
xync_client/Gate/premarket.py,sha256=IW-CgkmNJePJR2j_NRfULNKTePMX35XlhldqdiO76zY,2138
|
|
51
52
|
xync_client/Gate/etype/ad.py,sha256=-EwtFcOWWvtE6UjaOdsuXWDTCVjAIRK0kSEsqPP4Yls,1296
|
|
52
53
|
xync_client/Gmail/__init__.py,sha256=9JGT8PyzJaOTVvaFV0Gki3Fdo6Bp6m6DnWOPGZJ-eAA,5436
|
|
53
|
-
xync_client/Htx/agent.py,sha256=
|
|
54
|
+
xync_client/Htx/agent.py,sha256=6JYYrgUCNnBKuh5ePveSONECA8WXY-9Lya0bgmRHEQ8,14459
|
|
54
55
|
xync_client/Htx/earn.py,sha256=jL6eRwytZEMRom_3bFm1DYthi_GFg-E1Mm3ZDXENHSg,2386
|
|
55
|
-
xync_client/Htx/ex.py,sha256=
|
|
56
|
+
xync_client/Htx/ex.py,sha256=lM8mHuBRILPiPKXq-kCHTZZ6SrUFUj_PSc14Um3XlB8,6114
|
|
56
57
|
xync_client/Htx/etype/__init__.py,sha256=sZIhFOxj2dRQRmMe86-y9vlzOGAPo1qoOi6u1qVxWr0,123
|
|
57
|
-
xync_client/Htx/etype/ad.py,sha256=
|
|
58
|
+
xync_client/Htx/etype/ad.py,sha256=FtCOP-1xy8Ag7nLBfFv1K5FDhEvsrR-fYTTs7VLlyAo,2729
|
|
58
59
|
xync_client/Htx/etype/cred.py,sha256=sAOQTsk7BA8zBWUkkwM6vIQcq1LcSK5NLYGrkTdtkQ8,1129
|
|
60
|
+
xync_client/Htx/etype/order.py,sha256=9es-uYOAI1Zpjnntdc6KogvN9OQuD_-mUZiQVTIycjM,6276
|
|
59
61
|
xync_client/Htx/etype/pm.py,sha256=ILCP9reFRkfuzmtsJDYomJ3WBTU4s_KE-69JksTxwMk,375
|
|
60
62
|
xync_client/Htx/etype/test.py,sha256=uomFicPE1OoA3WXnXOxhsTtGJEpVCQ0CId9D0NI6vto,893
|
|
61
63
|
xync_client/KuCoin/ex.py,sha256=w-6-aedlC1mYf8LShMv6pOrQzqMR9E6yIyXGUHQP888,3237
|
|
62
64
|
xync_client/KuCoin/web.py,sha256=--OHS0Z29xjfNUjdTL7K0EDmU4dwej95OJ8Sv4PsxLI,920
|
|
63
65
|
xync_client/KuCoin/etype/ad.py,sha256=MTx90Qo2xFKvfgIr4_qMowjwO23HVpFCD6J7INNFDuQ,1223
|
|
64
66
|
xync_client/KuCoin/etype/pm.py,sha256=S50S5fyY5YeWlcPwO66o-GsPcdqgoeXuxvmEIy6Zqvs,130
|
|
65
|
-
xync_client/Mexc/agent.py,sha256=
|
|
66
|
-
xync_client/Mexc/api.py,sha256=
|
|
67
|
-
xync_client/Mexc/ex.py,sha256=
|
|
68
|
-
xync_client/Mexc/etype/ad.py,sha256=
|
|
69
|
-
xync_client/Mexc/etype/order.py,sha256=
|
|
67
|
+
xync_client/Mexc/agent.py,sha256=3jKVZG43QdW_9o2qE_PD9p-OWFX5xsP7NcEAtuGx0k8,10494
|
|
68
|
+
xync_client/Mexc/api.py,sha256=z4PCAa9LfzTjjcYbkUzpt6pVFkREriog4QUcxsG2leM,44447
|
|
69
|
+
xync_client/Mexc/ex.py,sha256=OZQbEuF4sMB920lajehTaPi3fKxL_zNV5n8Pim3ZlyY,5009
|
|
70
|
+
xync_client/Mexc/etype/ad.py,sha256=CVSkaP2FrAVHgJkVGw1pFk55AM2cAZHtRJHnOhPc2y8,2634
|
|
71
|
+
xync_client/Mexc/etype/order.py,sha256=Ts3yUOl8Qow21Jqak-3E67EbLm6AfY8lbrk07bIpp6I,7391
|
|
70
72
|
xync_client/Mexc/etype/pm.py,sha256=m5kCoMx9IEKUPB-z7YwwymQhASkv2npC4-Z_ePYeeRY,453
|
|
71
|
-
xync_client/Okx/
|
|
73
|
+
xync_client/Okx/1.py,sha256=c2mbB6C1q0k24yg1T_WHA69MjLFnrC6GzUC461vaw0s,1625
|
|
74
|
+
xync_client/Okx/agent.py,sha256=y_6tjGPyMCD6AK7qYUSvm26kJxEPnt3ZTRhAszPztJA,1089
|
|
75
|
+
xync_client/Okx/ex.py,sha256=4eQGQzON1mRv98beweoXmb02GfRwZAIiQUfKKAe-uuE,4558
|
|
72
76
|
xync_client/Okx/etype/ad.py,sha256=rTWMMmDwJK9chBByyihCZcgE5P6c5ti2yR1RbUtev3A,3773
|
|
73
77
|
xync_client/Okx/etype/pm.py,sha256=MaxeyltowP3ESdOjec2HvSfMBwV_mC6w56Xbw-puadc,251
|
|
74
78
|
xync_client/Pms/.gitignore,sha256=uGduC1_B8Wc0RiBzBS1YsrLPClFG2e42r1At9taidMI,6
|
|
@@ -77,13 +81,13 @@ xync_client/Pms/Alfa/state.json,sha256=MKE6vl-JsJO9PNCVqoQgBgYZTgYkHCas7USwl8QFt
|
|
|
77
81
|
xync_client/Pms/MTS/__init__.py,sha256=P_E7W46IZEk8RsEgl7H1xV3JplMT5l9vYQYTYyNbyQ8,2101
|
|
78
82
|
xync_client/Pms/Ozon/__init__.py,sha256=EvQZDSPv0fOT2hNCTP44nXHOIEQvP5bQf_7HVLiZc2I,4123
|
|
79
83
|
xync_client/Pms/Payeer/.gitignore,sha256=sWORdRp8ROppV2CsMEDJ3M_SokrNWCf8b1hlaNs64hg,12
|
|
80
|
-
xync_client/Pms/Payeer/
|
|
81
|
-
xync_client/Pms/Payeer/
|
|
82
|
-
xync_client/Pms/Payeer/
|
|
84
|
+
xync_client/Pms/Payeer/agent.py,sha256=ugxGfuIqS16wSbZMPNu_H5Rm_hJBlhENbtVNJ-4Kuqg,16930
|
|
85
|
+
xync_client/Pms/Payeer/login.py,sha256=9n-_bClzm6_zpznwfcKwnQzgE5k9v4lRuhTtHlY7Y2A,109
|
|
86
|
+
xync_client/Pms/Payeer/trade.py,sha256=Z_PSrXsFsecPam2sjuzImiwTXX-9cKGuJTbYOwLnLDM,1883
|
|
83
87
|
xync_client/Pms/Sber/__init__.py,sha256=dxQfd9ZPhFTc_C4xrwaxrV6p0SijDCLNzBeUv3oQG38,4926
|
|
84
88
|
xync_client/Pms/Sber/utils.py,sha256=gIeJspwvoBbOBt-fjxwW4WDHPoL2Evs8LVufsjrFOfo,1870
|
|
85
89
|
xync_client/Pms/Tinkoff/__init__.py,sha256=ZyLvBEUn-vh-85oPUUDS586AHgvx3c-mkQE3yBQtbw8,5580
|
|
86
|
-
xync_client/Pms/Volet/
|
|
90
|
+
xync_client/Pms/Volet/agent.py,sha256=K9GhwTHPQUK3TgobOZd_EYVp0GV-pGq_7MdcTUJJkPM,12056
|
|
87
91
|
xync_client/Pms/Volet/api.py,sha256=6_dH2rzmyyvha3PeoiZdSltiAzKDWn8roSUJOAErX4M,3673
|
|
88
92
|
xync_client/Pms/Volet/pl.py,sha256=l7lvUrpjFoObXPHaseOIAcSbkNqJdpy6OLDutxYJH3U,2451
|
|
89
93
|
xync_client/Pms/Volet/_todo_req/req.mjs,sha256=ut3Jw37rL5lY7SskjZ9f1l0VE33tuP-PZEYUTcJMc2I,817
|
|
@@ -100,7 +104,7 @@ xync_client/TgWallet/order.py,sha256=BOmBx5WWfJv0-_-A8DcR-Xd8utqO_VTmSqSegm0cteQ
|
|
|
100
104
|
xync_client/TgWallet/pyd.py,sha256=Ys3E8b3RLuyQ26frWT0F0BorkNxVpxnd18tY4Gp9dik,5636
|
|
101
105
|
xync_client/TgWallet/pyro.py,sha256=2K7QWdo48k4MbbgQt90gdz_HiPck69Njm4xaMjIVgoo,1440
|
|
102
106
|
xync_client/TgWallet/web.py,sha256=kDcv9SKKQPe91mw1qJBpbuyKYCAmZdfdHJylHumLBVU,1608
|
|
103
|
-
xync_client-0.0.
|
|
104
|
-
xync_client-0.0.
|
|
105
|
-
xync_client-0.0.
|
|
106
|
-
xync_client-0.0.
|
|
107
|
+
xync_client-0.0.162.dist-info/METADATA,sha256=fObLDRD-fDTgXnRXbmMBiioSGGgr0WgwS12thRoLeII,1181
|
|
108
|
+
xync_client-0.0.162.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
109
|
+
xync_client-0.0.162.dist-info/top_level.txt,sha256=bmYEVIIrD3v7yFwH-X15pEfRvzhuAdfsAZ2igvNI4O8,12
|
|
110
|
+
xync_client-0.0.162.dist-info/RECORD,,
|
|
@@ -1,262 +0,0 @@
|
|
|
1
|
-
import logging
|
|
2
|
-
from asyncio import run
|
|
3
|
-
from base64 import b64encode
|
|
4
|
-
from datetime import datetime
|
|
5
|
-
from decimal import Decimal
|
|
6
|
-
from enum import StrEnum
|
|
7
|
-
from hashlib import sha256
|
|
8
|
-
from json import dumps
|
|
9
|
-
from math import ceil
|
|
10
|
-
from os import urandom
|
|
11
|
-
from time import sleep
|
|
12
|
-
from urllib.parse import urlencode
|
|
13
|
-
|
|
14
|
-
from PGram import Bot
|
|
15
|
-
from asyncpg.pgproto.pgproto import timedelta
|
|
16
|
-
from cryptography.hazmat.primitives import padding
|
|
17
|
-
from cryptography.hazmat.primitives.ciphers import Cipher
|
|
18
|
-
from cryptography.hazmat.primitives.ciphers.algorithms import AES
|
|
19
|
-
from cryptography.hazmat.primitives.ciphers.modes import CBC
|
|
20
|
-
from payeer_api import PayeerAPI
|
|
21
|
-
from playwright.async_api import async_playwright, Playwright, Error, Browser
|
|
22
|
-
|
|
23
|
-
# noinspection PyProtectedMember
|
|
24
|
-
from playwright._impl._errors import TimeoutError
|
|
25
|
-
from tortoise.timezone import now
|
|
26
|
-
from xync_bot import XyncBot
|
|
27
|
-
from xync_schema.models import TopUp, TopUpAble, PmAgent, Transfer
|
|
28
|
-
|
|
29
|
-
from xync_client.loader import TORM, PAY_TOKEN
|
|
30
|
-
|
|
31
|
-
from xync_client.Abc.PmAgent import PmAgentClient
|
|
32
|
-
from xync_client.Pms.Payeer.login import login
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
def encrypt_data(data: dict, md5digest: bytes):
|
|
36
|
-
# Convert data to JSON string (equivalent to json_encode)
|
|
37
|
-
bdata = dumps(data).encode()
|
|
38
|
-
|
|
39
|
-
# Generate random IV (16 bytes for AES)
|
|
40
|
-
iv = urandom(16)
|
|
41
|
-
|
|
42
|
-
# Pad or truncate key to 32 bytes
|
|
43
|
-
if len(md5digest) < 32:
|
|
44
|
-
md5digest = md5digest.ljust(32, b"\0") # Pad with null bytes
|
|
45
|
-
elif len(md5digest) > 32:
|
|
46
|
-
md5digest = md5digest[:32] # Truncate to 32 bytes
|
|
47
|
-
|
|
48
|
-
# Apply PKCS7 padding
|
|
49
|
-
padder = padding.PKCS7(128).padder() # 128 bits = 16 bytes block size
|
|
50
|
-
padded_data = padder.update(bdata)
|
|
51
|
-
padded_data += padder.finalize()
|
|
52
|
-
|
|
53
|
-
# Create cipher
|
|
54
|
-
cipher = Cipher(AES(md5digest), CBC(iv))
|
|
55
|
-
encryptor = cipher.encryptor()
|
|
56
|
-
|
|
57
|
-
# Encrypt
|
|
58
|
-
ciphertext = encryptor.update(padded_data) + encryptor.finalize()
|
|
59
|
-
|
|
60
|
-
return iv + ciphertext
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
class Client(PmAgentClient):
|
|
64
|
-
class Pages(StrEnum):
|
|
65
|
-
_base = "https://payeer.com/en/"
|
|
66
|
-
LOGIN = _base + "auth/"
|
|
67
|
-
SEND = _base + "account/send/"
|
|
68
|
-
|
|
69
|
-
norm: str = "payeer"
|
|
70
|
-
pages: type(StrEnum) = Pages
|
|
71
|
-
api: PayeerAPI
|
|
72
|
-
with_userbot: bool = False
|
|
73
|
-
|
|
74
|
-
def __init__(self, agent: PmAgent, browser: Browser, abot: XyncBot):
|
|
75
|
-
super().__init__(agent, browser, abot)
|
|
76
|
-
if api_id := self.agent.auth.get("api_id"):
|
|
77
|
-
self.api = PayeerAPI(self.agent.auth["email"], api_id, self.agent.auth["api_sec"])
|
|
78
|
-
|
|
79
|
-
async def _login(self):
|
|
80
|
-
await login(self.agent)
|
|
81
|
-
for cookie in self.agent.state["cookies"]:
|
|
82
|
-
await self.page.context.add_cookies([cookie])
|
|
83
|
-
await self.page.goto(self.pages.SEND, wait_until="commit")
|
|
84
|
-
|
|
85
|
-
@staticmethod
|
|
86
|
-
def form_redirect(topup: TopUp) -> tuple[str, dict | None]:
|
|
87
|
-
m_shop = str(topup.topupable.auth["id"])
|
|
88
|
-
m_orderid = str(topup.id)
|
|
89
|
-
m_amount = "{0:.2f}".format(topup.amount * 0.01)
|
|
90
|
-
m_curr = topup.cur.ticker
|
|
91
|
-
m_desc = b64encode(b"XyncPay top up").decode()
|
|
92
|
-
m_key = topup.topupable.auth["sec"]
|
|
93
|
-
data = [m_shop, m_orderid, m_amount, m_curr, m_desc]
|
|
94
|
-
|
|
95
|
-
# # additional
|
|
96
|
-
# m_params = {
|
|
97
|
-
# 'success_url': 'https://xync.net/topup?success=1',
|
|
98
|
-
# 'fail_url': 'https://xync.net/topup?success=0',
|
|
99
|
-
# 'status_url': 'https://xync.net/topup',
|
|
100
|
-
# 'reference': {'var1': '1'},
|
|
101
|
-
# }
|
|
102
|
-
#
|
|
103
|
-
# key = md5(m_orderid.to_bytes()).digest()
|
|
104
|
-
#
|
|
105
|
-
# base64url_encode(encrypt_data(params, key))
|
|
106
|
-
#
|
|
107
|
-
# data.append(m_params)
|
|
108
|
-
# # additional
|
|
109
|
-
|
|
110
|
-
data.append(m_key)
|
|
111
|
-
|
|
112
|
-
sign = sha256(":".join(data).encode()).hexdigest().upper()
|
|
113
|
-
|
|
114
|
-
params = {
|
|
115
|
-
"m_shop": m_shop,
|
|
116
|
-
"m_orderid": m_orderid,
|
|
117
|
-
"m_amount": m_amount,
|
|
118
|
-
"m_curr": m_curr,
|
|
119
|
-
"m_desc": m_desc,
|
|
120
|
-
"m_sign": sign,
|
|
121
|
-
# 'm_params': m_params,
|
|
122
|
-
# 'm_cipher_method': 'AES-256-CBC-IV',
|
|
123
|
-
"form[ps]": "2609",
|
|
124
|
-
"form[curr[2609]]": m_curr,
|
|
125
|
-
}
|
|
126
|
-
url = "https://payeer.com/merchant/?" + urlencode(params)
|
|
127
|
-
return url, None
|
|
128
|
-
|
|
129
|
-
def get_topup(self, tid: str) -> dict:
|
|
130
|
-
hi = self.api.get_history_info(tid)
|
|
131
|
-
ti = self.api.shop_order_info(hi["params"]["SHOP_ID"], hi["params"]["ORDER_ID"])["info"]
|
|
132
|
-
return ti["status"] == "execute" and {
|
|
133
|
-
"pmid": ti["id"],
|
|
134
|
-
"from_acc": hi["params"]["ACCOUNT_NUMBER"],
|
|
135
|
-
"oid": hi["params"]["ORDER_ID"],
|
|
136
|
-
"amount": int(float(ti["sumOut"]) * 100),
|
|
137
|
-
"ts": datetime.strptime(ti["dateCreate"], "%d.%m.%Y %H:%M:%S") - timedelta(hours=3),
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
async def send(self, t: Transfer) -> tuple[str, bytes] | float:
|
|
141
|
-
dest, cur = t.order.cred.detail, t.order.cred.pmcur.cur.ticker
|
|
142
|
-
amount = round(t.order.amount * 10**-t.order.cred.pmcur.cur.scale, t.order.cred.pmcur.cur.scale)
|
|
143
|
-
self.last_active = now()
|
|
144
|
-
page = self.page
|
|
145
|
-
if not page.url.startswith(self.pages.SEND):
|
|
146
|
-
try:
|
|
147
|
-
await page.goto(self.pages.SEND, wait_until="commit")
|
|
148
|
-
except (TimeoutError, Error):
|
|
149
|
-
await login(self.agent)
|
|
150
|
-
for cookie in self.agent.state["cookies"]:
|
|
151
|
-
await page.context.add_cookies([cookie])
|
|
152
|
-
sleep(0.5)
|
|
153
|
-
await page.goto("https://payeer.com/en/account/send/", wait_until="commit")
|
|
154
|
-
has_amount = float(self.api.get_balance()[cur]["DOSTUPNO"])
|
|
155
|
-
if amount <= has_amount:
|
|
156
|
-
sleep(0.1)
|
|
157
|
-
await page.locator('input[name="param_ACCOUNT_NUMBER"]').fill(dest)
|
|
158
|
-
await page.locator("select[name=curr_receive]").select_option(value=cur)
|
|
159
|
-
sleep(0.8)
|
|
160
|
-
await page.locator('input[name="sum_receive"]').fill(str(amount))
|
|
161
|
-
sleep(0.1)
|
|
162
|
-
# await page.locator("div.n-form--title").first.click()
|
|
163
|
-
# sleep(0.1)
|
|
164
|
-
await page.click(".btn.n-form--btn.n-form--btn-mod")
|
|
165
|
-
sleep(0.5)
|
|
166
|
-
await page.click(".btn.n-form--btn.n-form--btn-mod")
|
|
167
|
-
sleep(1.1)
|
|
168
|
-
if await page.locator(".input4").count():
|
|
169
|
-
await page.locator(".input4").fill(self.agent.auth.get("master_key"))
|
|
170
|
-
await page.click(".ok.button_green2")
|
|
171
|
-
sleep(1)
|
|
172
|
-
try:
|
|
173
|
-
await page.locator(".note_txt").wait_for(state="visible", timeout=6000)
|
|
174
|
-
except TimeoutError as _:
|
|
175
|
-
logging.error("Repeat!")
|
|
176
|
-
sleep(0.5)
|
|
177
|
-
return await self.send(t)
|
|
178
|
-
if await page.locator('.note_txt:has-text("successfully completed")').count():
|
|
179
|
-
transaction = await page.locator(".note_txt").all_text_contents()
|
|
180
|
-
trans_num = transaction[0].replace("Transaction #", "").split()[0]
|
|
181
|
-
await page.goto("https://payeer.com/ru/account/history/", wait_until="commit")
|
|
182
|
-
await page.click(f".history-id-{trans_num} a.link")
|
|
183
|
-
sleep(1)
|
|
184
|
-
receipt = await page.query_selector(".ui-dialog.ui-corner-all")
|
|
185
|
-
return trans_num, receipt and await receipt.screenshot(path=f"tmp/{trans_num}.png")
|
|
186
|
-
else:
|
|
187
|
-
await self.receive("Payeer хз", photo=await self.page.screenshot())
|
|
188
|
-
return -1
|
|
189
|
-
else:
|
|
190
|
-
await self.receive(
|
|
191
|
-
f"Payeer no have {amount}, only {has_amount}{cur} to {dest}",
|
|
192
|
-
photo=await self.page.screenshot(),
|
|
193
|
-
)
|
|
194
|
-
return has_amount
|
|
195
|
-
|
|
196
|
-
async def check_in(
|
|
197
|
-
self, amount: Decimal | int | float, cur: str, dt: datetime = None, tid: str | int = None
|
|
198
|
-
) -> tuple[Decimal | None, int | None]:
|
|
199
|
-
history = self.api.history(type="incoming", count=10)
|
|
200
|
-
if tid:
|
|
201
|
-
return (t := history.get(tid)) and Decimal(t["creditedAmount"])
|
|
202
|
-
ts: list[dict] = [
|
|
203
|
-
h
|
|
204
|
-
for h in history.values()
|
|
205
|
-
if (
|
|
206
|
-
amount <= Decimal(h["creditedAmount"]) <= ceil(amount)
|
|
207
|
-
and h["creditedCurrency"] == cur
|
|
208
|
-
# todo: wrong tz
|
|
209
|
-
and datetime.fromisoformat(h["date"]) > dt - timedelta(minutes=3) # +180(tz)-5
|
|
210
|
-
)
|
|
211
|
-
]
|
|
212
|
-
if not (t := ts and ts[0]):
|
|
213
|
-
return None, None
|
|
214
|
-
return (
|
|
215
|
-
amount <= (am := Decimal(t["creditedAmount"])) <= ceil(amount) and t["creditedCurrency"] == cur
|
|
216
|
-
) and am, t["id"]
|
|
217
|
-
|
|
218
|
-
async def proof(self) -> bytes: ...
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
async def main(uid: int):
|
|
222
|
-
from x_model import init_db
|
|
223
|
-
|
|
224
|
-
_ = await init_db(TORM, True)
|
|
225
|
-
agent = await PmAgent.get_or_none(pm__norm="payeer", user__username_id=uid).prefetch_related(
|
|
226
|
-
"user__username__session", "pm"
|
|
227
|
-
)
|
|
228
|
-
if not agent:
|
|
229
|
-
raise Exception(f"No active user #{uid} with agent for volet!")
|
|
230
|
-
abot = Bot(PAY_TOKEN)
|
|
231
|
-
pyr = agent.client(abot)
|
|
232
|
-
playwright: Playwright = await async_playwright().start()
|
|
233
|
-
try:
|
|
234
|
-
dest, amount, cur = "P79619335", 4, "RUB"
|
|
235
|
-
ta = await TopUpAble.get(pm__norm="payeer")
|
|
236
|
-
topup = await TopUp.create(amount=1001, cur_id=1, topupable=ta, user_id=1)
|
|
237
|
-
await topup.fetch_related("cur")
|
|
238
|
-
_url, _data = pyr.form_redirect(topup)
|
|
239
|
-
|
|
240
|
-
await pyr.start(playwright, False)
|
|
241
|
-
|
|
242
|
-
_res = await pyr.send(dest, amount, cur)
|
|
243
|
-
_res = await pyr.send(dest, 3, cur)
|
|
244
|
-
|
|
245
|
-
res = pyr.check_in(3, cur, datetime.now())
|
|
246
|
-
|
|
247
|
-
if len(res) > 1 and isinstance(res[1], bytes):
|
|
248
|
-
await pyr.receive(f"Transaction #{res[0]}", photo=res[1])
|
|
249
|
-
elif res[0] > 0:
|
|
250
|
-
await pyr.receive(f"Sreen of transaction #{res[0]} failed", photo=await pyr.page.screenshot())
|
|
251
|
-
else:
|
|
252
|
-
await pyr.receive(f"Sending {amount} {cur} to {dest} FAILED", photo=await pyr.page.screenshot())
|
|
253
|
-
|
|
254
|
-
except TimeoutError as te:
|
|
255
|
-
await pyr.receive(repr(te), photo=await pyr.page.screenshot())
|
|
256
|
-
raise te
|
|
257
|
-
# finally:
|
|
258
|
-
# await pyr.stop()
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
if __name__ == "__main__":
|
|
262
|
-
run(main(193017646))
|
xync_client/Pms/Payeer/api.py
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
from asyncio import run
|
|
2
|
-
from playwright.async_api import Playwright, async_playwright
|
|
3
|
-
|
|
4
|
-
from xync_client.loader import TORM
|
|
5
|
-
from xync_client.Pms.Payeer import Client
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
async def main():
|
|
9
|
-
from x_model import init_db
|
|
10
|
-
|
|
11
|
-
_ = await init_db(TORM, True)
|
|
12
|
-
done = set()
|
|
13
|
-
pyr = Client(193017646)
|
|
14
|
-
pw: Playwright = await async_playwright().start()
|
|
15
|
-
await pyr.start(pw, False)
|
|
16
|
-
if r := pyr.check_in(3000, "RUB"):
|
|
17
|
-
am, tid = r
|
|
18
|
-
if tid not in done:
|
|
19
|
-
done.add(tid)
|
|
20
|
-
|
|
21
|
-
...
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
if __name__ == "__main__":
|
|
25
|
-
run(main())
|
|
File without changes
|
|
File without changes
|