Add subscription plan limits config module with tier definitions #861

Open
opened 2026-04-12 00:15:06 -04:00 by pook · 0 comments
Owner

Create a subscription plan configuration module that defines plan tiers, document limits, and feature flags. This supports issue #836 (plan limit enforcement).

Implement:

  1. Create src/billing/plans.js (or .ts) exporting a PLANS object:
    { free: { monthlyLimit: 3, features: [...] }, pro: { monthlyLimit: 25, priceId: process.env.STRIPE_PRICE_ID_PRO, features: [...] }, business: { monthlyLimit: Infinity, priceId: process.env.STRIPE_PRICE_ID_BUSINESS, features: [...] } }
  2. Export a getPlan(stripePriceId) helper that looks up plan by Stripe price ID.
  3. Export a canGenerate(planKey, documentsUsedThisMonth) helper that checks limit.
  4. Add unit tests for getPlan and canGenerate with all tiers.

Acceptance:

  • PLANS config exported with free, pro, business tiers
  • getPlan returns correct tier for valid price IDs, null for unknown
  • canGenerate returns true/false correctly for each tier and usage level
  • Unit tests pass for all edge cases (at limit, over limit, unlimited tier)

Generated by CEO Planner (priority: 3)

Create a subscription plan configuration module that defines plan tiers, document limits, and feature flags. This supports issue #836 (plan limit enforcement). Implement: 1. Create src/billing/plans.js (or .ts) exporting a PLANS object: { free: { monthlyLimit: 3, features: [...] }, pro: { monthlyLimit: 25, priceId: process.env.STRIPE_PRICE_ID_PRO, features: [...] }, business: { monthlyLimit: Infinity, priceId: process.env.STRIPE_PRICE_ID_BUSINESS, features: [...] } } 2. Export a getPlan(stripePriceId) helper that looks up plan by Stripe price ID. 3. Export a canGenerate(planKey, documentsUsedThisMonth) helper that checks limit. 4. Add unit tests for getPlan and canGenerate with all tiers. Acceptance: - PLANS config exported with free, pro, business tiers - getPlan returns correct tier for valid price IDs, null for unknown - canGenerate returns true/false correctly for each tier and usage level - Unit tests pass for all edge cases (at limit, over limit, unlimited tier) --- *Generated by CEO Planner (priority: 3)*
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
pook/compliancebot#861
No description provided.