From 3d3e6ca06a1a43b0f99bce01de170b66542a4a57 Mon Sep 17 00:00:00 2001 From: Reena Aheer Date: Thu, 6 Apr 2023 15:02:49 +0200 Subject: [PATCH] Update bank done --- apimanager/accountlist/views.py | 2 +- apimanager/apimanager/settings.py | 4 ++-- apimanager/banks/views.py | 1 + apimanager/base/context_processors.py | 2 +- apimanager/obp/api.py | 2 +- 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/apimanager/accountlist/views.py b/apimanager/accountlist/views.py index 08fa42a..156c905 100644 --- a/apimanager/accountlist/views.py +++ b/apimanager/accountlist/views.py @@ -55,7 +55,7 @@ class ExportCsvView(LoginRequiredMixin, View): self.bankids = get_banks(self.request) accounts_list = [] for bank_id in self.bankids: - urlpath = '/banks/{}/accounts'.format(bank_id) + urlpath = 'banks/{}/accounts'.format(bank_id) result = api.get(urlpath) if 'accounts' in result: accounts_list.extend(result['accounts']) diff --git a/apimanager/apimanager/settings.py b/apimanager/apimanager/settings.py index 030a73f..f0df7a4 100644 --- a/apimanager/apimanager/settings.py +++ b/apimanager/apimanager/settings.py @@ -259,7 +259,7 @@ API_HOST = 'http://127.0.0.1:8080' API_EXPLORER_HOST = 'http://127.0.0.1:8082' # Only override this if you have a separate portal instance API_PORTAL = API_HOST -API_BASE_PATH = '/obp/' +API_BASE_PATH = '/obp/v' API_VERSION = '5.1.0' # URL to API Tester @@ -319,10 +319,10 @@ except ImportError: # DO NOT TRY TO DO SO YOU WILL BE IGNORED! # Settings here might use parts overwritten in local settings -#API_ROOT = API_HOST + API_BASE_PATH + API_VERSION API_ROOT = API_HOST + API_BASE_PATH + API_VERSION # For some reason, swagger is not available at the latest API version API_URL_SWAGGER = API_HOST + '/obp/v1.4.0/resource-docs/v' + API_VERSION + '/swagger' # noqa + if not OAUTH_CONSUMER_KEY: raise ImproperlyConfigured('Missing settings for OAUTH_CONSUMER_KEY') if not OAUTH_CONSUMER_SECRET: diff --git a/apimanager/banks/views.py b/apimanager/banks/views.py index 46e3a25..aebdf38 100644 --- a/apimanager/banks/views.py +++ b/apimanager/banks/views.py @@ -38,6 +38,7 @@ class IndexBanksView(LoginRequiredMixin, FormView): messages.error(self.request, err) except Exception as err: messages.error(self.request, err) + return form # Form Valid, when create a new Bank diff --git a/apimanager/base/context_processors.py b/apimanager/base/context_processors.py index 12801b7..1169fdc 100644 --- a/apimanager/base/context_processors.py +++ b/apimanager/base/context_processors.py @@ -9,7 +9,7 @@ from django.contrib import messages from obp.api import API, APIError, LOGGER from django.core.cache import cache -USER_CURRENT = "v5.1.0/users/current" +USER_CURRENT = "/users/current" def api_root(request): """Returns the configured API_ROOT""" diff --git a/apimanager/obp/api.py b/apimanager/obp/api.py index 28abcbb..5f976fc 100644 --- a/apimanager/obp/api.py +++ b/apimanager/obp/api.py @@ -156,7 +156,7 @@ class API(object): def get_bank_id_choices(self): """Gets a list of bank ids and bank ids as used by form choices""" choices = [('', _('Choose ...'))] - result = self.get('v5.1.0/banks') + result = self.get('/banks') for bank in sorted(result['banks'], key=lambda d: d['id']) : choices.append((bank['id'], bank['id'])) return choices