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";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user