fix(payments): authenticate order detail and deposit checkout
masterplan-lock / check (push) Successful in 4s
masterplan-lock / check (pull_request) Successful in 4s
Security Scan (SIAX Cloud) / security (push) Successful in 17s
CI (SIAX Cloud) / security (pull_request) Successful in 17s
CI (SIAX Cloud) / quality (pull_request) Successful in 36s
CI (SIAX Cloud) / security (push) Successful in 1m14s
Security Scan (SIAX Cloud) / security (pull_request) Successful in 1m12s
CI (SIAX Cloud) / quality (push) Successful in 1m22s
CI (SIAX Cloud) / integration (push) Failing after 1m22s
CI (SIAX Cloud) / integration (pull_request) Failing after 1m22s

This commit is contained in:
2026-09-15 19:09:53 +02:00
parent c7f8b3f651
commit cecc2bc637
6 changed files with 104 additions and 17 deletions
+3 -1
View File
@@ -3,7 +3,9 @@ import { getOrder, setStatusIfCurrent } from "@/lib/orders-store";
import { requireRouteAuth } from "@/src/auth/require-route-auth";
// GET /api/orders/{id}
export async function GET(_req: NextRequest, ctx: { params: Promise<{ id: string }> }) {
export async function GET(req: NextRequest, ctx: { params: Promise<{ id: string }> }) {
const auth = await requireRouteAuth(req);
if (auth.response) return auth.response;
const { id } = await ctx.params;
const order = await getOrder(id);
if (!order) return NextResponse.json({ error: { code: "not_found", message: "Order saknas" } }, { status: 404 });
@@ -1,5 +1,6 @@
import { NextRequest, NextResponse } from "next/server";
import { getOrder } from "@/lib/orders-store";
import { requireRouteAuth } from "@/src/auth/require-route-auth";
// POST /api/payments/[order_id]/deposit
// Returns { url } for Stripe Checkout. Returns 501 when STRIPE_SECRET_KEY is absent.
@@ -7,6 +8,8 @@ export async function POST(
request: NextRequest,
{ params }: { params: Promise<{ order_id: string }> },
) {
const auth = await requireRouteAuth(request);
if (auth.response) return auth.response;
const { order_id } = await params;
const secretKey = process.env.STRIPE_SECRET_KEY;