Hide failed-payment order attempts from the customer's own order history
A cancelled order with no invoiceNumber is a Stripe payment that never succeeded (failed or timed out before ever reaching received/invoiced), not a real cancellation of something that actually happened — from the customer's point of view it was never really an order. Filtered out of getCustomerOrders/getCustomerOrderDetail by default; the row stays in Payload for admin/audit purposes (shown there as "Zahlung fehlgeschlagen", see backend). getCustomerOrderDetail's filter is opt-in via a new optional parameter, not the default — /api/checkout/status/route.ts's post-payment polling needs to keep seeing exactly this order to show the "Zahlung fehlgeschlagen, bitte erneut versuchen" retry state. The GDPR export route also opts out for the same reason a legal completeness export can't silently drop rows. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -10,9 +10,9 @@ export async function GET() {
|
||||
if (!session) return NextResponse.json({ ok: false, reason: "Bitte zuerst einloggen." }, { status: 401 });
|
||||
|
||||
const profile = await getCustomerProfile(session.token);
|
||||
const orderSummaries = await getCustomerOrders(session.token, session.customer.id);
|
||||
const orderSummaries = await getCustomerOrders(session.token, session.customer.id, false);
|
||||
const orders = await Promise.all(
|
||||
orderSummaries.map((o) => getCustomerOrderDetail(session.token, session.customer.id, o.orderNumber)),
|
||||
orderSummaries.map((o) => getCustomerOrderDetail(session.token, session.customer.id, o.orderNumber, false)),
|
||||
);
|
||||
|
||||
const payload = {
|
||||
|
||||
Reference in New Issue
Block a user