summaryrefslogtreecommitdiff
path: root/talerbank
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2020-09-09 21:15:51 +0530
committerFlorian Dold <florian.dold@gmail.com>2020-09-09 21:15:51 +0530
commitb36599bbd264bce84292a7076ac907f60639dbc3 (patch)
treea9605ac4718348614aa04723c71f280a0f2c187e /talerbank
parent89a7c04042aa1a359b386ea92c0f94e63938b387 (diff)
downloadbank-b36599bbd264bce84292a7076ac907f60639dbc3.tar.gz
bank-b36599bbd264bce84292a7076ac907f60639dbc3.tar.bz2
bank-b36599bbd264bce84292a7076ac907f60639dbc3.zip
fix API typo and add config responses
Diffstat (limited to 'talerbank')
-rw-r--r--talerbank/app/urls.py9
-rw-r--r--talerbank/app/views.py43
2 files changed, 48 insertions, 4 deletions
diff --git a/talerbank/app/urls.py b/talerbank/app/urls.py
index adcf8b1..42dc239 100644
--- a/talerbank/app/urls.py
+++ b/talerbank/app/urls.py
@@ -26,6 +26,7 @@ from . import views
# These paths are part of the GNU Taler wire gatweay API
taler_wire_gateway_patterns = [
path("<str:acct_id>/", views.twg_base, name="twg-base"),
+ path("<str:acct_id>/config", views.twg_config, name="twg-config"),
path(
"<str:acct_id>/admin/add-incoming",
views.twg_add_incoming,
@@ -92,11 +93,15 @@ urlpatterns = [
path("profile", views.profile_page, name="profile"),
path("history", views.serve_history, name="history"),
path(
- "api/withdraw-operation/<str:withdraw_id>",
+ "api/withdrawal-operation/<str:withdraw_id>",
views.api_withdraw_operation,
name="api-withdraw-operation",
),
- path("api/register", views.register_headless, name="register-headless"),
+ path(
+ "api/config",
+ views.api_config,
+ name="api-config",
+ ),
path("start-withdrawal", views.start_withdrawal, name="start-withdrawal"),
path(
"show-withdrawal/<str:withdraw_id>", views.show_withdrawal, name="withdraw-show"
diff --git a/talerbank/app/views.py b/talerbank/app/views.py
index 038b6b6..689b395 100644
--- a/talerbank/app/views.py
+++ b/talerbank/app/views.py
@@ -523,9 +523,31 @@ def logout_view(request):
return redirect("index")
+@require_GET
def config_view(request):
+ """
+ Config query of the taler bank access api
+ """
return JsonResponse(
- dict(version="0:0:0", currency=settings.TALER_CURRENCY), status=200
+ dict(
+ version="0:0:0", currency=settings.TALER_CURRENCY, name="taler-bank-access"
+ ),
+ status=200,
+ )
+
+
+@require_GET
+def api_config(request):
+ """
+ Config query of the taler bank integration api
+ """
+ return JsonResponse(
+ dict(
+ version="0:0:0",
+ currency=settings.TALER_CURRENCY,
+ name="taler-bank-integration",
+ ),
+ status=200,
)
@@ -792,6 +814,23 @@ def twg_base(request, acct_id):
return JsonResponse(dict(), status=200)
+@require_GET
+def twg_config(request, acct_id):
+ """
+ This endpoint is used by the exchange test cases to
+ check if the account is up, should not normally be used
+ for anything else.
+ """
+ return JsonResponse(
+ dict(
+ version="0:0:0",
+ name="taler-wire-gateway",
+ currency=settings.TALER_CURRENCY,
+ ),
+ status=200,
+ )
+
+
@csrf_exempt
@require_POST
@login_via_headers
@@ -987,7 +1026,7 @@ def make_taler_withdraw_uri(request, withdraw_id):
else:
pfx_components = pfx.split("/")
host = request.get_host()
- p = "/".join([host] + pfx_components + [str(withdraw_id)])
+ p = "/".join([host] + pfx_components + ["api"] + [str(withdraw_id)])
return f"taler{proto_extra}://withdraw/{p}"