@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | $this->customerId = $customerId; |
| 19 | 19 | $this->client = new GuzzleClient([ |
| 20 | 20 | 'base_uri' => config('services.dnb.endpoint'), |
| 21 | - 'handler' => tap(HandlerStack::create(new CurlHandler()), function ($stack) { |
|
| 21 | + 'handler' => tap(HandlerStack::create(new CurlHandler()), function($stack) { |
|
| 22 | 22 | $stack->push(new DNBRequestHandler( |
| 23 | 23 | new Credentials( |
| 24 | 24 | config('services.dnb.client_id'), |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | ]); |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | - public function fetch($endpoint, $method = 'GET', $params = []) |
|
| 34 | + public function fetch($endpoint, $method = 'GET', $params = [ ]) |
|
| 35 | 35 | { |
| 36 | 36 | return json_decode( |
| 37 | 37 | $this->client |
@@ -152,8 +152,8 @@ discard block |
||
| 152 | 152 | if (is_array($location)) { |
| 153 | 153 | return $this->fetch('/locations/branches/coordinates', 'GET', [ |
| 154 | 154 | 'query' => [ |
| 155 | - 'latitude' => $location[0], |
|
| 156 | - 'longitude' => $location[1] |
|
| 155 | + 'latitude' => $location[ 0 ], |
|
| 156 | + 'longitude' => $location[ 1 ] |
|
| 157 | 157 | ] |
| 158 | 158 | ]); |
| 159 | 159 | } |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | config('services.dnb.region') ?? 'eu-west-1' |
| 32 | 32 | ); |
| 33 | 33 | |
| 34 | - $this->cache_key = 'services.dnb.token.'.$this->customerId; |
|
| 34 | + $this->cache_key = 'services.dnb.token.' . $this->customerId; |
|
| 35 | 35 | $this->token = null; |
| 36 | 36 | } |
| 37 | 37 | |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | public function getFreshToken($cache = true) |
| 55 | 55 | { |
| 56 | 56 | $signedrequest = $this->signer->signRequest( |
| 57 | - new Request('GET', config('services.dnb.endpoint').'/token?customerId='.json_encode([ |
|
| 57 | + new Request('GET', config('services.dnb.endpoint') . '/token?customerId=' . json_encode([ |
|
| 58 | 58 | 'type' => 'SSN', |
| 59 | 59 | 'value' => $this->customerId |
| 60 | 60 | ]), [ |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | ); |
| 68 | 68 | $response = (new Client)->send($signedrequest); |
| 69 | 69 | |
| 70 | - return tap(collect(json_decode($response->getBody())->tokenInfo)->first(), function ($token) use ($cache) { |
|
| 70 | + return tap(collect(json_decode($response->getBody())->tokenInfo)->first(), function($token) use ($cache) { |
|
| 71 | 71 | if ($cache) { |
| 72 | 72 | Cache::put($this->cache_key, $token, $this->duration); |
| 73 | 73 | } |