Completed
Push — master ( 9537bc...5cf1f6 )
by Adriano
07:28
created
src/Integracao/ControlPay/API/ProdutoApi.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -30,8 +30,8 @@  discard block
 block discarded – undo
30 30
      */
31 31
     public function getByAtivosByPessoaId($pessoaId)
32 32
     {
33
-        try{
34
-            $this->response = $this->_httpClient->get(__FUNCTION__,[
33
+        try {
34
+            $this->response = $this->_httpClient->get(__FUNCTION__, [
35 35
                 'query' => $this->addQueryAdditionalParameters([
36 36
                     'pessoaId' => $pessoaId
37 37
                 ])
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
             );
44 44
         }catch (RequestException $ex) {
45 45
             $this->requestException($ex);
46
-        }catch (\Exception $ex){
46
+        }catch (\Exception $ex) {
47 47
             throw new \Exception($ex->getMessage(), $ex->getCode(), $ex);
48 48
         }
49 49
     }
Please login to merge, or discard this patch.
src/Integracao/ControlPay/API/IntencaoVendaApi.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -31,8 +31,8 @@  discard block
 block discarded – undo
31 31
      */
32 32
     public function getByFiltros(Contracts\IntencaoVenda\GetByFiltrosRequest $getByFiltrosRequest)
33 33
     {
34
-        try{
35
-            $this->response = $this->_httpClient->post(__FUNCTION__,[
34
+        try {
35
+            $this->response = $this->_httpClient->post(__FUNCTION__, [
36 36
                 'body' => json_encode($getByFiltrosRequest),
37 37
             ]);
38 38
 
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
             );
43 43
         }catch (RequestException $ex) {
44 44
             $this->requestException($ex);
45
-        }catch (\Exception $ex){
45
+        }catch (\Exception $ex) {
46 46
             throw new \Exception($ex->getMessage(), $ex->getCode(), $ex);
47 47
         }
48 48
     }
@@ -54,8 +54,8 @@  discard block
 block discarded – undo
54 54
      */
55 55
     public function getByFiltrosAsync(Contracts\IntencaoVenda\GetByFiltrosRequest $getByFiltrosRequest)
56 56
     {
57
-        try{
58
-            $this->response = $this->_httpClient->post(__FUNCTION__,[
57
+        try {
58
+            $this->response = $this->_httpClient->post(__FUNCTION__, [
59 59
                 'body' => json_encode($getByFiltrosRequest),
60 60
             ]);
61 61
 
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
             );
66 66
         }catch (RequestException $ex) {
67 67
             $this->requestException($ex);
68
-        }catch (\Exception $ex){
68
+        }catch (\Exception $ex) {
69 69
             throw new \Exception($ex->getMessage(), $ex->getCode(), $ex);
70 70
         }
71 71
     }
@@ -77,8 +77,8 @@  discard block
 block discarded – undo
77 77
      */
78 78
     public function getById($intencaoVendaId)
79 79
     {
80
-        try{
81
-            $this->response = $this->_httpClient->post(__FUNCTION__,[
80
+        try {
81
+            $this->response = $this->_httpClient->post(__FUNCTION__, [
82 82
                 'query' => $this->addQueryAdditionalParameters([
83 83
                     'intencaoVendaId' => $intencaoVendaId
84 84
                 ])
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
             );
91 91
         }catch (RequestException $ex) {
92 92
             $this->requestException($ex);
93
-        }catch (\Exception $ex){
93
+        }catch (\Exception $ex) {
94 94
             throw new \Exception($ex->getMessage(), $ex->getCode(), $ex);
95 95
         }
96 96
     }
Please login to merge, or discard this patch.
src/Integracao/ControlPay/API/TerminalApi.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -30,8 +30,8 @@  discard block
 block discarded – undo
30 30
      */
31 31
     public function getByPessoaId($pessoaId)
32 32
     {
33
-        try{
34
-            $this->response = $this->_httpClient->post(__FUNCTION__,[
33
+        try {
34
+            $this->response = $this->_httpClient->post(__FUNCTION__, [
35 35
                 'query' => $this->addQueryAdditionalParameters([
36 36
                     'pessoaId' => $pessoaId
37 37
                 ])
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
             );
44 44
         }catch (RequestException $ex) {
45 45
             $this->requestException($ex);
46
-        }catch (\Exception $ex){
46
+        }catch (\Exception $ex) {
47 47
             throw new \Exception($ex->getMessage(), $ex->getCode(), $ex);
48 48
         }
49 49
     }
@@ -55,8 +55,8 @@  discard block
 block discarded – undo
55 55
      */
56 56
     public function getById($terminalId)
57 57
     {
58
-        try{
59
-            $this->response = $this->_httpClient->post(__FUNCTION__,[
58
+        try {
59
+            $this->response = $this->_httpClient->post(__FUNCTION__, [
60 60
                 'query' => $this->addQueryAdditionalParameters([
61 61
                     'terminalId' => $terminalId
62 62
                 ])
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
             );
69 69
         }catch (RequestException $ex) {
70 70
             $this->requestException($ex);
71
-        }catch (\Exception $ex){
71
+        }catch (\Exception $ex) {
72 72
             throw new \Exception($ex->getMessage(), $ex->getCode(), $ex);
73 73
         }
74 74
     }
@@ -80,8 +80,8 @@  discard block
 block discarded – undo
80 80
      */
81 81
     public function insert(Contracts\Terminal\InsertRequest $insertRequest)
82 82
     {
83
-        try{
84
-            $this->response = $this->_httpClient->post(__FUNCTION__,[
83
+        try {
84
+            $this->response = $this->_httpClient->post(__FUNCTION__, [
85 85
                 'body' => json_encode($insertRequest)
86 86
             ]);
87 87
 
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
             );
92 92
         }catch (RequestException $ex) {
93 93
             $this->requestException($ex);
94
-        }catch (\Exception $ex){
94
+        }catch (\Exception $ex) {
95 95
             throw new \Exception($ex->getMessage(), $ex->getCode(), $ex);
96 96
         }
97 97
     }
Please login to merge, or discard this patch.
src/Integracao/ControlPay/API/PagamentoExternoApi.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -30,8 +30,8 @@  discard block
 block discarded – undo
30 30
      */
31 31
     public function getByFiltros(Contracts\PagamentoExterno\GetByFiltrosRequest $getByFiltrosRequest)
32 32
     {
33
-        try{
34
-            $this->response = $this->_httpClient->post(__FUNCTION__,[
33
+        try {
34
+            $this->response = $this->_httpClient->post(__FUNCTION__, [
35 35
                 'body' => json_encode($getByFiltrosRequest),
36 36
             ]);
37 37
 
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
             );
42 42
         }catch (RequestException $ex) {
43 43
             $this->requestException($ex);
44
-        }catch (\Exception $ex){
44
+        }catch (\Exception $ex) {
45 45
             throw new \Exception($ex->getMessage(), $ex->getCode(), $ex);
46 46
         }
47 47
     }
Please login to merge, or discard this patch.
src/Integracao/ControlPay/API/LoginApi.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -31,8 +31,8 @@  discard block
 block discarded – undo
31 31
      */
32 32
     public function login(Contracts\Login\LoginRequest $loginRequest)
33 33
     {
34
-        try{
35
-            $this->response = $this->_httpClient->post(__FUNCTION__,[
34
+        try {
35
+            $this->response = $this->_httpClient->post(__FUNCTION__, [
36 36
                 'body' => json_encode($loginRequest)
37 37
             ]);
38 38
 
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
             );
43 43
         }catch (RequestException $ex) {
44 44
             $this->requestException($ex);
45
-        }catch (\Exception $ex){
45
+        }catch (\Exception $ex) {
46 46
             throw new \Exception($ex->getMessage(), $ex->getCode(), $ex);
47 47
         }
48 48
     }
@@ -53,13 +53,13 @@  discard block
 block discarded – undo
53 53
      */
54 54
     public function logOut()
55 55
     {
56
-        try{
57
-            $this->response = $this->_httpClient->post(__FUNCTION__,[]);
56
+        try {
57
+            $this->response = $this->_httpClient->post(__FUNCTION__, [ ]);
58 58
 
59 59
             return true;
60 60
         }catch (RequestException $ex) {
61 61
             $this->requestException($ex);
62
-        }catch (\Exception $ex){
62
+        }catch (\Exception $ex) {
63 63
             throw new \Exception($ex->getMessage(), $ex->getCode(), $ex);
64 64
         }
65 65
     }
@@ -71,8 +71,8 @@  discard block
 block discarded – undo
71 71
      */
72 72
     public function consultaLogin(Contracts\Login\ConsultaLoginRequest $consultaLoginRequest)
73 73
     {
74
-        try{
75
-            $this->response = $this->_httpClient->post(__FUNCTION__,[
74
+        try {
75
+            $this->response = $this->_httpClient->post(__FUNCTION__, [
76 76
                 'body' => json_encode($consultaLoginRequest)
77 77
             ]);
78 78
 
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
             );
83 83
         }catch (RequestException $ex) {
84 84
             $this->requestException($ex);
85
-        }catch (\Exception $ex){
85
+        }catch (\Exception $ex) {
86 86
             throw new \Exception($ex->getMessage(), $ex->getCode(), $ex);
87 87
         }
88 88
     }
Please login to merge, or discard this patch.
src/Integracao/ControlPay/API/PedidoApi.php 1 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/API/VendaApi.php 1 patch
Spacing   +11 added lines, -11 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
     }
Please login to merge, or discard this patch.
src/Integracao/ControlPay/AbstractAPI.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
         $this->endpoint = $endpoint;
61 61
         $this->_client = $client;
62 62
 
63
-        if(is_null($this->_client))
63
+        if (is_null($this->_client))
64 64
             $this->_client = new Client();
65 65
 
66 66
         $this->query = new GuzzleHttp\Query();
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
                 $this->query->set('key', $this->_client->getAuthentication());
73 73
                 break;
74 74
             case BasicAuthentication::class:
75
-                $this->headers['Authorization'] = $this->_client->getAuthentication();
75
+                $this->headers[ 'Authorization' ] = $this->_client->getAuthentication();
76 76
                 break;
77 77
             default:
78 78
                 $this->query->set('key', $this->_client->getAuthentication());
@@ -103,8 +103,8 @@  discard block
 block discarded – undo
103 103
     {
104 104
         $this->query = new GuzzleHttp\Query();
105 105
 
106
-        if(isset($this->_httpClient->getDefaultOption()['query']))
107
-            $this->query = $this->_httpClient->getDefaultOption()['query'];
106
+        if (isset($this->_httpClient->getDefaultOption()[ 'query' ]))
107
+            $this->query = $this->_httpClient->getDefaultOption()[ 'query' ];
108 108
 
109 109
         foreach ($params as $key => $value)
110 110
             $this->query->set($key, $value);
@@ -125,8 +125,8 @@  discard block
 block discarded – undo
125 125
      */
126 126
     public function getQueryParameters()
127 127
     {
128
-        return isset($this->_httpClient->getDefaultOption()['query']) ?
129
-            $this->_httpClient->getDefaultOption()['query'] : [];
128
+        return isset($this->_httpClient->getDefaultOption()[ 'query' ]) ?
129
+            $this->_httpClient->getDefaultOption()[ 'query' ] : [ ];
130 130
     }
131 131
 
132 132
     /**
@@ -134,8 +134,8 @@  discard block
 block discarded – undo
134 134
      */
135 135
     public function getHeaders()
136 136
     {
137
-        return isset($this->_httpClient->getDefaultOption()['headers']) ?
138
-            $this->_httpClient->getDefaultOption()['headers'] : [];
137
+        return isset($this->_httpClient->getDefaultOption()[ 'headers' ]) ?
138
+            $this->_httpClient->getDefaultOption()[ 'headers' ] : [ ];
139 139
     }
140 140
 
141 141
     /**
Please login to merge, or discard this patch.