@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | $mode = config('laravel-daraja.mode'); |
72 | 72 | |
73 | 73 | $options = [ |
74 | - 'base_uri' => $this->base_url[$mode], |
|
74 | + 'base_uri' => $this->base_url[ $mode ], |
|
75 | 75 | 'verify' => $mode === 'sandbox' ? false : true, |
76 | 76 | ]; |
77 | 77 | |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | */ |
136 | 136 | protected function securityCredential($plaintext) |
137 | 137 | { |
138 | - $publicKey = file_get_contents(__DIR__.'/../cert.cer'); |
|
138 | + $publicKey = file_get_contents(__DIR__ . '/../cert.cer'); |
|
139 | 139 | |
140 | 140 | openssl_public_encrypt($plaintext, $encrypted, $publicKey, OPENSSL_PKCS1_PADDING); |
141 | 141 | |
@@ -151,10 +151,10 @@ discard block |
||
151 | 151 | * @return mixed |
152 | 152 | * @throws MpesaApiRequestException |
153 | 153 | */ |
154 | - protected function call($url, $options = [], $method = 'POST') |
|
154 | + protected function call($url, $options = [ ], $method = 'POST') |
|
155 | 155 | { |
156 | 156 | if (isset($this->accessToken)) { |
157 | - $options['headers'] = ['Authorization' => 'Bearer '.$this->accessToken]; |
|
157 | + $options[ 'headers' ] = [ 'Authorization' => 'Bearer ' . $this->accessToken ]; |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | try { |
@@ -164,10 +164,10 @@ discard block |
||
164 | 164 | } catch (ServerException $e) { |
165 | 165 | $response = json_decode($e->getResponse()->getBody()->getContents()); |
166 | 166 | if (isset($response->Envelope)) { |
167 | - $message = 'Safaricom APIs: '.$response->Envelope->Body->Fault->faultstring; |
|
167 | + $message = 'Safaricom APIs: ' . $response->Envelope->Body->Fault->faultstring; |
|
168 | 168 | throw new MpesaApiRequestException($message, $e->getCode()); |
169 | 169 | } |
170 | - throw new MpesaApiRequestException('Safaricom APIs: '.$response->errorMessage, $e->getCode()); |
|
170 | + throw new MpesaApiRequestException('Safaricom APIs: ' . $response->errorMessage, $e->getCode()); |
|
171 | 171 | } catch (ClientException $e) { |
172 | 172 | $response = json_decode($e->getResponse()->getBody()->getContents()); |
173 | 173 | throw new MpesaApiRequestException('Safaricom APIs: ' |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | /** |
10 | 10 | * Package path to config. |
11 | 11 | */ |
12 | - const CONFIG_PATH = __DIR__.'/../config/laravel-daraja.php'; |
|
12 | + const CONFIG_PATH = __DIR__ . '/../config/laravel-daraja.php'; |
|
13 | 13 | |
14 | 14 | /** |
15 | 15 | * Perform post-registration booting of services. |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | { |
39 | 39 | $this->mergeConfigFrom(self::CONFIG_PATH, 'laravel-daraja'); |
40 | 40 | |
41 | - $this->app->bind('mpesa-api', function () { |
|
41 | + $this->app->bind('mpesa-api', function() { |
|
42 | 42 | return new MpesaApi(); |
43 | 43 | }); |
44 | 44 | } |