Files
cfw-autumn/shared/models/orgModels/orgConfig.ts
2026-05-26 20:07:27 +01:00

52 lines
2.0 KiB
TypeScript

import { z } from "zod/v4";
import { DbUsageAlertSchema } from "../cusModels/billingControls/usageAlert.js";
export const OrgConfigSchema = z.object({
usage_alerts: z.array(DbUsageAlertSchema).optional().default([]),
/** Sandbox-env-only usage alerts. `checkUsageAlerts` reads this list when
* `ctx.env === AppEnv.Sandbox` and `usage_alerts` when env is live. */
sandbox_usage_alerts: z.array(DbUsageAlertSchema).optional().default([]),
bill_upgrade_immediately: z.boolean().default(true),
convert_to_charge_automatically: z.boolean().default(true),
anchor_start_of_month: z.boolean().default(false), // If true, the billing cycle will start on the first day of the month
cancel_on_past_due: z.boolean().default(false),
prorate_unused: z.boolean().default(true),
checkout_on_failed_payment: z.boolean().default(true), // false for pipeline?
reverse_deduction_order: z.boolean().default(false),
include_past_due: z.boolean().default(true),
sync_status: z.boolean().default(true),
merge_billing_cycles: z.boolean().default(true),
multiple_trials: z.boolean().default(false),
allow_paid_default: z.boolean().default(false),
cache_customer: z.boolean().default(false),
invoice_memos: z.boolean().default(false),
entity_product: z.boolean().default(false),
void_invoices_on_subscription_deletion: z.boolean().default(false),
// default
default_applies_to_entities: z.boolean().default(false),
// skip_overage_submission
skip_overage_submission: z.boolean().default(false),
// disable stripe writes
disable_stripe_writes: z.boolean().default(false),
disabled_auto_topup: z.boolean().default(false),
persist_free_overage: z.boolean().default(false),
dryrun_autotopups: z.boolean().default(false),
forward_customer_metadata: z.boolean().default(false),
// When true, Stripe writes pass `automatic_tax: { enabled: true }`.
// Customer must have a tax-resolvable address.
automatic_tax: z.boolean().default(false),
});
export type OrgConfig = z.infer<typeof OrgConfigSchema>;