From aefa6c58a4f517346ff408b78725681e3d6f81f7 Mon Sep 17 00:00:00 2001 From: Mark Veidemanis Date: Mon, 7 Mar 2022 20:10:59 +0000 Subject: [PATCH] Call the base class from TrueLayer with our fetched transactions --- handler/sinks/__init__.py | 14 ++++++++++++++ handler/ux/commands.py | 3 ++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/handler/sinks/__init__.py b/handler/sinks/__init__.py index ad26b99..c4c0af6 100644 --- a/handler/sinks/__init__.py +++ b/handler/sinks/__init__.py @@ -8,6 +8,7 @@ import sinks.fidor import sinks.nordigen import sinks.truelayer import util +from db import r class Sinks(util.Base): @@ -24,3 +25,16 @@ class Sinks(util.Base): def got_transactions(self, bank, account_id, transactions): print("GOT transactions", bank, account_id, transactions) + transaction_ids = [x["transaction_id"] for x in transactions] + print("IDS", transaction_ids) + new_key_name = f"new.transactions.{bank}.{account_id}" + old_key_name = f"transactions.{bank}.{account_id}" + r.sset(new_key_name, transaction_ids) + + difference = r.sdiff(new_key_name, old_key_name) + print("difference", difference) + + # Rename the new key to the old key so we can run the diff again + r.rename(new_key_name, old_key_name) + + # self.transactions.transaction(transactions) diff --git a/handler/ux/commands.py b/handler/ux/commands.py index 2e9eaf2..7923f9b 100644 --- a/handler/ux/commands.py +++ b/handler/ux/commands.py @@ -462,7 +462,8 @@ class IRCCommands(object): if length == 2: account = spl[1] accounts = tx.sinks.truelayer.get_accounts(account) - msg(dumps(accounts)) + for account in accounts["results"]: + msg(f"{account['account_id']} {account['display_name']} {account['currency']}") class transactions(object): name = "transactions"