@@ -196,6 +196,6 @@ |
||
| 196 | 196 | 'Occassion' => $occasion, |
| 197 | 197 | ]; |
| 198 | 198 | |
| 199 | - return $response = $this->call($this->endPoint, ['json' => $parameters]); |
|
| 199 | + return $response = $this->call($this->endPoint, [ 'json' => $parameters ]); |
|
| 200 | 200 | } |
| 201 | 201 | } |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | $this->initiatorName = config('laravel-daraja.initiator.name'); |
| 81 | 81 | $this->securityCredential = $this->securityCredential(config('laravel-daraja.initiator.credential')); |
| 82 | 82 | $this->partyA = config('laravel-daraja.initiator.short_code'); |
| 83 | - $this->senderIdentifierType = $this->identifier[config('laravel-daraja.initiator.type')]; |
|
| 83 | + $this->senderIdentifierType = $this->identifier[ config('laravel-daraja.initiator.type') ]; |
|
| 84 | 84 | |
| 85 | 85 | $this->queueTimeOutURL = $this->setUrl(config('laravel-daraja.queue_timeout_url.b2b')); |
| 86 | 86 | $this->resultURL = $this->setUrl(config('laravel-daraja.result_url.b2b')); |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | public function setShortCode($code, $type) |
| 118 | 118 | { |
| 119 | 119 | $this->partyA = $code; |
| 120 | - $this->senderIdentifierType = $this->identifier[$type]; |
|
| 120 | + $this->senderIdentifierType = $this->identifier[ $type ]; |
|
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | /** |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | public function payToPayBill($payBillNo, $amount, $remarks, $accountReference = '') |
| 155 | 155 | { |
| 156 | 156 | $this->setCommandId('BusinessPayBill'); |
| 157 | - $this->receiverIdentifierType = $this->identifier['paybill']; |
|
| 157 | + $this->receiverIdentifierType = $this->identifier[ 'paybill' ]; |
|
| 158 | 158 | |
| 159 | 159 | return $this->pay($payBillNo, $amount, $remarks, $accountReference); |
| 160 | 160 | } |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | public function payToBuyGoods($tillNo, $amount, $remarks) |
| 172 | 172 | { |
| 173 | 173 | $this->setCommandId('BusinessBuyGoods'); |
| 174 | - $this->receiverIdentifierType = $this->identifier['till']; |
|
| 174 | + $this->receiverIdentifierType = $this->identifier[ 'till' ]; |
|
| 175 | 175 | |
| 176 | 176 | return $this->pay($tillNo, $amount, $remarks); |
| 177 | 177 | } |
@@ -206,6 +206,6 @@ discard block |
||
| 206 | 206 | 'ResultURL' => $this->resultURL, |
| 207 | 207 | ]; |
| 208 | 208 | |
| 209 | - return $response = $this->call($this->endPoint, ['json' => $parameters]); |
|
| 209 | + return $response = $this->call($this->endPoint, [ 'json' => $parameters ]); |
|
| 210 | 210 | } |
| 211 | 211 | } |
@@ -110,6 +110,6 @@ |
||
| 110 | 110 | 'ResultURL' => $this->resultURL, |
| 111 | 111 | ]; |
| 112 | 112 | |
| 113 | - return $this->call($this->queryEndPoint, ['json' => $parameters]); |
|
| 113 | + return $this->call($this->queryEndPoint, [ 'json' => $parameters ]); |
|
| 114 | 114 | } |
| 115 | 115 | } |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | */ |
| 96 | 96 | protected function generatePassword($shortCode, $passKey, $timestamp) |
| 97 | 97 | { |
| 98 | - return base64_encode($shortCode.$passKey.$timestamp); |
|
| 98 | + return base64_encode($shortCode . $passKey . $timestamp); |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | /** |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | 'TransactionDesc' => str_limit($description, 20, ''), |
| 127 | 127 | ]; |
| 128 | 128 | |
| 129 | - return $this->call($this->stkEndpoint, ['json' => $parameters]); |
|
| 129 | + return $this->call($this->stkEndpoint, [ 'json' => $parameters ]); |
|
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | /** |
@@ -147,6 +147,6 @@ discard block |
||
| 147 | 147 | 'CheckoutRequestID' => $checkoutRequestId, |
| 148 | 148 | ]; |
| 149 | 149 | |
| 150 | - return $this->call($this->statusEndPoint, ['json' => $parameters]); |
|
| 150 | + return $this->call($this->statusEndPoint, [ 'json' => $parameters ]); |
|
| 151 | 151 | } |
| 152 | 152 | } |
@@ -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 | } |
@@ -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 | } |
@@ -115,6 +115,6 @@ |
||
| 115 | 115 | 'Occasion' => str_limit($occasion, 100, ''), |
| 116 | 116 | ]; |
| 117 | 117 | |
| 118 | - return $this->call($this->reversalEndPoint, ['json' => $parameters]); |
|
| 118 | + return $this->call($this->reversalEndPoint, [ 'json' => $parameters ]); |
|
| 119 | 119 | } |
| 120 | 120 | } |
@@ -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 | } |