Allow checking pending transactions
This commit is contained in:
@@ -305,12 +305,25 @@ class NordigenClient(BaseClient, AggregatorClient):
|
||||
"""
|
||||
path = f"accounts/{account_id}/transactions"
|
||||
response = await self.call(path, schema="Transactions")
|
||||
parsed = response["booked"]
|
||||
self.normalise_transactions(parsed, state="booked")
|
||||
|
||||
source = "booked"
|
||||
|
||||
# If requisition is specified, try to get the object
|
||||
# If present, take the transaction source from there,
|
||||
# pending or booked.
|
||||
if req:
|
||||
requisition = self.instance.get_requisition(req)
|
||||
if requisition:
|
||||
source = requisition.transaction_source
|
||||
|
||||
parsed = response[source]
|
||||
self.normalise_transactions(parsed, state=source)
|
||||
|
||||
if process:
|
||||
await self.process_transactions(account_id, parsed, req=req)
|
||||
if pending:
|
||||
if process:
|
||||
raise Exception("Cannot process and get pending")
|
||||
parsed_pending = response["pending"]
|
||||
self.normalise_transactions(parsed_pending, state="pending")
|
||||
parsed_pending.extend(parsed)
|
||||
|
||||
Reference in New Issue
Block a user