D

Duplex IPTV — QA Testing Suite

Subscription, 5-Day Window & Auto-Renewal Test Guide

Welcome, QA Tester!

This guide allows you to test the complete subscription lifecycle, the 5-Day Same-Plan Renewal Window, and Stripe Off-Session Auto-Renewal on both your local environment and deployed Smart TV / Web applications.

🕒 Rule 1: The 5-Day Manual Renewal Window

When a customer manually visits the renewal checkout, the platform blocks them if more than 5 days remain. Only when 5 days or less remain does the "Renew Now" button unlock.

⚡ Rule 2: Background Auto-Renewal

At the exact second of endDate, BullMQ wakes up. If autoRenewEnabled === true, Stripe auto-charges their saved card, marks the old subscription EXPIRED, and extends validity.

🚫 Rule 3: Auto-Renew Cancellation

If the user turns auto-renew OFF in their settings, BullMQ expires the subscription at endDate with zero charges to the customer's credit card.

♾️ Rule 4: Lifetime Plans Never Expire

Lifetime subscriptions grant permanent access (+100 years). They do NOT expire, have no renewal window, cannot be auto-renewed, and never charge recurring fees.

Live Subscription Inspector & Controller

Fetch subscriptions directly from your database and test rules with 1-click.

Click "Fetch Recent Subscriptions" to load active test subscriptions from your backend.

✓ Step-by-Step QA Test Cases

Test Scenario 1

Manual Renewal: Blocked State (> 5 Days Remaining)

Validates that users with an active plan cannot accidentally purchase duplicate renewals when they still have plenty of time remaining.

Step 1: Set Date in Backend

  • In the table above or Swagger, click "Set 20 Days".
  • Or run this cURL command:
curl -X POST "https://backend.duplexnew.com/api/test-helper/subscriptions/{SUB_ID}/set-renewal-window?daysRemaining=20"

Step 2: Check Deployed TV / Web App

  • Open your TV app or Web portal with this device's MAC.
  • Navigate to Account / Renew Subscription.
  • Attempt to select the same plan and click checkout.
✅
Expected Pass Result:
The frontend displays a notice: "Your current plan is still active. Same-plan renewal opens when 5 days or less remain (20 days left)." The checkout button is disabled or prevented from charging.
Test Scenario 2

Manual Renewal: Allowed State (<= 5 Days Remaining)

Validates that when a customer enters their final 5 days, manual renewal opens up so they can renew ahead of time.

Step 1: Set Date in Backend

  • In the table above or Swagger, click "Set 4 Days".
  • This updates daysRemaining to 4 (< 5 days).
curl -X POST "https://backend.duplexnew.com/api/test-helper/subscriptions/{SUB_ID}/set-renewal-window?daysRemaining=4"

Step 2: Check Deployed TV / Web App

  • Refresh the TV or Web account screen.
  • The warning notice disappears.
  • The "Renew Now" button is fully active and leads to the Stripe Payment Sheet!
✅
Expected Pass Result:
The customer is able to complete the Stripe payment. The subscription is extended by the plan's duration (e.g., +6 months), and the invoice is saved.
Test Scenario 3

Background Auto-Renewal: Automatic Stripe Deduction (BullMQ)

Validates that when a customer's subscription reaches its end date, BullMQ and Stripe automatically deduct the amount off-session without any user action.

Step 1: Fast-Forward to Expiration

  • In the table above, click "Ready for Auto-Renew".
  • This sets endDate = NOW() - 10s and autoRenewEnabled = true.
  • It queues the job into BullMQ with 0 delay.
curl -X POST "https://backend.duplexnew.com/api/test-helper/subscriptions/{SUB_ID}/set-ready-for-auto-renew"

Step 2: Observe Execution

  • Open Bull Board (/queues).
  • The BullMQ worker picks up the job immediately (or click "Promote").
  • Stripe processes an off-session payment intent.
✅
Expected Pass Result:
1. Stripe deducts the plan price (status: succeeded).
2. Old Subscription status updates to EXPIRED.
3. A new Subscription is created with status ACTIVE and a new invoice number.
4. In the TV app, the channel stream continues playing without interruption!
Test Scenario 4

Auto-Renewal OFF: Cancellation & Expiration without Deduction

Validates that if a customer cancels auto-renew in their settings, their card is NEVER charged when the plan ends.

Step 1: Turn Auto-Renew OFF

  • In the TV settings, toggle "Auto-Renew" to OFF.
  • (Or click "Turn OFF" in the table above).
  • Verify autoRenewEnabled = false in DB.
curl -X POST "https://backend.duplexnew.com/api/test-helper/subscriptions/{SUB_ID}/toggle-auto-renew" -H "Content-Type: application/json" -d '{"enabled":false}'

Step 2: Trigger Expiration

  • Fast-forward the subscription to expiration.
  • Promote the job in BullMQ or trigger auto-renew.
✅
Expected Pass Result:
The backend returns { success: false, reason: 'auto_renew_disabled' }. Zero dollars are charged on Stripe. The subscription cleanly expires, and the TV player shows the expired screen upon refresh.
Test Scenario 5

Lifetime Subscription: Non-Renewable & Permanent Access

Validates that devices with an active Lifetime plan never display renewal notices, cannot be charged recurring fees, and prevent duplicate renewal purchases.

Step 1: Check Lifetime Subscription State

  • Confirm the device has an active Lifetime plan.
  • Notice in the table above that all renewal buttons are hidden and replaced with Lifetime (No Renewal Needed).
  • Auto-Renew is permanently marked N/A (Lifetime).

Step 2: Verify TV / Web App Behavior

  • Open TV / Web App account page for this device.
  • Verify the subscription status shows Lifetime Active.
  • Attempting to renew or repurchase will return: "This device already has an active Lifetime subscription and does not require renewal."
♾️
Expected Pass Result:
Lifetime subscriptions remain active indefinitely without BullMQ renewal jobs or Stripe recurring deductions. Frontends and APIs safely reject renewal attempts.