Route storefront checkout to a local stub outside production
The checkout form and payment-method lookup were hardcoded to the live
payment router, so any local LMS (next dev included) created real
orders: a stray test click on 20261111 produced order 1794380127.
- resolvePayBase(): NEXT_PUBLIC_PAY_BASE_URL if set, otherwise the live
router for production builds and /dev/pay-stub for everything else.
- /dev/pay-stub/pay/{methods,order}: dev-only stand-ins (404 in
production) that make no outbound calls and store nothing.
- Document in CLAUDE.md that a local `next build && next start` still
hits the live router unless NEXT_PUBLIC_PAY_BASE_URL is set.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
import { NextResponse } from "next/server";
|
||||
|
||||
// Local stand-in for payment-router GET /pay/methods (see src/lib/pay-base.ts).
|
||||
// Production: 404. No outbound calls.
|
||||
export function GET() {
|
||||
if (process.env.NODE_ENV === "production") {
|
||||
return new NextResponse(null, { status: 404 });
|
||||
}
|
||||
return NextResponse.json({
|
||||
methods: [
|
||||
{ id: "stub-card", label: "Заглушка: карта", provider: "dev-stub", kind: "online" },
|
||||
{ id: "stub-invoice", label: "Заглушка: счёт", provider: "dev-stub", kind: "manual" },
|
||||
],
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user