From 7bc92dcef95cbe7d672541697c89b14f655ff5b8 Mon Sep 17 00:00:00 2001 From: Mark Veidemanis Date: Sat, 20 May 2023 14:15:29 +0100 Subject: [PATCH] Round amount before sending XMR --- core/clients/platforms/api/agoradesk.py | 5 ++++- core/management/commands/scheduling.py | 5 +++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/core/clients/platforms/api/agoradesk.py b/core/clients/platforms/api/agoradesk.py index 42aa14f..92f4009 100644 --- a/core/clients/platforms/api/agoradesk.py +++ b/core/clients/platforms/api/agoradesk.py @@ -102,6 +102,8 @@ class AgoraDesk: result["message"] = "OK" result["response"] = response else: + if "error" in response: + result["error"] = response["error"] result["message"] = "API ERROR" return result @@ -1037,8 +1039,9 @@ class AgoraDesk: if otp: params["otp"] = otp - return await self._api_call( + response = await self._api_call( api_method="wallet-send/XMR", http_method="POST", query_values=params, ) + return response diff --git a/core/management/commands/scheduling.py b/core/management/commands/scheduling.py index 16cdd06..b8f5a5c 100644 --- a/core/management/commands/scheduling.py +++ b/core/management/commands/scheduling.py @@ -122,9 +122,10 @@ async def withdrawal_job(group=None): # for wallet, amount in collapsed.items(): print("ITER SEND", wallet, amount) + amount_rounded = round(amount, 8) cast = { "address": wallet.address, - "amount": amount, + "amount": amount_rounded, "password": platform.password, "otp": otp_code, } @@ -139,7 +140,7 @@ async def withdrawal_job(group=None): payout = Payout.objects.create( # noqa user=group.user, wallet=wallet, - amount=amount, + amount=amount_rounded, description=reason, )