From 4ff687563815143b7620bb49dd6f9a0a638b6878 Mon Sep 17 00:00:00 2001 From: Mark Veidemanis Date: Wed, 29 Dec 2021 15:26:23 +0000 Subject: [PATCH] Allow using TX or reference for payment reference --- handler/transactions.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/handler/transactions.py b/handler/transactions.py index 0966b14..900347b 100644 --- a/handler/transactions.py +++ b/handler/transactions.py @@ -78,11 +78,18 @@ class Transactions(object): self.irc.client.msg( self.irc.client.channel, f"AUTO Incoming transaction: {amount}{currency} ({reference}) - {state} - {description}" ) - stored_trade = r.hgetall(f"trade.{reference}") + stored_trade = self.get_ref(reference) if not stored_trade: self.log.info(f"No reference in DB for {reference}") + self.irc.client.msg(self.irc.client.channel, f"No reference in DB for {reference}") + ref2 = self.tx_to_ref(reference) + if not ref2: + self.log.info("No TXID in DB for {reference}") + self.irc.client.msg(self.irc.client.channel, f"No TXID in DB for {reference}") return - stored_trade = convert(stored_trade) + else: + reference = ref2 + amount = float(amount) stored_trade["amount"] = float(stored_trade["amount"]) if not stored_trade["currency"] == currency: @@ -103,7 +110,7 @@ class Transactions(object): if not account_type == "revolut": self.irc.client.msg(self.irc.client.channel, f"Account type is not Revolut: {account_type}") return - self.irc.client.msg(self.irc.client.channel, f"All checks passed, would release funds for {stored_trade['id']}") + self.irc.client.msg(self.irc.client.channel, f"All checks passed, would release funds for {stored_trade['id']} / {reference}") def new_trade(self, trade_id, buyer, currency, amount, amount_xmr): """