gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [taler-merchant-frontends] branch master updated: POSTing t


From: gnunet
Subject: [GNUnet-SVN] [taler-merchant-frontends] branch master updated: POSTing the tip authorization to the backend.
Date: Fri, 17 Nov 2017 16:52:41 +0100

This is an automated email from the git hooks/post-receive script.

marcello pushed a commit to branch master
in repository merchant-frontends.

The following commit(s) were added to refs/heads/master by this push:
     new 1687b31  POSTing the tip authorization to the backend.
1687b31 is described below

commit 1687b3137ae818159180d1da1eb72f7877cef180
Author: Marcello Stanisci <address@hidden>
AuthorDate: Fri Nov 17 16:52:19 2017 +0100

    POSTing the tip authorization to the backend.
---
 talerfrontends/donations/donations.py          | 14 ++++++++++++--
 talerfrontends/donations/templates/survey.html |  5 ++++-
 2 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/talerfrontends/donations/donations.py 
b/talerfrontends/donations/donations.py
index bed0fac..a7721a4 100644
--- a/talerfrontends/donations/donations.py
+++ b/talerfrontends/donations/donations.py
@@ -61,9 +61,19 @@ def index():
     return flask.render_template("templates/index.html", 
merchant_currency=CURRENCY)
 
 
address@hidden("/survey")
address@hidden("/survey", methods=["GET", "POST"])
 def survey():
-    return flask.render_template("templates/survey.html")
+    success = False
+    if flask.request.method == "POST":
+        r = requests.post(urljoin(BACKEND_URL, 'tip-authorize'),
+                          json=dict(amount=dict(value=1, fraction=0, 
currency=CURRENCY),
+                                    instance="Taler",
+                                    justification="Payment methods survey"))
+        if 200 != r.status_code:
+            return backend_error(r)
+        else:
+            success = True
+    return flask.render_template("templates/survey.html", success=success)
 
 @app.route("/javascript")
 def javascript_licensing():
diff --git a/talerfrontends/donations/templates/survey.html 
b/talerfrontends/donations/templates/survey.html
index d684a3e..f842d6a 100644
--- a/talerfrontends/donations/templates/survey.html
+++ b/talerfrontends/donations/templates/survey.html
@@ -8,7 +8,10 @@
     </p>
   </div>
   <div>
-    <form action="{{ url('/survey') }}">
+    <form action="{{ url('/survey') }}" method="post">
+      {% if success %}
+        <strong>Congratulations, your reward has been successfully 
submitted!</strong>
+      {% endif %}
       What do you prefer?<br>
       <input type="radio" name="paypref" value="taler">
         <label>Taler</label>

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]