summaryrefslogtreecommitdiff
path: root/talerbank
diff options
context:
space:
mode:
authorMarcello Stanisci <stanisci.m@gmail.com>2019-06-29 12:22:55 +0200
committerMarcello Stanisci <stanisci.m@gmail.com>2019-06-29 12:22:55 +0200
commitca847cf6ba7861455d69ffd6bdd40403912690f7 (patch)
tree0414d34fdd9d16c89da0e455305cc8c274d74708 /talerbank
parente8a670dc558df9fbe83e22a56fd2ee52b8936cae (diff)
downloadbank-ca847cf6ba7861455d69ffd6bdd40403912690f7.tar.gz
bank-ca847cf6ba7861455d69ffd6bdd40403912690f7.tar.bz2
bank-ca847cf6ba7861455d69ffd6bdd40403912690f7.zip
Define headless-withdrawal validator
Diffstat (limited to 'talerbank')
-rw-r--r--talerbank/app/schemas.py8
-rw-r--r--talerbank/app/urls.py1
-rw-r--r--talerbank/app/views.py24
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