[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [taler-bank] 02/02: Define headless-withdrawal validator
From: |
gnunet |
Subject: |
[GNUnet-SVN] [taler-bank] 02/02: Define headless-withdrawal validator |
Date: |
Sun, 30 Jun 2019 20:46:41 +0200 |
This is an automated email from the git hooks/post-receive script.
marcello pushed a commit to branch master
in repository bank.
commit ca847cf6ba7861455d69ffd6bdd40403912690f7
Author: Marcello Stanisci <address@hidden>
AuthorDate: Sat Jun 29 12:22:55 2019 +0200
Define headless-withdrawal validator
---
talerbank/app/schemas.py | 8 ++++++++
talerbank/app/urls.py | 1 +
talerbank/app/views.py | 24 +++++++++++++++++-------
3 files changed, 26 insertions(+), 7 deletions(-)
diff --git a/talerbank/app/schemas.py b/talerbank/app/schemas.py
index 37094b4..db2ce7b 100644
--- a/talerbank/app/schemas.py
+++ b/talerbank/app/schemas.py
@@ -186,6 +186,14 @@ class PaytoField(forms.Field):
if "payto" != wire_uri.scheme:
raise ValidationError("URL is not 'payto'")
+class WithdrawHeadless(forms.Form):
+ auth = AuthField()
+ amount = forms.CharField(validators=[
+ RegexValidator(AMOUNT_REGEX,
+ message="Format CURRENCY:X[.Y] not respected")])
+ reserve_pub = forms.CharField()
+ exchange_wire_details = PaytoField(required=False)
+
class PinTanParams(forms.Form):
amount_currency = forms.CharField(
validators=[RegexValidator(
diff --git a/talerbank/app/urls.py b/talerbank/app/urls.py
index 4c52782..8a2d1e5 100644
--- a/talerbank/app/urls.py
+++ b/talerbank/app/urls.py
@@ -42,6 +42,7 @@ urlpatterns = [
url(r'^history-range$', views.serve_history_range, name="history-range"),
url(r'^reject$', views.reject, name="reject"),
url(r'^withdraw$', views.withdraw_nojs, name="withdraw-nojs"),
+ url(r'^taler/withdraw$', views.withdraw_nojs, name="withdraw-headless"),
url(r'^public-accounts$', views.serve_public_accounts,
name="public-accounts"),
url(r'^public-accounts/(?P<name>[a-zA-Z0-9]+)$',
diff --git a/talerbank/app/views.py b/talerbank/app/views.py
index 4cc509c..e868a4b 100644
--- a/talerbank/app/views.py
+++ b/talerbank/app/views.py
@@ -446,13 +446,11 @@ def internal_register(request):
##
- # This method serves the request for registering a user.
- # If successful, it redirects the user to their profile page;
- # otherwise it will show again the same form (currently, without
- # displaying _any_ error/warning message.)
- #
- # @param request Django-specific HTTP request object.
- # @return Django-specific HTTP response object.
+# This method serves the request for programmatically
+# registering a user.
+#
+# @param request Django-specific HTTP request object.
+# @return Django-specific HTTP response object.
@require_POST
def register_headless(request):
@@ -918,6 +916,18 @@ def add_incoming(request, user_account):
"timestamp": "/Date(%s)/" % int(wtrans.date.timestamp())})
##
+# Serves a headless withdrawal request for the Taler protocol.
+#
+# @param request Django-specific HTTP request.
+# @return Django-specific HTTP response object.
+@login_via_headers
+@csrf_exempt
+@require_POST
+def withdraw_headless(request):
+ pass
+
+
+##
# Serve a Taler withdrawal request; takes the amount chosen
# by the user, and builds a response to trigger the wallet into
# the withdrawal protocol
--
To stop receiving notification emails like this one, please contact
address@hidden.