Merge pull request #23203 from overleaf/ii-flexible-group-licensing-no-billing-details

[web] FL handle subscriptions with missing billing info

GitOrigin-RevId: 34209299c039992a80da5739e086beb5d0ede7b0
This commit is contained in:
ilkin-overleaf
2025-02-04 13:53:14 +02:00
committed by Copybot
parent 72be034435
commit 16130b79db
14 changed files with 242 additions and 2 deletions

View File

@@ -99,6 +99,7 @@ describe('RecurlyClient', function () {
let client
this.client = client = {
getAccount: sinon.stub(),
getBillingInfo: sinon.stub(),
listAccountSubscriptions: sinon.stub(),
previewSubscriptionChange: sinon.stub(),
}
@@ -108,6 +109,9 @@ describe('RecurlyClient', function () {
return client
},
}
this.Errors = {
MissingBillingInfoError: class MissingBillingInfoError extends Error {},
}
return (this.RecurlyClient = SandboxedModule.require(MODULE_PATH, {
globals: {
@@ -124,6 +128,7 @@ describe('RecurlyClient', function () {
debug: sinon.stub(),
},
'../User/UserGetter': this.UserGetter,
'./Errors': this.Errors,
},
}))
})
@@ -463,4 +468,22 @@ describe('RecurlyClient', function () {
})
})
})
describe('getPaymentMethod', function () {
it('should throw MissingBillingInfoError', async function () {
this.client.getBillingInfo = sinon
.stub()
.throws(new recurly.errors.NotFoundError())
await expect(
this.RecurlyClient.promises.getPaymentMethod(this.user._id)
).to.be.rejectedWith(this.Errors.MissingBillingInfoError)
})
it('should rethrow errors different than MissingBillingInfoError', async function () {
this.client.getBillingInfo = sinon.stub().throws(new Error())
await expect(
this.RecurlyClient.promises.getPaymentMethod(this.user._id)
).to.be.rejectedWith(Error)
})
})
})