Batch commit of the pending working tree on security/audit-fixes-2026-07. Major areas: - Outbound webhooks / Zapier: schema + signed delivery with retries, public v1 API (REST-hook subscribe/unsubscribe), settings UI, cron drain. - Deploy hardening: email via SMTP2GO (Resend fully removed), verified DB TLS (DATABASE_SSL=require + DATABASE_CA), storage fails loud in production when Spaces is unconfigured instead of silently using ephemeral disk. - Integrations & features (concurrent work): accounting (QuickBooks/Xero), e-signature (DocuSign/Dropbox Sign), PayPal, geocoding/maps, onboarding, expanded legal pages. - DB migrations 0006–0009. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
29 lines
1.2 KiB
TypeScript
29 lines
1.2 KiB
TypeScript
import type { Plan } from "@/types"
|
|
|
|
// PayPal billing-plan IDs, one per (plan, interval). Create them once with
|
|
// `node scripts/paypal-setup-plans.mjs` and paste the printed IDs into the
|
|
// environment. A plan/interval with no configured ID simply isn't offered.
|
|
const PAYPAL_PLAN_IDS: Record<string, string | undefined> = {
|
|
"pro:month": process.env.PAYPAL_PRO_MONTHLY_PLAN_ID,
|
|
"pro:year": process.env.PAYPAL_PRO_YEARLY_PLAN_ID,
|
|
"landlord:month": process.env.PAYPAL_LANDLORD_MONTHLY_PLAN_ID,
|
|
"landlord:year": process.env.PAYPAL_LANDLORD_YEARLY_PLAN_ID,
|
|
}
|
|
|
|
/** Recurring plans PayPal can bill (lifetime is a one-time order, not a plan). */
|
|
export const PAYPAL_RECURRING_PLANS = ["pro", "landlord"] as const
|
|
|
|
export function getPaypalPlanId(plan: Plan, interval: "month" | "year"): string | undefined {
|
|
return PAYPAL_PLAN_IDS[`${plan}:${interval}`] || undefined
|
|
}
|
|
|
|
/** True when at least one PayPal-billable plan is configured. */
|
|
export function anyPaypalPlanConfigured(): boolean {
|
|
return Object.values(PAYPAL_PLAN_IDS).some(Boolean)
|
|
}
|
|
|
|
/** Annual PayPal billing is offered only when both yearly plan IDs exist. */
|
|
export function paypalAnnualEnabled(): boolean {
|
|
return Boolean(PAYPAL_PLAN_IDS["pro:year"] && PAYPAL_PLAN_IDS["landlord:year"])
|
|
}
|