Restrict Rücksendung anfragen to delivered orders, fix Impressum email link

- customerOrderAction() only offers "Rücksendung anfragen" once an order
  is delivered, not already at shipped — a return before the package
  arrived doesn't make sense yet. UI-only change (a stricter subset of
  what the backend's CUSTOMER_ALLOWED_TRANSITIONS already permits).
- AnbieterAngaben.tsx's seller email is now a real mailto: link — it was
  plain text, the only non-clickable email on the site.
This commit is contained in:
Marco
2026-07-30 10:39:08 +00:00
parent 4adb844f8d
commit 2e537bc78d
5 changed files with 44 additions and 7 deletions
@@ -21,10 +21,13 @@ 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. 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") {
// checked here too for a friendly error instead of a bare 409. An
// explicit allowlist ('pending'/'not_applicable'), not a
// paymentStatus !== "paid" blocklist — see switchPaymentToStripe.ts's
// own comment on why 'failed'/'refunded'/'partially_refunded' aren't
// meaningful states to switch from either.
const eligiblePaymentStatus = order.paymentStatus === "pending" || order.paymentStatus === "not_applicable";
if (order.paymentProvider !== "manual" || order.status !== "received" || !eligiblePaymentStatus) {
return NextResponse.json({ ok: false, reason: "Die Zahlungsart kann für diese Bestellung gerade nicht geändert werden." }, { status: 400 });
}