From faa71dc2edb6ace8555f49d1738a7f48d9508b3f Mon Sep 17 00:00:00 2001 From: Mark Veidemanis Date: Sat, 1 Jan 2022 20:27:30 +0000 Subject: [PATCH] Add more debugging --- handler/transactions.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/handler/transactions.py b/handler/transactions.py index d1e0f00..cbcc991 100644 --- a/handler/transactions.py +++ b/handler/transactions.py @@ -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 :)")