@@ -61,16 +61,16 @@ |
||
| 61 | 61 | $this->endpoint = $endpoint; |
| 62 | 62 | $this->client = $client; |
| 63 | 63 | |
| 64 | - if(is_null($this->client)) |
|
| 64 | + if (is_null($this->client)) |
|
| 65 | 65 | $this->client = new Client(); |
| 66 | 66 | |
| 67 | - $this->headers['x-application-key'] = $this->client->getParameter( |
|
| 67 | + $this->headers[ 'x-application-key' ] = $this->client->getParameter( |
|
| 68 | 68 | PayGoTransactionParameterConst::PAYGO_TRANSACTIONS_TOKEN); |
| 69 | 69 | |
| 70 | 70 | $baseUrl = $this->client->getParameter( |
| 71 | 71 | PayGoTransactionParameterConst::PAYGO_TRANSACTIONS_HOST); |
| 72 | 72 | |
| 73 | - if(!empty($endpoint)) |
|
| 73 | + if (!empty($endpoint)) |
|
| 74 | 74 | $baseUrl = sprintf("%s%s/", $baseUrl, $endpoint); |
| 75 | 75 | |
| 76 | 76 | $this->httpClient = new GuzzleHttp\Client([ |
@@ -61,8 +61,9 @@ discard block |
||
| 61 | 61 | $this->endpoint = $endpoint; |
| 62 | 62 | $this->client = $client; |
| 63 | 63 | |
| 64 | - if(is_null($this->client)) |
|
| 65 | - $this->client = new Client(); |
|
| 64 | + if(is_null($this->client)) { |
|
| 65 | + $this->client = new Client(); |
|
| 66 | + } |
|
| 66 | 67 | |
| 67 | 68 | $this->headers['x-application-key'] = $this->client->getParameter( |
| 68 | 69 | PayGoTransactionParameterConst::PAYGO_TRANSACTIONS_TOKEN); |
@@ -70,8 +71,9 @@ discard block |
||
| 70 | 71 | $baseUrl = $this->client->getParameter( |
| 71 | 72 | PayGoTransactionParameterConst::PAYGO_TRANSACTIONS_HOST); |
| 72 | 73 | |
| 73 | - if(!empty($endpoint)) |
|
| 74 | - $baseUrl = sprintf("%s%s/", $baseUrl, $endpoint); |
|
| 74 | + if(!empty($endpoint)) { |
|
| 75 | + $baseUrl = sprintf("%s%s/", $baseUrl, $endpoint); |
|
| 76 | + } |
|
| 75 | 77 | |
| 76 | 78 | $this->httpClient = new GuzzleHttp\Client([ |
| 77 | 79 | 'base_url' => $baseUrl, |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | */ |
| 48 | 48 | public function getParameter($key) |
| 49 | 49 | { |
| 50 | - return isset($this->params[$key]) ? $this->params[$key] : null; |
|
| 50 | + return isset($this->params[ $key ]) ? $this->params[ $key ] : null; |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | /** |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | */ |
| 59 | 59 | public function setParameter($key, $value) |
| 60 | 60 | { |
| 61 | - $this->params[$key] = $value; |
|
| 61 | + $this->params[ $key ] = $value; |
|
| 62 | 62 | $this->loadParameters($this->params); |
| 63 | 63 | return $this; |
| 64 | 64 | } |
@@ -69,17 +69,17 @@ discard block |
||
| 69 | 69 | */ |
| 70 | 70 | private function loadParameters($params) |
| 71 | 71 | { |
| 72 | - $this->params[PayGoTransactionParameterConst::PAYGO_TRANSACTIONS_HOST] = |
|
| 72 | + $this->params[ PayGoTransactionParameterConst::PAYGO_TRANSACTIONS_HOST ] = |
|
| 73 | 73 | getenv('PAYGO_TRANSACTIONS_HOST'); |
| 74 | - $this->params[PayGoTransactionParameterConst::PAYGO_TRANSACTIONS_TIMEOUT] = |
|
| 74 | + $this->params[ PayGoTransactionParameterConst::PAYGO_TRANSACTIONS_TIMEOUT ] = |
|
| 75 | 75 | getenv('PAYGO_TRANSACTIONS_TIMEOUT'); |
| 76 | - $this->params[PayGoTransactionParameterConst::PAYGO_TRANSACTIONS_TOKEN] = |
|
| 76 | + $this->params[ PayGoTransactionParameterConst::PAYGO_TRANSACTIONS_TOKEN ] = |
|
| 77 | 77 | getenv('PAYGO_TRANSACTIONS_TOKEN'); |
| 78 | 78 | |
| 79 | - if(!is_null($params)) |
|
| 79 | + if (!is_null($params)) |
|
| 80 | 80 | foreach ($params as $key => $param) |
| 81 | 81 | { |
| 82 | - if(!in_array($key, [ |
|
| 82 | + if (!in_array($key, [ |
|
| 83 | 83 | PayGoTransactionParameterConst::PAYGO_TRANSACTIONS_HOST, |
| 84 | 84 | PayGoTransactionParameterConst::PAYGO_TRANSACTIONS_TIMEOUT, |
| 85 | 85 | PayGoTransactionParameterConst::PAYGO_TRANSACTIONS_TOKEN, |
@@ -87,9 +87,9 @@ discard block |
||
| 87 | 87 | throw new \Exception(sprintf("Parâmetro %s inválido", $key)); |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | - if(!is_null($params) && is_array($params)){ |
|
| 90 | + if (!is_null($params) && is_array($params)) { |
|
| 91 | 91 | foreach ($params as $key => $value) |
| 92 | - $this->params[$key] = $value; |
|
| 92 | + $this->params[ $key ] = $value; |
|
| 93 | 93 | } |
| 94 | 94 | } |
| 95 | 95 | |
@@ -76,8 +76,8 @@ discard block |
||
| 76 | 76 | $this->params[PayGoTransactionParameterConst::PAYGO_TRANSACTIONS_TOKEN] = |
| 77 | 77 | getenv('PAYGO_TRANSACTIONS_TOKEN'); |
| 78 | 78 | |
| 79 | - if(!is_null($params)) |
|
| 80 | - foreach ($params as $key => $param) |
|
| 79 | + if(!is_null($params)) { |
|
| 80 | + foreach ($params as $key => $param) |
|
| 81 | 81 | { |
| 82 | 82 | if(!in_array($key, [ |
| 83 | 83 | PayGoTransactionParameterConst::PAYGO_TRANSACTIONS_HOST, |
@@ -85,11 +85,13 @@ discard block |
||
| 85 | 85 | PayGoTransactionParameterConst::PAYGO_TRANSACTIONS_TOKEN, |
| 86 | 86 | ])) |
| 87 | 87 | throw new \Exception(sprintf("Parâmetro %s inválido", $key)); |
| 88 | + } |
|
| 88 | 89 | } |
| 89 | 90 | |
| 90 | 91 | if(!is_null($params) && is_array($params)){ |
| 91 | - foreach ($params as $key => $value) |
|
| 92 | - $this->params[$key] = $value; |
|
| 92 | + foreach ($params as $key => $value) { |
|
| 93 | + $this->params[$key] = $value; |
|
| 94 | + } |
|
| 93 | 95 | } |
| 94 | 96 | } |
| 95 | 97 | |
@@ -43,7 +43,7 @@ |
||
| 43 | 43 | * |
| 44 | 44 | * @var array |
| 45 | 45 | */ |
| 46 | - private $exclude = [SourceConst::FULL_RECEIPT_COPY]; |
|
| 46 | + private $exclude = [ SourceConst::FULL_RECEIPT_COPY ]; |
|
| 47 | 47 | |
| 48 | 48 | /** |
| 49 | 49 | * @var array|Sort |
@@ -108,23 +108,23 @@ |
||
| 108 | 108 | |
| 109 | 109 | public function jsonSerialize() |
| 110 | 110 | { |
| 111 | - $data = []; |
|
| 112 | - if(!empty($this->fromDate)) |
|
| 111 | + $data = [ ]; |
|
| 112 | + if (!empty($this->fromDate)) |
|
| 113 | 113 | $data = array_merge($data, [ |
| 114 | 114 | "From" => $this->fromDate->format('Y-m-d'), |
| 115 | 115 | ]); |
| 116 | 116 | |
| 117 | - if(!empty($this->endDate)) |
|
| 117 | + if (!empty($this->endDate)) |
|
| 118 | 118 | $data = array_merge($data, [ |
| 119 | 119 | "End" => $this->endDate->format('Y-m-d'), |
| 120 | 120 | ]); |
| 121 | 121 | |
| 122 | - if(!empty($this->fromDateTime)) |
|
| 122 | + if (!empty($this->fromDateTime)) |
|
| 123 | 123 | $data = array_merge($data, [ |
| 124 | 124 | "From" => $this->fromDateTime->format('Y-m-d H:i:s'), |
| 125 | 125 | ]); |
| 126 | 126 | |
| 127 | - if(!empty($this->endDateTime)) |
|
| 127 | + if (!empty($this->endDateTime)) |
|
| 128 | 128 | $data = array_merge($data, [ |
| 129 | 129 | "End" => $this->endDateTime->format('Y-m-d H:i:s'), |
| 130 | 130 | ]); |
@@ -109,25 +109,29 @@ |
||
| 109 | 109 | public function jsonSerialize() |
| 110 | 110 | { |
| 111 | 111 | $data = []; |
| 112 | - if(!empty($this->fromDate)) |
|
| 113 | - $data = array_merge($data, [ |
|
| 112 | + if(!empty($this->fromDate)) { |
|
| 113 | + $data = array_merge($data, [ |
|
| 114 | 114 | "From" => $this->fromDate->format('Y-m-d'), |
| 115 | 115 | ]); |
| 116 | + } |
|
| 116 | 117 | |
| 117 | - if(!empty($this->endDate)) |
|
| 118 | - $data = array_merge($data, [ |
|
| 118 | + if(!empty($this->endDate)) { |
|
| 119 | + $data = array_merge($data, [ |
|
| 119 | 120 | "End" => $this->endDate->format('Y-m-d'), |
| 120 | 121 | ]); |
| 122 | + } |
|
| 121 | 123 | |
| 122 | - if(!empty($this->fromDateTime)) |
|
| 123 | - $data = array_merge($data, [ |
|
| 124 | + if(!empty($this->fromDateTime)) { |
|
| 125 | + $data = array_merge($data, [ |
|
| 124 | 126 | "From" => $this->fromDateTime->format('Y-m-d H:i:s'), |
| 125 | 127 | ]); |
| 128 | + } |
|
| 126 | 129 | |
| 127 | - if(!empty($this->endDateTime)) |
|
| 128 | - $data = array_merge($data, [ |
|
| 130 | + if(!empty($this->endDateTime)) { |
|
| 131 | + $data = array_merge($data, [ |
|
| 129 | 132 | "End" => $this->endDateTime->format('Y-m-d H:i:s'), |
| 130 | 133 | ]); |
| 134 | + } |
|
| 131 | 135 | |
| 132 | 136 | return array_filter($data, function($val) { return !empty($val); }); |
| 133 | 137 | } |
@@ -17,12 +17,12 @@ discard block |
||
| 17 | 17 | /** |
| 18 | 18 | * @var array |
| 19 | 19 | */ |
| 20 | - private $uniqueIds = []; |
|
| 20 | + private $uniqueIds = [ ]; |
|
| 21 | 21 | |
| 22 | 22 | /** |
| 23 | 23 | * @var array |
| 24 | 24 | */ |
| 25 | - private $posCompanyDataTaxIds = []; |
|
| 25 | + private $posCompanyDataTaxIds = [ ]; |
|
| 26 | 26 | |
| 27 | 27 | /** |
| 28 | 28 | * @var DateRange |
@@ -32,47 +32,47 @@ discard block |
||
| 32 | 32 | /** |
| 33 | 33 | * @var array |
| 34 | 34 | */ |
| 35 | - private $types = []; |
|
| 35 | + private $types = [ ]; |
|
| 36 | 36 | |
| 37 | 37 | /** |
| 38 | 38 | * @var array |
| 39 | 39 | */ |
| 40 | - private $status = []; |
|
| 40 | + private $status = [ ]; |
|
| 41 | 41 | |
| 42 | 42 | /** |
| 43 | 43 | * @var array |
| 44 | 44 | */ |
| 45 | - private $authorizerNames = []; |
|
| 45 | + private $authorizerNames = [ ]; |
|
| 46 | 46 | |
| 47 | 47 | /** |
| 48 | 48 | * @var array |
| 49 | 49 | */ |
| 50 | - private $affiliationCompanyDataTaxIds = []; |
|
| 50 | + private $affiliationCompanyDataTaxIds = [ ]; |
|
| 51 | 51 | |
| 52 | 52 | /** |
| 53 | 53 | * @var array |
| 54 | 54 | */ |
| 55 | - private $posDataIdentifiers = []; |
|
| 55 | + private $posDataIdentifiers = [ ]; |
|
| 56 | 56 | |
| 57 | 57 | /** |
| 58 | 58 | * @var array |
| 59 | 59 | */ |
| 60 | - private $financingDataInstallmentsNumbers = []; |
|
| 60 | + private $financingDataInstallmentsNumbers = [ ]; |
|
| 61 | 61 | |
| 62 | 62 | /** |
| 63 | 63 | * @var array |
| 64 | 64 | */ |
| 65 | - private $cardDataTypes = []; |
|
| 65 | + private $cardDataTypes = [ ]; |
|
| 66 | 66 | |
| 67 | 67 | /** |
| 68 | 68 | * @var array |
| 69 | 69 | */ |
| 70 | - private $financingDataTypes = []; |
|
| 70 | + private $financingDataTypes = [ ]; |
|
| 71 | 71 | |
| 72 | 72 | /** |
| 73 | 73 | * @var array |
| 74 | 74 | */ |
| 75 | - private $cardDataCardHolderNames = []; |
|
| 75 | + private $cardDataCardHolderNames = [ ]; |
|
| 76 | 76 | |
| 77 | 77 | /** |
| 78 | 78 | * @var integer |
@@ -31,11 +31,11 @@ |
||
| 31 | 31 | */ |
| 32 | 32 | public function filter(Query $query) |
| 33 | 33 | { |
| 34 | - try{ |
|
| 34 | + try { |
|
| 35 | 35 | return $this->httpClient->post("transactions", [ |
| 36 | 36 | 'body' => json_encode($query) |
| 37 | 37 | ]); |
| 38 | - }catch (\Exception $ex){ |
|
| 38 | + }catch (\Exception $ex) { |
|
| 39 | 39 | throw new \Exception($ex->getMessage(), $ex->getCode(), $ex); |
| 40 | 40 | } |
| 41 | 41 | } |
@@ -35,7 +35,7 @@ |
||
| 35 | 35 | return $this->httpClient->post("transactions", [ |
| 36 | 36 | 'body' => json_encode($query) |
| 37 | 37 | ]); |
| 38 | - }catch (\Exception $ex){ |
|
| 38 | + } catch (\Exception $ex){ |
|
| 39 | 39 | throw new \Exception($ex->getMessage(), $ex->getCode(), $ex); |
| 40 | 40 | } |
| 41 | 41 | } |