Implement getting bank account details
This commit is contained in:
@@ -3,7 +3,13 @@ import asyncio
|
||||
from django.contrib.auth.mixins import LoginRequiredMixin
|
||||
from django.http import HttpResponse
|
||||
from django.views import View
|
||||
from mixins.views import ObjectCreate, ObjectDelete, ObjectList, ObjectUpdate
|
||||
from mixins.views import (
|
||||
ObjectCreate,
|
||||
ObjectDelete,
|
||||
ObjectList,
|
||||
ObjectRead,
|
||||
ObjectUpdate,
|
||||
)
|
||||
from two_factor.views.mixins import OTPRequiredMixin
|
||||
|
||||
from core.clients.aggregators.nordigen import NordigenClient
|
||||
@@ -175,12 +181,9 @@ class AggregatorLinkBank(LoginRequiredMixin, OTPRequiredMixin, View):
|
||||
run = synchronize_async_helper(NordigenClient(aggregator))
|
||||
auth_url = synchronize_async_helper(run.build_link(bank))
|
||||
|
||||
# Redirect to auth url
|
||||
print("AUTH URL", auth_url)
|
||||
# Create a blank response
|
||||
response = HttpResponse()
|
||||
response["HX-Redirect"] = auth_url
|
||||
# return redirect(auth_url)
|
||||
return response
|
||||
|
||||
|
||||
@@ -207,6 +210,33 @@ class ReqDelete(LoginRequiredMixin, OTPRequiredMixin, View):
|
||||
return response
|
||||
|
||||
|
||||
class ReqInfo(LoginRequiredMixin, OTPRequiredMixin, ObjectRead):
|
||||
context_object_name_singular = "requisition"
|
||||
context_object_name = "requisitions"
|
||||
detail_template = "partials/aggregator-req-info.html"
|
||||
|
||||
def get_object(self, **kwargs):
|
||||
pk = kwargs.get("pk")
|
||||
req_id = kwargs.get("req_id")
|
||||
try:
|
||||
aggregator = Aggregator.get_by_id(pk, self.request.user)
|
||||
|
||||
except Aggregator.DoesNotExist:
|
||||
message = "Aggregator does not exist"
|
||||
message_class = "danger"
|
||||
context = {
|
||||
"message": message,
|
||||
"message_class": message_class,
|
||||
"window_content": self.window_content,
|
||||
}
|
||||
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
|
||||
|
||||
|
||||
class AggregatorList(LoginRequiredMixin, OTPRequiredMixin, ObjectList):
|
||||
list_template = "partials/aggregator-list.html"
|
||||
model = Aggregator
|
||||
|
||||
Reference in New Issue
Block a user