Project

General

Profile

Edit Copy Actions

Feature #6235

open

Feature #6234: Implement left over features in the service subscriptions flow

Created the number of auto jobs based on the subscription configuration visit number and bug fix in subscription apis

Added by Yalavarthi Thriveni about 1 month ago. Updated 27 days ago.

Status:
Resolved
Priority:
Normal
Target version:
Start date:
12/26/2025
Due date:
% Done:

100%

Estimated time:
10:00 h
Spent time:

Description

Automatically generate jobs based on the configured number of visits per year for a service subscription. By default, one job will be scheduled per month with a predefined visit date.

The system should evaluate the current date and create only upcoming jobs. If the subscription starts mid-year or the current month’s visit date has already passed, jobs should be generated starting from the next applicable month.

Jobs should be created only for the remaining scheduled visits within the subscription period.


Add

Subtasks


Add

Related issues

Actions #1

Updated by Ajit A about 1 month ago

  • Assignee changed from Ajit A to Yalavarthi Thriveni
Actions #2

Updated by Yalavarthi Thriveni about 1 month ago

  • Assignee changed from Yalavarthi Thriveni to Ajit A

Updated by Ajit A 29 days ago

  • Status changed from New to In Progress

started working on auto job creation after completion of service subscription

Updated by Ajit A 29 days ago

  • Subject changed from Created the number of auto jobs based on the subscription configuration visit number to Created the number of auto jobs based on the subscription configuration visit number and bug fix in subscription apis
  • % Done changed from 0 to 20

completed few bugs in subscription api found by priyatham

Updated by Ajit A 29 days ago

Yalavarthi Thriveni wrote:

Automatically generate jobs based on the configured number of visits per year for a service subscription. By default, one job will be scheduled per month with a predefined visit date.

The system should evaluate the current date and create only upcoming jobs. If the subscription starts mid-year or the current month’s visit date has already passed, jobs should be generated starting from the next applicable month.

Jobs should be created only for the remaining scheduled visits within the subscription period.

Backend api issues
1) In discount, discount type is there but discount value is missing.. add it
2) Add Action History for Each product plan
3) Add search filter for status for Product Plans

Updated by Ajit A 29 days ago

  • % Done changed from 20 to 30

create edit optimization ,action history for create & edit plan ,discountCash variable added

Updated by Ajit A 27 days ago

  • % Done changed from 30 to 70
  • Estimated time set to 4:00 h

Auto job creation for the subscription flow is completed in the admin flow, and I have started working on the customer flow Auto job creation.

Actions #8

Updated by Ajit A 27 days ago

  • Estimated time changed from 4:00 h to 10:00 h

Updated by Ajit A 27 days ago

  • % Done changed from 70 to 80

optimized jobs components,with react tran/stack query hook and debounce search , Subscription job mention in the job rows,

Updated by Ajit A 27 days ago · Edited

  • % Done changed from 80 to 100

completed the auto job creation with customer flow

Summary of Backend Changes
1. jobService.js (src/allservices/jobService.js)
Added subscriptionMeta support in createJobNewForInvoice
Preserves subscriptionMeta from job data (defaults to { enabled: false } if not provided)
Enables marking jobs as subscription-based
2. jobs-controller.js (src/controllers/jobs-controller.js)
Updated getAllJobsPagination to derive subscription_based from subscriptionMeta.enabled
Maintains backward compatibility by mapping subscriptionMeta.enabled to subscription_based
3. subscription.controller.js (src/controllers/subscription.controller.js)
Added fallback in getSession to trigger autojob creation if payment is successful but webhooks haven't fired
Checks invoice payment status and calls handleInvoicePaidEvent if needed
Added logging for session checks and payment verification
Updated console log formatting (removed emojis in some places)
4. webhook.controller.js (src/controllers/webhook.controller.js)
Enhanced invoice.paid webhook routing to distinguish service subscriptions (on-store) from product subscriptions (off-store)
Routes service subscriptions to subscriptionService.handleSubscriptionEvent
Routes product subscriptions to invoicePaidHandler
Added logging for webhook event routing
5. EverGreen-invoice-controller.js (src/routes/EvergreenInvoice/EverGreen-invoice-controller.js)
Implemented full installment creation logic in addInstallmentAndPayWithSubscriptionOffline
Added validation for invoice ID, amount, and payment method
Calculates remaining balance and updates invoice status
Creates installment before delegating to subscription service
Returns invoice and installment ID in response
6. subscripiton.service.js (src/services/subscripiton.service.js)
Major addition: automatic job creation (autojobs) for subscription invoices
Added handleInvoicePaidEvent as a public export
Enhanced handleOnStoreInvoicePaid:
Checks if autojobs should be created before updating invoice
Creates jobs based on visitsPerCycle from subscription plan variant
Job scheduling logic:
First job: 5 days after payment date
Remaining jobs: 1st of each subsequent month
Marks jobs with subscriptionMeta: { enabled: true }
Prevents duplicate job creation using jobCreated flag
Added autojob creation in checkout completion handler
Added fallback autojob creation for new invoices
Enhanced idempotency checks to allow autojob creation even if payment was already processed
Added skipPaymentUpdate parameter to handleOnStoreInvoicePaid for retry scenarios
Added logging throughout the autojob creation process
Imported createJobNewForInvoice and getUserModel for job creation
Key Features Added:
Automatic job creation: creates jobs automatically when subscription invoices are paid
Smart scheduling: first job 5 days after payment, subsequent jobs on the 1st of each month
Idempotency: prevents duplicate jobs while allowing retry for missed autojobs
Fallback mechanisms: multiple paths to ensure autojobs are created even if webhooks fail
Enhanced logging: detailed console logs for debugging subscription and autojob flows

Updated by Ajit A 27 days ago

  • Status changed from In Progress to Resolved
  • Assignee changed from Ajit A to Sravani Rangannapalem

assigning to tester

Edit Copy Actions

Also available in: Atom PDF