Przeglądaj źródła

Merge pull request #27391 from overleaf/rh-stripe-pause-anchor

Reset billing cycle when resuming paused Stripe subscription

GitOrigin-RevId: 44f7aa4d3eeaab7622e97b0178fe7d6c7cccae50
roo hutton 1 rok temu
rodzic
commit
ec0f719307

+ 1 - 3
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)
 }
 
 /**

+ 8 - 3
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',
+          }
         )
       })
     })