@@ -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 | { |
@@ -189,11 +188,11 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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(); |
@@ -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 | |
116 | 116 | $quantity = intval(request()->quantity ?? 1); |
117 | 117 | |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | "first_name" => request()->first_name, |
124 | 124 | "last_name" => request()->last_name, |
125 | 125 | "callback_url" => request()->callback_url, |
126 | - "currency" => (request()->currency != "" ? request()->currency : "NGN"), |
|
126 | + "currency" => (request()->currency != "" ? request()->currency : "NGN"), |
|
127 | 127 | |
128 | 128 | /* |
129 | 129 | Paystack allows for transactions to be split into a subaccount - |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | } |
171 | 171 | |
172 | 172 | $this->response = $this->client->{strtolower($method)}( |
173 | - $this->baseUrl . $relativeUrl, |
|
173 | + $this->baseUrl.$relativeUrl, |
|
174 | 174 | ["body" => json_encode($body)] |
175 | 175 | ); |
176 | 176 | |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | |
215 | 215 | $relativeUrl = "/transaction/verify/{$transactionRef}"; |
216 | 216 | |
217 | - $this->response = $this->client->get($this->baseUrl . $relativeUrl, []); |
|
217 | + $this->response = $this->client->get($this->baseUrl.$relativeUrl, []); |
|
218 | 218 | } |
219 | 219 | |
220 | 220 | /** |
@@ -362,7 +362,7 @@ discard block |
||
362 | 362 | public function fetchPlan($plan_code) |
363 | 363 | { |
364 | 364 | $this->setRequestOptions(); |
365 | - return $this->setHttpResponse('/plan/' . $plan_code, 'GET', [])->getResponse(); |
|
365 | + return $this->setHttpResponse('/plan/'.$plan_code, 'GET', [])->getResponse(); |
|
366 | 366 | } |
367 | 367 | |
368 | 368 | /** |
@@ -383,7 +383,7 @@ discard block |
||
383 | 383 | ]; |
384 | 384 | |
385 | 385 | $this->setRequestOptions(); |
386 | - return $this->setHttpResponse('/plan/' . $plan_code, 'PUT', $data)->getResponse(); |
|
386 | + return $this->setHttpResponse('/plan/'.$plan_code, 'PUT', $data)->getResponse(); |
|
387 | 387 | } |
388 | 388 | |
389 | 389 | /** |
@@ -412,7 +412,7 @@ discard block |
||
412 | 412 | public function fetchCustomer($customer_id) |
413 | 413 | { |
414 | 414 | $this->setRequestOptions(); |
415 | - return $this->setHttpResponse('/customer/'. $customer_id, 'GET', [])->getResponse(); |
|
415 | + return $this->setHttpResponse('/customer/'.$customer_id, 'GET', [])->getResponse(); |
|
416 | 416 | } |
417 | 417 | |
418 | 418 | /** |
@@ -432,7 +432,7 @@ discard block |
||
432 | 432 | ]; |
433 | 433 | |
434 | 434 | $this->setRequestOptions(); |
435 | - return $this->setHttpResponse('/customer/'. $customer_id, 'PUT', $data)->getResponse(); |
|
435 | + return $this->setHttpResponse('/customer/'.$customer_id, 'PUT', $data)->getResponse(); |
|
436 | 436 | } |
437 | 437 | |
438 | 438 | /** |
@@ -488,7 +488,7 @@ discard block |
||
488 | 488 | { |
489 | 489 | $this->setRequestOptions(); |
490 | 490 | |
491 | - return $this->setHttpResponse('/subscription?customer=' . $customer_id, 'GET', [])->getData(); |
|
491 | + return $this->setHttpResponse('/subscription?customer='.$customer_id, 'GET', [])->getData(); |
|
492 | 492 | } |
493 | 493 | |
494 | 494 | /** |
@@ -501,7 +501,7 @@ discard block |
||
501 | 501 | { |
502 | 502 | $this->setRequestOptions(); |
503 | 503 | |
504 | - return $this->setHttpResponse('/subscription?plan=' . $plan_id, 'GET', [])->getData(); |
|
504 | + return $this->setHttpResponse('/subscription?plan='.$plan_id, 'GET', [])->getData(); |
|
505 | 505 | } |
506 | 506 | |
507 | 507 | /** |
@@ -604,7 +604,7 @@ discard block |
||
604 | 604 | * @return array |
605 | 605 | */ |
606 | 606 | |
607 | - public function createSubAccount(){ |
|
607 | + public function createSubAccount() { |
|
608 | 608 | $data = [ |
609 | 609 | "business_name" => request()->business_name, |
610 | 610 | "settlement_bank" => request()->settlement_bank, |
@@ -627,10 +627,10 @@ discard block |
||
627 | 627 | * @param subaccount code |
628 | 628 | * @return array |
629 | 629 | */ |
630 | - public function fetchSubAccount($subaccount_code){ |
|
630 | + public function fetchSubAccount($subaccount_code) { |
|
631 | 631 | |
632 | 632 | $this->setRequestOptions(); |
633 | - return $this->setHttpResponse("/subaccount/{$subaccount_code}","GET",[])->getResponse(); |
|
633 | + return $this->setHttpResponse("/subaccount/{$subaccount_code}", "GET", [])->getResponse(); |
|
634 | 634 | |
635 | 635 | } |
636 | 636 | |
@@ -639,10 +639,10 @@ discard block |
||
639 | 639 | * @param $per_page - Specifies how many records to retrieve per page , $page - SPecifies exactly what page to retrieve |
640 | 640 | * @return array |
641 | 641 | */ |
642 | - public function listSubAccounts($per_page,$page){ |
|
642 | + public function listSubAccounts($per_page, $page) { |
|
643 | 643 | |
644 | 644 | $this->setRequestOptions(); |
645 | - return $this->setHttpResponse("/subaccount/?perPage=".(int) $per_page."&page=".(int) $page,"GET")->getResponse(); |
|
645 | + return $this->setHttpResponse("/subaccount/?perPage=".(int) $per_page."&page=".(int) $page, "GET")->getResponse(); |
|
646 | 646 | |
647 | 647 | } |
648 | 648 | |
@@ -653,7 +653,7 @@ discard block |
||
653 | 653 | * @return array |
654 | 654 | */ |
655 | 655 | |
656 | - public function updateSubAccount($subaccount_code){ |
|
656 | + public function updateSubAccount($subaccount_code) { |
|
657 | 657 | $data = [ |
658 | 658 | "business_name" => request()->business_name, |
659 | 659 | "settlement_bank" => request()->settlement_bank, |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (! function_exists("paystack")) |
|
3 | +if (!function_exists("paystack")) |
|
4 | 4 | { |
5 | 5 | function paystack() { |
6 | 6 |