public function execute() { $this->module->getLogger()->info(get_class($this) . ': notify :: ' . print_r($_POST, true)); $payload = isset($_POST['payload_b64']) ? $_POST['payload_b64'] : null; $payload = $payload ? @base64_decode($payload) : null; $payload = $payload ? (array) @json_decode($payload) : array(); $signature = isset($_POST['signature']) ? $_POST['signature'] : null; $call_type = isset($_POST['call_type']) ? $_POST['call_type'] : null; // check the request if (!$this->debug) { if (!isset($_POST) || !$_POST) { $this->handleError($this->module->l('Invalid Request 1'), self::RESP_REQUEST_ERR); } } // check the request if (!is_array($payload) || !$signature || !$call_type) { $this->handleError($this->module->l('Invalid Request 2'), self::RESP_REQUEST_ERR); } // verify the payload if (!$this->module->verifySbnPayload($payload, $signature)) { $this->handleError($this->module->l('Payload could not be validated'), self::RESP_VERIFY_PAYLOAD_ERR); } // check the call type if (!in_array($call_type, $this->supported_calls)) { $this->handleError($this->module->l('Unsupported'), self::RESP_UNSUPPORTED_CALL_ERR); } // process $message = null; $code = null; $data = null; try { $success = $this->processPayload($call_type, $payload, $message, $code, $data); } catch (Exception $e) { $success = false; $message = $e->getMessage() . ' - ' . $e->getTraceAsString() . ' - ' . $e->getFile() . ' - ' . $e->getLine(); } if (!$success) { $this->module->getLogger()->err(get_class($this) . ': notify exception :: ' . $message); $this->handleError($message, self::RESP_GENERIC_ERR); } $this->handleResponse($message, $code, $success, $data); }