mirror of
https://github.com/overleaf/overleaf.git
synced 2025-04-05 05:28:18 +00:00
Run create subscription checks in subscriptions module (#14738)
GitOrigin-RevId: dacdf883e477b2587f9a10a069e9f63989f94498
This commit is contained in:
parent
004bdd593e
commit
6be63d4f96
1 changed files with 13 additions and 0 deletions
|
@ -24,6 +24,7 @@ const SplitTestHandler = require('../SplitTests/SplitTestHandler')
|
|||
const SubscriptionHelper = require('./SubscriptionHelper')
|
||||
const Features = require('../../infrastructure/Features')
|
||||
const UserGetter = require('../User/UserGetter')
|
||||
const Modules = require('../../infrastructure/Modules')
|
||||
|
||||
const groupPlanModalOptions = Settings.groupPlanModalOptions
|
||||
const validGroupPlanModalOptions = {
|
||||
|
@ -450,6 +451,18 @@ async function createSubscription(req, res) {
|
|||
return res.sendStatus(409) // conflict
|
||||
}
|
||||
|
||||
const result = {}
|
||||
await Modules.promises.hooks.fire(
|
||||
'createSubscription',
|
||||
req,
|
||||
res,
|
||||
user,
|
||||
result
|
||||
)
|
||||
if (result.error) {
|
||||
return HttpErrorHandler.unprocessableEntity(req, res)
|
||||
}
|
||||
|
||||
try {
|
||||
await SubscriptionHandler.promises.createSubscription(
|
||||
user,
|
||||
|
|
Loading…
Reference in a new issue