protected function factoryFromCreateResponse(Response $response) { $dataRaw = $response->getData(); $linkList = []; foreach ($dataRaw->getLink() as $link) { $linkList[$link['@rel']] = $link['@href']; } $data = ['id' => current($dataRaw->getOrderData()), 'checkoutUrl' => $linkList['urlWallet']]; return new Transaction($data); }
protected function processExecute(Request $request, Response $response) { if (300 > $response->getHttpStatusCode()) { $decorator = $this->resolveDecorator($request); } else { $decorator = $this->getFullyQualifiedDecoratorName('ProblematicDecorator'); } $data = $response->getData()->toArray(); $instance = new $decorator($data); $instance->setCode($response->getHttpStatusCode()); return $instance; }
/** * Executa a chamada http. * * @param Request $request Objeto com a requisição * * @return Response Objeto com a resposta da requisição */ protected function exec(Request $request) { try { $data = $request->exec(); $response = new Response($data); $response->setLogger($this->getLogger()); $response->validate(); $this->debug('Client Execution', ['request' => $request->toLog(), 'response' => $response->toLog()]); return $response; } catch (RequestException $e) { $this->error('Execucao fracassada', ['exception' => $e->toLog(), 'request' => $request->toLog()]); throw $e; } }
protected function factoryCustomer(Response $response) { $data = $response->getData()->toArray(); return new Customer($data); }
protected function processResponse(Response $response) { return $response->getData(); }