From 1256755a3a0ce386d9bf2a43fd7f4a96c9bd44b8 Mon Sep 17 00:00:00 2001 From: giles Date: Wed, 18 Feb 2026 18:38:11 +0000 Subject: [PATCH] Fix checkout return: resolve product URLs and read status after SumUp check Resolve page_slug and market_slug from the order's page_config so that product links on the checkout return page include the correct prefix. Also move the status read after check_sumup_status so the template reflects the actual payment result. Co-Authored-By: Claude Opus 4.6 --- bp/cart/global_routes.py | 22 ++++++++++++++++++++-- shared | 2 +- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/bp/cart/global_routes.py b/bp/cart/global_routes.py index 3c3c5ed..83bd8d1 100644 --- a/bp/cart/global_routes.py +++ b/bp/cart/global_routes.py @@ -6,6 +6,8 @@ from quart import Blueprint, g, request, render_template, redirect, url_for, mak from sqlalchemy import select from models.order import Order +from blog.models.ghost_content import Post +from market.models.market_place import MarketPlace from glue.services.order_lifecycle import get_entries_for_order from .services import ( current_cart_identity, @@ -178,13 +180,29 @@ def register(url_prefix: str) -> Blueprint: ) return await make_response(html) - status = (order.status or "pending").lower() + # Resolve page/market slugs so product links render correctly + if order.page_config: + post = await g.s.get(Post, order.page_config.container_id) + if post: + g.page_slug = post.slug + result = await g.s.execute( + select(MarketPlace).where( + MarketPlace.container_type == "page", + MarketPlace.container_id == post.id, + MarketPlace.deleted_at.is_(None), + ).limit(1) + ) + mp = result.scalar_one_or_none() + if mp: + g.market_slug = mp.slug if order.sumup_checkout_id: try: await check_sumup_status(g.s, order) except Exception: - status = status or "pending" + pass + + status = (order.status or "pending").lower() calendar_entries = await get_entries_for_order(g.s, order.id) await g.s.flush() diff --git a/shared b/shared index 3aa1aad..d805af0 160000 --- a/shared +++ b/shared @@ -1 +1 @@ -Subproject commit 3aa1aadd0bcc4df5de22b9d4c861429628480a67 +Subproject commit d805af07644528541f6cc853b791f1280513f078