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
This commit is contained in:
@@ -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";
|
||||
}
|
||||
|
||||
@@ -94,7 +94,9 @@ export interface PublicConfig {
|
||||
mock_payments: boolean;
|
||||
/** How packages are paid: Stripe Checkout, the stand-in, or not at all. */
|
||||
payments: "stripe" | "mock" | null;
|
||||
/** Stripe has a test key: only admins can buy. */
|
||||
/** Only admins can buy through Stripe (until the opening, and with a test key). */
|
||||
payments_admins_only: boolean;
|
||||
/** Stripe has a test key (test cards work, no real money). */
|
||||
payments_test: boolean;
|
||||
/** "invite": new accounts need an invitation. */
|
||||
signup_mode: "invite" | "open";
|
||||
|
||||
Reference in New Issue
Block a user