Completed
Push — master ( ac28ba...d1c608 )
by Adriano
05:00
created
src/Integracao/ControlPay/API/PedidoApi.php 1 patch
Braces   +15 added lines, -14 removed lines patch added patch discarded remove patch
@@ -34,10 +34,11 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
src/Integracao/ControlPay/API/VendaApi.php 1 patch
Braces   +19 added lines, -14 removed lines patch added patch discarded remove patch
@@ -44,29 +44,33 @@  discard block
 block discarded – undo
44 44
     {
45 45
         try{
46 46
 
47
-            if(empty($venderRequest->getTerminalId()))
48
-                $venderRequest->setTerminalId(
47
+            if(empty($venderRequest->getTerminalId())) {
48
+                            $venderRequest->setTerminalId(
49 49
                     $this->_client->getParameter(ControlPayParameterConst::CONTROLPAY_DEFAULT_TERMINAL_ID)
50 50
                 );
51
+            }
51 52
 
52
-            if(empty($venderRequest->getFormaPagamentoId()))
53
-                $venderRequest->setFormaPagamentoId(
53
+            if(empty($venderRequest->getFormaPagamentoId())) {
54
+                            $venderRequest->setFormaPagamentoId(
54 55
                     $this->_client->getParameter(ControlPayParameterConst::CONTROLPAY_DEFAULT_FORMA_PAGAMENTO_ID)
55 56
                 );
57
+            }
56 58
 
57
-            if(empty($venderRequest->isAguardarTefIniciarTransacao()))
58
-                $venderRequest->setAguardarTefIniciarTransacao(
59
+            if(empty($venderRequest->isAguardarTefIniciarTransacao())) {
60
+                            $venderRequest->setAguardarTefIniciarTransacao(
59 61
                     boolval(
60 62
                         $this->_client->getParameter(ControlPayParameterConst::CONTROLPAY_DEFAULT_FORMA_AGUARDA_TEF)
61 63
                     )
62 64
                 );
65
+            }
63 66
 
64 67
             foreach ($venderRequest->getProdutosVendidos() as $key => $produto)
65 68
             {
66
-                if(empty($produto->getId()))
67
-                    $venderRequest->getProdutosVendidos()[$key]->setId(
69
+                if(empty($produto->getId())) {
70
+                                    $venderRequest->getProdutosVendidos()[$key]->setId(
68 71
                         $this->_client->getParameter(ControlPayParameterConst::CONTROLPAY_DEFAULT_PRODUTO_ID)
69 72
                     );
73
+                }
70 74
             }
71 75
 
72 76
             $this->response = $this->_httpClient->post(__FUNCTION__,[
@@ -77,11 +81,11 @@  discard block
 block discarded – undo
77 81
                 $this->response->json(),
78 82
                 Contracts\Venda\VenderResponse::class
79 83
             );
80
-        }catch (RequestException $ex) {
84
+        } catch (RequestException $ex) {
81 85
             $this->response = $ex->getResponse();
82 86
             $responseBody = $ex->getResponse()->json();
83 87
             throw new \Exception($responseBody['message']);
84
-        }catch (\Exception $ex){
88
+        } catch (\Exception $ex){
85 89
             throw new \Exception($ex->getMessage(), $ex->getCode(), $ex);
86 90
         }
87 91
     }
@@ -96,19 +100,20 @@  discard block
 block discarded – undo
96 100
         try{
97 101
             $response = $this->pedidoApi->insert($venderComPedidoRequest->getPedidoInserirRequest());
98 102
 
99
-            if(empty($response->getPedido()->getId()))
100
-                throw new \Exception("Falha ao inserir pedido");
103
+            if(empty($response->getPedido()->getId())) {
104
+                            throw new \Exception("Falha ao inserir pedido");
105
+            }
101 106
 
102 107
             $venderComPedidoRequest->getInventarioVenderRequest()->setPedidoId(
103 108
                 $response->getPedido()->getId()
104 109
             );
105 110
 
106 111
             return $this->vender($venderComPedidoRequest->getInventarioVenderRequest());
107
-        }catch (RequestException $ex) {
112
+        } catch (RequestException $ex) {
108 113
             $this->response = $ex->getResponse();
109 114
             $responseBody = $ex->getResponse()->json();
110 115
             throw new \Exception($responseBody['message']);
111
-        }catch (\Exception $ex){
116
+        } catch (\Exception $ex){
112 117
             throw new \Exception($ex->getMessage(), $ex->getCode(), $ex);
113 118
         }
114 119
     }
Please login to merge, or discard this patch.
src/Integracao/ControlPay/Model/Pedido.php 1 patch
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -203,8 +203,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
src/Integracao/ControlPay/Contracts/Pedido/InserirResponse.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -63,8 +63,9 @@
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
src/Integracao/ControlPay/Contracts/Pedido/GetByFiltrosResponse.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -66,8 +66,9 @@
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
src/Integracao/ControlPay/Contracts/Pedido/GetByIdResponse.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -63,8 +63,9 @@
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
ControlPay/Contracts/Pedido/GetByPessoaIdByReferenciaResponse.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -66,8 +66,9 @@
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
src/Integracao/ControlPay/Contracts/Pedido/CancelarResponse.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -63,8 +63,9 @@
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
src/Integracao/ControlPay/Contracts/Pedido/GetPedidosByPessoaIdResponse.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -66,8 +66,9 @@
 block discarded – undo
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
     }
Please login to merge, or discard this patch.