@@ -336,8 +336,9 @@ |
||
| 336 | 336 | public function setProdutosVendidos($produtosVendidos) |
| 337 | 337 | { |
| 338 | 338 | |
| 339 | - foreach ($produtosVendidos as $produto) |
|
| 340 | - $this->produtosVendidos[] = is_array($produto) ? SerializerHelper::denormalize($produto, Produto::class) : $produto; |
|
| 339 | + foreach ($produtosVendidos as $produto) { |
|
| 340 | + $this->produtosVendidos[] = is_array($produto) ? SerializerHelper::denormalize($produto, Produto::class) : $produto; |
|
| 341 | + } |
|
| 341 | 342 | |
| 342 | 343 | return $this; |
| 343 | 344 | } |
@@ -62,8 +62,9 @@ |
||
| 62 | 62 | { |
| 63 | 63 | $this->intencaoVenda = $intencaoVenda; |
| 64 | 64 | |
| 65 | - if(is_array($this->intencaoVenda)) |
|
| 66 | - $this->intencaoVenda = SerializerHelper::denormalize($this->intencaoVenda, IntencaoVenda::class); |
|
| 65 | + if(is_array($this->intencaoVenda)) { |
|
| 66 | + $this->intencaoVenda = SerializerHelper::denormalize($this->intencaoVenda, IntencaoVenda::class); |
|
| 67 | + } |
|
| 67 | 68 | |
| 68 | 69 | return $this; |
| 69 | 70 | } |
@@ -34,10 +34,11 @@ discard block |
||
| 34 | 34 | |
| 35 | 35 | foreach ($inserirRequest->getProdutosPedido() as $key => $produto) |
| 36 | 36 | { |
| 37 | - if(empty($produto->getId())) |
|
| 38 | - $inserirRequest->getProdutosPedido()[$key]->setId( |
|
| 37 | + if(empty($produto->getId())) { |
|
| 38 | + $inserirRequest->getProdutosPedido()[$key]->setId( |
|
| 39 | 39 | $this->_client->getParameter(ControlPayParameterConst::CONTROLPAY_DEFAULT_PRODUTO_ID) |
| 40 | 40 | ); |
| 41 | + } |
|
| 41 | 42 | } |
| 42 | 43 | |
| 43 | 44 | $this->response = $this->_httpClient->post(__FUNCTION__,[ |
@@ -48,11 +49,11 @@ discard block |
||
| 48 | 49 | $this->response->json(), |
| 49 | 50 | Pedido\InserirResponse::class |
| 50 | 51 | ); |
| 51 | - }catch (RequestException $ex) { |
|
| 52 | + } catch (RequestException $ex) { |
|
| 52 | 53 | $this->response = $ex->getResponse(); |
| 53 | 54 | $responseBody = $ex->getResponse()->json(); |
| 54 | 55 | throw new \Exception($responseBody['message']); |
| 55 | - }catch (\Exception $ex){ |
|
| 56 | + } catch (\Exception $ex){ |
|
| 56 | 57 | throw new \Exception($ex->getMessage(), $ex->getCode(), $ex); |
| 57 | 58 | } |
| 58 | 59 | } |
@@ -73,11 +74,11 @@ discard block |
||
| 73 | 74 | $this->response->json(), |
| 74 | 75 | Pedido\GetByFiltrosResponse::class |
| 75 | 76 | ); |
| 76 | - }catch (RequestException $ex) { |
|
| 77 | + } catch (RequestException $ex) { |
|
| 77 | 78 | $this->response = $ex->getResponse(); |
| 78 | 79 | $responseBody = $ex->getResponse()->json(); |
| 79 | 80 | throw new \Exception($responseBody['message']); |
| 80 | - }catch (\Exception $ex){ |
|
| 81 | + } catch (\Exception $ex){ |
|
| 81 | 82 | throw new \Exception($ex->getMessage(), $ex->getCode(), $ex); |
| 82 | 83 | } |
| 83 | 84 | } |
@@ -102,11 +103,11 @@ discard block |
||
| 102 | 103 | $this->response->json(), |
| 103 | 104 | Pedido\GetByPessoaIdByReferenciaResponse::class |
| 104 | 105 | ); |
| 105 | - }catch (RequestException $ex) { |
|
| 106 | + } catch (RequestException $ex) { |
|
| 106 | 107 | $this->response = $ex->getResponse(); |
| 107 | 108 | $responseBody = $ex->getResponse()->json(); |
| 108 | 109 | throw new \Exception($responseBody['message']); |
| 109 | - }catch (\Exception $ex){ |
|
| 110 | + } catch (\Exception $ex){ |
|
| 110 | 111 | throw new \Exception($ex->getMessage(), $ex->getCode(), $ex); |
| 111 | 112 | } |
| 112 | 113 | } |
@@ -131,11 +132,11 @@ discard block |
||
| 131 | 132 | $this->response->json(), |
| 132 | 133 | Pedido\GetByPessoaIdByReferenciaResponse::class |
| 133 | 134 | ); |
| 134 | - }catch (RequestException $ex) { |
|
| 135 | + } catch (RequestException $ex) { |
|
| 135 | 136 | $this->response = $ex->getResponse(); |
| 136 | 137 | $responseBody = $ex->getResponse()->json(); |
| 137 | 138 | throw new \Exception($responseBody['message']); |
| 138 | - }catch (\Exception $ex){ |
|
| 139 | + } catch (\Exception $ex){ |
|
| 139 | 140 | throw new \Exception($ex->getMessage(), $ex->getCode(), $ex); |
| 140 | 141 | } |
| 141 | 142 | } |
@@ -158,11 +159,11 @@ discard block |
||
| 158 | 159 | $this->response->json(), |
| 159 | 160 | Pedido\CancelarResponse::class |
| 160 | 161 | ); |
| 161 | - }catch (RequestException $ex) { |
|
| 162 | + } catch (RequestException $ex) { |
|
| 162 | 163 | $this->response = $ex->getResponse(); |
| 163 | 164 | $responseBody = $ex->getResponse()->json(); |
| 164 | 165 | throw new \Exception($responseBody['message']); |
| 165 | - }catch (\Exception $ex){ |
|
| 166 | + } catch (\Exception $ex){ |
|
| 166 | 167 | throw new \Exception($ex->getMessage(), $ex->getCode(), $ex); |
| 167 | 168 | } |
| 168 | 169 | } |
@@ -185,11 +186,11 @@ discard block |
||
| 185 | 186 | $this->response->json(), |
| 186 | 187 | Pedido\GetByIdResponse::class |
| 187 | 188 | ); |
| 188 | - }catch (RequestException $ex) { |
|
| 189 | + } catch (RequestException $ex) { |
|
| 189 | 190 | $this->response = $ex->getResponse(); |
| 190 | 191 | $responseBody = $ex->getResponse()->json(); |
| 191 | 192 | throw new \Exception($responseBody['message']); |
| 192 | - }catch (\Exception $ex){ |
|
| 193 | + } catch (\Exception $ex){ |
|
| 193 | 194 | throw new \Exception($ex->getMessage(), $ex->getCode(), $ex); |
| 194 | 195 | } |
| 195 | 196 | } |
@@ -203,8 +203,9 @@ discard block |
||
| 203 | 203 | */ |
| 204 | 204 | public function setProdutos($produtos) |
| 205 | 205 | { |
| 206 | - foreach ($produtos as $produto) |
|
| 207 | - $this->produtos[] = SerializerHelper::denormalize($produto, Produto::class); |
|
| 206 | + foreach ($produtos as $produto) { |
|
| 207 | + $this->produtos[] = SerializerHelper::denormalize($produto, Produto::class); |
|
| 208 | + } |
|
| 208 | 209 | |
| 209 | 210 | return $this; |
| 210 | 211 | } |
@@ -441,8 +442,9 @@ discard block |
||
| 441 | 442 | { |
| 442 | 443 | $this->pedidoStatus = $pedidoStatus; |
| 443 | 444 | |
| 444 | - if(is_array($this->pedidoStatus)) |
|
| 445 | - $this->pedidoStatus = SerializerHelper::denormalize($this->pedidoStatus, PedidoStatus::class); |
|
| 445 | + if(is_array($this->pedidoStatus)) { |
|
| 446 | + $this->pedidoStatus = SerializerHelper::denormalize($this->pedidoStatus, PedidoStatus::class); |
|
| 447 | + } |
|
| 446 | 448 | |
| 447 | 449 | return $this; |
| 448 | 450 | } |
@@ -63,8 +63,9 @@ |
||
| 63 | 63 | { |
| 64 | 64 | $this->pedido = $pedido; |
| 65 | 65 | |
| 66 | - if(is_array($this->pedido)) |
|
| 67 | - $this->pedido = SerializerHelper::denormalize($this->pedido, Pedido::class); |
|
| 66 | + if(is_array($this->pedido)) { |
|
| 67 | + $this->pedido = SerializerHelper::denormalize($this->pedido, Pedido::class); |
|
| 68 | + } |
|
| 68 | 69 | |
| 69 | 70 | return $this; |
| 70 | 71 | } |
@@ -66,8 +66,9 @@ |
||
| 66 | 66 | */ |
| 67 | 67 | public function setPedidos($pedidos) |
| 68 | 68 | { |
| 69 | - foreach ($pedidos as $pedido) |
|
| 70 | - $this->pedidos[] = SerializerHelper::denormalize($pedido, Pedido::class); |
|
| 69 | + foreach ($pedidos as $pedido) { |
|
| 70 | + $this->pedidos[] = SerializerHelper::denormalize($pedido, Pedido::class); |
|
| 71 | + } |
|
| 71 | 72 | |
| 72 | 73 | return $this; |
| 73 | 74 | } |
@@ -21,8 +21,9 @@ |
||
| 21 | 21 | */ |
| 22 | 22 | public static function getInstance(array $params, Client $client = null) |
| 23 | 23 | { |
| 24 | - if(!isset($params[ControlPayParameterConst::CONTROLPAY_OAUTH_TYPE])) |
|
| 25 | - throw new \Exception("Tipo de autenticação não especificado"); |
|
| 24 | + if(!isset($params[ControlPayParameterConst::CONTROLPAY_OAUTH_TYPE])) { |
|
| 25 | + throw new \Exception("Tipo de autenticação não especificado"); |
|
| 26 | + } |
|
| 26 | 27 | |
| 27 | 28 | switch ($params[ControlPayParameterConst::CONTROLPAY_OAUTH_TYPE]) |
| 28 | 29 | { |
@@ -66,8 +66,9 @@ |
||
| 66 | 66 | */ |
| 67 | 67 | public function setPedidos($pedidos) |
| 68 | 68 | { |
| 69 | - foreach ($pedidos as $pedido) |
|
| 70 | - $this->pedidos[] = SerializerHelper::denormalize($pedido, Pedido::class); |
|
| 69 | + foreach ($pedidos as $pedido) { |
|
| 70 | + $this->pedidos[] = SerializerHelper::denormalize($pedido, Pedido::class); |
|
| 71 | + } |
|
| 71 | 72 | |
| 72 | 73 | return $this; |
| 73 | 74 | } |
@@ -63,8 +63,9 @@ |
||
| 63 | 63 | { |
| 64 | 64 | $this->pedido = $pedido; |
| 65 | 65 | |
| 66 | - if(is_array($this->pedido)) |
|
| 67 | - $this->pedido = SerializerHelper::denormalize($this->pedido, Pedido::class); |
|
| 66 | + if(is_array($this->pedido)) { |
|
| 67 | + $this->pedido = SerializerHelper::denormalize($this->pedido, Pedido::class); |
|
| 68 | + } |
|
| 68 | 69 | |
| 69 | 70 | return $this; |
| 70 | 71 | } |