Add definitions for all Nordigen API calls

This commit is contained in:
Mark Veidemanis 2023-03-08 18:38:53 +00:00
parent a49459da6d
commit de04f8d29b
Signed by: m
GPG Key ID: 5ACFCEED46C0904F
4 changed files with 51 additions and 6 deletions

View File

@ -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}"

View File

@ -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",
}

View File

@ -25,7 +25,7 @@
</td>
<td>{{ item.created }}</td>
<td>{{ item.institution_id }}</td>
<td>{{ item.accounts }}</td>
<td>{{ item.accounts|length }}</td>
<td>
<div class="buttons">
<button

View File

@ -76,7 +76,6 @@ class ReqsList(LoginRequiredMixin, OTPRequiredMixin, ObjectList):
run = synchronize_async_helper(NordigenClient(aggregator))
reqs = synchronize_async_helper(run.get_requisitions())
print("REQS", reqs)
return reqs
@ -115,7 +114,6 @@ class AggregatorCountriesList(LoginRequiredMixin, OTPRequiredMixin, ObjectList):
)
run = synchronize_async_helper(NordigenClient(aggregator))
countries = synchronize_async_helper(run.get_countries())
print("COUNTRIES", countries)
self.extra_args = {"pk": pk}
return countries
@ -158,7 +156,6 @@ class AggregatorCountryBanksList(LoginRequiredMixin, OTPRequiredMixin, ObjectLis
)
run = synchronize_async_helper(NordigenClient(aggregator))
banks = synchronize_async_helper(run.get_banks(country))
print("BANKS", banks)
return banks
@ -232,7 +229,6 @@ class ReqInfo(LoginRequiredMixin, OTPRequiredMixin, ObjectRead):
return self.render_to_response(context)
run = synchronize_async_helper(NordigenClient(aggregator))
req = synchronize_async_helper(run.get_all_account_info(req_id))
print("REQ KEYS", req.keys())
self.extra_context = {"pretty": list(req.keys())}
return req