Completed
Push — master ( 2e74d2...2d9a19 )
by Stanley
02:30
created
src/Requests/B2B.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
         $this->initiatorName = config('laravel-daraja.initiator.name');
82 82
         $this->securityCredential = $this->securityCredential(config('laravel-daraja.initiator.credential'));
83 83
         $this->partyA = config('laravel-daraja.initiator.short_code');
84
-        $this->senderIdentifierType = $this->identifier[config('laravel-daraja.initiator.type')];
84
+        $this->senderIdentifierType = $this->identifier[ config('laravel-daraja.initiator.type') ];
85 85
 
86 86
         $this->queueTimeOutURL = $this->setUrl(config('laravel-daraja.queue_timeout_url.b2b'));
87 87
         $this->resultURL = $this->setUrl(config('laravel-daraja.result_url.b2b'));
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
     public function setShortCode($code, $type)
119 119
     {
120 120
         $this->partyA = $code;
121
-        $this->senderIdentifierType = $this->identifier[$type];
121
+        $this->senderIdentifierType = $this->identifier[ $type ];
122 122
     }
123 123
 
124 124
     /**
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
     public function payToPayBill($payBillNo, $amount, $remarks, $accountReference = '')
156 156
     {
157 157
         $this->setCommandId('BusinessPayBill');
158
-        $this->receiverIdentifierType = $this->identifier['paybill'];
158
+        $this->receiverIdentifierType = $this->identifier[ 'paybill' ];
159 159
         return $this->pay($payBillNo, $amount, $remarks, $accountReference);
160 160
     }
161 161
 
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
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
         return $this->pay($tillNo, $amount, $remarks);
176 176
     }
177 177
 
@@ -205,6 +205,6 @@  discard block
 block discarded – undo
205 205
             'ResultURL' => $this->resultURL,
206 206
         ];
207 207
 
208
-        return $response = $this->call($this->endPoint, ['json' => $parameters]);
208
+        return $response = $this->call($this->endPoint, [ 'json' => $parameters ]);
209 209
     }
210 210
 }
211 211
\ No newline at end of file
Please login to merge, or discard this patch.
src/Requests/B2C.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -196,6 +196,6 @@
 block discarded – undo
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
 }
202 202
\ No newline at end of file
Please login to merge, or discard this patch.
src/Requests/Balance.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -109,7 +109,7 @@
 block discarded – undo
109 109
             'QueueTimeOutURL' => $this->queueTimeoutURL,
110 110
             'ResultURL' => $this->resultURL,
111 111
         ];
112
-        return $this->call($this->queryEndPoint, ['json' => $parameters]);
112
+        return $this->call($this->queryEndPoint, [ 'json' => $parameters ]);
113 113
     }
114 114
 
115 115
 }
116 116
\ No newline at end of file
Please login to merge, or discard this patch.
src/Requests/STK.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
      */
99 99
     protected function generatePassword($shortCode, $passKey, $timestamp)
100 100
     {
101
-        return base64_encode($shortCode.$passKey.$timestamp);
101
+        return base64_encode($shortCode . $passKey . $timestamp);
102 102
     }
103 103
 
104 104
     /**
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
             'TransactionDesc' => str_limit($description, 20, ''),
130 130
         ];
131 131
 
132
-        return $this->call($this->stkEndpoint, ['json' => $parameters]);
132
+        return $this->call($this->stkEndpoint, [ 'json' => $parameters ]);
133 133
     }
134 134
 
135 135
     /**
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
             'CheckoutRequestID' => $checkoutRequestId,
151 151
         ];
152 152
 
153
-        return $this->call($this->statusEndPoint, ['json' => $parameters]);
153
+        return $this->call($this->statusEndPoint, [ 'json' => $parameters ]);
154 154
     }
155 155
 
156 156
 }
157 157
\ No newline at end of file
Please login to merge, or discard this patch.
src/Requests/Reversal.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -116,7 +116,7 @@
 block discarded – undo
116 116
             'Occasion' => str_limit($occasion, 100, ''),
117 117
         ];
118 118
 
119
-        return $this->call($this->reversalEndPoint, ['json' => $parameters]);
119
+        return $this->call($this->reversalEndPoint, [ 'json' => $parameters ]);
120 120
     }
121 121
 
122 122
 }
123 123
\ No newline at end of file
Please login to merge, or discard this patch.
src/LaravelDarajaServiceProvider.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
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.
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
             'laravel-daraja'
42 42
         );
43 43
 
44
-        $this->app->bind('mpesa-api', function () {
44
+        $this->app->bind('mpesa-api', function() {
45 45
             return new MpesaApi();
46 46
         });
47 47
     }
Please login to merge, or discard this patch.
src/MpesaApiClient.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -60,10 +60,10 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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: '
Please login to merge, or discard this patch.
src/Requests/Transaction.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
Please login to merge, or discard this patch.
src/Requests/C2B.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
Please login to merge, or discard this patch.