Completed
Push — master ( eef78e...8b8d83 )
by PROSPER
01:30 queued 13s
created
src/PaystackServiceProvider.php 2 patches
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -24,8 +24,8 @@  discard block
 block discarded – undo
24 24
     protected $defer = false;
25 25
 
26 26
     /**
27
-    * Publishes all the config file this package needs to function
28
-    */
27
+     * Publishes all the config file this package needs to function
28
+     */
29 29
     public function boot()
30 30
     {
31 31
         $config = realpath(__DIR__.'/../resources/config/paystack.php');
@@ -36,8 +36,8 @@  discard block
 block discarded – undo
36 36
     }
37 37
 
38 38
     /**
39
-    * Register the application services.
40
-    */
39
+     * Register the application services.
40
+     */
41 41
     public function register()
42 42
     {
43 43
         $this->app->bind('laravel-paystack', function () {
@@ -48,9 +48,9 @@  discard block
 block discarded – undo
48 48
     }
49 49
 
50 50
     /**
51
-    * Get the services provided by the provider
52
-    * @return array
53
-    */
51
+     * Get the services provided by the provider
52
+     * @return array
53
+     */
54 54
     public function provides()
55 55
     {
56 56
         return ['laravel-paystack'];
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@
 block discarded – undo
40 40
     */
41 41
     public function register()
42 42
     {
43
-        $this->app->bind('laravel-paystack', function () {
43
+        $this->app->bind('laravel-paystack', function() {
44 44
 
45 45
             return new Paystack;
46 46
 
Please login to merge, or discard this patch.
src/Paystack.php 2 patches
Indentation   +22 added lines, -23 removed lines patch added patch discarded remove patch
@@ -102,12 +102,11 @@  discard block
 block discarded – undo
102 102
 
103 103
 
104 104
      /**
105
-
106
-     * Initiate a payment request to Paystack
107
-     * Included the option to pass the payload to this method for situations
108
-     * when the payload is built on the fly (not passed to the controller from a view)
109
-     * @return Paystack
110
-     */
105
+      * Initiate a payment request to Paystack
106
+      * Included the option to pass the payload to this method for situations
107
+      * when the payload is built on the fly (not passed to the controller from a view)
108
+      * @return Paystack
109
+      */
111 110
 
112 111
     public function makePaymentRequest( $data = null)
113 112
     {
@@ -189,11 +188,11 @@  discard block
 block discarded – undo
189 188
     }
190 189
 
191 190
      /**
192
-     * Get the authorization callback response
193
-     * In situations where Laravel serves as an backend for a detached UI, the api cannot redirect
194
-     * and might need to take different actions based on the success or not of the transaction
195
-     * @return array
196
-     */
191
+      * Get the authorization callback response
192
+      * In situations where Laravel serves as an backend for a detached UI, the api cannot redirect
193
+      * and might need to take different actions based on the success or not of the transaction
194
+      * @return array
195
+      */
197 196
     public function getAuthorizationResponse($data)
198 197
     {
199 198
         $this->makePaymentRequest($data);
@@ -597,10 +596,10 @@  discard block
 block discarded – undo
597 596
     }
598 597
 
599 598
      /**
600
-     * Creates a subaccount to be used for split payments . Required    params are business_name , settlement_bank , account_number ,   percentage_charge
601
-     *
602
-     * @return array
603
-     */
599
+      * Creates a subaccount to be used for split payments . Required    params are business_name , settlement_bank , account_number ,   percentage_charge
600
+      *
601
+      * @return array
602
+      */
604 603
 
605 604
     public function createSubAccount(){
606 605
         $data = [
@@ -621,10 +620,10 @@  discard block
 block discarded – undo
621 620
     }
622 621
 
623 622
      /**
624
-     * Fetches details of a subaccount
625
-     * @param subaccount code
626
-     * @return array
627
-     */
623
+      * Fetches details of a subaccount
624
+      * @param subaccount code
625
+      * @return array
626
+      */
628 627
     public function fetchSubAccount($subaccount_code){
629 628
 
630 629
         $this->setRequestOptions();
@@ -633,10 +632,10 @@  discard block
 block discarded – undo
633 632
     }
634 633
 
635 634
      /**
636
-     * Lists all the subaccounts associated with the account
637
-     * @param $per_page - Specifies how many records to retrieve per page , $page - SPecifies exactly what page to retrieve
638
-     * @return array
639
-     */
635
+      * Lists all the subaccounts associated with the account
636
+      * @param $per_page - Specifies how many records to retrieve per page , $page - SPecifies exactly what page to retrieve
637
+      * @return array
638
+      */
640 639
     public function listSubAccounts($per_page,$page){
641 640
 
642 641
         $this->setRequestOptions();
Please login to merge, or discard this patch.
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
      */
87 87
     private function setRequestOptions()
88 88
     {
89
-        $authBearer = 'Bearer '. $this->secretKey;
89
+        $authBearer = 'Bearer '.$this->secretKey;
90 90
 
91 91
         $this->client = new Client(
92 92
             [
@@ -109,19 +109,19 @@  discard block
 block discarded – undo
109 109
      * @return Paystack
110 110
      */
111 111
 
112
-    public function makePaymentRequest( $data = null)
112
+    public function makePaymentRequest($data = null)
113 113
     {
114
-        if ( $data == null ) {
114
+        if ($data == null) {
115 115
                 $quantity = intval(request()->quantity);
116 116
               $data = [
117
-                "amount" => intval(request()->amount)*$quantity,
117
+                "amount" => intval(request()->amount) * $quantity,
118 118
                 "reference" => request()->reference,
119 119
                 "email" => request()->email,
120 120
                 "plan" => request()->plan,
121 121
                 "first_name" => request()->first_name,
122 122
                 "last_name" => request()->last_name,
123 123
                 "callback_url" => request()->callback_url,
124
-                "currency" => (request()->currency != ""  ? request()->currency : "NGN"),
124
+                "currency" => (request()->currency != "" ? request()->currency : "NGN"),
125 125
                 /*
126 126
                     Paystack allows for transactions to be split into a subaccount -
127 127
                     The following lines trap the subaccount ID - as well as the ammount to charge the subaccount (if overriden in the form)
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
         }
170 170
 
171 171
         $this->response = $this->client->{strtolower($method)}(
172
-            $this->baseUrl . $relativeUrl,
172
+            $this->baseUrl.$relativeUrl,
173 173
             ["body" => json_encode($body)]
174 174
         );
175 175
 
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
 
214 214
         $relativeUrl = "/transaction/verify/{$transactionRef}";
215 215
 
216
-        $this->response = $this->client->get($this->baseUrl . $relativeUrl, []);
216
+        $this->response = $this->client->get($this->baseUrl.$relativeUrl, []);
217 217
     }
218 218
 
219 219
     /**
@@ -361,7 +361,7 @@  discard block
 block discarded – undo
361 361
     public function fetchPlan($plan_code)
362 362
     {
363 363
         $this->setRequestOptions();
364
-        return $this->setHttpResponse('/plan/' . $plan_code, 'GET', [])->getResponse();
364
+        return $this->setHttpResponse('/plan/'.$plan_code, 'GET', [])->getResponse();
365 365
     }
366 366
 
367 367
     /**
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
         ];
383 383
 
384 384
         $this->setRequestOptions();
385
-        return $this->setHttpResponse('/plan/' . $plan_code, 'PUT', $data)->getResponse();
385
+        return $this->setHttpResponse('/plan/'.$plan_code, 'PUT', $data)->getResponse();
386 386
     }
387 387
 
388 388
     /**
@@ -411,7 +411,7 @@  discard block
 block discarded – undo
411 411
     public function fetchCustomer($customer_id)
412 412
     {
413 413
         $this->setRequestOptions();
414
-        return $this->setHttpResponse('/customer/'. $customer_id, 'GET', [])->getResponse();
414
+        return $this->setHttpResponse('/customer/'.$customer_id, 'GET', [])->getResponse();
415 415
     }
416 416
 
417 417
     /**
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
         ];
432 432
 
433 433
         $this->setRequestOptions();
434
-        return $this->setHttpResponse('/customer/'. $customer_id, 'PUT', $data)->getResponse();
434
+        return $this->setHttpResponse('/customer/'.$customer_id, 'PUT', $data)->getResponse();
435 435
     }
436 436
 
437 437
     /**
@@ -487,7 +487,7 @@  discard block
 block discarded – undo
487 487
     {
488 488
         $this->setRequestOptions();
489 489
 
490
-        return $this->setHttpResponse('/subscription?customer=' . $customer_id, 'GET', [])->getData();
490
+        return $this->setHttpResponse('/subscription?customer='.$customer_id, 'GET', [])->getData();
491 491
     }
492 492
 
493 493
     /**
@@ -500,7 +500,7 @@  discard block
 block discarded – undo
500 500
     {
501 501
         $this->setRequestOptions();
502 502
 
503
-        return $this->setHttpResponse('/subscription?plan=' . $plan_id, 'GET', [])->getData();
503
+        return $this->setHttpResponse('/subscription?plan='.$plan_id, 'GET', [])->getData();
504 504
     }
505 505
 
506 506
     /**
@@ -603,7 +603,7 @@  discard block
 block discarded – undo
603 603
      * @return array
604 604
      */
605 605
 
606
-    public function createSubAccount(){
606
+    public function createSubAccount() {
607 607
         $data = [
608 608
             "business_name" => request()->business_name,
609 609
             "settlement_bank" => request()->settlement_bank,
@@ -626,10 +626,10 @@  discard block
 block discarded – undo
626 626
      * @param subaccount code
627 627
      * @return array
628 628
      */
629
-    public function fetchSubAccount($subaccount_code){
629
+    public function fetchSubAccount($subaccount_code) {
630 630
 
631 631
         $this->setRequestOptions();
632
-        return $this->setHttpResponse("/subaccount/{$subaccount_code}","GET",[])->getResponse();
632
+        return $this->setHttpResponse("/subaccount/{$subaccount_code}", "GET", [])->getResponse();
633 633
 
634 634
     }
635 635
 
@@ -638,10 +638,10 @@  discard block
 block discarded – undo
638 638
      * @param $per_page - Specifies how many records to retrieve per page , $page - SPecifies exactly what page to retrieve
639 639
      * @return array
640 640
      */
641
-    public function listSubAccounts($per_page,$page){
641
+    public function listSubAccounts($per_page, $page) {
642 642
 
643 643
         $this->setRequestOptions();
644
-        return $this->setHttpResponse("/subaccount/?perPage=".(int) $per_page."&page=".(int) $page,"GET")->getResponse();
644
+        return $this->setHttpResponse("/subaccount/?perPage=".(int) $per_page."&page=".(int) $page, "GET")->getResponse();
645 645
 
646 646
     }
647 647
 
@@ -652,7 +652,7 @@  discard block
 block discarded – undo
652 652
      * @return array
653 653
      */
654 654
 
655
-    public function updateSubAccount($subaccount_code){
655
+    public function updateSubAccount($subaccount_code) {
656 656
         $data = [
657 657
             "business_name" => request()->business_name,
658 658
             "settlement_bank" => request()->settlement_bank,
Please login to merge, or discard this patch.
src/Support/helpers.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (! function_exists("paystack"))
3
+if (!function_exists("paystack"))
4 4
 {
5 5
     function paystack() {
6 6
 
Please login to merge, or discard this patch.