Add subscription status lookup helper in src/billing/subscription.ts #757

Open
opened 2026-04-11 15:26:19 -04:00 by pook · 0 comments
Owner

Create src/billing/subscription.ts with database helpers for checking subscription status:

  1. getActiveSubscription(userId: string): queries stripe_subscriptions, returns record or null
  2. hasActiveSubscription(userId: string): returns boolean
  3. Treat active, trialling, past_due as active; canceled, incomplete, unpaid as inactive

Direct dependency for requireSubscription middleware (issue #751) which gates /api/generate — the revenue-critical endpoint.

Acceptance criteria:

  • src/billing/subscription.ts exports getActiveSubscription and hasActiveSubscription
  • Correctly distinguishes active vs inactive subscription statuses
  • Handles case where user has no stripe_customers record
  • TypeScript compiles without errors

Generated by CEO Planner (priority: 3)

Create src/billing/subscription.ts with database helpers for checking subscription status: 1. getActiveSubscription(userId: string): queries stripe_subscriptions, returns record or null 2. hasActiveSubscription(userId: string): returns boolean 3. Treat active, trialling, past_due as active; canceled, incomplete, unpaid as inactive Direct dependency for requireSubscription middleware (issue #751) which gates /api/generate — the revenue-critical endpoint. Acceptance criteria: - src/billing/subscription.ts exports getActiveSubscription and hasActiveSubscription - Correctly distinguishes active vs inactive subscription statuses - Handles case where user has no stripe_customers record - TypeScript compiles without errors --- *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#757
No description provided.