Group currency list by requisition

This commit is contained in:
2023-03-14 14:06:54 +00:00
parent a855e7e5b5
commit 4211d3c10a
8 changed files with 49 additions and 10 deletions

View File

@@ -76,7 +76,9 @@ class AggregatorClient(ABC):
)
# New transaction
await notify.sendmsg(
f"New transaction: {orjson.dumps(tx_cast)}", title="New transaction"
self.instance.user,
f"New transaction: {orjson.dumps(tx_cast)}",
title="New transaction",
)
await self.transaction(platforms, tx_obj)
else:

View File

@@ -124,7 +124,7 @@ class NordigenClient(BaseClient, AggregatorClient):
# ownernames = loads(settings.Nordigen.OwnerNames)
# return ownernames
async def get_account(self, account_id):
async def get_account(self, req_id, account_id):
"""
Get details of an account.
:param account_id: account ID"""
@@ -148,6 +148,7 @@ class NordigenClient(BaseClient, AggregatorClient):
# Let's add the account ID so we can reference it later
parsed["account_id"] = account_id
parsed["aggregator_id"] = str(self.instance.id)
parsed["requisition_id"] = str(req_id)
return parsed
async def get_all_account_info(self, requisition=None, store=False):
@@ -157,10 +158,11 @@ class NordigenClient(BaseClient, AggregatorClient):
else:
requisitions = [await self.get_requisition(requisition)]
print("REQS", requisitions)
for req in requisitions:
accounts = req["accounts"]
for account_id in accounts:
account_info = await self.get_account(account_id)
account_info = await self.get_account(req["id"], account_id)
if not account_info:
continue
if req["institution_id"] in to_return: