@@ -60,10 +60,10 @@ discard block |
||
60 | 60 | |
61 | 61 | $mode = config('laravel-daraja.mode'); |
62 | 62 | |
63 | - $baseUrl = $this->removeLastSlash(config('laravel-daraja.base_uri.'.$mode)); |
|
63 | + $baseUrl = $this->removeLastSlash(config('laravel-daraja.base_uri.' . $mode)); |
|
64 | 64 | |
65 | 65 | $options = [ |
66 | - 'base_uri' => $baseUrl.'/', |
|
66 | + 'base_uri' => $baseUrl . '/', |
|
67 | 67 | 'verify' => $mode === 'sandbox' ? false : true, |
68 | 68 | ]; |
69 | 69 | |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | */ |
140 | 140 | protected function securityCredential($plaintext) |
141 | 141 | { |
142 | - $publicKey = file_get_contents(__DIR__.'/../cert.cer'); |
|
142 | + $publicKey = file_get_contents(__DIR__ . '/../cert.cer'); |
|
143 | 143 | |
144 | 144 | openssl_public_encrypt($plaintext, $encrypted, $publicKey, OPENSSL_PKCS1_PADDING); |
145 | 145 | |
@@ -155,10 +155,10 @@ discard block |
||
155 | 155 | * @return mixed |
156 | 156 | * @throws MpesaApiRequestException |
157 | 157 | */ |
158 | - protected function call($url, $options = [], $method = 'POST') |
|
158 | + protected function call($url, $options = [ ], $method = 'POST') |
|
159 | 159 | { |
160 | 160 | if (isset($this->accessToken)) { |
161 | - $options['headers'] = ['Authorization' => 'Bearer '.$this->accessToken]; |
|
161 | + $options[ 'headers' ] = [ 'Authorization' => 'Bearer ' . $this->accessToken ]; |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | try { |
@@ -168,10 +168,10 @@ discard block |
||
168 | 168 | } catch (ServerException $e) { |
169 | 169 | $response = json_decode($e->getResponse()->getBody()->getContents()); |
170 | 170 | if (isset($response->Envelope)) { |
171 | - $message = 'Safaricom APIs: '.$response->Envelope->Body->Fault->faultstring; |
|
171 | + $message = 'Safaricom APIs: ' . $response->Envelope->Body->Fault->faultstring; |
|
172 | 172 | throw new MpesaApiRequestException($message, $e->getCode()); |
173 | 173 | } |
174 | - throw new MpesaApiRequestException('Safaricom APIs: '.$response->errorMessage, $e->getCode()); |
|
174 | + throw new MpesaApiRequestException('Safaricom APIs: ' . $response->errorMessage, $e->getCode()); |
|
175 | 175 | } catch (ClientException $e) { |
176 | 176 | $response = json_decode($e->getResponse()->getBody()->getContents()); |
177 | 177 | throw new MpesaApiRequestException('Safaricom APIs: ' |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | */ |
105 | 105 | public function toPayBillStatus($transactionID, $remarks, $occasion = '') |
106 | 106 | { |
107 | - $this->identifierType = $this->identifier['paybill']; |
|
107 | + $this->identifierType = $this->identifier[ 'paybill' ]; |
|
108 | 108 | |
109 | 109 | return $this->status($transactionID, $remarks, $occasion); |
110 | 110 | } |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | */ |
120 | 120 | public function toTillStatus($transactionID, $remarks, $occasion = '') |
121 | 121 | { |
122 | - $this->identifierType = $this->identifier['till']; |
|
122 | + $this->identifierType = $this->identifier[ 'till' ]; |
|
123 | 123 | |
124 | 124 | return $this->status($transactionID, $remarks, $occasion); |
125 | 125 | } |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | */ |
135 | 135 | public function toMsisdnStatus($transactionID, $remarks, $occasion = '') |
136 | 136 | { |
137 | - $this->identifierType = $this->identifier['msisdn']; |
|
137 | + $this->identifierType = $this->identifier[ 'msisdn' ]; |
|
138 | 138 | |
139 | 139 | return $this->status($transactionID, $remarks, $occasion); |
140 | 140 | } |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | public function fromMsisdnStatus($msisdn, $transactionID, $remarks, $occasion = '') |
152 | 152 | { |
153 | 153 | $this->partyA = $msisdn; |
154 | - $this->identifierType = $this->identifier['msisdn']; |
|
154 | + $this->identifierType = $this->identifier[ 'msisdn' ]; |
|
155 | 155 | |
156 | 156 | return $this->status($transactionID, $remarks, $occasion); |
157 | 157 | } |
@@ -180,6 +180,6 @@ discard block |
||
180 | 180 | 'Occasion' => $occasion, |
181 | 181 | ]; |
182 | 182 | |
183 | - return $this->call($this->queryEndPoint, ['json' => $parameters]); |
|
183 | + return $this->call($this->queryEndPoint, [ 'json' => $parameters ]); |
|
184 | 184 | } |
185 | 185 | } |
186 | 186 | \ No newline at end of file |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | 'ValidationURL' => $this->setUrl($validationUrl), |
55 | 55 | ]; |
56 | 56 | |
57 | - return $this->call($this->urlRegistrationEndPoint, ['json' => $parameters]); |
|
57 | + return $this->call($this->urlRegistrationEndPoint, [ 'json' => $parameters ]); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | /** |
@@ -118,6 +118,6 @@ discard block |
||
118 | 118 | 'BillRefNumber' => $reference, |
119 | 119 | ]; |
120 | 120 | |
121 | - return $this->call($this->simulationEndpoint, ['json' => $parameters]); |
|
121 | + return $this->call($this->simulationEndpoint, [ 'json' => $parameters ]); |
|
122 | 122 | } |
123 | 123 | } |
124 | 124 | \ No newline at end of file |