public function process() { try { $requestTime = $this->getHelper('Data')->getCurrentGmtDate(); $result = $this->getHelper('Server')->sendRequest($this->getBody(), $this->getHeaders(), $this->getServerBaseUrl(), $this->getServerHostName(), $this->getTimeout(), $this->isTryToResendOnError(), $this->isTryToSwitchEndpointOnError()); } catch (\Exception $exception) { $this->getHelper('Client')->updateMySqlConnection(); throw $exception; } $this->getHelper('Client')->updateMySqlConnection(); try { $this->response = $this->modelFactory->getObject('Connector\\Connection\\Response'); $this->response->initFromRawResponse($result['response']); $this->response->setRequestTime($requestTime); } catch (\Exception $exception) { $this->isTryToSwitchEndpointOnError() && $this->helperFactory->getObject('Server')->switchEndpoint(); $connectionErrorMessage = 'The Action was not completed because connection with M2E Pro Server was not set. There are several possible reasons: temporary connection problem – please wait and try again later; block of outgoing connection by firewall – please, ensure that connection to s1.m2epro.com and s2.m2epro.com, port 443 is allowed; CURL library is not installed or it does not support HTTPS Protocol – please, install/update CURL library on your server and ensure it supports HTTPS Protocol. More information you can find <a target="_blank" href="' . $this->helperFactory->getObject('Module\\Support')->getKnowledgebaseUrl('664870-issues-with-m2e-pro-server-connection') . '">here</a>'; throw new \Ess\M2ePro\Model\Exception\Connection($connectionErrorMessage, $result); } if ($this->getResponse()->getMessages()->hasSystemErrorEntity()) { throw new \Ess\M2ePro\Model\Exception($this->getHelper('Module\\Translation')->__("Internal Server Error(s) [%error_message%]", $this->getResponse()->getMessages()->getCombinedSystemErrorsString()), array(), 0, !$this->getResponse()->isServerInMaintenanceMode()); } }
protected function getResponse() { if (!is_null($this->response)) { return $this->response; } $this->response = $this->modelFactory->getObject('Connector\\Connection\\Response'); $this->response->initFromPreparedResponse($this->getProcessingObject()->getResultData(), $this->getProcessingObject()->getResultMessages()); $params = $this->getParams(); if (!empty($params['request_time'])) { $this->response->setRequestTime($params['request_time']); } return $this->response; }