Practitionist / Practitionist/elluminar_web

🔁 Handle subscription.resumed — restore ACTIVE status

Open
#49 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug payments
Dominant language
TypeScript
Stars
1
Forks
0
Avg merge
17h 2m
Merged PRs (30d)
18

Description

Context

docs/DEPLOYMENT.md instructs enabling the subscription.resumed Razorpay webhook event, but STATUS_MAP in handleRazorpaySubscriptionEvent (src/lib/commerce/subscriptions.ts) has no entry for it — resuming a paused/halted subscription updates nothing locally, so the Subscription row stays PAUSED/PAST_DUE while Razorpay bills again.

Implementation

  1. Add "subscription.resumed": "ACTIVE" to STATUS_MAP; when transitioning PAST_DUE/PAUSED → ACTIVE, recompute currentPeriodStart/End from the event payload's charge fields (mirror the subscription.charged period logic) so access windows don't silently extend.
  2. If the resume event carries no billing-cycle info, rely on the paired subscription.charged that Razorpay emits on the next cycle; resumed should still flip status immediately.
  3. Reuse the lapse/reinstate helper used by activated so enrollments scoped by Enrollment.subscriptionId regain access exactly once (idempotent).
  4. Add a unit test with a synthetic resumed payload.

Acceptance

  • Resuming in Razorpay dashboard flips local status to ACTIVE and restores scoped enrollments
  • No duplicate credit grants or period extension

Part of #38. Advances #42.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in src/lib/commerce/subscriptions.ts at handleRazorpaySubscriptionEvent and compare the existing activated and subscription.charged handling, including the lapse/reinstate helper. Add coverage with a synthetic subscription.resumed payload; done means the subscription becomes ACTIVE, scoped enrollments regain access once, and billing periods or credits are not duplicated.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
backend, payments
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
74/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.