Purchases for admins only until the opening; brand images for Stripe
CI / test (push) Successful in 1m22s
CI / build (push) Successful in 7m0s
CI / deploy (push) Skipped

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
This commit is contained in:
feco
2026-11-20 06:57:00 +00:00
co-authored by Claude Opus 5.5
parent 42a982010d
commit d9e71ed349
13 changed files with 76 additions and 11 deletions
+6 -3
View File
@@ -1,9 +1,12 @@
import type { Me, PayMethod, PublicConfig } from "./types";
/** How this user can buy packages (with a Stripe test key: admins only). */
/**
* 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_test) return "stripe";
return me.user.roles.includes("admin") ? "stripe_test" : null;
if (config.payments_admins_only && !me.user.roles.includes("admin")) return null;
return config.payments_test ? "stripe_test" : "stripe";
}