Fix formatting issues

This commit is contained in:
2023-03-11 11:51:19 +00:00
parent be9f9e7363
commit 0477e55361
10 changed files with 79 additions and 90 deletions

View File

@@ -1,5 +1,7 @@
from abc import ABC
import orjson
from core.lib import db, notify
# from core.lib.money import money
@@ -159,19 +161,20 @@ class AggregatorClient(ABC):
return None
return stored_trade_reference.pop()
async def can_alt_lookup(self, amount, currency, reference):
amount_usd = self.money.to_usd(amount, currency)
# Amount is reliable here as it is checked by find_trade,
# so no need for stored_trade["amount"]
if float(amount_usd) > float(settings.Agora.AcceptableAltLookupUSD):
message = (
f"Amount exceeds max for {reference}"
f"Currency: {currency} | Amount: {amount}"
)
title = "Amount exceeds max for {reference}"
await notify.sendmsg(self.instance.user, message, title=title)
return False
return True
# TODO: pass platform here
# async def can_alt_lookup(self, amount, currency, reference):
# amount_usd = self.money.to_usd(amount, currency)
# # Amount is reliable here as it is checked by find_trade,
# # so no need for stored_trade["amount"]
# if float(amount_usd) > float(settings.Agora.AcceptableAltLookupUSD):
# message = (
# f"Amount exceeds max for {reference}"
# f"Currency: {currency} | Amount: {amount}"
# )
# title = "Amount exceeds max for {reference}"
# await notify.sendmsg(self.instance.user, message, title=title)
# return False
# return True
async def amount_currency_lookup(self, amount, currency, txid, reference):
log.info(f"No reference in DB refs for {reference}")
@@ -288,7 +291,7 @@ class AggregatorClient(ABC):
}
db.r.hmset(f"tx.{txid}", to_store)
log.info(f"Transaction processed: {dumps(to_store, indent=2)}")
log.info(f"Transaction processed: {orjson.dumps(to_store, indent=2)}")
self.irc.sendmsg(
(
f"AUTO Incoming transaction on {subclass}: {txid} {amount}{currency} "
@@ -347,10 +350,10 @@ class AggregatorClient(ABC):
):
return
platform = stored_trade["subclass"]
platform_buyer = stored_trade["buyer"]
# platform_buyer = stored_trade["buyer"]
# Check sender - we don't do anything with this yet
# sender_valid = self.antifraud.check_valid_sender(
# sender_valid = antifraud.check_valid_sender(
# reference, platform, sender, platform_buyer
# )
# log.info(f"Trade {reference} buyer {platform_buyer} valid: {sender_valid}")

View File

@@ -108,6 +108,7 @@ class AgoraClient(LocalPlatformClient, BaseClient):
"password": self.instance.password,
"otp": otp_code.now(),
}
print("SENDING", send_cast)
return # TODO
# send_cast["address"] = settings.XMR.Wallet1

View File

@@ -90,8 +90,6 @@ class AgoraDesk:
status_code = response_raw.status
else:
# response = httpx.get(url=api_call_url, headers=headers, params=query_values)
# response = treq.get(api_call_url, headers=headers, params=query_values)
cast["params"] = query_values
async with aiohttp.ClientSession() as session:
async with session.get(api_call_url, **cast) as response_raw: