Fix cart clearing on unpaid checkout
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 50s
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 50s
Cart was soft-deleted when the SumUp checkout was created, before the user paid. If they navigated back, their cart was empty. Move clear_cart_for_order into check_sumup_status so it only runs when the order status transitions to "paid". Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -13,7 +13,6 @@ from .services import (
|
|||||||
current_cart_identity,
|
current_cart_identity,
|
||||||
get_cart,
|
get_cart,
|
||||||
total,
|
total,
|
||||||
clear_cart_for_order,
|
|
||||||
get_calendar_cart_entries,
|
get_calendar_cart_entries,
|
||||||
calendar_total,
|
calendar_total,
|
||||||
get_ticket_cart_entries,
|
get_ticket_cart_entries,
|
||||||
@@ -184,8 +183,6 @@ def register(url_prefix: str) -> Blueprint:
|
|||||||
description=description,
|
description=description,
|
||||||
page_config=page_config,
|
page_config=page_config,
|
||||||
)
|
)
|
||||||
await clear_cart_for_order(g.s, order)
|
|
||||||
|
|
||||||
order.sumup_checkout_id = checkout_data.get("id")
|
order.sumup_checkout_id = checkout_data.get("id")
|
||||||
order.sumup_status = checkout_data.get("status")
|
order.sumup_status = checkout_data.get("status")
|
||||||
order.description = checkout_data.get("description")
|
order.description = checkout_data.get("description")
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ from shared.browser.app.payments.sumup import create_checkout as sumup_create_ch
|
|||||||
from shared.config import config
|
from shared.config import config
|
||||||
from .services import (
|
from .services import (
|
||||||
total,
|
total,
|
||||||
clear_cart_for_order,
|
|
||||||
calendar_total,
|
calendar_total,
|
||||||
ticket_total,
|
ticket_total,
|
||||||
)
|
)
|
||||||
@@ -107,8 +106,6 @@ def register(url_prefix: str) -> Blueprint:
|
|||||||
description=description,
|
description=description,
|
||||||
page_config=page_config,
|
page_config=page_config,
|
||||||
)
|
)
|
||||||
await clear_cart_for_order(g.s, order, page_post_id=post.id)
|
|
||||||
|
|
||||||
order.sumup_checkout_id = checkout_data.get("id")
|
order.sumup_checkout_id = checkout_data.get("id")
|
||||||
order.sumup_status = checkout_data.get("status")
|
order.sumup_status = checkout_data.get("status")
|
||||||
order.description = checkout_data.get("description")
|
order.description = checkout_data.get("description")
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
from shared.browser.app.payments.sumup import get_checkout as sumup_get_checkout
|
from shared.browser.app.payments.sumup import get_checkout as sumup_get_checkout
|
||||||
from shared.events import emit_activity
|
from shared.events import emit_activity
|
||||||
from shared.services.registry import services
|
from shared.services.registry import services
|
||||||
|
from .clear_cart_for_order import clear_cart_for_order
|
||||||
|
|
||||||
|
|
||||||
async def check_sumup_status(session, order):
|
async def check_sumup_status(session, order):
|
||||||
@@ -17,6 +18,11 @@ async def check_sumup_status(session, order):
|
|||||||
session, order.id, order.user_id, order.session_id
|
session, order.id, order.user_id, order.session_id
|
||||||
)
|
)
|
||||||
await services.calendar.confirm_tickets_for_order(session, order.id)
|
await services.calendar.confirm_tickets_for_order(session, order.id)
|
||||||
|
|
||||||
|
# Clear cart only after payment is confirmed
|
||||||
|
page_post_id = page_config.container_id if page_config else None
|
||||||
|
await clear_cart_for_order(session, order, page_post_id=page_post_id)
|
||||||
|
|
||||||
await emit_activity(
|
await emit_activity(
|
||||||
session,
|
session,
|
||||||
activity_type="rose:OrderPaid",
|
activity_type="rose:OrderPaid",
|
||||||
|
|||||||
Reference in New Issue
Block a user