gnunet-svn
[Top][All Lists]
Advanced

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

[taler-taler-merchant-demos] 01/02: use the tip_status_url in survey


From: gnunet
Subject: [taler-taler-merchant-demos] 01/02: use the tip_status_url in survey
Date: Thu, 20 Aug 2020 14:12:02 +0200

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

dold pushed a commit to branch master
in repository taler-merchant-demos.

commit 4260ba3e9e83d4fe1e90d31d67a37e762c850720
Author: Florian Dold <florian.dold@gmail.com>
AuthorDate: Thu Aug 20 17:41:20 2020 +0530

    use the tip_status_url in survey
---
 talermerchantdemos/survey/survey.py               | 26 +----------------
 talermerchantdemos/survey/templates/show_tip.html | 35 -----------------------
 2 files changed, 1 insertion(+), 60 deletions(-)

diff --git a/talermerchantdemos/survey/survey.py 
b/talermerchantdemos/survey/survey.py
index fa5edbf..25b97ad 100644
--- a/talermerchantdemos/survey/survey.py
+++ b/talermerchantdemos/survey/survey.py
@@ -24,9 +24,6 @@ import logging
 from urllib.parse import urljoin
 import flask
 import traceback
-import qrcode
-import qrcode.image.svg
-import lxml.etree
 from taler.util.talerconfig import TalerConfig
 from ..httpcommon import backend_get, backend_post
 
@@ -91,11 +88,6 @@ def favicon():
         mimetype="image/vnd.microsoft.ico"
     )
 
-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")
-
 ##
 # Return a error response to the client.
 #
@@ -121,23 +113,7 @@ def submit_survey():
         justification="Payment methods survey"
     )
     backend_resp = backend_post(INSTANCED_URL, "private/tips", tip_spec)
-    taler_tip_uri = backend_resp.get("tip_redirect_url")
-    if taler_tip_uri:
-        qrcode_svg = get_qrcode_svg(taler_tip_uri)
-        content = flask.render_template(
-            "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=headers)
-
-    return err_abort(
-        500,
-        message="Tipping failed, unexpected backend response",
-        json=backend_resp
-    )
-
+    return flask.redirect(backend_resp["tip_status_url"])
 
 ##
 # Serve the main index page.
diff --git a/talermerchantdemos/survey/templates/show_tip.html 
b/talermerchantdemos/survey/templates/show_tip.html
deleted file mode 100644
index 1c6317a..0000000
--- a/talermerchantdemos/survey/templates/show_tip.html
+++ /dev/null
@@ -1,35 +0,0 @@
-{% extends "templates/base.html" %}
-
-
-{% block meta %}
-<noscript>
-  <meta http-equiv="refresh" content="1">
-</noscript>
-{% endblock meta %}
-
-{% block main %}
-
-<h1>Tip Offered</h1>
-
-<div class="taler-installed-hide">
-  <p>
-  Looks like your browser doesn't support GNU Taler payments.  You can try
-  installing a <a href="https://taler.net/en/wallet.html";>wallet browser 
extension</a>.
-  </p>
-</div>
-
-<div>
-
-  <p>
-  You can use this QR code to receive a tip with your mobile wallet:
-  </p>
-
-  {{ qrcode_svg | safe }}
-
-  <p>
-  Click <a href="{{ taler_tip_uri }}">this link</a> to open your system's 
Taler wallet if it exists.
-  </p>
-
-</div>
-
-{% endblock main %}

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

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