taler-merchant-demos

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

commit a8d266404efe9ea9ce61ff2ee537489e6d5bae3a
parent b0f3d60fec149ffee23872bd0e9290bebdf679e3
Author: Florian Dold <florian.dold@gmail.com>
Date:   Mon,  7 Sep 2020 11:43:43 +0530

support the re-purchase detection mechanism

Diffstat:
Mtalermerchantdemos/blog/blog.py | 12++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/talermerchantdemos/blog/blog.py b/talermerchantdemos/blog/blog.py @@ -245,8 +245,16 @@ def article(article_name, data=None): article_name=article_name, order_id=order_id, ) - else: - return render_article(article_name, data, order_id) + return render_article(article_name, data, order_id) + + # Check if the customer came on this page via the + # re-purchase detection mechanism + ai = pay_status.get("already_paid_order_id") + au = pay_status.get("already_paid_fulfillment_url") + if ai is not None and au is not None: + response = flask.redirect(au) + response.set_cookie("order_id", ai, path=f"/essay/{article_name}") + return response # Redirect the browser to a page where the wallet can # run the payment protocol.