From 5ae838b55fb7e1264a551e17bfce6e3c379e462e Mon Sep 17 00:00:00 2001 From: Mark Veidemanis Date: Thu, 9 Mar 2023 18:28:50 +0000 Subject: [PATCH] Add schemas for account balances --- core/clients/aggregators/nordigen.py | 2 +- core/lib/schemas/nordigen_s.py | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/core/clients/aggregators/nordigen.py b/core/clients/aggregators/nordigen.py index 71d325d..0f03dfa 100644 --- a/core/clients/aggregators/nordigen.py +++ b/core/clients/aggregators/nordigen.py @@ -180,7 +180,7 @@ class NordigenClient(BaseClient, AggregatorClient): """ path = f"accounts/{account_id}/balances" - response = await self.call(path, schema="AccountBalance") + response = await self.call(path, schema="AccountBalances") total = 0 currency = None diff --git a/core/lib/schemas/nordigen_s.py b/core/lib/schemas/nordigen_s.py index 9a4da5a..216321f 100644 --- a/core/lib/schemas/nordigen_s.py +++ b/core/lib/schemas/nordigen_s.py @@ -128,3 +128,20 @@ class AccountDetails(BaseModel): AccountDetailsSchema = { "account": "account", } + + +class AccountBalance(BaseModel): + balanceAmount: dict[str, str] + balanceType: str + referenceDate: str + + +class AccountBalances(BaseModel): + balances: list[AccountBalance] + summary: str | None + + +AccountBalancesSchema = { + "balances": "balances", + "summary": "summary", +}