Round amount before sending XMR

This commit is contained in:
Mark Veidemanis 2023-05-20 14:15:29 +01:00
parent 1744b9ead8
commit 7bc92dcef9
Signed by: m
GPG Key ID: 5ACFCEED46C0904F
2 changed files with 7 additions and 3 deletions

View File

@ -102,6 +102,8 @@ class AgoraDesk:
result["message"] = "OK" result["message"] = "OK"
result["response"] = response result["response"] = response
else: else:
if "error" in response:
result["error"] = response["error"]
result["message"] = "API ERROR" result["message"] = "API ERROR"
return result return result
@ -1037,8 +1039,9 @@ class AgoraDesk:
if otp: if otp:
params["otp"] = otp params["otp"] = otp
return await self._api_call( response = await self._api_call(
api_method="wallet-send/XMR", api_method="wallet-send/XMR",
http_method="POST", http_method="POST",
query_values=params, query_values=params,
) )
return response

View File

@ -122,9 +122,10 @@ async def withdrawal_job(group=None):
# for wallet, amount in collapsed.items(): # for wallet, amount in collapsed.items():
print("ITER SEND", wallet, amount) print("ITER SEND", wallet, amount)
amount_rounded = round(amount, 8)
cast = { cast = {
"address": wallet.address, "address": wallet.address,
"amount": amount, "amount": amount_rounded,
"password": platform.password, "password": platform.password,
"otp": otp_code, "otp": otp_code,
} }
@ -139,7 +140,7 @@ async def withdrawal_job(group=None):
payout = Payout.objects.create( # noqa payout = Payout.objects.create( # noqa
user=group.user, user=group.user,
wallet=wallet, wallet=wallet,
amount=amount, amount=amount_rounded,
description=reason, description=reason,
) )