From 2a8c56ead59c943e967c5e5acdd12fca727d22ab Mon Sep 17 00:00:00 2001 From: Mark Veidemanis Date: Fri, 4 Mar 2022 22:21:12 +0000 Subject: [PATCH] Remove references to Revolut in Transactions --- handler/transactions.py | 33 ++++++++++++++------------------- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/handler/transactions.py b/handler/transactions.py index 997b9af..086659b 100644 --- a/handler/transactions.py +++ b/handler/transactions.py @@ -225,11 +225,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 mismatch, Agora: {currency_agora} / Sink: {currency}", currency_agora=stored_trade["currency"], currency=currency, ) - self.irc.sendmsg(f"Currency mismatch, Agora: {stored_trade['currency']} / Revolut: {currency}") + self.irc.sendmsg(f"Currency mismatch, Agora: {stored_trade['currency']} / Sink: {currency}") return # Make sure the expected amount was sent @@ -253,11 +253,6 @@ class Transactions(object): ) 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 # We have made it this far without hitting any of the returns, so let's set valid = True # This will let us instantly release if the type is pending, and it is subsequently updated to completed with a callback. @@ -320,7 +315,7 @@ class Transactions(object): """ Get a trade reference that matches the given currency and amount. Only works if there is one result. - :param txid: Revolut transaction ID + :param txid: Sink transaction ID :param currency: currency :param amount: amount :type txid: string @@ -438,9 +433,7 @@ class Transactions(object): :return: value in USD :rtype float: """ - total_usd_revolut = self.revolut.get_total_usd() - if total_usd_revolut is False: - return False + # TODO: get Sink totals agora_wallet_xmr = self.agora.agora.wallet_balance_xmr() if not agora_wallet_xmr["success"]: return False @@ -463,7 +456,9 @@ class Transactions(object): # Add it all up total_usd_agora = total_usd_agora_xmr + total_usd_agora_btc - total_usd = total_usd_agora + total_usd_revolut + # total_usd = total_usd_agora + total_usd_revolut + # TODO: add sinks value here + total_usd = total_usd_agora cast_es = { "price_usd": total_usd, "total_usd_agora_xmr": total_usd_agora_xmr, @@ -472,7 +467,7 @@ class Transactions(object): "total_btc_agora": total_btc_agora, "xmr_usd": xmr_usd["monero"]["usd"], "btc_usd": btc_usd["bitcoin"]["usd"], - "total_usd_revolut": total_usd_revolut, + # "total_usd_sinks": total_usd_sinks, "total_usd_agora": total_usd_agora, } self.write_to_es("get_total_usd", cast_es) @@ -486,10 +481,8 @@ class Transactions(object): :return: ((total SEK, total USD, total GBP), (total XMR USD, total BTC USD), (total XMR, total BTC)) :rtype: tuple(tuple(float, float, float), tuple(float, float), tuple(float, float)) """ - total_usd_revolut = self.revolut.get_total_usd() - if total_usd_revolut is False: - self.log.error("Could not get USD total.") - return False + # TODO: get sinks value here + # total_usd_revolut = self.revolut.get_total_usd() agora_wallet_xmr = self.agora.agora.wallet_balance_xmr() if not agora_wallet_xmr["success"]: self.log.error("Could not get Agora XMR wallet total.") @@ -514,7 +507,9 @@ class Transactions(object): # Add it all up total_usd_agora = total_usd_agora_xmr + total_usd_agora_btc - total_usd = total_usd_agora + total_usd_revolut + # total_usd = total_usd_agora + total_usd_revolut + # TODO: add sinks value here + total_usd = total_usd_agora # Convert the total USD price to GBP and SEK rates = self.money.get_rates_all() @@ -538,7 +533,7 @@ class Transactions(object): "total_btc_agora": total_btc_agora, "xmr_usd": xmr_usd["monero"]["usd"], "btc_usd": btc_usd["bitcoin"]["usd"], - "total_usd_revolut": total_usd_revolut, + # "total_usd_revolut": total_usd_revolut, "total_usd_agora": total_usd_agora, } self.write_to_es("get_total", cast_es)