[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [taler-survey] branch master updated: mobile tipping
From: |
gnunet |
Subject: |
[GNUnet-SVN] [taler-survey] branch master updated: mobile tipping |
Date: |
Fri, 30 Aug 2019 14:13:25 +0200 |
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 095aa94 mobile tipping
095aa94 is described below
commit 095aa94e9adfaf1c60260839782c741b40b10e8f
Author: Florian Dold <address@hidden>
AuthorDate: Fri Aug 30 14:13:23 2019 +0200
mobile tipping
---
talersurvey/survey/survey.py | 22 ++++++++++++++++++----
1 file changed, 18 insertions(+), 4 deletions(-)
diff --git a/talersurvey/survey/survey.py b/talersurvey/survey/survey.py
index 1c6b8aa..e64de96 100644
--- a/talersurvey/survey/survey.py
+++ b/talersurvey/survey/survey.py
@@ -199,6 +199,12 @@ def survey_stats():
return flask.render_template("templates/survey_stats.html", stats=stats)
+def get_qrcode_svg(data):
+ factory = qrcode.image.svg.SvgImage
+ img = qrcode.make(data, image_factory=factory)
+ return lxml.etree.tostring(img.get_image()).decode("utf-8")
+
+
##
# Tell the backend to 'authorize' a tip; this means that
# the backend will allocate a certain amount to be later
@@ -215,10 +221,18 @@ def submit_survey():
instance="default",
justification="Payment methods survey"
)
- resp = backend_post("tip-authorize", tip_spec)
-
- if resp.get("tip_redirect_url"):
- return flask.redirect(resp["tip_redirect_url"])
+ backend_resp = backend_post("tip-authorize", tip_spec)
+
+ taler_tip_uri = backend_resp.get("taler_tip_uri")
+ if taler_tip_uri:
+ qrcode_svg = get_qrcode_svg(taler_tip_uri)
+ content = flask.render_tempate(
+ "templates/show_tip.html",
+ qrcode_svg=qrcode_svg,
+ taler_tip_uri=taler_tip_uri,
+ )
+ headers = {"Taler", taler_tip_uri}
+ return flask.Response(content, status=402, headers)
err_abort(
500, message="Tipping failed, unexpected backend response", json=resp
--
To stop receiving notification emails like this one, please contact
address@hidden.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] [taler-survey] branch master updated: mobile tipping,
gnunet <=