@@ -24,8 +24,8 @@ discard block |
||
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 |
||
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 |
||
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']; |
@@ -40,7 +40,7 @@ |
||
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 |
@@ -102,12 +102,11 @@ discard block |
||
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 | { |
@@ -181,11 +180,11 @@ discard block |
||
181 | 180 | } |
182 | 181 | |
183 | 182 | /** |
184 | - * Get the authorization callback response |
|
185 | - * In situations where Laravel serves as an backend for a detached UI, the api cannot redirect |
|
186 | - * and might need to take different actions based on the success or not of the transaction |
|
187 | - * @return array |
|
188 | - */ |
|
183 | + * Get the authorization callback response |
|
184 | + * In situations where Laravel serves as an backend for a detached UI, the api cannot redirect |
|
185 | + * and might need to take different actions based on the success or not of the transaction |
|
186 | + * @return array |
|
187 | + */ |
|
189 | 188 | public function getAuthorizationResponse($data) |
190 | 189 | { |
191 | 190 | $this->makePaymentRequest($data); |
@@ -600,10 +599,10 @@ discard block |
||
600 | 599 | } |
601 | 600 | |
602 | 601 | /** |
603 | - * Creates a subaccount to be used for split payments . Required params are business_name , settlement_bank , account_number , percentage_charge |
|
604 | - * |
|
605 | - * @return array |
|
606 | - */ |
|
602 | + * Creates a subaccount to be used for split payments . Required params are business_name , settlement_bank , account_number , percentage_charge |
|
603 | + * |
|
604 | + * @return array |
|
605 | + */ |
|
607 | 606 | |
608 | 607 | public function createSubAccount( $data = null ){ |
609 | 608 | |
@@ -628,10 +627,10 @@ discard block |
||
628 | 627 | } |
629 | 628 | |
630 | 629 | /** |
631 | - * Fetches details of a subaccount |
|
632 | - * @param subaccount code |
|
633 | - * @return array |
|
634 | - */ |
|
630 | + * Fetches details of a subaccount |
|
631 | + * @param subaccount code |
|
632 | + * @return array |
|
633 | + */ |
|
635 | 634 | public function fetchSubAccount($subaccount_code){ |
636 | 635 | |
637 | 636 | $this->setRequestOptions(); |
@@ -640,10 +639,10 @@ discard block |
||
640 | 639 | } |
641 | 640 | |
642 | 641 | /** |
643 | - * Lists all the subaccounts associated with the account |
|
644 | - * @param $per_page - Specifies how many records to retrieve per page , $page - SPecifies exactly what page to retrieve |
|
645 | - * @return array |
|
646 | - */ |
|
642 | + * Lists all the subaccounts associated with the account |
|
643 | + * @param $per_page - Specifies how many records to retrieve per page , $page - SPecifies exactly what page to retrieve |
|
644 | + * @return array |
|
645 | + */ |
|
647 | 646 | public function listSubAccounts($per_page,$page){ |
648 | 647 | |
649 | 648 | $this->setRequestOptions(); |
@@ -86,7 +86,7 @@ discard block |
||
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,9 +109,9 @@ discard block |
||
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 | $data = [ |
116 | 116 | "amount" => intval(request()->amount), |
117 | 117 | "reference" => request()->reference, |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | } |
161 | 161 | |
162 | 162 | $this->response = $this->client->{strtolower($method)}( |
163 | - $this->baseUrl . $relativeUrl, |
|
163 | + $this->baseUrl.$relativeUrl, |
|
164 | 164 | ["body" => json_encode($body)] |
165 | 165 | ); |
166 | 166 | |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | |
205 | 205 | $relativeUrl = "/transaction/verify/{$transactionRef}"; |
206 | 206 | |
207 | - $this->response = $this->client->get($this->baseUrl . $relativeUrl, []); |
|
207 | + $this->response = $this->client->get($this->baseUrl.$relativeUrl, []); |
|
208 | 208 | } |
209 | 209 | |
210 | 210 | /** |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | /** |
327 | 327 | * Create a plan |
328 | 328 | */ |
329 | - public function createPlan( $data = null ) |
|
329 | + public function createPlan($data = null) |
|
330 | 330 | { |
331 | 331 | if ($data == null) { |
332 | 332 | $data = [ |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | public function fetchPlan($plan_code) |
355 | 355 | { |
356 | 356 | $this->setRequestOptions(); |
357 | - return $this->setHttpResponse('/plan/' . $plan_code, 'GET', [])->getResponse(); |
|
357 | + return $this->setHttpResponse('/plan/'.$plan_code, 'GET', [])->getResponse(); |
|
358 | 358 | } |
359 | 359 | |
360 | 360 | /** |
@@ -377,15 +377,15 @@ discard block |
||
377 | 377 | } |
378 | 378 | |
379 | 379 | $this->setRequestOptions(); |
380 | - return $this->setHttpResponse('/plan/' . $plan_code, 'PUT', $data)->getResponse(); |
|
380 | + return $this->setHttpResponse('/plan/'.$plan_code, 'PUT', $data)->getResponse(); |
|
381 | 381 | } |
382 | 382 | |
383 | 383 | /** |
384 | 384 | * Create a customer |
385 | 385 | */ |
386 | - public function createCustomer( $data = null ) |
|
386 | + public function createCustomer($data = null) |
|
387 | 387 | { |
388 | - if ($data == null){ |
|
388 | + if ($data == null) { |
|
389 | 389 | $data = [ |
390 | 390 | "email" => request()->email, |
391 | 391 | "first_name" => request()->fname, |
@@ -407,7 +407,7 @@ discard block |
||
407 | 407 | public function fetchCustomer($customer_id) |
408 | 408 | { |
409 | 409 | $this->setRequestOptions(); |
410 | - return $this->setHttpResponse('/customer/'. $customer_id, 'GET', [])->getResponse(); |
|
410 | + return $this->setHttpResponse('/customer/'.$customer_id, 'GET', [])->getResponse(); |
|
411 | 411 | } |
412 | 412 | |
413 | 413 | /** |
@@ -429,14 +429,14 @@ discard block |
||
429 | 429 | } |
430 | 430 | |
431 | 431 | $this->setRequestOptions(); |
432 | - return $this->setHttpResponse('/customer/'. $customer_id, 'PUT', $data)->getResponse(); |
|
432 | + return $this->setHttpResponse('/customer/'.$customer_id, 'PUT', $data)->getResponse(); |
|
433 | 433 | } |
434 | 434 | |
435 | 435 | /** |
436 | 436 | * Export transactions in .CSV |
437 | 437 | * @return array |
438 | 438 | */ |
439 | - public function exportTransactions( $data = null ) |
|
439 | + public function exportTransactions($data = null) |
|
440 | 440 | { |
441 | 441 | if ($data == null) { |
442 | 442 | $data = [ |
@@ -487,7 +487,7 @@ discard block |
||
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,14 +500,14 @@ discard block |
||
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 | /** |
507 | 507 | * Enable a subscription using the subscription code and token |
508 | 508 | * @return array |
509 | 509 | */ |
510 | - public function enableSubscription( $data = null ) |
|
510 | + public function enableSubscription($data = null) |
|
511 | 511 | { |
512 | 512 | if ($data == null) { |
513 | 513 | $data = [ |
@@ -605,7 +605,7 @@ discard block |
||
605 | 605 | * @return array |
606 | 606 | */ |
607 | 607 | |
608 | - public function createSubAccount( $data = null ){ |
|
608 | + public function createSubAccount($data = null) { |
|
609 | 609 | |
610 | 610 | if ($data == null) { |
611 | 611 | $data = [ |
@@ -632,10 +632,10 @@ discard block |
||
632 | 632 | * @param subaccount code |
633 | 633 | * @return array |
634 | 634 | */ |
635 | - public function fetchSubAccount($subaccount_code){ |
|
635 | + public function fetchSubAccount($subaccount_code) { |
|
636 | 636 | |
637 | 637 | $this->setRequestOptions(); |
638 | - return $this->setHttpResponse("/subaccount/{$subaccount_code}","GET",[])->getResponse(); |
|
638 | + return $this->setHttpResponse("/subaccount/{$subaccount_code}", "GET", [])->getResponse(); |
|
639 | 639 | |
640 | 640 | } |
641 | 641 | |
@@ -644,10 +644,10 @@ discard block |
||
644 | 644 | * @param $per_page - Specifies how many records to retrieve per page , $page - SPecifies exactly what page to retrieve |
645 | 645 | * @return array |
646 | 646 | */ |
647 | - public function listSubAccounts($per_page,$page){ |
|
647 | + public function listSubAccounts($per_page, $page) { |
|
648 | 648 | |
649 | 649 | $this->setRequestOptions(); |
650 | - return $this->setHttpResponse("/subaccount/?perPage=".(int) $per_page."&page=".(int) $page,"GET")->getResponse(); |
|
650 | + return $this->setHttpResponse("/subaccount/?perPage=".(int) $per_page."&page=".(int) $page, "GET")->getResponse(); |
|
651 | 651 | |
652 | 652 | } |
653 | 653 | |
@@ -658,7 +658,7 @@ discard block |
||
658 | 658 | * @return array |
659 | 659 | */ |
660 | 660 | |
661 | - public function updateSubAccount($subaccount_code, $data = null){ |
|
661 | + public function updateSubAccount($subaccount_code, $data = null) { |
|
662 | 662 | if ($data == null) { |
663 | 663 | $data = [ |
664 | 664 | "business_name" => request()->business_name, |