The catalog stays in packages.rs: every checkout session carries the package's name and gross price, nothing has to be kept in Stripe. The package is granted once, when Stripe confirms the payment: by the signed webhook, or by the return page asking Stripe when the webhook is late. With a test key only admins can buy, so Stripe's test cards give nobody free packages. Without the keys nothing changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL
43 lines
1.5 KiB
TypeScript
43 lines
1.5 KiB
TypeScript
import type { Metadata } from "next";
|
|
|
|
import { PersonPacks } from "@/components/PersonPacks";
|
|
import { payMethod } from "@/lib/payments";
|
|
import { backendGet, requireMe } from "@/lib/server";
|
|
import type { PublicConfig } from "@/lib/types";
|
|
|
|
import { NewPersonChooser } from "./NewPersonChooser";
|
|
|
|
export const metadata: Metadata = { title: "Új személy" };
|
|
|
|
export default async function NewPersonPage() {
|
|
const me = await requireMe("/szemelyek/uj");
|
|
const config = await backendGet<PublicConfig>("/v1/config");
|
|
const slots = me.persons;
|
|
|
|
return (
|
|
<main className="page">
|
|
<div className="page-head">
|
|
<h1>Új személy</h1>
|
|
<p className="muted">
|
|
Társad, családtagod, barátod: megadhatod a születési adatait, vagy meghívhatod, hogy ő adja meg, és megnézzétek,
|
|
mennyire illetek össze.
|
|
{!slots.unlimited && slots.left !== null && slots.left > 0 && ` Még ${slots.left} személyt vehetsz fel.`}
|
|
</p>
|
|
</div>
|
|
<section className="card" aria-label="Új személy">
|
|
<NewPersonChooser
|
|
canAdd={slots.left !== 0}
|
|
hasOwnChart={me.primary_chart_id !== null}
|
|
invitesOpen={(config?.user_invites ?? false) || me.user.roles.includes("admin")}
|
|
full={
|
|
<>
|
|
<p className="muted">Elfogytak a helyeid. Újabb személyhez válassz csomagot, vagy hívd meg.</p>
|
|
<PersonPacks canPay={payMethod(config, me)} />
|
|
</>
|
|
}
|
|
/>
|
|
</section>
|
|
</main>
|
|
);
|
|
}
|