| @@ 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 | } |
|
| @@ 91-112 (lines=22) @@ | ||
| 88 | * @return Pedido\GetByPessoaIdByReferenciaResponse |
|
| 89 | * @throws \Exception |
|
| 90 | */ |
|
| 91 | public function getByPessoaIdByReferencia($pessoaId, $pedidoReferencia) |
|
| 92 | { |
|
| 93 | try{ |
|
| 94 | $this->response = $this->_httpClient->post(__FUNCTION__,[ |
|
| 95 | 'query' => $this->addQueryAdditionalParameters([ |
|
| 96 | 'pessoaId' => $pessoaId, |
|
| 97 | 'pedidoReferencia' => $pedidoReferencia |
|
| 98 | ]) |
|
| 99 | ]); |
|
| 100 | ||
| 101 | return SerializerHelper::denormalize( |
|
| 102 | $this->response->json(), |
|
| 103 | Pedido\GetByPessoaIdByReferenciaResponse::class |
|
| 104 | ); |
|
| 105 | }catch (RequestException $ex) { |
|
| 106 | $this->response = $ex->getResponse(); |
|
| 107 | $responseBody = $ex->getResponse()->json(); |
|
| 108 | throw new \Exception($responseBody['message']); |
|
| 109 | }catch (\Exception $ex){ |
|
| 110 | throw new \Exception($ex->getMessage(), $ex->getCode(), $ex); |
|
| 111 | } |
|
| 112 | } |
|
| 113 | ||
| 114 | /** |
|
| 115 | * @param $pessoaVendedorId |
|
| @@ 120-141 (lines=22) @@ | ||
| 117 | * @return Pedido\GetByPessoaIdByReferenciaResponse |
|
| 118 | * @throws \Exception |
|
| 119 | */ |
|
| 120 | public function getPedidosByPessoaId($pessoaVendedorId, $pedidoId) |
|
| 121 | { |
|
| 122 | try{ |
|
| 123 | $this->response = $this->_httpClient->post(__FUNCTION__,[ |
|
| 124 | 'query' => $this->addQueryAdditionalParameters([ |
|
| 125 | 'pessoaVendedorId' => $pessoaVendedorId, |
|
| 126 | 'pedidoId' => $pedidoId |
|
| 127 | ]) |
|
| 128 | ]); |
|
| 129 | ||
| 130 | return SerializerHelper::denormalize( |
|
| 131 | $this->response->json(), |
|
| 132 | Pedido\GetByPessoaIdByReferenciaResponse::class |
|
| 133 | ); |
|
| 134 | }catch (RequestException $ex) { |
|
| 135 | $this->response = $ex->getResponse(); |
|
| 136 | $responseBody = $ex->getResponse()->json(); |
|
| 137 | throw new \Exception($responseBody['message']); |
|
| 138 | }catch (\Exception $ex){ |
|
| 139 | throw new \Exception($ex->getMessage(), $ex->getCode(), $ex); |
|
| 140 | } |
|
| 141 | } |
|
| 142 | ||
| 143 | /** |
|
| 144 | * @param $pedidoId |
|
| @@ 148-168 (lines=21) @@ | ||
| 145 | * @return Pedido\CancelarResponse |
|
| 146 | * @throws \Exception |
|
| 147 | */ |
|
| 148 | public function cancelar($pedidoId) |
|
| 149 | { |
|
| 150 | try{ |
|
| 151 | $this->response = $this->_httpClient->post(__FUNCTION__,[ |
|
| 152 | 'query' => $this->addQueryAdditionalParameters([ |
|
| 153 | 'pedidoId' => $pedidoId |
|
| 154 | ]) |
|
| 155 | ]); |
|
| 156 | ||
| 157 | return SerializerHelper::denormalize( |
|
| 158 | $this->response->json(), |
|
| 159 | Pedido\CancelarResponse::class |
|
| 160 | ); |
|
| 161 | }catch (RequestException $ex) { |
|
| 162 | $this->response = $ex->getResponse(); |
|
| 163 | $responseBody = $ex->getResponse()->json(); |
|
| 164 | throw new \Exception($responseBody['message']); |
|
| 165 | }catch (\Exception $ex){ |
|
| 166 | throw new \Exception($ex->getMessage(), $ex->getCode(), $ex); |
|
| 167 | } |
|
| 168 | } |
|
| 169 | ||
| 170 | /** |
|
| 171 | * @param integer $pedidoId |
|
| @@ 175-195 (lines=21) @@ | ||
| 172 | * @return Pedido\GetByIdResponse |
|
| 173 | * @throws \Exception |
|
| 174 | */ |
|
| 175 | public function getById($pedidoId) |
|
| 176 | { |
|
| 177 | try{ |
|
| 178 | $this->response = $this->_httpClient->post(__FUNCTION__,[ |
|
| 179 | 'query' => $this->addQueryAdditionalParameters([ |
|
| 180 | 'pedidoId' => $pedidoId |
|
| 181 | ]) |
|
| 182 | ]); |
|
| 183 | ||
| 184 | return SerializerHelper::denormalize( |
|
| 185 | $this->response->json(), |
|
| 186 | Pedido\GetByIdResponse::class |
|
| 187 | ); |
|
| 188 | }catch (RequestException $ex) { |
|
| 189 | $this->response = $ex->getResponse(); |
|
| 190 | $responseBody = $ex->getResponse()->json(); |
|
| 191 | throw new \Exception($responseBody['message']); |
|
| 192 | }catch (\Exception $ex){ |
|
| 193 | throw new \Exception($ex->getMessage(), $ex->getCode(), $ex); |
|
| 194 | } |
|
| 195 | } |
|
| 196 | } |
|