From 848130d2cecb0116972a4301dcb814e07c6fb914 Mon Sep 17 00:00:00 2001 From: Mark Veidemanis Date: Tue, 14 Jun 2022 08:19:11 +0100 Subject: [PATCH] Fix fetching balance from Nordigen --- handler/sinks/nordigen.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/handler/sinks/nordigen.py b/handler/sinks/nordigen.py index 46b71b2..a498f1d 100644 --- a/handler/sinks/nordigen.py +++ b/handler/sinks/nordigen.py @@ -447,15 +447,15 @@ class Nordigen(util.Base): except ValidationError as err: self.log.error(f"Validation error: {err}") return (False, False) - parsed = obj.to_dict()["balances"] + parsed = obj.to_dict() total = 0 currency = None - for entry in parsed: + for entry in parsed["balances"]: if currency: if not currency == entry["balanceAmount"]["currency"]: self.log.error("Different currencies in balance query.") return (False, False) - if not entry["balanceType"] == "interimBooked": + if not entry["balanceType"] == "expected": continue total += float(entry["balanceAmount"]["amount"]) currency = entry["balanceAmount"]["currency"]