Fixed webhook handler check for if Stripe configured

no-issue

Previously we would not create an instance of the StripeAPIService if
Stripe was not configured, but that is not the case any more, instead we
have a configured flag on the service. The webhook route handler was not
updated to use this flag and so would attempt to handle webhooks without
having any of the required data. This would result in an uncaught error.
This commit is contained in:
Fabien O'Carroll 2021-09-08 12:27:09 +02:00
parent a072d19385
commit 00e0c9d205

View File

@ -350,7 +350,7 @@ module.exports = function MembersAPI({
}; };
middleware.handleStripeWebhook.use(body.raw({type: 'application/json'}), async function (req, res) { middleware.handleStripeWebhook.use(body.raw({type: 'application/json'}), async function (req, res) {
if (!stripeAPIService) { if (!stripeAPIService.configured) {
common.logging.error(`Stripe not configured, not handling webhook`); common.logging.error(`Stripe not configured, not handling webhook`);
res.writeHead(400); res.writeHead(400);
return res.end(); return res.end();