summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2020-08-20 17:41:20 +0530
committerFlorian Dold <florian.dold@gmail.com>2020-08-20 17:41:20 +0530
commit4260ba3e9e83d4fe1e90d31d67a37e762c850720 (patch)
treef72a7ae644054591957f4ea05aea84ecde032e55
parent8865aeb7f1139764c59ce33b8e0f06bf80973b04 (diff)
downloadtaler-merchant-demos-4260ba3e9e83d4fe1e90d31d67a37e762c850720.tar.gz
taler-merchant-demos-4260ba3e9e83d4fe1e90d31d67a37e762c850720.tar.bz2
taler-merchant-demos-4260ba3e9e83d4fe1e90d31d67a37e762c850720.zip
use the tip_status_url in survey
-rw-r--r--talermerchantdemos/survey/survey.py26
-rw-r--r--talermerchantdemos/survey/templates/show_tip.html35
2 files changed, 1 insertions, 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 %}