[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-bank] branch master updated: implement headless way to get taler:
From: |
gnunet |
Subject: |
[taler-bank] branch master updated: implement headless way to get taler://withdraw URI |
Date: |
Thu, 28 Nov 2019 17:42:02 +0100 |
This is an automated email from the git hooks/post-receive script.
dold pushed a commit to branch master
in repository bank.
The following commit(s) were added to refs/heads/master by this push:
new 847c96c implement headless way to get taler://withdraw URI
847c96c is described below
commit 847c96c9cd2c3da2eaf4cd300b82b0f8b8fb877a
Author: Florian Dold <address@hidden>
AuthorDate: Thu Nov 28 17:41:53 2019 +0100
implement headless way to get taler://withdraw URI
---
talerbank/app/schemas.py | 9 +++++++++
talerbank/app/urls.py | 5 +++++
talerbank/app/views.py | 16 ++++++++++++++++
3 files changed, 30 insertions(+)
diff --git a/talerbank/app/schemas.py b/talerbank/app/schemas.py
index b6aaeb2..b4c64ce 100644
--- a/talerbank/app/schemas.py
+++ b/talerbank/app/schemas.py
@@ -236,6 +236,15 @@ class WithdrawHeadless(forms.Form):
reserve_pub = forms.CharField()
exchange_wire_details = PaytoField(required=False)
+class WithdrawHeadlessUri(forms.Form):
+ amount = forms.CharField(
+ validators=[
+ RegexValidator(
+ AMOUNT_REGEX, message="Format CURRENCY:X[.Y] not respected"
+ )
+ ]
+ )
+
class PinTanParams(forms.Form):
amount_currency = forms.CharField(
diff --git a/talerbank/app/urls.py b/talerbank/app/urls.py
index 9699ed8..28230ed 100644
--- a/talerbank/app/urls.py
+++ b/talerbank/app/urls.py
@@ -51,6 +51,11 @@ urlpatterns = [
views.withdraw_headless,
name="withdraw-headless"
),
+ path(
+ "api/withdraw-headless-uri",
+ views.withdraw_headless_uri,
+ name="withdraw-headless-uri"
+ ),
path("api/register", views.register_headless, name="register-headless"),
path("start-withdrawal", views.start_withdrawal, name="start-withdrawal"),
path(
diff --git a/talerbank/app/views.py b/talerbank/app/views.py
index d4c1872..9199cf7 100644
--- a/talerbank/app/views.py
+++ b/talerbank/app/views.py
@@ -904,6 +904,22 @@ def add_incoming(request, user_account):
})
+
+@login_via_headers
+@csrf_exempt
+@require_POST
+def withdraw_headless_uri(request, user):
+ data_json = json.loads(request.body.decode("utf-8"))
+ data = WithdrawHeadlessUri(data_json)
+ user_account = BankAccount.objects.get(user=request.user)
+ op = TalerWithdrawOperation(amount=data.amount,
withdraw_account=user_account)
+ op.save()
+ host = request.get_host()
+ taler_withdraw_uri = f"taler://withdraw/{host}/-/{op.withdraw_id}"
+ return JsonResponse({
+ "taler_withdraw_uri": taler_withdraw_uri,
+ })
+
##
# Serves a headless withdrawal request for the Taler protocol.
#
--
To stop receiving notification emails like this one, please contact
address@hidden.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-bank] branch master updated: implement headless way to get taler://withdraw URI,
gnunet <=