import { NextRequest, NextResponse } from "next/server"; // Local stand-in for payment-router POST /pay/order (see src/lib/pay-base.ts). // Echoes the submitted fields back as a page. Stores nothing, sends nothing. // Production: 404. function escapeHtml(s: string) { return s.replace(/[&<>"']/g, (c) => ({ "&": "&", "<": "<", ">": ">", '"': """, "'": "'" })[c] as string, ); } export async function POST(request: NextRequest) { if (process.env.NODE_ENV === "production") { return new NextResponse(null, { status: 404 }); } const form = await request.formData(); const rows = [...form.entries()] .map(([k, v]) => `${escapeHtml(k)}${escapeHtml(typeof v === "string" ? v : "[файл]")}`) .join(""); const html = `Заглушка оплаты

Заглушка оплаты (dev)

Заказ не создан, данные никуда не отправлены. Так выглядела бы отправка на payment-router:

${rows}

← На дашборд

`; return new NextResponse(html, { headers: { "Content-Type": "text/html; charset=utf-8" } }); }