Files
sorsfonalak/services/frontend/src/lib/payments.ts
T
fecoandClaude Opus 5.5 d9e71ed349
CI / test (push) Successful in 1m22s
CI / build (push) Successful in 7m0s
CI / deploy (push) Skipped
Purchases for admins only until the opening; brand images for Stripe
PURCHASES_OPEN (default false) keeps Stripe purchases to admins, also with
a live key, so nobody types a real card before the opening.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL
2026-11-20 06:57:00 +00:00

13 lines
540 B
TypeScript

import type { Me, PayMethod, PublicConfig } from "./types";
/**
* How this user can buy packages. Until purchases open (and with a Stripe
* test key) only admins can; everyone else sees "soon".
*/
export function payMethod(config: PublicConfig | null | undefined, me: Me): PayMethod | null {
if (config?.payments === "mock") return "mock";
if (config?.payments !== "stripe") return null;
if (config.payments_admins_only && !me.user.roles.includes("admin")) return null;
return config.payments_test ? "stripe_test" : "stripe";
}