summaryrefslogtreecommitdiff
path: root/talermerchantdemos/blog/blog.py
diff options
context:
space:
mode:
Diffstat (limited to 'talermerchantdemos/blog/blog.py')
-rw-r--r--talermerchantdemos/blog/blog.py19
1 files changed, 10 insertions, 9 deletions
diff --git a/talermerchantdemos/blog/blog.py b/talermerchantdemos/blog/blog.py
index 1d1a332..85f3cfe 100644
--- 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