Skip to content

Commit

Permalink
added server side validation to some endpoints
Browse files Browse the repository at this point in the history
wip: there might still be other enpoints that need server side validation, and also most of these are untested as we have figure out how
  • Loading branch information
pvighi committed Oct 27, 2023
1 parent 97330c6 commit ec9df9f
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions server/routes/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,14 +126,19 @@ router.post(

router.post(
'/supporter-plus-cancel/:subscriptionName',
withOktaSeverSideValidation,
productMoveAPI(
'supporter-plus-cancel/:subscriptionName',
'CANCEL_SUPPORTER_PLUS',
['subscriptionName'],
),
);

router.post('/payment/card', stripeSetupIntentHandler);
router.post(
'/payment/card',
withOktaSeverSideValidation,
stripeSetupIntentHandler,
);
router.post(
'/payment/card/:subscriptionName',
membersDataApiHandler(
Expand Down Expand Up @@ -163,10 +168,12 @@ router.post(

router.post(
'/case/:caseId?',
withOktaSeverSideValidation,
cancellationSfCasesAPI('case', 'CREATE_CANCELLATION_CASE'),
);
router.patch(
'/case/:caseId?',
withOktaSeverSideValidation,
cancellationSfCasesAPI('case/:caseId', 'UPDATE_CANCELLATION_CASE', [
'caseId',
]),
Expand All @@ -183,6 +190,7 @@ router.post(

router.post(
'/update-supporter-plus-amount/:subscriptionName',
withOktaSeverSideValidation,
productMoveAPI(
'update-supporter-plus-amount/:subscriptionName',
'MOVE_PRODUCT_UPDATE_AMOUNT',
Expand Down Expand Up @@ -250,6 +258,7 @@ router.get(
);
router.post(
'/delivery-records/:subscriptionName',
withOktaSeverSideValidation,
deliveryRecordsAPI(
'delivery-records/:subscriptionName',
'DELIVERY_PROBLEM_CREATE',
Expand Down Expand Up @@ -297,7 +306,7 @@ router.get('/known-issues', async (_, response) => {
router.get('/help-centre/article/:article', getArticleHandler);
router.get('/help-centre/topic/:topic', getTopicHandler);

router.post('/contact-us', contactUsFormHandler);
router.post('/contact-us', withOktaSeverSideValidation, contactUsFormHandler);

router.post('/reminders/create', createOneOffReminderHandler); // requires sign-in
router.post(
Expand Down

0 comments on commit ec9df9f

Please sign in to comment.