mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-01 21:31:36 +02:00
Merge pull request #27093 from overleaf/ls-support-3ds-in-group-plan-update-flows
Support 3DS verification in group plan update flows GitOrigin-RevId: 3206f612e5699f39ac44864daf6610da2956e6ca
This commit is contained in:
@@ -137,6 +137,12 @@ describe('SubscriptionGroupController', function () {
|
||||
SubtotalLimitExceededError: class extends Error {},
|
||||
HasPastDueInvoiceError: class extends Error {},
|
||||
HasNoAdditionalLicenseWhenManuallyCollectedError: class extends Error {},
|
||||
PaymentActionRequiredError: class extends Error {
|
||||
constructor(info) {
|
||||
super('Payment action required')
|
||||
this.info = info
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
vi.doMock(
|
||||
@@ -718,6 +724,38 @@ describe('SubscriptionGroupController', function () {
|
||||
ctx.Controller.createAddSeatsSubscriptionChange(ctx.req, res)
|
||||
})
|
||||
})
|
||||
|
||||
it('should send 402 response with PaymentActionRequiredError', async function (ctx) {
|
||||
await new Promise(resolve => {
|
||||
const adding = 2
|
||||
ctx.req.body = { adding }
|
||||
const error = new ctx.Errors.PaymentActionRequiredError({
|
||||
clientSecret: 'secret',
|
||||
publicKey: 'key',
|
||||
})
|
||||
ctx.SubscriptionGroupHandler.promises.createAddSeatsSubscriptionChange =
|
||||
sinon.stub().throws(error)
|
||||
|
||||
const res = {
|
||||
status: statusCode => {
|
||||
statusCode.should.equal(402)
|
||||
|
||||
return {
|
||||
json: data => {
|
||||
data.should.deep.equal({
|
||||
message: 'Payment action required',
|
||||
clientSecret: error.info.clientSecret,
|
||||
publicKey: error.info.publicKey,
|
||||
})
|
||||
resolve()
|
||||
},
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
ctx.Controller.createAddSeatsSubscriptionChange(ctx.req, res)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('submitForm', function () {
|
||||
@@ -896,5 +934,34 @@ describe('SubscriptionGroupController', function () {
|
||||
ctx.Controller.upgradeSubscription(ctx.req, res)
|
||||
})
|
||||
})
|
||||
|
||||
it('should send 402 response with PaymentActionRequiredError', async function (ctx) {
|
||||
await new Promise(resolve => {
|
||||
const error = new ctx.Errors.PaymentActionRequiredError({
|
||||
clientSecret: 'secret',
|
||||
publicKey: 'public',
|
||||
})
|
||||
ctx.SubscriptionGroupHandler.promises.upgradeGroupPlan = sinon
|
||||
.stub()
|
||||
.rejects(error)
|
||||
const res = {
|
||||
status: code => {
|
||||
code.should.equal(402)
|
||||
return {
|
||||
json: data => {
|
||||
data.should.deep.equal({
|
||||
message: 'Payment action required',
|
||||
clientSecret: error.info.clientSecret,
|
||||
publicKey: error.info.publicKey,
|
||||
})
|
||||
resolve()
|
||||
},
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
ctx.Controller.upgradeSubscription(ctx.req, res)
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user