Skip to content

Commit a8ede63

Browse files
committed
Adding a billing account check on activation
1 parent d57759a commit a8ede63

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/services/ChallengeService.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1149,6 +1149,11 @@ async function update (currentUser, challengeId, data, userToken, isFull) {
11491149
throw new errors.BadRequestError('You cannot activate the challenge as it has not been created on legacy yet. Please try again later or contact support.')
11501150
}
11511151
billingAccountId = await helper.getProjectBillingAccount(_.get(challenge, 'legacy.directProjectId'))
1152+
// if activating a challenge, the challenge must have a billing account id
1153+
if ((!billingAccountId || billingAccountId === null) &&
1154+
challenge.status === constants.challengeStatuses.Draft) {
1155+
throw new errors.BadRequestError('Cannot Activate this project, it has no active billing accounts.')
1156+
}
11521157
}
11531158
if (data.status === constants.challengeStatuses.Completed) {
11541159
if (challenge.status !== constants.challengeStatuses.Active) {

0 commit comments

Comments
 (0)