From a092e7cc9bfb79d94f27535a560a9be37991ab59 Mon Sep 17 00:00:00 2001 From: "@ChristelLoftus" <christel@bob.co.za> Date: Tue, 12 Nov 2024 12:28:03 +0200 Subject: [PATCH] add check for empty webhook key --- Model/Carrier/BobGo.php | 5 +++++ Observer/OrderWebhookBase.php | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/Model/Carrier/BobGo.php b/Model/Carrier/BobGo.php index 1260bbf..d269be1 100644 --- a/Model/Carrier/BobGo.php +++ b/Model/Carrier/BobGo.php @@ -1066,6 +1066,11 @@ class BobGo extends AbstractCarrierOnline implements \Magento\Shipping\Model\Car \Magento\Store\Model\ScopeInterface::SCOPE_STORE ); + // Check if the webhook key is empty and return false + if (empty($webhookKey)) { + return false; + } + // Convert the string to a boolean value $isEnabled = $this->isWebhookEnabled(); diff --git a/Observer/OrderWebhookBase.php b/Observer/OrderWebhookBase.php index 62988c4..311daa7 100644 --- a/Observer/OrderWebhookBase.php +++ b/Observer/OrderWebhookBase.php @@ -52,6 +52,11 @@ abstract class OrderWebhookBase implements ObserverInterface // Generate the signature using the webhook key saved in config $webhookKey = $this->scopeConfig->getValue('carriers/bobgo/webhook_key', \Magento\Store\Model\ScopeInterface::SCOPE_STORE); + // Check if the webhook key is empty and return false + if (empty($webhookKey)) { + return; + } + // Send the webhook $this->bobGo->encodeWebhookAndPostRequest($url, $data, $storeId, $webhookKey); } -- GitLab