analyticsToken = $analyticsToken; $this->httpClient = $httpClient; $this->config = $config; $this->responseResolver = $responseResolver; $this->logger = $logger; } /** * Performs obtaining of an OTP from the MBI service. * * Returns received OTP or FALSE in case of failure. * * @return string|false */ public function call() { $result = false; if ($this->analyticsToken->isTokenExist()) { $response = $this->httpClient->request( ZendClient::POST, $this->config->getValue($this->otpUrlConfigPath), [ "access-token" => $this->analyticsToken->getToken(), "url" => $this->config->getValue(Store::XML_PATH_SECURE_BASE_URL), ] ); $result = $this->responseResolver->getResult($response); if (!$result) { $this->logger->warning( sprintf( 'Obtaining of an OTP from the MBI service has been failed: %s. Content-Type: %s', !empty($response->getBody()) ? $response->getBody() : 'Response body is empty', $response->getHeader('Content-Type') ) ); } } return $result; } }