import { NextResponse, type NextRequest } from "next/server"; import { callMobileApi } from "@/app/lib/server/mobileApi"; import { getToken } from "@/app/lib/server/session"; import { errorResponse, unauthorized } from "@/app/lib/server/apiRoute"; import type { PosTender } from "@/app/lib/types"; // GET /api/counter/payment-methods -> /api/admin/counter/payment-methods // (add-branch-counter-sale). Pure read — side-effect-free so a Next.js prefetch can never mutate // anything (CLAUDE.md GET-prefetch rule). Returns the POS-enabled, active tenders for the // operator's branch. The BO_COUNTER module grant is enforced downstream in the BFF (super-admin // bypass). export async function GET(_req: NextRequest) { const token = await getToken(); if (!token) return unauthorized(); const result = await callMobileApi("/api/admin/counter/payment-methods", { token }); if (!result.ok) return errorResponse(result); return NextResponse.json(result.data); }