mirror of
https://github.com/sudoxnym/habitica-self-host.git
synced 2026-07-14 02:02:19 +00:00
fix(subs): correct cancellation check logic and test
This commit is contained in:
parent
7080715bcc
commit
08352c5f49
2 changed files with 2 additions and 1 deletions
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue