use the obp-api data to show into html page

This commit is contained in:
hongwei1 2019-08-18 08:21:25 +02:00
parent 2509ae0e7d
commit 1f017dc34c
3 changed files with 17 additions and 235 deletions

View File

@ -29,12 +29,12 @@
<label class="form-group">Parameters:</label> <br>
</div>
</div>
{% for method_routhing in method_routhings %}
{% for method_routing in method_routings %}
<div class="row">
<div class="runner">
<div class="col-xs-12 col-sm-2">
<div class="form-group" cols="1" rows="1" >
<strong id="method_name">{{ method_routhing.method_name }}</strong></div>
<strong id="method_name">{{ method_routing.method_name }}</strong></div>
</div>
<div class="col-xs-12 col-sm-2">
<select id="connector_name">
@ -47,7 +47,7 @@
<div class="col-xs-12 col-sm-2">
<textarea class="form-group"
rows="1"
name="bank_id_pattern">{{ method_routhing.bank_id_pattern }}</textarea>
name="bank_id_pattern">{{ method_routing.bank_id_pattern }}</textarea>
</div>
<div class="col-xs-12 col-sm-2" align="center">
<select id="is_bank_id_exact_match" >
@ -59,7 +59,7 @@
<textarea cols="40"
rows="1"
class="form-control"
name="parameters">{{ method_routhing.parameters }}</textarea>
name="parameters">{{ method_routing.parameters }}</textarea>
</div>
<div class="col-sm-12 col-sm-2">
<div class="form-group">

View File

@ -33,185 +33,21 @@ class IndexView(LoginRequiredMixin, FormView):
def get_context_data(self, **kwargs):
context = super(IndexView, self).get_context_data(**kwargs)
method_routhings=json.loads("""{
"method_routings": [
{
"method_name": "getChallengeThreshold",
"connector_name": "rest_vMar2019",
"bank_id_pattern": "some_bankId_.+d",
"is_bank_id_exact_match": false,
"parameters": [
{
"key": "url",
"value": "http://127.0.0.1:8088/bnpedapi"
}
]
},
{
"method_name": "getChargeLevel",
"connector_name": "akka_vDec2018",
"bank_id_pattern": "some_bankId_.[a-zA-Z]",
"is_bank_id_exact_match": false,
"parameters": [
{
"key": "url",
"value": "http://127.0.0.1:8088/bnpedapi"
}
]
},
{
"method_name": "getBank",
"connector_name": "kafka_vMar2017",
"bank_id_pattern": "*",
"is_bank_id_exact_match": false,
"parameters": [
{
"key": "url",
"value": "http://127.0.0.1:8088/bnpedapi"
}
]
api = API(self.request.session.get('obp'))
urlpath = '/management/method_routings?active=true'
},
{
"method_name": "getUser",
"connector_name": "mapped",
"bank_id_pattern": "some_bankId_[0-9]",
"is_bank_id_exact_match": false,
"parameters": [
{
"key": "url",
"value": "http://127.0.0.1:8088/bnpedapi"
}
]
},
{
"method_name": "getBankAccounts",
"connector_name": "mapped",
"bank_id_pattern": "[a-z]{6}",
"is_bank_id_exact_match": false,
"parameters": [
{
"key": "url",
"value": "http://127.0.0.1:8088/bnpedapi"
}
]
},
{
"method_name": "getCounterparty",
"connector_name": "mapped",
"bank_id_pattern": "some_bankId_[789][0-9]{9}",
"is_bank_id_exact_match": false,
"parameters": [
{
"key": "url",
"value": "http://127.0.0.1:8088/bnpedapi"
}
]
},
{
"method_name": "getCoreBankAccounts",
"connector_name": "mapped",
"bank_id_pattern": "[0-9]{6}",
"is_bank_id_exact_match": false,
"parameters": [
{
"key": "url",
"value": "http://127.0.0.1:8088/bnpedapi"
}
]
},
{
"method_name": "getBankAccountByIban",
"connector_name": "mapped",
"bank_id_pattern": "some_bankId_.*",
"is_bank_id_exact_match": false,
"parameters": [
{
"key": "url",
"value": "http://127.0.0.1:8088/bnpedapi"
}
]
},
{
"method_name": "getBankAccountByRouting",
"connector_name": "mapped",
"bank_id_pattern": "some_bankId_.*",
"is_bank_id_exact_match": false,
"parameters": [
{
"key": "url",
"value": "http://127.0.0.1:8088/bnpedapi"
}
]
},
{
"method_name": "getBankAccountsBalances",
"connector_name": "mapped",
"bank_id_pattern": "some_bankId_.*",
"is_bank_id_exact_match": false,
"parameters": [
{
"key": "url",
"value": "http://127.0.0.1:8088/bnpedapi"
}
]
},
{
"method_name": "checkBankAccountExists",
"connector_name": "mapped",
"bank_id_pattern": "some_bankId_.*",
"is_bank_id_exact_match": false,
"parameters": [
{
"key": "url",
"value": "http://127.0.0.1:8088/bnpedapi"
}
]
},
{
"method_name": "getCounterpartiesFromTransaction",
"connector_name": "mapped",
"bank_id_pattern": "some_bankId_.*",
"is_bank_id_exact_match": false,
"parameters": [
{
"key": "url",
"value": "http://127.0.0.1:8088/bnpedapi"
}
]
},
{
"method_name": "getCounterpartyTrait",
"connector_name": "mapped",
"bank_id_pattern": "some_bankId_.*",
"is_bank_id_exact_match": false,
"parameters": [
{
"key": "url",
"value": "http://127.0.0.1:8088/bnpedapi"
}
]
},
{
"method_name": "getCounterparty",
"connector_name": "mapped",
"bank_id_pattern": "some_bankId_.*",
"is_bank_id_exact_match": false,
"parameters": [
{
"key": "url",
"value": "http://127.0.0.1:8088/bnpedapi"
}
]
}
]
}""")
context.update({'method_routhings': method_routhings["method_routings"]})
try:
response = api.get(urlpath)
except APIError as err:
messages.error(self.request, Exception("OBP-API server is not running or do not response properly. "
"Please check OBP-API server. "
"Details: " + str(err)))
except BaseException as err:
messages.error(self.request, (Exception("Unknown Error. Details:" + str(err))))
else:
context.update(response)
return context
@csrf_exempt
def methodrouting_save(request):
method_name = request.POST.get('method_name')

View File

@ -41,61 +41,7 @@ class IndexView(LoginRequiredMixin, FormView):
urlpath = '/management/webui_props?active=true'
try:
# response = api.get(urlpath)
response = json.loads("""{
"webui_props": [
{
"name": "webui_header_logo_left_url ",
"value": " /media/images/logo.png",
"web_ui_props_id": "default"
},
{
"name": "webui_header_logo_right_url ",
"value": "",
"web_ui_props_id": "default"
},
{
"name": "webui_index_page_about_section_background_image_url ",
"value": " /media/images/about-background.jpg",
"web_ui_props_id": "default"
},
{
"name": "webui_top_text",
"value": "",
"web_ui_props_id": "default"
},
{
"name": "webui_api_explorer_url ",
"value": " https://apiexplorer.openbankproject.com",
"web_ui_props_id": "default"
},
{
"name": "webui_sofi_url ",
"value": " https://sofi.openbankproject.com",
"web_ui_props_id": "default"
},
{
"name": "webui_api_manager_url ",
"value": " https://apimanager.openbankproject.com",
"web_ui_props_id": "default"
},
{
"name": "webui_api_manager_url ",
"value": " https://apitester.openbankproject.com",
"web_ui_props_id": "default"
},
{
"name": "webui_api_documentation_url ",
"value": " https://github.com/OpenBankProject/OBP-API/wiki",
"web_ui_props_id": "default"
},
{
"name": "webui_login_page_special_instructions",
"value": "",
"web_ui_props_id": "default"
}
]
}""")
response = api.get(urlpath)
except APIError as err:
messages.error(self.request, Exception("OBP-API server is not running or do not response properly. "
"Please check OBP-API server. "