Feature #9798
openFeature #9777: Subscribers page backend features adding
subscriptions both product and service
Added by Divya Inapakurthi 21 days ago. Updated 13 days ago.
100%
Subtasks
Related issues
Updated by Divya Inapakurthi 21 days ago
test order tracking emails and remove unwanted files, services and others.
Updated by Divya Inapakurthi 20 days ago
- Due date changed from 07/14/2026 to 07/15/2026
removing frontend and backend unused code
Updated by Divya Inapakurthi 20 days ago
fixed payment issue in service subscription for off store
Updated by Divya Inapakurthi 19 days ago
working on the removing backend unused code and also fixing issues reported by tester
Updated by Divya Inapakurthi 19 days ago
- Due date changed from 07/15/2026 to 07/16/2026
Updated by Divya Inapakurthi 15 days ago
- Due date changed from 07/16/2026 to 07/20/2026
- Status changed from New to In Progress
Backend (evergreen_pos_be) — Stripe Webhook Hardening & Subscription Mappings:
Stripe March 2025 API Update Compatibility (2025-03-31.basil):
Added support for Stripe's newer "parent.subscription_details" shape to resolve dbName (tenant context) and subscription IDs.
Updated helper functions in subscriptionHelper.js (extractDbNameFromStripeObject, resolveDbName) and webhook handlers (invoicePaid.js) to read metadata from the new nested parent.subscription_details.metadata structure.
Hardened serviceWebhook.controller.js to guarantee fallback resolution checks run correctly for invoice_payment.paid events.
Race Condition & Duplication Prevention:
Fixed a race condition where checkout.session.completed and invoice.paid fallbacks could concurrently attempt to create duplicate contracts. Added an atomic MongoDB claim (claimedAt) on PendingSubscription records so only one thread executes contract creation.
Prevented duplicate autojob generation on payment retries after a partial handler failure. The system now searches existing jobs (by service ID and start date) before creating new job entries.
Resolved duplicate past_due client alerts. Skipped redundant payment_intent.payment_failed and charge.failed events (letting only invoice.payment_failed handle the status transition), protected by an idempotency check (invoice ID + retry attempt count).
Hardened Contract-Status State Machine:
Blocked payment-failure handlers from pulling closed (Completed/Cancelled) contracts back into past_due status.
Tightened customer-level query lookups to prevent webhooks from mis-associating sibling subscription contracts belonging to the same customer.
checkout.session.completed failures (product flow) now propagate a Stripe retry code instead of silent success status, protecting paid customers from getting stuck without a created subscription.
Product Subscription Error Notification:
Registered a new Product_Subscription_Error event type in notificationSchema.js.
Added validation guards in the product checkout handler (checkoutCompleted.js) to dispatch the error notification to staff if the customer ID is missing or checkout validation fails.
SMS & Traceability Improvements:
Removed redundant company name signatures (- CompanyName) from templates in subscripiton.service.js, invoicePaid.js, and subscriptionUpdated.js (now handled centrally in twilioService.js).
Propagated standard tracking metadata parameters (dbName, recipientName, module, and sentBy) to notifyUsers calls for Traceability & Communication Logging compliance.
Frontend (evergreen_pos_fe):
Public Subscription Signup:
Modified the OTP dialog verification flow to preserve the code input field if OTP validation fails, preventing users from having to re-type it.
Subscriber History UI Cleans:
Switched subscription history dates to utilize the shared US date/time formatter.
Streamlined the history timeline view by removing redundant internal model-type chips and username fallbacks.
Updated by Divya Inapakurthi 14 days ago
- Due date changed from 07/20/2026 to 07/21/2026
- Status Update - July 21, 2026
Completed the end-to-end webhook optimization and race-condition fixes for both Service and Product subscriptions.
- 1. Service Subscriptions Optimization
- Deferred Activation: Moved subscription contract creation, invoice payment logs, and auto-job scheduling out of `checkout.session.completed` and deferred it entirely to `invoice.paid`. This ensures active contracts and visits are generated only after successful payment verification.
- Race Condition Guard: Implemented a synchronous 2-second delay & database re-check in `invoice.paid` to give the checkout handler ample time to save new records to MongoDB, successfully preventing concurrent webhook 500 response errors.
- Credit Card Tax Exclusion: Standardized tax calculations across all service invoice installments and total amounts to record the base payment values correctly (`amount - creditTaxAmount`).
- Admin Notifications: Integrated `Service_Subscription_Created` email/SMS dispatches directly into the final `invoice.paid` activation path.
- 2. Product Subscriptions Optimization
- Fast-Path Initial Payment Guard: Repositioned the initial subscription invoice check (`subscription_create`) to the top of the `invoice.paid` handler. This allows the server to skip processing immediate duplicates without running database retries, preventing browser polling timeouts and customer-facing warning pages.
Updated by Divya Inapakurthi 13 days ago
- Status changed from In Progress to Resolved
- % Done changed from 0 to 100