Completed
Push — master ( 741114...78e68a )
by Adriano
09:10
created
src/Integracao/ControlPay/API/PedidoApi.php 2 patches
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.
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -30,17 +30,17 @@  discard block
 block discarded – undo
30 30
      */
31 31
     public function insert(Pedido\InserirRequest $inserirRequest)
32 32
     {
33
-        try{
33
+        try {
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
-            $this->response = $this->_httpClient->post(__FUNCTION__,[
43
+            $this->response = $this->_httpClient->post(__FUNCTION__, [
44 44
                 'body' => json_encode($inserirRequest),
45 45
             ]);
46 46
 
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
             );
51 51
         }catch (RequestException $ex) {
52 52
             $this->requestException($ex);
53
-        }catch (\Exception $ex){
53
+        }catch (\Exception $ex) {
54 54
             throw new \Exception($ex->getMessage(), $ex->getCode(), $ex);
55 55
         }
56 56
     }
@@ -62,8 +62,8 @@  discard block
 block discarded – undo
62 62
      */
63 63
     public function getByFiltros(Pedido\GetByFiltrosRequest $getByFiltrosRequest)
64 64
     {
65
-        try{
66
-            $this->response = $this->_httpClient->post(__FUNCTION__,[
65
+        try {
66
+            $this->response = $this->_httpClient->post(__FUNCTION__, [
67 67
                 'body' => json_encode($getByFiltrosRequest),
68 68
             ]);
69 69
 
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
             );
74 74
         }catch (RequestException $ex) {
75 75
             $this->requestException($ex);
76
-        }catch (\Exception $ex){
76
+        }catch (\Exception $ex) {
77 77
             throw new \Exception($ex->getMessage(), $ex->getCode(), $ex);
78 78
         }
79 79
     }
@@ -86,8 +86,8 @@  discard block
 block discarded – undo
86 86
      */
87 87
     public function getByPessoaIdByReferencia($pessoaId, $pedidoReferencia)
88 88
     {
89
-        try{
90
-            $this->response = $this->_httpClient->post(__FUNCTION__,[
89
+        try {
90
+            $this->response = $this->_httpClient->post(__FUNCTION__, [
91 91
                 'query' => $this->addQueryAdditionalParameters([
92 92
                     'pessoaId' => $pessoaId,
93 93
                     'pedidoReferencia' => $pedidoReferencia
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
             );
101 101
         }catch (RequestException $ex) {
102 102
             $this->requestException($ex);
103
-        }catch (\Exception $ex){
103
+        }catch (\Exception $ex) {
104 104
             throw new \Exception($ex->getMessage(), $ex->getCode(), $ex);
105 105
         }
106 106
     }
@@ -113,8 +113,8 @@  discard block
 block discarded – undo
113 113
      */
114 114
     public function getPedidosByPessoaId($pessoaVendedorId, $pedidoId)
115 115
     {
116
-        try{
117
-            $this->response = $this->_httpClient->post(__FUNCTION__,[
116
+        try {
117
+            $this->response = $this->_httpClient->post(__FUNCTION__, [
118 118
                 'query' => $this->addQueryAdditionalParameters([
119 119
                     'pessoaVendedorId' => $pessoaVendedorId,
120 120
                     'pedidoId' => $pedidoId
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
             );
128 128
         }catch (RequestException $ex) {
129 129
             $this->requestException($ex);
130
-        }catch (\Exception $ex){
130
+        }catch (\Exception $ex) {
131 131
             throw new \Exception($ex->getMessage(), $ex->getCode(), $ex);
132 132
         }
133 133
     }
@@ -139,8 +139,8 @@  discard block
 block discarded – undo
139 139
      */
140 140
     public function cancelar($pedidoId)
141 141
     {
142
-        try{
143
-            $this->response = $this->_httpClient->post(__FUNCTION__,[
142
+        try {
143
+            $this->response = $this->_httpClient->post(__FUNCTION__, [
144 144
                 'query' => $this->addQueryAdditionalParameters([
145 145
                     'pedidoId' => $pedidoId
146 146
                 ])
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
             );
153 153
         }catch (RequestException $ex) {
154 154
             $this->requestException($ex);
155
-        }catch (\Exception $ex){
155
+        }catch (\Exception $ex) {
156 156
             throw new \Exception($ex->getMessage(), $ex->getCode(), $ex);
157 157
         }
158 158
     }
@@ -164,8 +164,8 @@  discard block
 block discarded – undo
164 164
      */
165 165
     public function getById($pedidoId)
166 166
     {
167
-        try{
168
-            $this->response = $this->_httpClient->post(__FUNCTION__,[
167
+        try {
168
+            $this->response = $this->_httpClient->post(__FUNCTION__, [
169 169
                 'query' => $this->addQueryAdditionalParameters([
170 170
                     'pedidoId' => $pedidoId
171 171
                 ])
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
             );
178 178
         }catch (RequestException $ex) {
179 179
             $this->requestException($ex);
180
-        }catch (\Exception $ex){
180
+        }catch (\Exception $ex) {
181 181
             throw new \Exception($ex->getMessage(), $ex->getCode(), $ex);
182 182
         }
183 183
     }
Please login to merge, or discard this patch.
src/Integracao/ControlPay/Model/Pedido.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
     public function setProdutos($produtos)
205 205
     {
206 206
         foreach ($produtos as $produto)
207
-            $this->produtos[] = SerializerHelper::denormalize($produto, Produto::class);
207
+            $this->produtos[ ] = SerializerHelper::denormalize($produto, Produto::class);
208 208
 
209 209
         return $this;
210 210
     }
@@ -441,7 +441,7 @@  discard block
 block discarded – undo
441 441
     {
442 442
         $this->pedidoStatus = $pedidoStatus;
443 443
 
444
-        if(is_array($this->pedidoStatus))
444
+        if (is_array($this->pedidoStatus))
445 445
             $this->pedidoStatus = SerializerHelper::denormalize($this->pedidoStatus, PedidoStatus::class);
446 446
 
447 447
         return $this;
Please login to merge, or discard this 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/GetByFiltrosRequest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -155,7 +155,7 @@
 block discarded – undo
155 155
         return [
156 156
             'status' => $this->status,
157 157
             'dataInicio' => empty($this->dataInicio) ? null : $this->dataInicio->format('d/m/Y H:i:s'),
158
-            'dataFim' => empty($this->dataFim) ? null :$this->dataFim->format('d/m/Y H:i:s'),
158
+            'dataFim' => empty($this->dataFim) ? null : $this->dataFim->format('d/m/Y H:i:s'),
159 159
             'tipo' => $this->tipo,
160 160
             'valorComDivergencia' => $this->valorComDivergencia,
161 161
             'referencia' => $this->referencia
Please login to merge, or discard this patch.
src/Integracao/ControlPay/Contracts/Pedido/CancelarResponse.php 3 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@
 block discarded – undo
63 63
     {
64 64
         $this->pedido = $pedido;
65 65
 
66
-        if(is_array($this->pedido))
66
+        if (is_array($this->pedido))
67 67
             $this->pedido = SerializerHelper::denormalize($this->pedido, Pedido::class);
68 68
 
69 69
         return $this;
Please login to merge, or discard this 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.
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -3,7 +3,6 @@
 block discarded – undo
3 3
 namespace Integracao\ControlPay\Contracts\Pedido;
4 4
 
5 5
 use Integracao\ControlPay\Helpers\SerializerHelper;
6
-use Integracao\ControlPay\Model\IntencaoVenda;
7 6
 use Integracao\ControlPay\Model\Pedido;
8 7
 
9 8
 /**
Please login to merge, or discard this patch.
src/Integracao/ControlPay/Factory/AuthenticationFactory.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -21,24 +21,24 @@
 block discarded – undo
21 21
      */
22 22
     public static function getInstance(array $params, Client $client = null)
23 23
     {
24
-        if(!isset($params[ControlPayParameterConst::CONTROLPAY_OAUTH_TYPE]))
24
+        if (!isset($params[ ControlPayParameterConst::CONTROLPAY_OAUTH_TYPE ]))
25 25
             throw new \Exception("Tipo de autenticação não especificado");
26 26
 
27
-        switch ($params[ControlPayParameterConst::CONTROLPAY_OAUTH_TYPE])
27
+        switch ($params[ ControlPayParameterConst::CONTROLPAY_OAUTH_TYPE ])
28 28
         {
29 29
             case BasicAuthentication::class:
30 30
                 return new BasicAuthentication(
31
-                    isset($params[ControlPayParameterConst::CONTROLPAY_USER]) ?$params[ControlPayParameterConst::CONTROLPAY_USER] : null,
32
-                    isset($params[ControlPayParameterConst::CONTROLPAY_PWD]) ?$params[ControlPayParameterConst::CONTROLPAY_PWD] : null,
33
-                    isset($params[ControlPayParameterConst::CONTROLPAY_KEY]) ?$params[ControlPayParameterConst::CONTROLPAY_KEY] : null
31
+                    isset($params[ ControlPayParameterConst::CONTROLPAY_USER ]) ? $params[ ControlPayParameterConst::CONTROLPAY_USER ] : null,
32
+                    isset($params[ ControlPayParameterConst::CONTROLPAY_PWD ]) ? $params[ ControlPayParameterConst::CONTROLPAY_PWD ] : null,
33
+                    isset($params[ ControlPayParameterConst::CONTROLPAY_KEY ]) ? $params[ ControlPayParameterConst::CONTROLPAY_KEY ] : null
34 34
                 );
35 35
                 break;
36 36
             case KeyQueryStringAuthentication::class:
37 37
                 return new KeyQueryStringAuthentication(
38
-                    isset($params[ControlPayParameterConst::CONTROLPAY_USER]) ?$params[ControlPayParameterConst::CONTROLPAY_USER] : null,
39
-                    isset($params[ControlPayParameterConst::CONTROLPAY_PWD]) ?$params[ControlPayParameterConst::CONTROLPAY_PWD] : null,
40
-                    isset($params[ControlPayParameterConst::CONTROLPAY_KEY]) ?$params[ControlPayParameterConst::CONTROLPAY_KEY] : null,
41
-                    isset($params[ControlPayParameterConst::CONTROLPAY_DEFAULT_PESSOA_ID]) ?$params[ControlPayParameterConst::CONTROLPAY_DEFAULT_PESSOA_ID] : null,
38
+                    isset($params[ ControlPayParameterConst::CONTROLPAY_USER ]) ? $params[ ControlPayParameterConst::CONTROLPAY_USER ] : null,
39
+                    isset($params[ ControlPayParameterConst::CONTROLPAY_PWD ]) ? $params[ ControlPayParameterConst::CONTROLPAY_PWD ] : null,
40
+                    isset($params[ ControlPayParameterConst::CONTROLPAY_KEY ]) ? $params[ ControlPayParameterConst::CONTROLPAY_KEY ] : null,
41
+                    isset($params[ ControlPayParameterConst::CONTROLPAY_DEFAULT_PESSOA_ID ]) ? $params[ ControlPayParameterConst::CONTROLPAY_DEFAULT_PESSOA_ID ] : null,
42 42
                     $client
43 43
                 );
44 44
                 break;
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -21,8 +21,9 @@
 block discarded – undo
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
         {
Please login to merge, or discard this patch.
src/Integracao/ControlPay/Contracts/Pedido/GetByIdResponse.php 3 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -3,7 +3,6 @@
 block discarded – undo
3 3
 namespace Integracao\ControlPay\Contracts\Pedido;
4 4
 
5 5
 use Integracao\ControlPay\Helpers\SerializerHelper;
6
-use Integracao\ControlPay\Model\IntencaoVenda;
7 6
 use Integracao\ControlPay\Model\Pedido;
8 7
 
9 8
 /**
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@
 block discarded – undo
63 63
     {
64 64
         $this->pedido = $pedido;
65 65
 
66
-        if(is_array($this->pedido))
66
+        if (is_array($this->pedido))
67 67
             $this->pedido = SerializerHelper::denormalize($this->pedido, Pedido::class);
68 68
 
69 69
         return $this;
Please login to merge, or discard this 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/Venda/CancelarVendaResponse.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 
39 39
     /**
40 40
      * @param \DateTime $data
41
-     * @return VenderResponse
41
+     * @return CancelarVendaResponse
42 42
      */
43 43
     public function setData($data)
44 44
     {
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 
57 57
     /**
58 58
      * @param IntencaoVenda $intencaoVenda
59
-     * @return VenderResponse
59
+     * @return CancelarVendaResponse
60 60
      */
61 61
     public function setIntencaoVenda($intencaoVenda)
62 62
     {
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@
 block discarded – undo
62 62
     {
63 63
         $this->intencaoVenda = $intencaoVenda;
64 64
 
65
-        if(is_array($this->intencaoVenda))
65
+        if (is_array($this->intencaoVenda))
66 66
             $this->intencaoVenda = SerializerHelper::denormalize($this->intencaoVenda, IntencaoVenda::class);
67 67
 
68 68
         return $this;
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -62,8 +62,9 @@
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
src/Integracao/ControlPay/API/VendaApi.php 2 patches
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -42,19 +42,19 @@  discard block
 block discarded – undo
42 42
      */
43 43
     public function vender(Contracts\Venda\VenderRequest $venderRequest)
44 44
     {
45
-        try{
45
+        try {
46 46
 
47
-            if(empty($venderRequest->getTerminalId()))
47
+            if (empty($venderRequest->getTerminalId()))
48 48
                 $venderRequest->setTerminalId(
49 49
                     $this->_client->getParameter(ControlPayParameterConst::CONTROLPAY_DEFAULT_TERMINAL_ID)
50 50
                 );
51 51
 
52
-            if(empty($venderRequest->getFormaPagamentoId()))
52
+            if (empty($venderRequest->getFormaPagamentoId()))
53 53
                 $venderRequest->setFormaPagamentoId(
54 54
                     $this->_client->getParameter(ControlPayParameterConst::CONTROLPAY_DEFAULT_FORMA_PAGAMENTO_ID)
55 55
                 );
56 56
 
57
-            if(empty($venderRequest->isAguardarTefIniciarTransacao()))
57
+            if (empty($venderRequest->isAguardarTefIniciarTransacao()))
58 58
                 $venderRequest->setAguardarTefIniciarTransacao(
59 59
                     boolval(
60 60
                         $this->_client->getParameter(ControlPayParameterConst::CONTROLPAY_DEFAULT_FORMA_AGUARDA_TEF)
@@ -63,13 +63,13 @@  discard block
 block discarded – undo
63 63
 
64 64
             foreach ($venderRequest->getProdutosVendidos() as $key => $produto)
65 65
             {
66
-                if(empty($produto->getId()))
67
-                    $venderRequest->getProdutosVendidos()[$key]->setId(
66
+                if (empty($produto->getId()))
67
+                    $venderRequest->getProdutosVendidos()[ $key ]->setId(
68 68
                         $this->_client->getParameter(ControlPayParameterConst::CONTROLPAY_DEFAULT_PRODUTO_ID)
69 69
                     );
70 70
             }
71 71
 
72
-            $this->response = $this->_httpClient->post(__FUNCTION__,[
72
+            $this->response = $this->_httpClient->post(__FUNCTION__, [
73 73
                 'body' => json_encode($venderRequest),
74 74
             ]);
75 75
 
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
             );
80 80
         }catch (RequestException $ex) {
81 81
             $this->requestException($ex);
82
-        }catch (\Exception $ex){
82
+        }catch (\Exception $ex) {
83 83
             throw new \Exception($ex->getMessage(), $ex->getCode(), $ex);
84 84
         }
85 85
     }
@@ -91,10 +91,10 @@  discard block
 block discarded – undo
91 91
      */
92 92
     public function venderComPedido(Contracts\Venda\VenderComPedidoRequest $venderComPedidoRequest)
93 93
     {
94
-        try{
94
+        try {
95 95
             $response = $this->pedidoApi->insert($venderComPedidoRequest->getPedidoInserirRequest());
96 96
 
97
-            if(empty($response->getPedido()->getId()))
97
+            if (empty($response->getPedido()->getId()))
98 98
                 throw new \Exception("Falha ao inserir pedido");
99 99
 
100 100
             $venderComPedidoRequest->getInventarioVenderRequest()->setPedidoId(
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
             return $this->vender($venderComPedidoRequest->getInventarioVenderRequest());
105 105
         }catch (RequestException $ex) {
106 106
             $this->requestException($ex);
107
-        }catch (\Exception $ex){
107
+        }catch (\Exception $ex) {
108 108
             throw new \Exception($ex->getMessage(), $ex->getCode(), $ex);
109 109
         }
110 110
     }
@@ -116,19 +116,19 @@  discard block
 block discarded – undo
116 116
      */
117 117
     public function cancelarVenda(Contracts\Venda\CancelarVendaRequest $cancelarVendaRequest)
118 118
     {
119
-        try{
119
+        try {
120 120
 
121
-            if(empty($cancelarVendaRequest->getTerminalId()))
121
+            if (empty($cancelarVendaRequest->getTerminalId()))
122 122
                 $cancelarVendaRequest->setTerminalId(
123 123
                     $this->_client->getParameter(ControlPayParameterConst::CONTROLPAY_DEFAULT_TERMINAL_ID)
124 124
                 );
125 125
 
126
-            if(empty($cancelarVendaRequest->getSenhaTecnica()))
126
+            if (empty($cancelarVendaRequest->getSenhaTecnica()))
127 127
                 $cancelarVendaRequest->setSenhaTecnica(
128 128
                     $this->_client->getParameter(ControlPayParameterConst::CONTROLPAY_DEFAULT_SENHA_TECNICA)
129 129
                 );
130 130
 
131
-            if(empty($cancelarVendaRequest->isAguardarTefIniciarTransacao()))
131
+            if (empty($cancelarVendaRequest->isAguardarTefIniciarTransacao()))
132 132
                 $cancelarVendaRequest->setAguardarTefIniciarTransacao(
133 133
                     boolval(
134 134
                         $this->_client->getParameter(ControlPayParameterConst::CONTROLPAY_DEFAULT_FORMA_AGUARDA_TEF)
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
                 );
137 137
 
138 138
 
139
-            $this->response = $this->_httpClient->post(__FUNCTION__,[
139
+            $this->response = $this->_httpClient->post(__FUNCTION__, [
140 140
                 'body' => json_encode($cancelarVendaRequest),
141 141
             ]);
142 142
 
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
             );
147 147
         }catch (RequestException $ex) {
148 148
             $this->requestException($ex);
149
-        }catch (\Exception $ex){
149
+        }catch (\Exception $ex) {
150 150
             throw new \Exception($ex->getMessage(), $ex->getCode(), $ex);
151 151
         }
152 152
     }
Please login to merge, or discard this patch.
Braces   +30 added lines, -22 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,9 +81,9 @@  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->requestException($ex);
82
-        }catch (\Exception $ex){
86
+        } catch (\Exception $ex){
83 87
             throw new \Exception($ex->getMessage(), $ex->getCode(), $ex);
84 88
         }
85 89
     }
@@ -94,17 +98,18 @@  discard block
 block discarded – undo
94 98
         try{
95 99
             $response = $this->pedidoApi->insert($venderComPedidoRequest->getPedidoInserirRequest());
96 100
 
97
-            if(empty($response->getPedido()->getId()))
98
-                throw new \Exception("Falha ao inserir pedido");
101
+            if(empty($response->getPedido()->getId())) {
102
+                            throw new \Exception("Falha ao inserir pedido");
103
+            }
99 104
 
100 105
             $venderComPedidoRequest->getInventarioVenderRequest()->setPedidoId(
101 106
                 $response->getPedido()->getId()
102 107
             );
103 108
 
104 109
             return $this->vender($venderComPedidoRequest->getInventarioVenderRequest());
105
-        }catch (RequestException $ex) {
110
+        } catch (RequestException $ex) {
106 111
             $this->requestException($ex);
107
-        }catch (\Exception $ex){
112
+        } catch (\Exception $ex){
108 113
             throw new \Exception($ex->getMessage(), $ex->getCode(), $ex);
109 114
         }
110 115
     }
@@ -118,22 +123,25 @@  discard block
 block discarded – undo
118 123
     {
119 124
         try{
120 125
 
121
-            if(empty($cancelarVendaRequest->getTerminalId()))
122
-                $cancelarVendaRequest->setTerminalId(
126
+            if(empty($cancelarVendaRequest->getTerminalId())) {
127
+                            $cancelarVendaRequest->setTerminalId(
123 128
                     $this->_client->getParameter(ControlPayParameterConst::CONTROLPAY_DEFAULT_TERMINAL_ID)
124 129
                 );
130
+            }
125 131
 
126
-            if(empty($cancelarVendaRequest->getSenhaTecnica()))
127
-                $cancelarVendaRequest->setSenhaTecnica(
132
+            if(empty($cancelarVendaRequest->getSenhaTecnica())) {
133
+                            $cancelarVendaRequest->setSenhaTecnica(
128 134
                     $this->_client->getParameter(ControlPayParameterConst::CONTROLPAY_DEFAULT_SENHA_TECNICA)
129 135
                 );
136
+            }
130 137
 
131
-            if(empty($cancelarVendaRequest->isAguardarTefIniciarTransacao()))
132
-                $cancelarVendaRequest->setAguardarTefIniciarTransacao(
138
+            if(empty($cancelarVendaRequest->isAguardarTefIniciarTransacao())) {
139
+                            $cancelarVendaRequest->setAguardarTefIniciarTransacao(
133 140
                     boolval(
134 141
                         $this->_client->getParameter(ControlPayParameterConst::CONTROLPAY_DEFAULT_FORMA_AGUARDA_TEF)
135 142
                     )
136 143
                 );
144
+            }
137 145
 
138 146
 
139 147
             $this->response = $this->_httpClient->post(__FUNCTION__,[
@@ -144,9 +152,9 @@  discard block
 block discarded – undo
144 152
                 $this->response->json(),
145 153
                 Contracts\Venda\CancelarVendaResponse::class
146 154
             );
147
-        }catch (RequestException $ex) {
155
+        } catch (RequestException $ex) {
148 156
             $this->requestException($ex);
149
-        }catch (\Exception $ex){
157
+        } catch (\Exception $ex){
150 158
             throw new \Exception($ex->getMessage(), $ex->getCode(), $ex);
151 159
         }
152 160
     }
Please login to merge, or discard this patch.