public function execute() { if (!$this->_api->enabled()) { $this->getResponse()->appendBody("This plugin is not currently enabled"); $this->Result400(); return; } $rawRequest = $this->getRawPost(); $request = $this->getRequest(); $hash = $request->getHeader('X-SIGNIFYD-SEC-HMAC-SHA256'); $topic = $request->getHeader('X-SIGNIFYD-TOPIC'); if ($hash == null) { $this->getResponse()->appendBody("You have successfully reached the webhook endpoint"); $this->Result200(); return; } if ($this->_api->validWebhookRequest($rawRequest, $hash, $topic)) { // For the webhook test, all of the request data will be invalid if ($topic === 'cases/test') { $this->Result200(); return; } $request = json_decode($rawRequest); $caseData = $this->initRequest($request); $caseObj = $this->_objectManager->create('Signifyd\\Connect\\Model\\Casedata'); $caseObj->updateCase($caseData); $this->Result200(); return; } else { $this->Result403(); return; } }