Promo codes; purchases off in production
Admins make promo codes for a package (Admin → Promókódok: batch, note, copy all), list them filtered (unused by default, used, revoked; by package; by code, note or redeemer) and withdraw unused ones. A logged-in user redeems a code once (header link, /bevaltas?kod=... prefilled, packages page, and the analysis and question offers point there) and gets the package as an order with source 'promo'. Failed redemptions are rate limited. Production purchases are off: MOCK_PAYMENTS now defaults to false in the deploy compose, so package cards say 'Hamarosan'. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
import type { Metadata } from "next";
|
||||
import { notFound } from "next/navigation";
|
||||
|
||||
import { AdminNav } from "@/components/AdminNav";
|
||||
import { backendGet, requireMe } from "@/lib/server";
|
||||
import type { Package } from "@/lib/types";
|
||||
|
||||
import { PromoCodes } from "./PromoCodes";
|
||||
|
||||
export const metadata: Metadata = { title: "Promókódok" };
|
||||
|
||||
export default async function AdminPromoPage() {
|
||||
const me = await requireMe("/admin/promokodok");
|
||||
if (!me.user.roles.includes("admin")) notFound();
|
||||
const catalog = await backendGet<{ packages: Package[] }>("/v1/packages");
|
||||
return (
|
||||
<main className="page" style={{ maxWidth: 1180 }}>
|
||||
<AdminNav current="/admin/promokodok" />
|
||||
<div className="page-head">
|
||||
<h1>Promókódok</h1>
|
||||
<p className="muted">
|
||||
Egy kód egy csomagot ad, és egyszer váltható be a „Kód beváltása” oldalon (a fejlécben). A beváltó link:
|
||||
sorsfonalak.hu/bevaltas?kod=KÓD — ezt elég elküldeni, belépés után kitöltve várja.
|
||||
</p>
|
||||
</div>
|
||||
<PromoCodes packages={catalog?.packages ?? []} />
|
||||
</main>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user