| @@ 31-50 (lines=20) @@ | ||
| 28 | * @return Contracts\Terminal\GetByPessoaIdResponse |
|
| 29 | * @throws \Exception |
|
| 30 | */ |
|
| 31 | public function getByPessoaId($pessoaId) |
|
| 32 | { |
|
| 33 | try{ |
|
| 34 | $this->response = $this->_httpClient->post(__FUNCTION__,[ |
|
| 35 | 'query' => $this->addQueryAdditionalParameters([ |
|
| 36 | 'pessoaId' => $pessoaId |
|
| 37 | ]) |
|
| 38 | ]); |
|
| 39 | ||
| 40 | return SerializerHelper::denormalize( |
|
| 41 | $this->response->json(), |
|
| 42 | Contracts\Terminal\GetByPessoaIdResponse::class |
|
| 43 | ); |
|
| 44 | }catch (RequestException $ex) { |
|
| 45 | $responseBody = $ex->getResponse()->json(); |
|
| 46 | throw new \Exception($responseBody['message']); |
|
| 47 | }catch (\Exception $ex){ |
|
| 48 | throw new \Exception($ex->getMessage(), $ex->getCode(), $ex); |
|
| 49 | } |
|
| 50 | } |
|
| 51 | ||
| 52 | /** |
|
| 53 | * @param integer $terminalId |
|
| @@ 57-77 (lines=21) @@ | ||
| 54 | * @return Contracts\Terminal\GetByIdResponse |
|
| 55 | * @throws \Exception |
|
| 56 | */ |
|
| 57 | public function getById($terminalId) |
|
| 58 | { |
|
| 59 | try{ |
|
| 60 | $this->response = $this->_httpClient->post(__FUNCTION__,[ |
|
| 61 | 'query' => $this->addQueryAdditionalParameters([ |
|
| 62 | 'terminalId' => $terminalId |
|
| 63 | ]) |
|
| 64 | ]); |
|
| 65 | ||
| 66 | return SerializerHelper::denormalize( |
|
| 67 | $this->response->json(), |
|
| 68 | Contracts\Terminal\GetByIdResponse::class |
|
| 69 | ); |
|
| 70 | }catch (RequestException $ex) { |
|
| 71 | $this->response = $ex->getResponse(); |
|
| 72 | $responseBody = $ex->getResponse()->json(); |
|
| 73 | throw new \Exception($responseBody['message']); |
|
| 74 | }catch (\Exception $ex){ |
|
| 75 | throw new \Exception($ex->getMessage(), $ex->getCode(), $ex); |
|
| 76 | } |
|
| 77 | } |
|
| 78 | ||
| 79 | /** |
|
| 80 | * @param Contracts\Terminal\InsertRequest $insertRequest |
|
| @@ 82-102 (lines=21) @@ | ||
| 79 | * @return Contracts\IntencaoVenda\GetByIdResponse |
|
| 80 | * @throws \Exception |
|
| 81 | */ |
|
| 82 | public function getById($intencaoVendaId) |
|
| 83 | { |
|
| 84 | try{ |
|
| 85 | $this->response = $this->_httpClient->post(__FUNCTION__,[ |
|
| 86 | 'query' => $this->addQueryAdditionalParameters([ |
|
| 87 | 'intencaoVendaId' => $intencaoVendaId |
|
| 88 | ]) |
|
| 89 | ]); |
|
| 90 | ||
| 91 | return SerializerHelper::denormalize( |
|
| 92 | $this->response->json(), |
|
| 93 | Contracts\IntencaoVenda\GetByIdResponse::class |
|
| 94 | ); |
|
| 95 | }catch (RequestException $ex) { |
|
| 96 | $this->response = $ex->getResponse(); |
|
| 97 | $responseBody = $ex->getResponse()->json(); |
|
| 98 | throw new \Exception($responseBody['message']); |
|
| 99 | }catch (\Exception $ex){ |
|
| 100 | throw new \Exception($ex->getMessage(), $ex->getCode(), $ex); |
|
| 101 | } |
|
| 102 | } |
|
| 103 | ||
| 104 | // /** |
|
| 105 | // * API Provavelmente descontinuada |
|
| @@ 31-51 (lines=21) @@ | ||
| 28 | * @return Contracts\Venda\VenderResponse |
|
| 29 | * @throws \Exception |
|
| 30 | */ |
|
| 31 | public function getByAtivosByPessoaId($pessoaId) |
|
| 32 | { |
|
| 33 | try{ |
|
| 34 | $this->response = $this->_httpClient->get(__FUNCTION__,[ |
|
| 35 | 'query' => $this->addQueryAdditionalParameters([ |
|
| 36 | 'pessoaId' => $pessoaId |
|
| 37 | ]) |
|
| 38 | ]); |
|
| 39 | ||
| 40 | return SerializerHelper::denormalize( |
|
| 41 | $this->response->json(), |
|
| 42 | Contracts\Produto\GetByAtivosByPessoaIdResponse::class |
|
| 43 | ); |
|
| 44 | }catch (RequestException $ex) { |
|
| 45 | $this->response = $ex->getResponse(); |
|
| 46 | $responseBody = $ex->getResponse()->json(); |
|
| 47 | throw new \Exception($responseBody['message']); |
|
| 48 | }catch (\Exception $ex){ |
|
| 49 | throw new \Exception($ex->getMessage(), $ex->getCode(), $ex); |
|
| 50 | } |
|
| 51 | } |
|
| 52 | ||
| 53 | } |
|