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:
Marco
2026-07-30 10:08:37 +00:00
parent 6448c8736a
commit beea592706
4 changed files with 43 additions and 4 deletions
@@ -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 });
}
@@ -55,6 +55,7 @@ export default async function KontoBestellungDetailPage({ params }: { params: Pr
const canSwitchPayment =
order.paymentProvider === "manual" &&
order.status === "received" &&
order.paymentStatus !== "paid" &&
groupPaymentMethodsForCheckout(await getPaymentMethods()).some((m) => m.provider === "stripe");
return (
+2 -2
View File
@@ -14,8 +14,8 @@ const LABEL: Record<string, string> = {
};
const STYLES: Record<string, string> = {
not_applicable: "bg-bg-muted text-text-muted",
pending: "bg-bg-muted text-text-muted",
not_applicable: "bg-red-50 text-red-600",
pending: "bg-red-50 text-red-600",
paid: "bg-success-subtle text-success",
failed: "bg-red-50 text-red-600",
refunded: "bg-bg-muted text-text-light",