From ece71f0426164675245ccd7546b70b3be5218d73 Mon Sep 17 00:00:00 2001 From: roo hutton Date: Mon, 11 Aug 2025 13:24:44 +0100 Subject: [PATCH] Merge pull request #27391 from overleaf/rh-stripe-pause-anchor Reset billing cycle when resuming paused Stripe subscription GitOrigin-RevId: 44f7aa4d3eeaab7622e97b0178fe7d6c7cccae50 --- .../src/Features/Subscription/SubscriptionHandler.js | 4 +--- .../unit/src/Subscription/SubscriptionHandlerTests.js | 11 ++++++++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/services/web/app/src/Features/Subscription/SubscriptionHandler.js b/services/web/app/src/Features/Subscription/SubscriptionHandler.js index 0ba485ca75..4f3b1ac978 100644 --- a/services/web/app/src/Features/Subscription/SubscriptionHandler.js +++ b/services/web/app/src/Features/Subscription/SubscriptionHandler.js @@ -335,9 +335,7 @@ async function resumeSubscription(user) { ) { throw new Error('No active subscription to resume') } - await RecurlyClient.promises.resumeSubscriptionByUuid( - subscription.recurlySubscription_id - ) + await Modules.promises.hooks.fire('resumePaidSubscription', subscription) } /** diff --git a/services/web/test/unit/src/Subscription/SubscriptionHandlerTests.js b/services/web/test/unit/src/Subscription/SubscriptionHandlerTests.js index a6d1201d47..12ca8c6246 100644 --- a/services/web/test/unit/src/Subscription/SubscriptionHandlerTests.js +++ b/services/web/test/unit/src/Subscription/SubscriptionHandlerTests.js @@ -436,11 +436,16 @@ describe('SubscriptionHandler', function () { }, }) }) - it('should make a resume call to recurly', async function () { + it('should call resume hook', async function () { await this.SubscriptionHandler.promises.resumeSubscription(this.user) - this.RecurlyClient.promises.resumeSubscriptionByUuid.called.should.equal( - true + expect(this.Modules.promises.hooks.fire).to.have.been.calledWith( + 'resumePaidSubscription', + { + recurlySubscription_id: this.activeRecurlySubscription.uuid, + recurlyStatus: { state: 'non-trial' }, + planCode: 'collaborator', + } ) }) })