From 7d9679f2d5cffe64d65f8d43f5143a9f56f68876 Mon Sep 17 00:00:00 2001 From: Mark Veidemanis Date: Thu, 21 Apr 2022 20:45:27 +0100 Subject: [PATCH] Add the recipient to the account details --- handler/markets.py | 1 + handler/sinks/nordigen.py | 2 ++ handler/ux/commands.py | 14 ++++++++++++++ 3 files changed, 17 insertions(+) diff --git a/handler/markets.py b/handler/markets.py index 06b6a84..b32eee3 100644 --- a/handler/markets.py +++ b/handler/markets.py @@ -197,6 +197,7 @@ class Markets(util.Base): if account["currency"] == currency: currency_account_info_map[currency] = account["account_number"] currency_account_info_map[currency]["bank"] = bank.split("_")[0] + currency_account_info_map[currency]["recipient"] = account["recipient"] return (supported_currencies, currency_account_info_map) def get_matching_account_details(self, platform, currency): diff --git a/handler/sinks/nordigen.py b/handler/sinks/nordigen.py index 62d5be9..74254a8 100644 --- a/handler/sinks/nordigen.py +++ b/handler/sinks/nordigen.py @@ -247,11 +247,13 @@ class Nordigen(util.Base): if "bban" in parsed and parsed["currency"] == "GBP": sort_code = parsed["bban"][0:6] account_number = parsed["bban"][6:] + recipient = parsed["ownerName"] del parsed["bban"] del parsed["iban"] sort_code = "-".join(list(map("".join, zip(*[iter(sort_code)] * 2)))) parsed["sort_code"] = sort_code parsed["number"] = account_number + parsed["recipient"] = recipient # Let's add the account ID so we can reference it later parsed["account_id"] = account_id return parsed diff --git a/handler/ux/commands.py b/handler/ux/commands.py index d36e868..3c3c007 100644 --- a/handler/ux/commands.py +++ b/handler/ux/commands.py @@ -939,3 +939,17 @@ class IRCCommands(object): identifier = spl[1] verified = ux.verify.get_external_user_id_status(identifier) msg(f"Verification status: {verified}") + + class bankdetails(object): + name = "bankdetails" + authed = True + helptext = "Get the bank details for a platform. Usage: bankdetails " + + @staticmethod + def run(cmd, spl, length, authed, msg, agora, tx, ux): + if length == 3: + platform = spl[1] + currency = spl[2] + account_info = tx.markets.get_matching_account_details(platform, currency) + bank_details = tx.markets.format_payment_details(currency, account_info, real=True) + msg(bank_details)