@@ -30,8 +30,8 @@ discard block |
||
| 30 | 30 | */ |
| 31 | 31 | public function getByFiltros(Contracts\PagamentoExterno\GetByFiltrosRequest $getByFiltrosRequest) |
| 32 | 32 | { |
| 33 | - try{ |
|
| 34 | - $response = $this->_httpClient->post(__FUNCTION__,[ |
|
| 33 | + try { |
|
| 34 | + $response = $this->_httpClient->post(__FUNCTION__, [ |
|
| 35 | 35 | 'body' => json_encode($getByFiltrosRequest), |
| 36 | 36 | ]); |
| 37 | 37 | |
@@ -41,8 +41,8 @@ discard block |
||
| 41 | 41 | ); |
| 42 | 42 | }catch (RequestException $ex) { |
| 43 | 43 | $responseBody = $ex->getResponse()->json(); |
| 44 | - throw new \Exception($responseBody['message']); |
|
| 45 | - }catch (\Exception $ex){ |
|
| 44 | + throw new \Exception($responseBody[ 'message' ]); |
|
| 45 | + }catch (\Exception $ex) { |
|
| 46 | 46 | throw new \Exception($ex->getMessage(), $ex->getCode(), $ex); |
| 47 | 47 | } |
| 48 | 48 | } |
@@ -30,8 +30,8 @@ discard block |
||
| 30 | 30 | */ |
| 31 | 31 | public function getByPessoaId($pessoaId) |
| 32 | 32 | { |
| 33 | - try{ |
|
| 34 | - $response = $this->_httpClient->post(__FUNCTION__,[ |
|
| 33 | + try { |
|
| 34 | + $response = $this->_httpClient->post(__FUNCTION__, [ |
|
| 35 | 35 | 'query' => $this->addQueryAdditionalParameters([ |
| 36 | 36 | 'pessoaId' => $pessoaId |
| 37 | 37 | ]) |
@@ -43,8 +43,8 @@ discard block |
||
| 43 | 43 | ); |
| 44 | 44 | }catch (RequestException $ex) { |
| 45 | 45 | $responseBody = $ex->getResponse()->json(); |
| 46 | - throw new \Exception($responseBody['message']); |
|
| 47 | - }catch (\Exception $ex){ |
|
| 46 | + throw new \Exception($responseBody[ 'message' ]); |
|
| 47 | + }catch (\Exception $ex) { |
|
| 48 | 48 | throw new \Exception($ex->getMessage(), $ex->getCode(), $ex); |
| 49 | 49 | } |
| 50 | 50 | } |
@@ -56,8 +56,8 @@ discard block |
||
| 56 | 56 | */ |
| 57 | 57 | public function getById($terminalId) |
| 58 | 58 | { |
| 59 | - try{ |
|
| 60 | - $response = $this->_httpClient->post(__FUNCTION__,[ |
|
| 59 | + try { |
|
| 60 | + $response = $this->_httpClient->post(__FUNCTION__, [ |
|
| 61 | 61 | 'query' => $this->addQueryAdditionalParameters([ |
| 62 | 62 | 'terminalId' => $terminalId |
| 63 | 63 | ]) |
@@ -69,8 +69,8 @@ discard block |
||
| 69 | 69 | ); |
| 70 | 70 | }catch (RequestException $ex) { |
| 71 | 71 | $responseBody = $ex->getResponse()->json(); |
| 72 | - throw new \Exception($responseBody['message']); |
|
| 73 | - }catch (\Exception $ex){ |
|
| 72 | + throw new \Exception($responseBody[ 'message' ]); |
|
| 73 | + }catch (\Exception $ex) { |
|
| 74 | 74 | throw new \Exception($ex->getMessage(), $ex->getCode(), $ex); |
| 75 | 75 | } |
| 76 | 76 | } |
@@ -82,8 +82,8 @@ discard block |
||
| 82 | 82 | */ |
| 83 | 83 | public function insert(Contracts\Terminal\InsertRequest $insertRequest) |
| 84 | 84 | { |
| 85 | - try{ |
|
| 86 | - $response = $this->_httpClient->post(__FUNCTION__,[ |
|
| 85 | + try { |
|
| 86 | + $response = $this->_httpClient->post(__FUNCTION__, [ |
|
| 87 | 87 | 'body' => json_encode($insertRequest) |
| 88 | 88 | ]); |
| 89 | 89 | |
@@ -93,8 +93,8 @@ discard block |
||
| 93 | 93 | ); |
| 94 | 94 | }catch (RequestException $ex) { |
| 95 | 95 | $responseBody = $ex->getResponse()->json(); |
| 96 | - throw new \Exception($responseBody['message']); |
|
| 97 | - }catch (\Exception $ex){ |
|
| 96 | + throw new \Exception($responseBody[ 'message' ]); |
|
| 97 | + }catch (\Exception $ex) { |
|
| 98 | 98 | throw new \Exception($ex->getMessage(), $ex->getCode(), $ex); |
| 99 | 99 | } |
| 100 | 100 | } |
@@ -30,8 +30,8 @@ discard block |
||
| 30 | 30 | */ |
| 31 | 31 | public function getByAtivosByPessoaId($pessoaId) |
| 32 | 32 | { |
| 33 | - try{ |
|
| 34 | - $response = $this->_httpClient->get(__FUNCTION__,[ |
|
| 33 | + try { |
|
| 34 | + $response = $this->_httpClient->get(__FUNCTION__, [ |
|
| 35 | 35 | 'query' => $this->addQueryAdditionalParameters([ |
| 36 | 36 | 'pessoaId' => $pessoaId |
| 37 | 37 | ]) |
@@ -43,8 +43,8 @@ discard block |
||
| 43 | 43 | ); |
| 44 | 44 | }catch (RequestException $ex) { |
| 45 | 45 | $responseBody = $ex->getResponse()->json(); |
| 46 | - throw new \Exception($responseBody['message']); |
|
| 47 | - }catch (\Exception $ex){ |
|
| 46 | + throw new \Exception($responseBody[ 'message' ]); |
|
| 47 | + }catch (\Exception $ex) { |
|
| 48 | 48 | throw new \Exception($ex->getMessage(), $ex->getCode(), $ex); |
| 49 | 49 | } |
| 50 | 50 | } |
@@ -31,8 +31,8 @@ discard block |
||
| 31 | 31 | */ |
| 32 | 32 | public function login(Contracts\Login\LoginRequest $loginRequest) |
| 33 | 33 | { |
| 34 | - try{ |
|
| 35 | - $response = $this->_httpClient->post(__FUNCTION__,[ |
|
| 34 | + try { |
|
| 35 | + $response = $this->_httpClient->post(__FUNCTION__, [ |
|
| 36 | 36 | 'body' => json_encode($loginRequest) |
| 37 | 37 | ]); |
| 38 | 38 | |
@@ -42,8 +42,8 @@ discard block |
||
| 42 | 42 | ); |
| 43 | 43 | }catch (RequestException $ex) { |
| 44 | 44 | $responseBody = $ex->getResponse()->json(); |
| 45 | - throw new \Exception($responseBody['message']); |
|
| 46 | - }catch (\Exception $ex){ |
|
| 45 | + throw new \Exception($responseBody[ 'message' ]); |
|
| 46 | + }catch (\Exception $ex) { |
|
| 47 | 47 | throw new \Exception($ex->getMessage(), $ex->getCode(), $ex); |
| 48 | 48 | } |
| 49 | 49 | } |
@@ -54,14 +54,14 @@ discard block |
||
| 54 | 54 | */ |
| 55 | 55 | public function logOut() |
| 56 | 56 | { |
| 57 | - try{ |
|
| 58 | - $this->_httpClient->post(__FUNCTION__,[]); |
|
| 57 | + try { |
|
| 58 | + $this->_httpClient->post(__FUNCTION__, [ ]); |
|
| 59 | 59 | |
| 60 | 60 | return true; |
| 61 | 61 | }catch (RequestException $ex) { |
| 62 | 62 | $responseBody = $ex->getResponse()->json(); |
| 63 | - throw new \Exception($responseBody['message']); |
|
| 64 | - }catch (\Exception $ex){ |
|
| 63 | + throw new \Exception($responseBody[ 'message' ]); |
|
| 64 | + }catch (\Exception $ex) { |
|
| 65 | 65 | throw new \Exception($ex->getMessage(), $ex->getCode(), $ex); |
| 66 | 66 | } |
| 67 | 67 | } |
@@ -73,8 +73,8 @@ discard block |
||
| 73 | 73 | */ |
| 74 | 74 | public function consultaLogin(Contracts\Login\ConsultaLoginRequest $consultaLoginRequest) |
| 75 | 75 | { |
| 76 | - try{ |
|
| 77 | - $response = $this->_httpClient->post(__FUNCTION__,[ |
|
| 76 | + try { |
|
| 77 | + $response = $this->_httpClient->post(__FUNCTION__, [ |
|
| 78 | 78 | 'body' => json_encode($consultaLoginRequest) |
| 79 | 79 | ]); |
| 80 | 80 | |
@@ -84,8 +84,8 @@ discard block |
||
| 84 | 84 | ); |
| 85 | 85 | }catch (RequestException $ex) { |
| 86 | 86 | $responseBody = $ex->getResponse()->json(); |
| 87 | - throw new \Exception($responseBody['message']); |
|
| 88 | - }catch (\Exception $ex){ |
|
| 87 | + throw new \Exception($responseBody[ 'message' ]); |
|
| 88 | + }catch (\Exception $ex) { |
|
| 89 | 89 | throw new \Exception($ex->getMessage(), $ex->getCode(), $ex); |
| 90 | 90 | } |
| 91 | 91 | } |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | */ |
| 71 | 71 | public function getParameter($key) |
| 72 | 72 | { |
| 73 | - return isset($this->_params[$key]) ? $this->_params[$key] : null; |
|
| 73 | + return isset($this->_params[ $key ]) ? $this->_params[ $key ] : null; |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | /** |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | */ |
| 83 | 83 | public function setParameter($key, $value) |
| 84 | 84 | { |
| 85 | - $this->_params[$key] = $value; |
|
| 85 | + $this->_params[ $key ] = $value; |
|
| 86 | 86 | $this->loadParameters($this->_params, $this->authentication); |
| 87 | 87 | return $this; |
| 88 | 88 | } |
@@ -96,17 +96,17 @@ discard block |
||
| 96 | 96 | */ |
| 97 | 97 | private function loadParameters($params, IAuthentication $authentication = null) |
| 98 | 98 | { |
| 99 | - $this->_params[ControlPayParameter::CONTROLPAY_HOST] = getenv('CONTROLPAY_HOST'); |
|
| 100 | - $this->_params[ControlPayParameter::CONTROLPAY_TIMEOUT] = getenv('CONTROLPAY_TIMEOUT'); |
|
| 101 | - $this->_params[ControlPayParameter::CONTROLPAY_USER] = getenv('CONTROLPAY_USER'); |
|
| 102 | - $this->_params[ControlPayParameter::CONTROLPAY_PWD] = getenv('CONTROLPAY_PWD'); |
|
| 103 | - $this->_params[ControlPayParameter::CONTROLPAY_KEY] = getenv('CONTROLPAY_KEY'); |
|
| 104 | - $this->_params[ControlPayParameter::CONTROLPAY_OAUTH_TYPE] = KeyQueryStringAuthentication::class; |
|
| 105 | - |
|
| 106 | - if(!is_null($params)) |
|
| 99 | + $this->_params[ ControlPayParameter::CONTROLPAY_HOST ] = getenv('CONTROLPAY_HOST'); |
|
| 100 | + $this->_params[ ControlPayParameter::CONTROLPAY_TIMEOUT ] = getenv('CONTROLPAY_TIMEOUT'); |
|
| 101 | + $this->_params[ ControlPayParameter::CONTROLPAY_USER ] = getenv('CONTROLPAY_USER'); |
|
| 102 | + $this->_params[ ControlPayParameter::CONTROLPAY_PWD ] = getenv('CONTROLPAY_PWD'); |
|
| 103 | + $this->_params[ ControlPayParameter::CONTROLPAY_KEY ] = getenv('CONTROLPAY_KEY'); |
|
| 104 | + $this->_params[ ControlPayParameter::CONTROLPAY_OAUTH_TYPE ] = KeyQueryStringAuthentication::class; |
|
| 105 | + |
|
| 106 | + if (!is_null($params)) |
|
| 107 | 107 | foreach ($params as $key => $param) |
| 108 | 108 | { |
| 109 | - if(!in_array($key, [ |
|
| 109 | + if (!in_array($key, [ |
|
| 110 | 110 | ControlPayParameter::CONTROLPAY_HOST, |
| 111 | 111 | ControlPayParameter::CONTROLPAY_TIMEOUT, |
| 112 | 112 | ControlPayParameter::CONTROLPAY_USER, |
@@ -117,11 +117,11 @@ discard block |
||
| 117 | 117 | throw new \Exception(sprintf("Parâmetro %s inválido", $key)); |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | - if(!is_null($params) && is_array($params)) |
|
| 120 | + if (!is_null($params) && is_array($params)) |
|
| 121 | 121 | foreach ($params as $key => $value) |
| 122 | - $this->_params[$key] = $value; |
|
| 122 | + $this->_params[ $key ] = $value; |
|
| 123 | 123 | |
| 124 | - if(is_null($authentication)) |
|
| 124 | + if (is_null($authentication)) |
|
| 125 | 125 | { |
| 126 | 126 | $this->authentication = AuthenticationFactory::getInstance($this->_params, $this); |
| 127 | 127 | return; |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | { |
| 85 | 85 | $this->pessoa = $pessoa; |
| 86 | 86 | |
| 87 | - if(is_array($pessoa)) |
|
| 87 | + if (is_array($pessoa)) |
|
| 88 | 88 | $this->pessoa = SerializerHelper::denormalize($this->pessoa, Pessoa::class); |
| 89 | 89 | |
| 90 | 90 | return $this; |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | { |
| 107 | 107 | $this->operador = $operador; |
| 108 | 108 | |
| 109 | - if(is_array($this->operador)) |
|
| 109 | + if (is_array($this->operador)) |
|
| 110 | 110 | $this->operador = SerializerHelper::denormalize($this->operador, Operador::class); |
| 111 | 111 | |
| 112 | 112 | return $this; |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | { |
| 129 | 129 | $this->android = $android; |
| 130 | 130 | |
| 131 | - if(is_array($this->android)) |
|
| 131 | + if (is_array($this->android)) |
|
| 132 | 132 | $this->android = SerializerHelper::denormalize($this->android, Device::class); |
| 133 | 133 | |
| 134 | 134 | return $this; |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | { |
| 151 | 151 | $this->ios = $ios; |
| 152 | 152 | |
| 153 | - if(is_array($this->ios)) |
|
| 153 | + if (is_array($this->ios)) |
|
| 154 | 154 | $this->ios = SerializerHelper::denormalize($this->ios, Device::class); |
| 155 | 155 | |
| 156 | 156 | return $this; |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | { |
| 69 | 69 | $this->pessoa = $pessoa; |
| 70 | 70 | |
| 71 | - if(is_array($pessoa)) |
|
| 71 | + if (is_array($pessoa)) |
|
| 72 | 72 | $this->pessoa = SerializerHelper::denormalize($this->pessoa, Pessoa::class); |
| 73 | 73 | |
| 74 | 74 | return $this; |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | { |
| 91 | 91 | $this->operador = $operador; |
| 92 | 92 | |
| 93 | - if(is_array($this->operador)) |
|
| 93 | + if (is_array($this->operador)) |
|
| 94 | 94 | $this->operador = SerializerHelper::denormalize($this->operador, Operador::class); |
| 95 | 95 | |
| 96 | 96 | return $this; |
@@ -62,7 +62,7 @@ |
||
| 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; |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | { |
| 45 | 45 | $this->data = \DateTime::createFromFormat('d/m/Y H:i:s.u', $data); |
| 46 | 46 | |
| 47 | - if(!$this->data) |
|
| 47 | + if (!$this->data) |
|
| 48 | 48 | $this->data = \DateTime::createFromFormat('d/m/Y H:i:s', $data); |
| 49 | 49 | |
| 50 | 50 | return $this; |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | { |
| 67 | 67 | |
| 68 | 68 | foreach ($pagamentosExterno as $item) |
| 69 | - $this->pagamentosExterno[] = SerializerHelper::denormalize($item, PagamentoExterno::class); |
|
| 69 | + $this->pagamentosExterno[ ] = SerializerHelper::denormalize($item, PagamentoExterno::class); |
|
| 70 | 70 | |
| 71 | 71 | return $this; |
| 72 | 72 | } |