From 144e048d5f2565c44a5dcd908219d3b1b21883f6 Mon Sep 17 00:00:00 2001 From: Mark Veidemanis Date: Wed, 8 Mar 2023 15:44:21 +0000 Subject: [PATCH] Allow deleting requisitions --- app/urls.py | 6 ++++ core/clients/aggregators/nordigen.py | 15 ++++++--- core/templates/partials/aggregator-info.html | 2 +- core/views/aggregators.py | 32 ++++++++++++++++++-- 4 files changed, 48 insertions(+), 7 deletions(-) diff --git a/app/urls.py b/app/urls.py index d379637..2575b4f 100644 --- a/app/urls.py +++ b/app/urls.py @@ -81,4 +81,10 @@ urlpatterns = [ aggregators.AggregatorLinkBank.as_view(), name="aggregator_link", ), + # Delete requisition + path( + "aggs//delete///", + aggregators.ReqDelete.as_view(), + name="req_delete", + ), ] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) diff --git a/core/clients/aggregators/nordigen.py b/core/clients/aggregators/nordigen.py index 2dfe375..06f95ac 100644 --- a/core/clients/aggregators/nordigen.py +++ b/core/clients/aggregators/nordigen.py @@ -36,14 +36,11 @@ class NordigenClient(BaseClient): } response = await self.call("token/new", http_method="post", data=data) - print("RESPONSE IN GET ACCESS TOKEN", response) # access = response["access"] access_expires = response["access_expires"] - print("ACCESS EXPIRES", access_expires) now = timezone.now() # Offset now by access_expires seconds access_expires = now + timedelta(seconds=access_expires) - print("ACCESS EXPIRES", access_expires) self.instance.access_token = access self.instance.access_token_expires = access_expires self.instance.save() @@ -93,7 +90,17 @@ class NordigenClient(BaseClient): response = await self.call( "requisitions", schema="RequisitionsPost", http_method="post", data=data ) - print("build_link response", response) if "link" in response: return response["link"] return False + + async def delete_requisition(self, requisition_id): + """ + Delete a requisision ID. + """ + path = f"requisitions/{requisition_id}" + + response = await self.call( + path, schema="RequisitionDelete", http_method="delete" + ) + return response diff --git a/core/templates/partials/aggregator-info.html b/core/templates/partials/aggregator-info.html index 684a500..abce5bf 100644 --- a/core/templates/partials/aggregator-info.html +++ b/core/templates/partials/aggregator-info.html @@ -30,7 +30,7 @@