Add more debugging

This commit is contained in:
Mark Veidemanis 2022-01-01 20:27:30 +00:00
parent 4053dce048
commit faa71dc2ed
Signed by: m
GPG Key ID: 5ACFCEED46C0904F
1 changed files with 19 additions and 1 deletions

View File

@ -129,7 +129,7 @@ class Transactions(object):
if not stored_trade:
stored_trade = self.get_ref(stored_trade_reference.pop())
if not stored_trade:
self.log.info(f"No reference in DB for {reference}", reference=reference)
self.log.info("No reference in DB for {reference}", reference=reference)
self.irc.sendmsg(f"No reference in DB for {reference}")
return
@ -138,6 +138,11 @@ class Transactions(object):
# Make sure it was sent in the expected currency
if not stored_trade["currency"] == currency:
self.log.info(
"Currency mismatch, Agora: {currency_agora} / Revolut: {currency}",
currency_agora=stored_trade["currency"],
currency=currency,
)
self.irc.sendmsg(f"Currency mismatch, Agora: {stored_trade['currency']} / Revolut: {currency}")
return
@ -147,14 +152,27 @@ class Transactions(object):
return
# If the amount does not match exactly, get the min and max values for our given acceptable margins for trades
min_amount, max_amount = self.agora.get_acceptable_margins(currency, amount)
self.log.info(
"Amount does not match exactly, trying with margins: min: {min_amount} / max: {max_amount}",
min_amount=min_amount,
max_amount=max_amount,
)
self.irc.sendmsg(f"Amount does not match exactly, trying with margins: min: {min_amount} / max: {max_amount}")
if not min_amount < stored_trade["amount"] < max_amount:
self.log.info(
"Amount mismatch - not in margins: {amount} (min: {min_amount} / max: {max_amount}",
amount=stored_trade["amount"],
min_amount=min_amount,
max_amount=max_amount,
)
self.irc.sendmsg(f"Amount mismatch - not in margins: {stored_trade['amount']} (min: {min_amount} / max: {max_amount}")
return
# Make sure the account type was Revolut, as these are completed instantly
if not account_type == "revolut":
self.log.info("Account type is not Revolut: {account_type}", account_type=account_type)
self.irc.sendmsg(f"Account type is not Revolut: {account_type}")
return
self.log.info("All checks passed, releasing funds for {trade_id} {reference}", trade_id=stored_trade["id"], reference=reference)
self.irc.sendmsg(f"All checks passed, releasing funds for {stored_trade['id']} / {reference}")
# rtrn = self.agora.release_funds(stored_trade["id"])
# self.agora.agora.contact_message_post(stored_trade["id"], "Thanks! Releasing now :)")