Support #11522
closedSupport #11444: Subscription Payment Failure Flow
Service Subscription: End-to-End Bug Fixes, Centralized Cancellation Settlement & Reschedule Ticker Resolution
Subtasks
Related issues
Updated by Divya Inapakurthi 19 days ago
- Status changed from New to Closed
- Frontend Route Fix: Updated NeedsRescheduleJobsTicker.tsx API URL from plural /jobs/ to singular /job/needs-reschedule-jobs.
- Job Schema Update: Added needsReschedule, rescheduleReason, and subscriptionContractId fields to Job-Model.js to prevent schema stripping.
- Reschedule Query Controller: Fixed dynamic Client model registration and filtered strictly for active subscribers with past scheduled dates in jobs-controller.js.
- Payment Failure Guard: Added checks in invoicePaymentFailed.js to prevent late payment-failure webhooks from resurrecting cancelled or Completed subscriptions back to past_due.
- Centralized Settlement Engine: Created reusable computeCancellationSettlement in subscriptionHelper.js to calculate completed job costs, invoice payments, and balances.
- Contract Schema Update: Added cancellationSettlement schema definition in subscriptionContract.model.js so settlement records persist cleanly.
- Stripe Deletion Handler Refactor: Populated cancellationSettlement, restored customer cancellation emails, and fixed actor attribution (stripe/System vs. customer/Client) in subscriptionDeleted.js.
- Scheduled Cancellation Note Precision: Refined action history logging to clearly document scheduled period finalization vs. immediate cancellations.
- UI Service Settlement Refactor: Refactored cancelSubscriptionByUser in subscripiton.service.js to use the centralized settlement helper, eliminating duplicated logic.
- Comprehensive E2E Testing: Built and executed automated test suites with all 28/28 lifecycle tests passing and 0 ESLint errors.
Updated by Divya Inapakurthi 19 days ago
- Past Due Payment Link Email API & Controller: Added POST /send-payment-link/:id endpoint and controller sendSubscriptionPaymentLinkEmail in subscription.controller.js to dispatch Stripe invoice / payment update emails directly to customers.
- Action History Audit Logging: Automatically recorded payment link email dispatches in the subscriber's contract history (payment_link_emailed) capturing the customer's email and the triggering admin user.
- Multi-Location Past Due Payment Email UI: Added interactive "Send Email to Customer" and "Copy Payment Link" action buttons across Subscribers table (Subscribers.tsx), Subscription Details drawer/section (SubscriptionDetailsSection.tsx), and the dedicated Subscription Details page (SubscriptionDetail.tsx).
- Subscription Jobs Reschedule Alert Banner & Chips: Surfaced an alert banner for visits requiring rescheduling and interactive "Needs Reschedule" status chips on SubscriberJobs.tsx for jobs on payment hold or with missed scheduled dates.
- Universal Reschedule Ticker Integration: Embedded NeedsRescheduleJobsTicker across Jobs Management (/jobs), Active Subscribers tab, and the Home Dashboard.
- Harmonized Ticker UI & Pixel-Perfect Alignment: Standardized NeedsRescheduleJobsTicker layout, label width (w-[190px] sm:w-[240px]), badge pills, divider alignments, and continuous marquee animations to perfectly match CancelSettlementPendingTicker (Settlements & Past Due).