diff --git a/test/api/unit/libs/payments/google.test.js b/test/api/unit/libs/payments/google.test.js index d912769f24..3cf40b0a4e 100644 --- a/test/api/unit/libs/payments/google.test.js +++ b/test/api/unit/libs/payments/google.test.js @@ -327,6 +327,7 @@ describe('Google Payments', () => { }); it('should not cancel a user subscription with autorenew', async () => { + iap.getPurchaseData.restore(); iapGetPurchaseDataStub = sinon.stub(iap, 'getPurchaseData') .returns([{ autoRenewing: true }]); await googlePayments.cancelSubscribe(user, headers); diff --git a/website/server/libs/payments/google.js b/website/server/libs/payments/google.js index 95057dad41..86f0967213 100644 --- a/website/server/libs/payments/google.js +++ b/website/server/libs/payments/google.js @@ -246,7 +246,7 @@ api.cancelSubscribe = async function cancelSubscribe (user, headers) { if (purchases.length === 0) throw new NotAuthorized(this.constants.RESPONSE_INVALID_RECEIPT); const subscriptionData = purchases[0]; // Check to make sure the sub isn't active anymore. - if (subscriptionData.autoRenewing === false) return; + if (subscriptionData.autoRenewing !== false) return; dateTerminated = new Date(Number(subscriptionData.expirationDate)); } catch (err) {