Merge pull request #27017 from overleaf/ii-flexible-licensing-manually-billed-users-add-seats-revert
[web] Revert "FL manually billed subscriptions with no upsell" GitOrigin-RevId: 3ce5441f825f9a364d3c17e3ac09aa3b9e87b0e7
This commit is contained in:
@@ -73,6 +73,8 @@ describe('SubscriptionGroupController', function () {
|
||||
.resolves(ctx.previewSubscriptionChangeData),
|
||||
checkBillingInfoExistence: sinon.stub().resolves(ctx.paymentMethod),
|
||||
updateSubscriptionPaymentTerms: sinon.stub().resolves(),
|
||||
ensureSubscriptionHasAdditionalLicenseAddOnWhenCollectionMethodIsManual:
|
||||
sinon.stub().resolves(),
|
||||
},
|
||||
}
|
||||
|
||||
@@ -140,6 +142,7 @@ describe('SubscriptionGroupController', function () {
|
||||
InactiveError: class extends Error {},
|
||||
SubtotalLimitExceededError: class extends Error {},
|
||||
HasPastDueInvoiceError: class extends Error {},
|
||||
HasNoAdditionalLicenseWhenManuallyCollectedError: class extends Error {},
|
||||
}
|
||||
|
||||
vi.doMock(
|
||||
@@ -521,6 +524,28 @@ describe('SubscriptionGroupController', function () {
|
||||
})
|
||||
})
|
||||
|
||||
it('should redirect to manually collected subscription error page when collection method is manual and has no additional license add-on', async function (ctx) {
|
||||
await new Promise(resolve => {
|
||||
ctx.SubscriptionGroupHandler.promises.ensureSubscriptionHasAdditionalLicenseAddOnWhenCollectionMethodIsManual =
|
||||
sinon
|
||||
.stub()
|
||||
.throws(
|
||||
new ctx.Errors.HasNoAdditionalLicenseWhenManuallyCollectedError()
|
||||
)
|
||||
|
||||
const res = {
|
||||
redirect: url => {
|
||||
url.should.equal(
|
||||
'/user/subscription/group/manually-collected-subscription'
|
||||
)
|
||||
resolve()
|
||||
},
|
||||
}
|
||||
|
||||
ctx.Controller.addSeatsToGroupSubscription(ctx.req, res)
|
||||
})
|
||||
})
|
||||
|
||||
it('should redirect to subscription page when there is a pending change', async function (ctx) {
|
||||
await new Promise(resolve => {
|
||||
ctx.SubscriptionGroupHandler.promises.ensureSubscriptionHasNoPendingChanges =
|
||||
|
||||
@@ -806,6 +806,49 @@ describe('SubscriptionGroupHandler', function () {
|
||||
})
|
||||
})
|
||||
|
||||
describe('ensureSubscriptionHasAdditionalLicenseAddOnWhenCollectionMethodIsManual', function () {
|
||||
it('should throw if the subscription is manually collected and has no additional license add-on', async function () {
|
||||
await expect(
|
||||
this.Handler.promises.ensureSubscriptionHasAdditionalLicenseAddOnWhenCollectionMethodIsManual(
|
||||
{
|
||||
isCollectionMethodManual: true,
|
||||
hasAddOn: sinon
|
||||
.stub()
|
||||
.withArgs('additional-license')
|
||||
.returns(false),
|
||||
}
|
||||
)
|
||||
).to.be.rejectedWith(
|
||||
'This subscription is being collected manually has no "additional-license" add-on'
|
||||
)
|
||||
})
|
||||
|
||||
it('should not throw if the subscription is not manually collected and has no additional license add-on and ', async function () {
|
||||
await expect(
|
||||
this.Handler.promises.ensureSubscriptionHasAdditionalLicenseAddOnWhenCollectionMethodIsManual(
|
||||
{
|
||||
isCollectionMethodManual: false,
|
||||
hasAddOn: sinon
|
||||
.stub()
|
||||
.withArgs('additional-license')
|
||||
.returns(false),
|
||||
}
|
||||
)
|
||||
).to.not.be.rejected
|
||||
})
|
||||
|
||||
it('should not throw if the subscription is not manually collected and has additional license add-on', async function () {
|
||||
await expect(
|
||||
this.Handler.promises.ensureSubscriptionHasAdditionalLicenseAddOnWhenCollectionMethodIsManual(
|
||||
{
|
||||
isCollectionMethodManual: true,
|
||||
hasAddOn: sinon.stub().withArgs('additional-license').returns(true),
|
||||
}
|
||||
)
|
||||
).to.not.be.rejected
|
||||
})
|
||||
})
|
||||
|
||||
describe('getGroupPlanUpgradePreview', function () {
|
||||
it('should generate preview for subscription upgrade', async function () {
|
||||
const result = await this.Handler.promises.getGroupPlanUpgradePreview(
|
||||
|
||||
Reference in New Issue
Block a user