Reflect Orders.paymentStatus's new meaning for Überweisung orders
- switch-to-stripe eligibility gained paymentStatus !== "paid" — an order an admin already marked paid by hand must never also be switchable to Stripe. - PaymentStatusBadge: "Offen" now renders in the same red/subtle style as a failed status (was neutral grey) — worth visually flagging, now that it's a real tracked state rather than a permanent placeholder.
This commit is contained in:
@@ -21,8 +21,10 @@ export async function POST(request: Request, { params }: { params: Promise<{ ord
|
||||
if (!order) return NextResponse.json({ ok: false, reason: "Bestellung nicht gefunden." }, { status: 404 });
|
||||
|
||||
// Same eligibility the backend endpoint re-checks authoritatively —
|
||||
// checked here too for a friendly error instead of a bare 409.
|
||||
if (order.paymentProvider !== "manual" || order.status !== "received") {
|
||||
// checked here too for a friendly error instead of a bare 409. An admin
|
||||
// can mark an Überweisung order paid by hand (Orders.ts's paymentStatus
|
||||
// field) — that order must never also be switched to Stripe.
|
||||
if (order.paymentProvider !== "manual" || order.status !== "received" || order.paymentStatus === "paid") {
|
||||
return NextResponse.json({ ok: false, reason: "Die Zahlungsart kann für diese Bestellung gerade nicht geändert werden." }, { status: 400 });
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user