taler-merchant-demos

Python-based Frontends for the Demonstration Web site
Log | Files | Refs | Submodules | README | LICENSE

commit 4260ba3e9e83d4fe1e90d31d67a37e762c850720
parent 8865aeb7f1139764c59ce33b8e0f06bf80973b04
Author: Florian Dold <florian.dold@gmail.com>
Date:   Thu, 20 Aug 2020 17:41:20 +0530

use the tip_status_url in survey

Diffstat:
Mtalermerchantdemos/survey/survey.py | 26+-------------------------
Dtalermerchantdemos/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 @@ -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 @@ -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 %}