Update bank done

This commit is contained in:
Reena Aheer 2023-04-06 14:59:30 +02:00
parent 12b0eddb7d
commit c94e995827
7 changed files with 12 additions and 13 deletions

View File

@ -27,7 +27,7 @@ class AccountListView(IndexAccountsView, LoginRequiredMixin, FormView ):
#self.bankids = self.get_banks()
accounts_list = []
#for bank_id in self.bankids:
urlpath = 'v5.1.0/my/accounts'
urlpath = '/my/accounts'
result = api.get(urlpath)
if 'accounts' in result:
accounts_list.extend(result['accounts'])
@ -55,7 +55,7 @@ class ExportCsvView(LoginRequiredMixin, View):
self.bankids = get_banks(self.request)
accounts_list = []
for bank_id in self.bankids:
urlpath = 'v5.1.0/banks/{}/accounts'.format(bank_id)
urlpath = '/banks/{}/accounts'.format(bank_id)
result = api.get(urlpath)
if 'accounts' in result:
accounts_list.extend(result['accounts'])

View File

@ -260,7 +260,7 @@ 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_VERSION = '5.1.0'
API_VERSION = '5.1.0'
# URL to API Tester
API_TESTER_URL = 'https://www.example.com'
@ -320,10 +320,9 @@ except ImportError:
# 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_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
API_URL_SWAGGER = API_HOST + '/obp/v1.4.0/resource-docs/v5.1.0/swagger' # noqa
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:

View File

@ -23,7 +23,7 @@ class BankListView(IndexBanksView, LoginRequiredMixin, FormView ):
def get_banks(self,context):
api = API(self.request.session.get('obp'))
try:
urlpath = 'v5.1.0/banks'
urlpath = '/banks'
result = api.get(urlpath)
banks_list = []
if 'banks' in result:

View File

@ -44,7 +44,7 @@ class IndexBanksView(LoginRequiredMixin, FormView):
def form_valid(self, form):
try:
data = form.cleaned_data
urlpath = 'v5.1.0/banks'
urlpath = '/banks'
payload ={
"id": data["bank_id"],
"bank_code": data["bank_code"],
@ -96,7 +96,7 @@ class UpdateBanksView(LoginRequiredMixin, FormView):
messages.error(self.request, err)
try:
urlpath = 'v5.1.0/banks/{}'.format(self.kwargs["bank_id"])
urlpath = '/banks/{}'.format(self.kwargs["bank_id"])
result = self.api.get(urlpath)
fields['bank_id'].initial = self.kwargs['bank_id']
fields['bank_code'].initial = result['bank_code']
@ -116,7 +116,7 @@ class UpdateBanksView(LoginRequiredMixin, FormView):
def form_valid(self, form):
data = form.cleaned_data
print("data is:", data)
urlpath = 'v5.1.0/banks'
urlpath = '/banks'
payload ={
"id": data["bank_id"],
"bank_code": data["bank_code"],

View File

@ -12,7 +12,7 @@ from obp.api import API, APIError
def get_banks(request):
api = API(request.session.get('obp'))
try:
urlpath = 'v5.1.0/banks'
urlpath = '/banks'
result = api.get(urlpath)
if 'banks' in result:
return [bank['id'] for bank in sorted(result['banks'], key=lambda d: d['id'])]

View File

@ -29,7 +29,7 @@ class LoginToDjangoMixin(object):
# Here, we already get the Token for the api call.
api = API(self.request.session.get('obp'))
try:
data = api.get('v5.1.0/users/current')
data = api.get('/users/current')
except APIError as err:
messages.error(self.request, err)
except Exception as err:

View File

@ -23,7 +23,7 @@ class SystemView(LoginRequiredMixin, FormView):
api = API(self.request.session.get('obp'))
try:
system_view = []
urlpath = 'v5.1.0/system-views/owner'
urlpath = '/system-views/owner'
result = api.get(urlpath)
system_view = result
except APIError as err: