From de04f8d29bcdde7677882630f82954c88762a229 Mon Sep 17 00:00:00 2001 From: Mark Veidemanis Date: Wed, 8 Mar 2023 18:38:53 +0000 Subject: [PATCH] Add definitions for all Nordigen API calls --- core/clients/base.py | 1 - core/lib/schemas/nordigen_s.py | 50 ++++++++++++++++++++ core/templates/partials/aggregator-info.html | 2 +- core/views/aggregators.py | 4 -- 4 files changed, 51 insertions(+), 6 deletions(-) diff --git a/core/clients/base.py b/core/clients/base.py index 55988a6..ade822c 100644 --- a/core/clients/base.py +++ b/core/clients/base.py @@ -131,7 +131,6 @@ class BaseClient(ABC): "headers": DEFAULT_HEADERS, } - print("TOKEN", self.token) # Use the token if it's set if self.token is not None: cast["headers"]["Authorization"] = f"Bearer {self.token}" diff --git a/core/lib/schemas/nordigen_s.py b/core/lib/schemas/nordigen_s.py index 00ac771..c50986c 100644 --- a/core/lib/schemas/nordigen_s.py +++ b/core/lib/schemas/nordigen_s.py @@ -75,3 +75,53 @@ RequisitionsPostSchema = { "account_selection": "account_selection", "redirect_immediate": "redirect_immediate", } + + +class Requisition(BaseModel): + id: str + created: str + redirect: str + status: str + institution_id: str + agreement: str + reference: str + accounts: list[str] + link: str + ssn: str | None + account_selection: bool + redirect_immediate: bool + + +RequisitionSchema = { + "id": "id", + "created": "created", + "redirect": "redirect", + "status": "status", + "institution_id": "institution_id", + "agreement": "agreement", + "reference": "reference", + "accounts": "accounts", + "link": "link", + "ssn": "ssn", + "account_selection": "account_selection", + "redirect_immediate": "redirect_immediate", +} + + +class AccountDetailsNested(BaseModel): + resourceId: str + currency: str + ownerName: str + cashAccountType: str + status: str + maskedPan: str | None + details: str + + +class AccountDetails(BaseModel): + account: AccountDetailsNested + + +AccountDetailsSchema = { + "account": "account", +} diff --git a/core/templates/partials/aggregator-info.html b/core/templates/partials/aggregator-info.html index 1669b7e..28aa55b 100644 --- a/core/templates/partials/aggregator-info.html +++ b/core/templates/partials/aggregator-info.html @@ -25,7 +25,7 @@ {{ item.created }} {{ item.institution_id }} - {{ item.accounts }} + {{ item.accounts|length }}