new-site/api/src/service-catalog.ts
justin cf021e2f91 feat(healthcare): OIG/SAM exclusion screening as $79/mo Stripe Subscription
Convert OIG/SAM from one-time $299/yr to recurring $79/month (card+ACH only) -
the first real recurring-billing product in the system. Exclusion screening is
a *monthly* federal obligation, so recurring monitoring fits the requirement and
is the biggest valuation lever (vs a one-time annual run).

Catalog (single source of truth):
- service-catalog.ts: add billing_interval + allowed_methods to ComplianceService;
  oig-sam-screening -> 7900c, billing_interval:"month", allowed_methods:[card,ach],
  name "(Monthly Monitoring)".
- gen-service-catalog.py + check-service-catalog-drift.py: carry/guard the two new
  fields; regenerate site catalog.

Checkout (api/src/routes/checkout.ts):
- mode:"subscription" with recurring price_data when billing_interval is set;
  surcharge absorbed for recurring (clean $79/mo); server-side METHOD_NOT_ALLOWED
  re-validation against allowed_methods.
- ensureColumns + migration 100: compliance_orders.stripe_subscription_id,
  bundle_upsell_sent_at (+ subscription index).

Webhooks (api/src/routes/webhooks.ts):
- record stripe_subscription_id on checkout.session.completed (subscription mode).
- invoice.paid (subscription_cycle only) -> re-dispatch screening for the cycle;
  invoice.payment_failed -> admin alert + first-failure customer nudge;
  customer.subscription.deleted -> mark order cancelled. (API 2026-03-25 moved the
  subscription link to invoice.parent.subscription_details.subscription.)

Fulfillment:
- job_server.py: pass recurring_cycle/invoice_id into the order.
- npi_provider.py: OIG handler labels renewal cycles "[Monthly cycle]" + re-screen
  note; bundle action runs only the FIRST screening + flags the $79/mo upsell.

Bundle land-and-expand:
- Provider Compliance Bundle now includes only the first OIG/SAM screening (was
  giving away $948/yr of monitoring inside an $899 bundle).
- new worker scripts/workers/bundle_upsell.py (+ pw-bundle-upsell timer): ~3 weeks
  after a paid bundle, emails the customer to continue $79/mo monitoring; dedup via
  bundle_upsell_sent_at; skips customers who already have an OIG/SAM order.

Surfaces updated to $79/mo: PaymentStep (filters methods, "Billed every month,
cancel anytime"), order pages, healthcare index, npi-compliance-check tool (also
fixed stale $699 bundle drift -> $899), hc_oig_screening + hc_compliance_bundle
emails.

Docs: billing.md gains a "Stripe-native Subscriptions" section + a reality-check
banner (Adyen/ERPNext-gateway model documented there is NOT live; Stripe is the
real rail). Fixed run-migrations.yml container name bug
(performancewest-postgres-1 -> performancewest-api-postgres-1, overridable).

Tests: api/tests/recurring-subscription.test.ts (28 assertions) covers catalog
gating, method validation, surcharge suppression, recurring line-item build,
invoiceSubscriptionId extraction, renewal-cycle gating. tsc clean; site build
clean; catalog drift OK.

Manual deploy step: enable invoice.paid, invoice.payment_failed,
customer.subscription.deleted on the Stripe webhook endpoint.
2026-06-18 07:54:38 -05:00

570 lines
21 KiB
TypeScript

/**
* Canonical compliance service catalog -- SINGLE SOURCE OF TRUTH for pricing.
*
* This is the authority: checkout charges order.service_fee_cents which is set
* from this catalog at order-creation time. The public site does NOT keep its
* own copy; site/src/lib/service-catalog.generated.ts is generated from this
* file by scripts/gen-service-catalog.mjs (run automatically before site build),
* and intake_manifest.ts re-exports it as SERVICE_META. To change a price, edit
* ONLY this file.
*
* Keep slug set in sync with:
* - api/src/routes/compliance-orders.ts REQUIRED_FIELDS (intake validation)
* - scripts/workers/services/__init__.py SERVICE_HANDLERS (fulfillment)
*/
export interface ComplianceService {
name: string;
price_cents: number;
gov_fee_cents?: number;
gov_fee_label?: string;
erpnext_item: string;
discountable: boolean;
/**
* Recurring billing. When set, checkout builds a Stripe Subscription
* (mode:"subscription") that charges price_cents every interval instead of a
* one-time payment. Only payment methods that support off-session recurring
* charges are allowed for these (see allowed_methods).
*/
billing_interval?: "month" | "year";
/**
* Restrict the payment methods offered for this service. Omit = all methods
* (card, ach, paypal, klarna, crypto). Recurring services MUST list only
* methods that can do off-session charges: ["card","ach"] — PayPal/Klarna/
* crypto here are one-time only and cannot back a subscription.
*/
allowed_methods?: ("card" | "ach" | "paypal" | "klarna" | "crypto")[];
}
export const COMPLIANCE_SERVICES: Record<string, ComplianceService> = {
"fcc-compliance-checkup": {
name: "FCC Carrier Compliance Checkup",
price_cents: 79900,
erpnext_item: "FCC-COMPLIANCE-CHECKUP",
discountable: true,
},
"fcc-499a": {
name: "FCC Form 499-A Filing",
price_cents: 49900,
erpnext_item: "FCC-499A",
discountable: true,
},
"fcc-499a-zero": {
name: "FCC Form 499-A Filing (Zero Revenue)",
price_cents: 17900,
erpnext_item: "FCC-499A-ZERO",
discountable: true,
},
"fcc-499a-499q": {
name: "FCC Form 499-A + 499-Q Bundle",
price_cents: 59900,
erpnext_item: "FCC-499A-499Q",
discountable: true,
},
"fcc-full-compliance": {
name: "FCC Full Compliance Bundle",
price_cents: 149900,
erpnext_item: "FCC-FULL-COMPLIANCE",
discountable: true,
},
"cpni-certification": {
name: "CPNI Annual Certification",
price_cents: 19900,
erpnext_item: "CPNI-CERT",
discountable: true,
},
"rmd-filing": {
name: "RMD Registration / Recertification",
price_cents: 24900,
gov_fee_cents: 10000,
gov_fee_label: "FCC RMD filing fee",
erpnext_item: "RMD-FILING",
discountable: true,
},
"stir-shaken": {
name: "STIR/SHAKEN Implementation Assistance",
price_cents: 49900,
erpnext_item: "STIR-SHAKEN",
discountable: true,
},
"dc-agent": {
name: "D.C. Registered Agent (Annual)",
price_cents: 14900,
erpnext_item: "DC-AGENT",
discountable: false,
},
// BDC filings — the FCC retired Form 477 in Dec 2022 and folded voice
// subscription data into BDC. Broadband-only and voice-only SKUs let
// carriers pay for just what they need; bdc-filing remains as a bundle.
"bdc-broadband": {
name: "BDC Broadband Deployment Filing",
price_cents: 24900,
erpnext_item: "BDC-BROADBAND",
discountable: true,
},
"bdc-voice": {
name: "BDC Voice Subscription Filing (formerly Form 477 Voice)",
price_cents: 19900,
erpnext_item: "BDC-VOICE",
discountable: true,
},
"bdc-filing": {
name: "BDC Filing (Broadband + Voice)",
price_cents: 34900,
erpnext_item: "BDC-FILING",
discountable: true,
},
// New-carrier entry point — register in CORES + obtain FRN
"cores-frn-registration": {
name: "CORES / FRN Registration",
price_cents: 14900,
erpnext_item: "CORES-FRN",
discountable: true,
},
// 499-A New Filer Registration (distinct from the annual revenue filing)
"fcc-499-initial": {
name: "Form 499 Initial Registration",
price_cents: 34900,
erpnext_item: "FCC-499-INITIAL",
discountable: true,
},
// CALEA System Security & Integrity plan (47 USC 229)
"calea-ssi": {
name: "CALEA SSI Plan",
price_cents: 79900,
erpnext_item: "CALEA-SSI",
discountable: true,
},
// 47 CFR § 63.11 Foreign Carrier Affiliation Notification
"fcc-63-11-notification": {
name: "Foreign Carrier Affiliation Notification (47 CFR § 63.11)",
price_cents: 34900,
erpnext_item: "FCC-63-11",
discountable: true,
},
// One-click onboarding for a brand-new carrier (composes 5 filings)
"new-carrier-bundle": {
name: "New Carrier Onboarding Bundle (FRN + 499 Initial + RMD + CPNI + CALEA)",
price_cents: 179900,
erpnext_item: "NEW-CARRIER-BUNDLE",
discountable: true,
},
// Trucking/DOT brand-new-carrier starter bundle (composes the FMCSA filings a
// new motor carrier needs to start operating). DISTINCT from the telecom
// new-carrier-bundle above -- they are different verticals and must not share
// a slug (doing so charged trucking customers the telecom product/price and
// showed "FCC" on their receipt). Components in BUNDLE_COMPONENTS.
"dot-new-carrier-bundle": {
name: "New Carrier Starter Bundle (USDOT + MC Authority + BOC-3 + MCS-150 + Drug & Alcohol)",
price_cents: 59900,
gov_fee_cents: 30000,
gov_fee_label: "FMCSA registration fees (USDOT + operating authority, billed at cost)",
erpnext_item: "DOT-NEW-CARRIER-BUNDLE",
discountable: true,
},
// NECA OCN registration — required for VoIP/IPES carriers that need
// their own Operating Company Number for STIR/SHAKEN signing, LRN
// assignments, or direct numbering authority. NECA charges $550
// standard / $675 expedited; we pass through + margin for prep work.
"ocn-registration": {
name: "NECA OCN + Sponsoring CLEC Agreement",
price_cents: 265000,
erpnext_item: "OCN-REGISTRATION",
discountable: false,
},
"fcc-499q": {
name: "FCC Form 499-Q Quarterly Filing",
price_cents: 0, // included in 499-A+Q bundle — not sold standalone
erpnext_item: "FCC-499Q",
discountable: false,
},
"fcc-499a-discontinuance": {
name: "Form 499-A Discontinuance Filing",
price_cents: 29900,
erpnext_item: "499A-DISCONTINUANCE",
discountable: false,
},
// Standalone CDR Traffic Study — customers who want the classified
// study (unlocks the current reporting year) without buying the
// full 499-A filing service. Either slug unlocks the study via the
// cdr_study_access_grants paywall hook.
"cdr-analysis": {
name: "CDR Traffic Study (Annual)",
price_cents: 49900,
erpnext_item: "CDR-ANALYSIS",
discountable: true,
},
// CDR storage / processing tiers. Annual subscription; renew alongside
// the filing. Each tier is additive — customer picks the smallest tier
// that covers their worst of (storage bytes, classified rows).
"cdr-storage-tier1": {
name: "CDR Storage Tier 1 (50 GB / 50M calls)",
price_cents: 9900,
erpnext_item: "CDR-STORAGE-TIER1",
discountable: false,
},
"cdr-storage-tier2": {
name: "CDR Storage Tier 2 (250 GB / 250M calls)",
price_cents: 29900,
erpnext_item: "CDR-STORAGE-TIER2",
discountable: false,
},
"cdr-storage-tier3": {
name: "CDR Storage Tier 3 (1 TB / 1B calls)",
price_cents: 79900,
erpnext_item: "CDR-STORAGE-TIER3",
discountable: false,
},
// ── Foreign qualification (Certificate of Authority) ─────────────────
// Per-state fees are added on top of these flat service fees at order
// time (state fee + NWRA RA wholesale, looked up from jurisdictions +
// state_filing_fees). Handler fans out one filing per selected state.
//
// Pricing model:
// - `foreign-qualification-single`: flat service fee ($149) + state
// fee + optional NWRA RA. One state per order.
// - `foreign-qualification-multi`: discounted per-state service fee
// ($99) + state fees + RAs. For FCC carriers filing across their
// operating territory.
"foreign-qualification-single": {
name: "Foreign Qualification (One State)",
price_cents: 14900,
erpnext_item: "FOREIGN-QUAL-SINGLE",
discountable: true,
},
"foreign-qualification-multi": {
name: "Foreign Qualification (Multi-State)",
price_cents: 9900, // per-state service fee
erpnext_item: "FOREIGN-QUAL-MULTI",
discountable: true,
},
// ── Business name reservation ────────────────────────────────────────
// Sell the binding Name RESERVATION (the SOS holds the name for a fixed
// window), not a non-binding "search". State fee passed through at cost.
// Free instant pre-check on the order form stays free (lead magnet).
// See docs/name-reservation-product.md.
"name-reservation-tx": {
name: "Texas Name Reservation (Form 501, 120 days)",
price_cents: 7900, // flat service fee
gov_fee_cents: 4000, // TX SOS name reservation fee
gov_fee_label: "Texas SOS name reservation fee (Form 501)",
erpnext_item: "NAME-RESERVATION",
discountable: true,
},
"name-reservation-nv": {
name: "Nevada Name Reservation (90 days)",
price_cents: 7900, // flat service fee
gov_fee_cents: 2500, // NV SOS name reservation fee
gov_fee_label: "Nevada SOS name reservation fee",
erpnext_item: "NAME-RESERVATION",
discountable: true,
},
// Business entity formation (used by the trucking new-carrier flow when the
// carrier needs to form an LLC/corp before registering). Formation is also
// available via the dedicated /order/formation flow; these catalog entries
// let the new-carrier batch include formation as a line item.
"llc-formation": {
name: "LLC Formation",
price_cents: 19900,
erpnext_item: "LLC-FORMATION",
discountable: true,
},
"corp-formation": {
name: "Corporation Formation",
price_cents: 24900,
erpnext_item: "CORP-FORMATION",
discountable: true,
},
// State PUC/PSC Registration — $399 per-state service fee + state
// filing fees. Bond procurement coordinated separately.
"state-puc": {
name: "State PUC/PSC Registration",
price_cents: 39900, // per-state service fee
erpnext_item: "STATE-PUC",
discountable: true,
},
// ── DOT / FMCSA Motor Carrier Services ──────────────────────────────
"mcs150-update": {
name: "MCS-150 Biennial Update",
price_cents: 7900,
erpnext_item: "MCS150-UPDATE",
discountable: true,
},
"boc3-filing": {
name: "BOC-3 Process Agent Filing",
price_cents: 8900,
erpnext_item: "BOC3-FILING",
discountable: false, // passthrough cost — $25 to Process Agent LLC
},
"ucr-registration": {
name: "UCR Annual Registration",
price_cents: 3900,
gov_fee_cents: 4600, // minimum tier ($46 for 0-2 power units)
gov_fee_label: "UCR registration fee (tier-based, minimum shown)",
erpnext_item: "UCR-REGISTRATION",
discountable: true,
},
"dot-registration": {
name: "New USDOT Number Registration",
price_cents: 8900,
erpnext_item: "DOT-REGISTRATION",
discountable: true,
},
"mc-authority": {
name: "MC Operating Authority Application",
price_cents: 19900, // $199 + $300 FMCSA gov fee
gov_fee_cents: 30000, // $300 FMCSA application fee
gov_fee_label: "FMCSA operating authority application fee",
erpnext_item: "MC-AUTHORITY",
discountable: false, // $300 FMCSA gov fee makes this non-discountable
},
"usdot-reactivation": {
name: "USDOT Number Reactivation",
price_cents: 14900,
erpnext_item: "USDOT-REACTIVATION",
discountable: true,
},
"emergency-temporary-authority": {
name: "Emergency Temporary Authority (ETA)",
price_cents: 49900,
erpnext_item: "EMERGENCY-TEMP-AUTH",
discountable: false, // urgent service, premium pricing
},
"dot-drug-alcohol": {
name: "DOT Drug & Alcohol Compliance Program",
price_cents: 14900,
erpnext_item: "DOT-DRUG-ALCOHOL",
discountable: true, // instant PDF binder we generate — our own deliverable, no passthrough cost
},
"dot-audit-prep": {
name: "New Entrant Safety Audit Preparation",
price_cents: 39900,
erpnext_item: "DOT-AUDIT-PREP",
discountable: true,
},
"dot-full-compliance": {
name: "DOT Full Compliance Bundle",
price_cents: 39900, // $399 — includes MCS-150+BOC-3+UCR+D&A+Audit ($775 individual)
erpnext_item: "DOT-FULL-COMPLIANCE",
discountable: true,
},
"carrier-closeout": {
name: "Trucking Wrap-Up (USDOT Shutdown)",
price_cents: 19900, // $199 — final MCS-150 (out of business) + MC revoke + UCR cancel + state account closures
erpnext_item: "CARRIER-CLOSEOUT",
discountable: true,
},
"entity-dissolution": {
name: "Business Entity Dissolution (LLC/Corp)",
price_cents: 4900, // $49 add-on to the wrap-up — LLC/Corp dissolution + final report; state filing fees billed separately
gov_fee_label: "State dissolution filing fee (varies by state, billed at cost)",
erpnext_item: "ENTITY-DISSOLUTION",
discountable: true,
},
// ── State-Level Trucking Compliance ──────────────────────────────────
// For these services the price_cents is our flat SERVICE fee only. The
// actual state government charges (apportioned IRP registration, IFTA decal
// fees, weight-distance/HUT account setup, permit/decal costs) vary by the
// carrier's fleet weight, mileage, and base state, so they are passed
// through AT COST and billed separately once the state issues the invoice —
// we never mark them up. The gov_fee_label is shown to the customer at
// checkout so the pass-through is disclosed up front.
"irp-registration": {
name: "IRP Registration Assistance",
price_cents: 10900, // + state fees (apportioned registration billed at cost)
gov_fee_label: "Apportioned IRP registration & plate fees (state, by jurisdictions + weight, billed at cost)",
erpnext_item: "IRP-REGISTRATION",
discountable: true,
},
"ifta-application": {
name: "IFTA Application + Decals",
price_cents: 10900, // + state fees
gov_fee_label: "IFTA license & decal fees (state, billed at cost)",
erpnext_item: "IFTA-APPLICATION",
discountable: true,
},
"ifta-quarterly": {
name: "IFTA Quarterly Filing",
price_cents: 10900,
gov_fee_label: "IFTA taxes due (remitted to the state at cost based on your mileage)",
erpnext_item: "IFTA-QUARTERLY",
discountable: true,
},
"or-weight-mile-tax": {
name: "Oregon Weight-Mile Tax Setup",
price_cents: 10900, // + state fees
gov_fee_label: "Oregon weight-mile tax account & bond/deposit (state, billed at cost)",
erpnext_item: "OR-WEIGHT-MILE-TAX",
discountable: true,
},
"ny-hut-registration": {
name: "NY Highway Use Tax Registration",
price_cents: 10900, // + state fees
gov_fee_label: "NY HUT certificate & decal fees (state, billed at cost)",
erpnext_item: "NY-HUT-REGISTRATION",
discountable: true,
},
"ky-kyu-registration": {
name: "KY Weight-Distance Tax Setup",
price_cents: 10900, // + state fees
gov_fee_label: "KYU weight-distance account fees (state, billed at cost)",
erpnext_item: "KY-KYU-REGISTRATION",
discountable: true,
},
"nm-weight-distance": {
name: "NM Weight-Distance Tax Setup",
price_cents: 10900, // + state fees
gov_fee_label: "NM weight-distance permit & account fees (state, billed at cost)",
erpnext_item: "NM-WEIGHT-DISTANCE",
discountable: true,
},
"ct-highway-use-fee": {
name: "CT Highway Use Fee Setup",
price_cents: 10900, // + state fees
gov_fee_label: "CT Highway Use Fee registration (state, billed at cost)",
erpnext_item: "CT-HIGHWAY-USE-FEE",
discountable: true,
},
"ca-mcp-carb": {
name: "California MCP + CARB Compliance",
price_cents: 22900, // $229 + state fees (CA is more complex: MCP + CARB)
gov_fee_label: "CA MCP permit fee + CARB/Clean Truck Check fees (state, by fleet size, billed at cost)",
erpnext_item: "CA-MCP-CARB",
discountable: true,
},
"state-dot-registration": {
name: "State DOT Registration",
price_cents: 10900, // + state fees
gov_fee_label: "State DOT/intrastate registration fee (state, billed at cost)",
erpnext_item: "STATE-DOT-REGISTRATION",
discountable: true,
},
"intrastate-authority": {
name: "Intrastate Operating Authority",
price_cents: 10900, // + state fees
gov_fee_label: "State intrastate authority filing fee (state, billed at cost)",
erpnext_item: "INTRASTATE-AUTHORITY",
discountable: true,
},
"osow-permit": {
name: "Oversize/Overweight Permit",
price_cents: 10900, // + state permit fees
gov_fee_label: "State oversize/overweight permit fees (per trip/route, billed at cost)",
erpnext_item: "OSOW-PERMIT",
discountable: true,
},
"state-trucking-bundle": {
name: "State Compliance Bundle",
price_cents: 49900, // $499 — IRP+IFTA+weight tax+intrastate ($796 individual)
gov_fee_label: "State registration, decal & tax fees for each included filing (billed at cost)",
erpnext_item: "STATE-TRUCKING-BUNDLE",
discountable: true,
},
// ── Hazmat / Emissions ───────────────────────────────────────────────
"hazmat-phmsa": {
name: "PHMSA Hazmat Registration",
price_cents: 14900, // $149 admin-assisted; PHMSA gov fee billed at cost
gov_fee_label: "PHMSA registration fee ($25 + $250-$3,000 processing, by business size, billed at cost)",
erpnext_item: "HAZMAT-PHMSA",
discountable: true,
},
"state-emissions": {
name: "State Clean-Truck / Emissions Compliance",
price_cents: 10900, // $109 + state fees — NY/CO/MD/NJ/MA clean-truck / ACT advisory + registration assist
erpnext_item: "STATE-EMISSIONS",
discountable: true,
},
// ── Corporate / Entity Services ──
"annual-report-filing": {
name: "Annual Report / Franchise Tax Filing",
price_cents: 14900,
erpnext_item: "ANNUAL-REPORT",
discountable: true,
},
"registered-agent": {
name: "Registered Agent Service (1 Year)",
price_cents: 9900,
erpnext_item: "REGISTERED-AGENT",
discountable: true,
},
"entity-reinstatement": {
name: "Entity Reinstatement",
price_cents: 29900,
erpnext_item: "ENTITY-REINSTATEMENT",
discountable: true,
},
"virtual-mailbox": {
name: "Virtual Mailbox (1 Year)",
price_cents: 14900,
erpnext_item: "VIRTUAL-MAILBOX",
discountable: true,
},
"ein-application": {
name: "EIN Application (IRS SS-4)",
price_cents: 7900,
erpnext_item: "EIN-APPLICATION",
discountable: true,
},
"entity-upgrade-bundle": {
name: "Entity Upgrade Package (Sole Prop → LLC)",
price_cents: 59900,
erpnext_item: "ENTITY-UPGRADE-BUNDLE",
discountable: true,
},
// ── Healthcare / NPI compliance ──────────────────────────────────────
// CMS/NPPES provider compliance. Handlers are review-staged (a human
// files in PECOS/NPPES) — same safety default as the FCC auto-filing
// toggle. HIPAA is intentionally out of scope (separate specialty).
// Flagship = npi-revalidation (CMS 5-yr Medicare revalidation, dateable
// overdue signal from the free CMS revalidation list).
"npi-revalidation": {
name: "Medicare PECOS Revalidation Filing",
price_cents: 59900,
erpnext_item: "NPI-REVALIDATION",
discountable: true,
},
"npi-reactivation": {
name: "NPI Reactivation",
price_cents: 44900,
erpnext_item: "NPI-REACTIVATION",
discountable: true,
},
"nppes-update": {
name: "NPPES Data Update / Attestation",
price_cents: 34900,
erpnext_item: "NPPES-UPDATE",
discountable: true,
},
"clia-renewal": {
name: "CLIA Certificate Renewal",
price_cents: 44900,
erpnext_item: "CLIA-RENEWAL",
discountable: true,
},
"medicare-enrollment": {
name: "Medicare Enrollment (PECOS)",
price_cents: 69900,
erpnext_item: "MEDICARE-ENROLLMENT",
discountable: true,
},
"oig-sam-screening": {
name: "OIG/SAM Exclusion Screening (Monthly Monitoring)",
price_cents: 7900,
erpnext_item: "OIG-SAM-SCREENING",
discountable: false,
// Federal exclusion screening is a MONTHLY obligation (OIG SAB) — sell it as
// recurring monitoring, not a one-time annual run. Recurring requires an
// off-session-capable rail, so only card + ACH (PayPal/Klarna/crypto can't
// back a subscription).
billing_interval: "month",
allowed_methods: ["card", "ach"],
},
"provider-compliance-bundle": {
name: "Provider Compliance Bundle (Annual)",
price_cents: 89900,
erpnext_item: "PROVIDER-COMPLIANCE-BUNDLE",
discountable: true,
},
};