taler-merchant-demos

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

commit d530292d4755ff35e55ebde4069d21035b04c327
parent 252426087d2ebf3f141b515d642a3541ebef4fea
Author: MS <ms@taler.net>
Date:   Thu, 10 Sep 2020 18:09:30 +0200

using more relative times

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

diff --git a/talermerchantdemos/blog/blog.py b/talermerchantdemos/blog/blog.py @@ -142,10 +142,10 @@ def confirm_refund(order_id): ) article_name = pay_status["contract_terms"]["extra"]["article_name"] - ## FIXME: here goes #refund-checks. - """ - if not refunded and < deadline, allow statement below. - """ + if not refundable(pay_status): + return flask.render_template( + "templates/error.html", message="Item not refundable (anymore)" + ) return flask.render_template( "templates/confirm_refund.html", article_name=article_name, order_id=order_id ) @@ -180,7 +180,7 @@ def refund(order_id): if not refundable(pay_status): err_abort( 403, message="Item not refundable (anymore)", json=pay_status - ) + ) refund_spec = dict(reason="Demo reimbursement", refund=ARTICLE_AMOUNT) resp = backend_post(BACKEND_URL, f"private/orders/{order_id}/refund", refund_spec) return flask.redirect(pay_status["order_status_url"]) @@ -259,11 +259,12 @@ def article(article_name, data=None): extra=dict(article_name=article_name), fulfillment_url=flask.request.base_url, summary="Essay: " + article_name.replace("_", " "), - # 10 minutes time for a refund - refund_deadline=dict(t_ms=1000 * int(time.time() + 10 * 30)), - wire_transfer_deadline=dict(t_ms=1000 * int(time.time() + 15 * 30)), + wire_transfer_deadline=dict(t_ms=1000 * int(time.time() + 150)) + ) + order_resp = backend_post( + BACKEND_URL, "private/orders", + dict(order=order, refund_deadline=dict(d_ms=1000 * 120)) ) - order_resp = backend_post(BACKEND_URL, "private/orders", dict(order=order)) order_id = order_resp["order_id"] # Ask the backend for the status of the payment