summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian <sebasjm@gmail.com>2023-07-10 14:07:02 -0300
committerSebastian <sebasjm@gmail.com>2023-07-10 14:07:02 -0300
commitf5da2dc9bdb9727a94f38e7dbf8472366dfcc329 (patch)
tree49c43aa4a0e3c1ee2dbea4e7abf9d55aa3af1e2e
parentc07742666ac10f972be94f3b46a5a4a609f1ba06 (diff)
downloadtaler-merchant-demos-f5da2dc9bdb9727a94f38e7dbf8472366dfcc329.tar.gz
taler-merchant-demos-f5da2dc9bdb9727a94f38e7dbf8472366dfcc329.tar.bz2
taler-merchant-demos-f5da2dc9bdb9727a94f38e7dbf8472366dfcc329.zip
set the new order id in the cookie after recreating from refund
-rw-r--r--talermerchantdemos/blog/blog.py19
-rw-r--r--talermerchantdemos/templates/blog-article-refunded.html.j24
2 files changed, 19 insertions, 4 deletions
diff --git a/talermerchantdemos/blog/blog.py b/talermerchantdemos/blog/blog.py
index 493ffac..f787f0c 100644
--- a/talermerchantdemos/blog/blog.py
+++ b/talermerchantdemos/blog/blog.py
@@ -459,16 +459,31 @@ def article(article_name, lang=None, data=None):
#If the order is refunded show the status, unless the user is already aware
#and notified using the query parameter to create a new order
- if pay_status["refunded"]:
+ if order_status == "paid" and pay_status.get("refunded"):
if new_if_refunded == "yes":
order_resp = post_order(article_name, lang)
order_id = order_resp["order_id"]
pay_status = backend_get(
BACKEND_URL,
f"private/orders/{order_id}",
- params=dict(session_id=session_id),
auth_token=APIKEY,
)
+ # Order ID is fresh, thus setting the cookies now, and
+ # redirecting the client to the cookie support check.
+ redirect_url = pay_status["order_status_url"]
+ response = flask.redirect(redirect_url)
+ response.set_cookie(
+ "order_id",
+ order_id,
+ path=urllib.parse.quote(url_for ('index') + f"essay/{article_name}")
+ )
+ response.set_cookie(
+ "order_id",
+ order_id,
+ path=urllib.parse.quote(url_for ('index') + f"{lang}/essay/{article_name}")
+ )
+ return response
+
else:
return flask.render_template(
"blog-article-refunded.html.j2",
diff --git a/talermerchantdemos/templates/blog-article-refunded.html.j2 b/talermerchantdemos/templates/blog-article-refunded.html.j2
index 3b0d765..4252adb 100644
--- a/talermerchantdemos/templates/blog-article-refunded.html.j2
+++ b/talermerchantdemos/templates/blog-article-refunded.html.j2
@@ -13,9 +13,9 @@
{{
gettext("You will not be able to read the article until you pay for it again.")
}}
-<a href="{{ url_for('article', lang=article_lang, article_name=article_name) }}" class="articleTitle">
+<a href="{{ url_for('article', lang=article_lang, article_name=article_name) }}?new_if_refunded=yes" class="articleTitle">
{{
- gettext("Click here to it again.")
+ gettext("Click here to pay it again.")
}}
</a>
</p>