Skip to content

Commit

Permalink
Merge pull request #352 from OpenBankProject/develop
Browse files Browse the repository at this point in the history
release update
  • Loading branch information
karmaking authored Dec 14, 2023
2 parents 460193e + 5482acb commit a9497f2
Show file tree
Hide file tree
Showing 34 changed files with 20,394 additions and 563 deletions.
2 changes: 1 addition & 1 deletion apimanager/apicollections/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ def apicollections_update(request):
'is_sharable': True if request.POST.get('api_collection_is_sharable').strip().lower() == "true" else False,
'description': request.POST.get('api_collection_description').strip()
}
result = api.put(urlpath, payload=payload, version=settings.API_ROOT['v510'])
result = api.put(urlpath, payload=payload, version=settings.API_VERSION['v510'])
return result


Expand Down
15 changes: 8 additions & 7 deletions apimanager/apimanager/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
'base.context_processors.api_root',
'base.context_processors.api_version_processor',
'base.context_processors.api_username',
'base.context_processors.api_user_id',
'base.context_processors.api_tester_url',
Expand Down Expand Up @@ -251,6 +251,9 @@
#Map Java: yyyy-MM-dd'T'HH:mm:ss.SSS'Z'
API_DATE_FORMAT_WITH_MILLISECONDS = '%Y-%m-%dT%H:%M:%S.%fZ'

# the API_Manager the web form datetime format, eg: 2023-11-28 10:49:27
API_DATE_FORMAT_WITH_DAY_DATE_TIME = '%Y-%m-%d %H:%M:%S'

# the API_Manager the web form date format, eg: 2020-10-11
API_DATE_FORMAT_WITH_DAY = '%Y-%m-%d'
API_FIELD_TIME_FORMAT = '%H-%M-%S'
Expand Down Expand Up @@ -319,8 +322,6 @@
# Global
UNDEFINED = "<undefined>"

API_ROOT_KEY = "v500"

# Local settings can replace any value ABOVE
try:
from apimanager.local_settings import * # noqa
Expand All @@ -331,8 +332,8 @@
OBPv500 = API_HOST + '/obp/v5.0.0'
OBPv510 = API_HOST + '/obp/v5.1.0'

# Settings here might use parts overwritten in local settings
API_ROOT = {
# API Versions
API_VERSION = {
"v500": OBPv500,
"v510": OBPv510
}
Expand All @@ -354,8 +355,8 @@

CSP_IMG_SRC = ("'self' data:", 'https://static.openbankproject.com')
CSP_STYLE_SRC = ("'self' 'sha256-z2a+NIknPDE7NIEqE1lfrnG39eWOhJXWsXHYGGNb5oU=' 'sha256-Dn0vMZLidJplZ4cSlBMg/F5aa7Vol9dBMHzBF4fGEtk=' 'sha256-sA0hymKbXmMTpnYi15KmDw4u6uRdLXqHyoYIaORFtjU=' 'sha256-jUuiwf3ITuJc/jfynxWHLwTZifHIlhddD8NPmmVBztk=' 'sha256-RqzjtXRBqP4i+ruV3IRuHFq6eGIACITqGbu05VSVXsI='", 'https://cdnjs.cloudflare.com', )
CSP_SCRIPT_SRC = ("'self' 'unsafe-eval' 'sha256-4Hr8ttnXaUA4A6o0hGi3NUGNP2Is3Ep0W+rvm+W7BAk=' 'sha256-GgQWQ4Ejk4g9XpAZJ4YxIgZDgp7CdQCmqjMOMh9hD2g=' 'sha256-05NIAwVBHkAzKcXTfkYqTnBPtkpX+AmQvM/raql3qo0='", 'http://code.jquery.com', 'https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/', 'https://cdnjs.cloudflare.com')
CSP_SCRIPT_SRC = ("'self' 'unsafe-eval' 'sha256-CAykt4V7LQN6lEkjV8hZQx0GV6LTZZGUvQDqamuUq2Q=' 'sha256-4Hr8ttnXaUA4A6o0hGi3NUGNP2Is3Ep0W+rvm+W7BAk=' 'sha256-GgQWQ4Ejk4g9XpAZJ4YxIgZDgp7CdQCmqjMOMh9hD2g=' 'sha256-05NIAwVBHkAzKcXTfkYqTnBPtkpX+AmQvM/raql3qo0='", 'http://code.jquery.com', 'https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/', 'https://cdnjs.cloudflare.com')
CSP_FONT_SRC = ("'self'", 'http://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/fonts/')
CSP_FRAME_ANCESTORS = ("'self'")
CSP_FORM_ACTION = ("'self'")
CSP_CONNECT_SRC = (API_HOST)
CSP_CONNECT_SRC = ("'self'", API_HOST)
8 changes: 4 additions & 4 deletions apimanager/atms/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ class UpdateAtmsView(LoginRequiredMixin, FormView):
template_name = "atms/update.html"
success_url = '/atms/list'
form_class = CreateAtmForm
v510 = settings.API_ROOT['v510']
v510 = settings.API_VERSION['v510']

def dispatch(self, request, *args, **kwargs):
self.api = API(request.session.get('obp'))
Expand Down Expand Up @@ -410,7 +410,7 @@ def atm_attribute_save(request):
'value': request.POST.get('value').strip(),
'is_active': True
}
result = api.post(urlpath_save, payload = payload, version=settings.API_ROOT['v510'])
result = api.post(urlpath_save, payload = payload, version=settings.API_VERSION['v510'])
return result


Expand All @@ -428,7 +428,7 @@ def atm_attribute_update(request):
'value': request.POST.get('value').strip(),
'is_active': True
}
result = api.put(urlpath_update, payload=payload, version=settings.API_ROOT['v510'])
result = api.put(urlpath_update, payload=payload, version=settings.API_VERSION['v510'])
return result


Expand All @@ -441,7 +441,7 @@ def atm_attribute_delete(request):

api = API(request.session.get('obp'))
urlpath_delete = '/banks/{}/atms/{}/attributes/{}'.format(bank_id, atm_id, atm_attribute_id)
result = api.delete(urlpath_delete, version=settings.API_ROOT['v510'])
result = api.delete(urlpath_delete, version=settings.API_VERSION['v510'])
return result


Expand Down
14 changes: 4 additions & 10 deletions apimanager/banks/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class UpdateBanksView(LoginRequiredMixin, FormView):
template_name = "banks/update.html"
form_class = CreateBankForm
success_url = '/banks/list'
v510 = settings.API_ROOT['v510']
v510 = settings.API_VERSION['v510']

def dispatch(self, request, *args, **kwargs):
self.api = API(request.session.get('obp'))
Expand Down Expand Up @@ -111,8 +111,6 @@ def get_form(self, *args, **kwargs):
fields['bank_routings_scheme'].initial = result['bank_routings'][0]["scheme"]
fields['bank_routings_address'].initial = result['bank_routings'][0]["address"]
except Exception as err:
if DEBUG:
raise(err)
messages.error(self.request, "Unknown Error {}".format(err))
return form

Expand All @@ -138,13 +136,9 @@ def form_valid(self, form):
messages.error(self.request, result['message'])
return super(UpdateBanksView, self).form_invalid(form)
except APIError as err:
if DEBUG:
raise(err)
messages.error(self.request, err)
return super(UpdateBanksView, self).form_invalid(form)
except Exception as e:
if DEBUG:
raise(err)
messages.error(self.request, e)
return super(UpdateBanksView, self).form_invalid(form)
msg = 'Bank {} has been updated successfully!'.format( # noqa
Expand Down Expand Up @@ -183,7 +177,7 @@ def bank_attribute_save(request):
'value': request.POST.get('value').strip(),
'is_active': True
}
result = api.post(urlpath_save, payload = payload, version=settings.API_ROOT['v510'])
result = api.post(urlpath_save, payload = payload, version=settings.API_VERSION['v510'])
return result


Expand All @@ -201,7 +195,7 @@ def bank_attribute_update(request):
'value': request.POST.get('value').strip(),
'is_active': True
}
result = api.put(urlpath_update, payload=payload, version=settings.API_ROOT['v510'])
result = api.put(urlpath_update, payload=payload, version=settings.API_VERSION['v510'])
return result


Expand All @@ -212,6 +206,6 @@ def bank_attribute_delete(request):
bank_attribute_id = request.POST.get('bank_attribute_id').strip()
api = API(request.session.get('obp'))
urlpath_delete = '/banks/{}/attributes/{}'.format(bank_id, bank_attribute_id)
result = api.delete(urlpath_delete, version=settings.API_ROOT['v510'])
result = api.delete(urlpath_delete, version=settings.API_VERSION['v510'])
return result

6 changes: 3 additions & 3 deletions apimanager/base/context_processors.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@

USER_CURRENT = "/users/current"

def api_root(request):
"""Returns the configured API_ROOT"""
return {'API_ROOT': settings.API_ROOT['v500']}
def api_version_processor(request):
"""Returns the configured API_VERSION"""
return {'API_VERSION': settings.API_VERSION['v500']}


def portal_page(request):
Expand Down
Loading

0 comments on commit a9497f2

Please sign in to comment.