/** * @return array */ protected function serializeCard() { /** @var $card \Payu\Component\Card */ $card = $this->request->getCard(); if (!$card) { return array(); } return array('CC_NUMBER' => $card->getNumber(), 'EXP_MONTH' => sprintf('%02d', $card->getMonth()), 'EXP_YEAR' => $card->getYear(), 'CC_CVV' => $card->getCvv(), 'CC_OWNER' => $card->getOwner()); }
/** * @param RequestAbstract $request * @param string $endpointUrl * @return \Guzzle\Http\EntityBodyInterface|string * @throws Exception\ConnectionError */ private function sendRequest(RequestAbstract $request, $endpointUrl) { $client = new HttpClient(); $client->setConfig(array('curl.options' => array(CURLOPT_SSL_VERIFYPEER => false, CURLOPT_SSL_VERIFYHOST => false))); $httpRequest = $client->post($endpointUrl, null, $request->getRawData()); try { return $httpRequest->send()->getBody(); } catch (RequestException $e) { throw new ConnectionError($e->getMessage()); } }