Fix fetching balance from Nordigen

This commit is contained in:
Mark Veidemanis 2022-06-14 08:19:11 +01:00
parent e5ba8a1273
commit 848130d2ce
Signed by: m
GPG Key ID: 5ACFCEED46C0904F
1 changed files with 3 additions and 3 deletions

View File

@ -447,15 +447,15 @@ class Nordigen(util.Base):
except ValidationError as err: except ValidationError as err:
self.log.error(f"Validation error: {err}") self.log.error(f"Validation error: {err}")
return (False, False) return (False, False)
parsed = obj.to_dict()["balances"] parsed = obj.to_dict()
total = 0 total = 0
currency = None currency = None
for entry in parsed: for entry in parsed["balances"]:
if currency: if currency:
if not currency == entry["balanceAmount"]["currency"]: if not currency == entry["balanceAmount"]["currency"]:
self.log.error("Different currencies in balance query.") self.log.error("Different currencies in balance query.")
return (False, False) return (False, False)
if not entry["balanceType"] == "interimBooked": if not entry["balanceType"] == "expected":
continue continue
total += float(entry["balanceAmount"]["amount"]) total += float(entry["balanceAmount"]["amount"])
currency = entry["balanceAmount"]["currency"] currency = entry["balanceAmount"]["currency"]