@@ -2,7 +2,6 @@ |
||
2 | 2 | |
3 | 3 | namespace Integracao\ControlPay\Contracts\Pedido; |
4 | 4 | |
5 | -use Integracao\ControlPay\Helpers\SerializerHelper; |
|
6 | 5 | use Integracao\ControlPay\Model\Produto; |
7 | 6 | |
8 | 7 | /** |
@@ -204,7 +204,7 @@ discard block |
||
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 |
||
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; |
@@ -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 | } |
@@ -155,7 +155,7 @@ |
||
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 |
@@ -63,7 +63,7 @@ |
||
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; |
@@ -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 | } |
@@ -3,7 +3,6 @@ |
||
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 | /** |
@@ -21,24 +21,24 @@ |
||
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; |
@@ -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 | { |
@@ -30,8 +30,8 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -41,9 +41,9 @@ discard block |
||
41 | 41 | $this->response->json(), |
42 | 42 | Contracts\Terminal\GetByPessoaIdResponse::class |
43 | 43 | ); |
44 | - }catch (RequestException $ex) { |
|
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 | } |
@@ -66,9 +66,9 @@ discard block |
||
66 | 66 | $this->response->json(), |
67 | 67 | Contracts\Terminal\GetByIdResponse::class |
68 | 68 | ); |
69 | - }catch (RequestException $ex) { |
|
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 | } |
@@ -89,9 +89,9 @@ discard block |
||
89 | 89 | $this->response->json(), |
90 | 90 | Contracts\Terminal\InsertResponse::class |
91 | 91 | ); |
92 | - }catch (RequestException $ex) { |
|
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 | } |
@@ -30,8 +30,8 @@ discard block |
||
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 |
||
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 | } |
@@ -39,9 +39,9 @@ |
||
39 | 39 | $this->response->json(), |
40 | 40 | Contracts\PagamentoExterno\GetByFiltrosResponse::class |
41 | 41 | ); |
42 | - }catch (RequestException $ex) { |
|
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 | } |
@@ -31,8 +31,8 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -40,9 +40,9 @@ discard block |
||
40 | 40 | $this->response->json(), |
41 | 41 | Contracts\Login\LoginResponse::class |
42 | 42 | ); |
43 | - }catch (RequestException $ex) { |
|
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 | } |
@@ -57,9 +57,9 @@ discard block |
||
57 | 57 | $this->response = $this->_httpClient->post(__FUNCTION__,[]); |
58 | 58 | |
59 | 59 | return true; |
60 | - }catch (RequestException $ex) { |
|
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 | } |
@@ -80,9 +80,9 @@ discard block |
||
80 | 80 | $this->response->json(), |
81 | 81 | Contracts\Login\ConsultaLoginResponse::class |
82 | 82 | ); |
83 | - }catch (RequestException $ex) { |
|
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 | } |
@@ -30,17 +30,17 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -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,9 +49,9 @@ 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->requestException($ex); |
53 | - }catch (\Exception $ex){ |
|
54 | + } catch (\Exception $ex){ |
|
54 | 55 | throw new \Exception($ex->getMessage(), $ex->getCode(), $ex); |
55 | 56 | } |
56 | 57 | } |
@@ -71,9 +72,9 @@ discard block |
||
71 | 72 | $this->response->json(), |
72 | 73 | Pedido\GetByFiltrosResponse::class |
73 | 74 | ); |
74 | - }catch (RequestException $ex) { |
|
75 | + } catch (RequestException $ex) { |
|
75 | 76 | $this->requestException($ex); |
76 | - }catch (\Exception $ex){ |
|
77 | + } catch (\Exception $ex){ |
|
77 | 78 | throw new \Exception($ex->getMessage(), $ex->getCode(), $ex); |
78 | 79 | } |
79 | 80 | } |
@@ -98,9 +99,9 @@ discard block |
||
98 | 99 | $this->response->json(), |
99 | 100 | Pedido\GetByPessoaIdByReferenciaResponse::class |
100 | 101 | ); |
101 | - }catch (RequestException $ex) { |
|
102 | + } catch (RequestException $ex) { |
|
102 | 103 | $this->requestException($ex); |
103 | - }catch (\Exception $ex){ |
|
104 | + } catch (\Exception $ex){ |
|
104 | 105 | throw new \Exception($ex->getMessage(), $ex->getCode(), $ex); |
105 | 106 | } |
106 | 107 | } |
@@ -125,9 +126,9 @@ discard block |
||
125 | 126 | $this->response->json(), |
126 | 127 | Pedido\GetByPessoaIdByReferenciaResponse::class |
127 | 128 | ); |
128 | - }catch (RequestException $ex) { |
|
129 | + } catch (RequestException $ex) { |
|
129 | 130 | $this->requestException($ex); |
130 | - }catch (\Exception $ex){ |
|
131 | + } catch (\Exception $ex){ |
|
131 | 132 | throw new \Exception($ex->getMessage(), $ex->getCode(), $ex); |
132 | 133 | } |
133 | 134 | } |
@@ -150,9 +151,9 @@ discard block |
||
150 | 151 | $this->response->json(), |
151 | 152 | Pedido\CancelarResponse::class |
152 | 153 | ); |
153 | - }catch (RequestException $ex) { |
|
154 | + } catch (RequestException $ex) { |
|
154 | 155 | $this->requestException($ex); |
155 | - }catch (\Exception $ex){ |
|
156 | + } catch (\Exception $ex){ |
|
156 | 157 | throw new \Exception($ex->getMessage(), $ex->getCode(), $ex); |
157 | 158 | } |
158 | 159 | } |
@@ -175,9 +176,9 @@ discard block |
||
175 | 176 | $this->response->json(), |
176 | 177 | Pedido\GetByIdResponse::class |
177 | 178 | ); |
178 | - }catch (RequestException $ex) { |
|
179 | + } catch (RequestException $ex) { |
|
179 | 180 | $this->requestException($ex); |
180 | - }catch (\Exception $ex){ |
|
181 | + } catch (\Exception $ex){ |
|
181 | 182 | throw new \Exception($ex->getMessage(), $ex->getCode(), $ex); |
182 | 183 | } |
183 | 184 | } |