Skip to content

Paused subscriptions with a resumeAt are never automatically resumed #1389

Description

@RUKAYAT-CODER

Overview

SubscriptionsService.pauseSubscription() in src/payments/subscriptions/subscriptions.service.ts accepts a resumeAt and stores it on the subscription's properties (resumeAt, isPaused: true), but the code that would actually schedule the automatic resume is left commented out as a TODO (lines ~116-135). A subscription-job.processor.ts already exists to handle subscription jobs, so the consumer side is present — only the scheduling call is missing. As a result, a subscription paused with a resumeAt stays paused forever and must be resumed manually, silently breaking the documented pause/auto-resume behaviour.

Specifications

Features:

  • Pausing a subscription with a future resumeAt schedules an automatic resume at that time.
  • The resume job is retried on failure and is a no-op if the subscription was already resumed/cancelled.

Tasks:

  • Replace the commented-out TODO in pauseSubscription() with a real enqueue: schedule a delayed RESUME_SUBSCRIPTION job (delay = resumeAt - now) via the queue service, only when resumeAt is in the future.
  • Implement/verify the corresponding handler in subscription-job.processor.ts that transitions the subscription from PAUSED back to ACTIVE, guarding against double-resume and missing/cancelled subscriptions.
  • Ignore or reject a resumeAt in the past with a clear error.

Impacted Files:

  • src/payments/subscriptions/subscriptions.service.ts
  • src/payments/subscriptions/subscription-job.processor.ts

Acceptance Criteria

  • Pausing with a future resumeAt results in the subscription becoming ACTIVE again at that time without manual intervention.
  • The resume handler is idempotent (a second run does not double-resume) and safely handles an already-cancelled subscription.
  • A resumeAt in the past is handled explicitly rather than silently ignored.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave program

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions