Project

General

Profile

Edit Copy Actions

Feature #11564

closed

Feature #11348: Integrate stripe subscription module for onboarding companies

Task 6: Dunning Email Consolidation, Pre-Renewal Charge Notices & Billing Portal Session Integration

Added by Divya Inapakurthi 6 days ago. Updated about 13 hours ago.

Status:
Closed
Priority:
Normal
Start date:
10/16/2026
Due date:
10/16/2026
% Done:

100%

Estimated time:
Spent time:

Add

Subtasks


Add

Related issues

Updated by Divya Inapakurthi 6 days ago

  • % Done changed from 0 to 100
  1. 1. Tenant Table Status Filters & UI Polish (Connect Super Admin)
    - Status Filter Implementation: Added and fixed backend status filtering in `onboarding.controller.js` supporting `Active`, `Past Due`, `Suspended`, `Canceling`, and `Deactivated`.
    - Case-Insensitive & Dual-Field Matching: Resolved MongoDB query mismatch between root company `status` and `saasBilling.status` using isolated `$and` criteria.
    - Clean Table Representation: Refactored `TenantsListPage.tsx` to remove bulky inline labels beside tenant company names, displaying clean micro-indicator status badges beneath the Subscription Plan column instead.
  1. 2. Tenant Deactivation Messaging & Terminology
    - Standardized Terminology: Replaced ambiguous "Inactive" labels with "Deactivated / Deactivate" for clearer operational understanding.
    - Login Block & Toast Notification: Updated tenant login handler in `user-controller.js` so users attempting to log into a deactivated tenant receive a clear toast notification:
    > "Tenant account is deactivated. Please contact support."
  1. 3. Payment Failure Notifications (Tenant & Super Admin)
    - Unified Single Email Dispatch: Eliminated duplicate emails on invoice payment failure; combined invoice failure details, attempt count (`Attempt #X`), automatic retry schedule, and 7-day grace period alert box into ONE single email.
    - Tenant Failure Email: Includes failed invoice summary, next Stripe retry date, 7-day grace countdown, attached failed PDF invoice (`Invoice_<Number>_failed.pdf`), and live `[Update Payment Method Now]` CTA button.
    - Super Admin Failure Alert: Dispatches a single comprehensive alert to Super Admin containing tenant details, invoice number, attempt count, amount due, plan, and grace period end date.
    - Webhook Deduplication: Added deduplication guard in `handleStripeSubscriptionUpdated` to prevent duplicate emails when Stripe emits concurrent `invoice.payment_failed` and `customer.subscription.updated` events.
  1. 4. Workspace Suspension Notifications (Grace Period Expiry)
    - Automated Suspension Trigger: Connected to hourly dunning cron (`processPastDueGraceExpirations`) to transition tenants from `past_due` to `suspended` when the 7-day grace period lapses.
    - Tenant Urgent Lockout Email: Dispatches branded notification informing tenant that grace period has expired, operational POS access is locked, and provides a direct payment update link to restore access.
    - Super Admin Suspension Alert: Alerts Super Admin with exact formatted timestamps for `Grace Expired On` and `Suspended At` (eliminating the `"shortly"` fallback string).
  1. 5. Pre-Renewal Notifications (Upcoming Charge Notice)
    - 7-Day Advance Notice: Automated pre-renewal notice dispatched 7 days prior to recurring charge detailing plan name, scheduled renewal date, estimated charge, and billing portal link.
    - Dual Handling: Handled via Stripe `invoice.upcoming` webhook handler and automated daily fallback cron (`processUpcomingRenewalReminders(7)`).
    - Cycle Deduplication: Deduplicated using billing cycle key (`lastRenewalReminderDate`).
    - Super Admin Noise Reduction: Configured to notify only the paying tenant company without spamming Super Admin.
  1. 6. Live Stripe Customer Billing Portal Session Integration
    - Connected dynamic Stripe Customer Portal session generation (`stripe.billingPortal.sessions.create`) with encrypted session tokens.
    - Ensures the `[Update Payment Method Now]` button in failure and suspension emails loads the real, authenticated Stripe Customer Portal dashboard for payment method updates instead of blank/mock pages.
Actions #2

Updated by Divya Inapakurthi about 13 hours ago

  • Status changed from New to Closed
Edit Copy Actions

Also available in: Atom PDF