From a6f1cac6c440e9cd03e7ff75844e3c2a8bd42002 Mon Sep 17 00:00:00 2001 From: Greg Solovyev Date: Sun, 21 Apr 2024 23:33:16 -0700 Subject: [PATCH] handle coinbase callback --- server/server.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/server/server.js b/server/server.js index 514c0de..362671f 100644 --- a/server/server.js +++ b/server/server.js @@ -400,16 +400,16 @@ APP.post('/api/coinbasecommerce', async (req, res) => { const sharedSecret = COINBASE_SHARED_SECRET; // Verify the webhook notification using the shared secret -// const signature = req.headers['x-cc-webhook-signature']; -// const isValid = coinbaseLib.verifyWebhookPayload(signature, req.body, sharedSecret, Sentry); - // if (isValid) { + const signature = req.headers['x-cc-webhook-signature']; + const isValid = coinbaseLib.verifyWebhookPayload(signature, req.body, sharedSecret, Sentry); + if (isValid) { const DB = CLIENT.db(DBNAME); coinbaseLib.updateCharge(DB, Sentry, req.body); res.sendStatus(200); - /*} else { + } else { Sentry.captureException(new Error('Invalid signature for Coinbase Commerce webhook')); res.sendStatus(500); - }*/ + } }); /**