Allow using TX or reference for payment reference

This commit is contained in:
Mark Veidemanis 2021-12-29 15:26:23 +00:00
parent 23372bd491
commit 4ff6875638
Signed by: m
GPG Key ID: 5ACFCEED46C0904F
1 changed files with 10 additions and 3 deletions

View File

@ -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):
"""