gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [taler-survey] branch master updated: use tip_token, simpli


From: gnunet
Subject: [GNUnet-SVN] [taler-survey] branch master updated: use tip_token, simplify
Date: Thu, 30 Nov 2017 02:04:44 +0100

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

dold pushed a commit to branch master
in repository survey.

The following commit(s) were added to refs/heads/master by this push:
     new 1495079  use tip_token, simplify
1495079 is described below

commit 149507937c9b13dad4ef0bb98a3c56f826c67df6
Author: Florian Dold <address@hidden>
AuthorDate: Thu Nov 30 02:04:17 2017 +0100

    use tip_token, simplify
---
 talersurvey/survey/survey.py | 28 +++++++++++-----------------
 1 file changed, 11 insertions(+), 17 deletions(-)

diff --git a/talersurvey/survey/survey.py b/talersurvey/survey/survey.py
index 2cabaec..f4e7824 100644
--- a/talersurvey/survey/survey.py
+++ b/talersurvey/survey/survey.py
@@ -81,23 +81,17 @@ def pick():
 def survey():
     if flask.request.method == "GET":
         return flask.render_template("templates/index.html", 
merchant_currency=CURRENCY)
-    success = False
-    amount = Amount(CURRENCY, 1)
-    if flask.request.method == "POST":
-        r = requests.post(urljoin(BACKEND_URL, 'tip-authorize'),
-                          json=dict(pickup_url=urljoin(flask.request.base_url, 
"/pick"),
-                                   amount=amount.dump(),
-                                    instance="default",
-                                    justification="Payment methods survey"))
-        if 200 != r.status_code:
-            return backend_error(r)
-        else:
-            success = True
+    tip_spec = dict(pickup_url=urljoin(flask.request.base_url, "/pick"),
+                    amount=Amount(CURRENCY, 1).dump(),
+                    instance="default",
+                    justification="Payment methods survey")
+    r = requests.post(urljoin(BACKEND_URL, 'tip-authorize'), json=tip_spec)
+    if 200 != r.status_code:
+        return backend_error(r)
 
-    response = flask.make_response(flask.render_template(
-            "templates/wait.html",
-           success=success),
-       402)
-    response.headers["X-Taler-Tip"] = json.dumps(r.json())
+    response = flask.make_response(
+            flask.render_template("templates/wait.html", success=True),
+            402)
+    response.headers["X-Taler-Tip"] = r.json()["tip_token"]
 
     return response

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



reply via email to

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