Merge pull request #28202 from overleaf/ls-remove-user-features-for-past-due-stripe-subscriptions

Remove paid user features for past due Stripe subscriptions

GitOrigin-RevId: 07a97f90312db7f6e91cbf15201f71cbdeb2e33c
This commit is contained in:
Liangjun Song
2025-09-09 08:06:52 +00:00
committed by Copybot
parent 8f9a343004
commit b678b545f7
5 changed files with 59 additions and 3 deletions
@@ -135,6 +135,49 @@ describe('FeaturesUpdater', function () {
})
describe('computeFeatures', function () {
describe('when userFeaturesDisabled is true for individual plan', function () {
beforeEach(function () {
this.SubscriptionLocator.promises.getUsersSubscription
.withArgs(this.user._id)
.resolves({
planCode: 'individual-plan',
userFeaturesDisabled: true,
groupPlan: false,
addOns: [this.aiAddOn],
})
})
it('removes all individual plan features', async function () {
const features = await this.FeaturesUpdater.promises.computeFeatures(
this.user._id
)
expect(features).to.deep.equal({ default: 'features' })
})
})
describe('when userFeaturesDisabled is true for group plan', function () {
beforeEach(function () {
const groupSubscription = {
planCode: 'group-plan-1',
userFeaturesDisabled: true,
groupPlan: true,
addOns: [this.aiAddOn],
}
this.SubscriptionLocator.promises.getUsersSubscription
.withArgs(this.user._id)
.resolves(groupSubscription)
this.SubscriptionLocator.promises.getGroupSubscriptionsMemberOf
.withArgs(this.user._id)
.resolves([groupSubscription])
})
it('removes all group plan features', async function () {
const features = await this.FeaturesUpdater.promises.computeFeatures(
this.user._id
)
expect(features).to.deep.equal({ default: 'features' })
})
})
beforeEach(function () {
this.SubscriptionLocator.promises.getUsersSubscription
.withArgs(this.user._id)