@@ -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 | { |
@@ -215,11 +214,11 @@ discard block |
||
215 | 214 | } |
216 | 215 | |
217 | 216 | /** |
218 | - * Get the authorization callback response |
|
219 | - * In situations where Laravel serves as an backend for a detached UI, the api cannot redirect |
|
220 | - * and might need to take different actions based on the success or not of the transaction |
|
221 | - * @return array |
|
222 | - */ |
|
217 | + * Get the authorization callback response |
|
218 | + * In situations where Laravel serves as an backend for a detached UI, the api cannot redirect |
|
219 | + * and might need to take different actions based on the success or not of the transaction |
|
220 | + * @return array |
|
221 | + */ |
|
223 | 222 | public function getAuthorizationResponse($data) |
224 | 223 | { |
225 | 224 | $this->makePaymentRequest($data); |
@@ -623,10 +622,10 @@ discard block |
||
623 | 622 | } |
624 | 623 | |
625 | 624 | /** |
626 | - * Creates a subaccount to be used for split payments . Required params are business_name , settlement_bank , account_number , percentage_charge |
|
627 | - * |
|
628 | - * @return array |
|
629 | - */ |
|
625 | + * Creates a subaccount to be used for split payments . Required params are business_name , settlement_bank , account_number , percentage_charge |
|
626 | + * |
|
627 | + * @return array |
|
628 | + */ |
|
630 | 629 | |
631 | 630 | public function createSubAccount(){ |
632 | 631 | $data = [ |
@@ -647,10 +646,10 @@ discard block |
||
647 | 646 | } |
648 | 647 | |
649 | 648 | /** |
650 | - * Fetches details of a subaccount |
|
651 | - * @param subaccount code |
|
652 | - * @return array |
|
653 | - */ |
|
649 | + * Fetches details of a subaccount |
|
650 | + * @param subaccount code |
|
651 | + * @return array |
|
652 | + */ |
|
654 | 653 | public function fetchSubAccount($subaccount_code){ |
655 | 654 | |
656 | 655 | $this->setRequestOptions(); |
@@ -659,10 +658,10 @@ discard block |
||
659 | 658 | } |
660 | 659 | |
661 | 660 | /** |
662 | - * Lists all the subaccounts associated with the account |
|
663 | - * @param $per_page - Specifies how many records to retrieve per page , $page - SPecifies exactly what page to retrieve |
|
664 | - * @return array |
|
665 | - */ |
|
661 | + * Lists all the subaccounts associated with the account |
|
662 | + * @param $per_page - Specifies how many records to retrieve per page , $page - SPecifies exactly what page to retrieve |
|
663 | + * @return array |
|
664 | + */ |
|
666 | 665 | public function listSubAccounts($per_page,$page){ |
667 | 666 | |
668 | 667 | $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 | [ |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | |
112 | 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 - |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | } |
195 | 195 | |
196 | 196 | $this->response = $this->client->{strtolower($method)}( |
197 | - $this->baseUrl . $relativeUrl, |
|
197 | + $this->baseUrl.$relativeUrl, |
|
198 | 198 | ["body" => json_encode($body)] |
199 | 199 | ); |
200 | 200 | |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | |
239 | 239 | $relativeUrl = "/transaction/verify/{$transactionRef}"; |
240 | 240 | |
241 | - $this->response = $this->client->get($this->baseUrl . $relativeUrl, []); |
|
241 | + $this->response = $this->client->get($this->baseUrl.$relativeUrl, []); |
|
242 | 242 | } |
243 | 243 | |
244 | 244 | /** |
@@ -386,7 +386,7 @@ discard block |
||
386 | 386 | public function fetchPlan($plan_code) |
387 | 387 | { |
388 | 388 | $this->setRequestOptions(); |
389 | - return $this->setHttpResponse('/plan/' . $plan_code, 'GET', [])->getResponse(); |
|
389 | + return $this->setHttpResponse('/plan/'.$plan_code, 'GET', [])->getResponse(); |
|
390 | 390 | } |
391 | 391 | |
392 | 392 | /** |
@@ -407,7 +407,7 @@ discard block |
||
407 | 407 | ]; |
408 | 408 | |
409 | 409 | $this->setRequestOptions(); |
410 | - return $this->setHttpResponse('/plan/' . $plan_code, 'PUT', $data)->getResponse(); |
|
410 | + return $this->setHttpResponse('/plan/'.$plan_code, 'PUT', $data)->getResponse(); |
|
411 | 411 | } |
412 | 412 | |
413 | 413 | /** |
@@ -436,7 +436,7 @@ discard block |
||
436 | 436 | public function fetchCustomer($customer_id) |
437 | 437 | { |
438 | 438 | $this->setRequestOptions(); |
439 | - return $this->setHttpResponse('/customer/'. $customer_id, 'GET', [])->getResponse(); |
|
439 | + return $this->setHttpResponse('/customer/'.$customer_id, 'GET', [])->getResponse(); |
|
440 | 440 | } |
441 | 441 | |
442 | 442 | /** |
@@ -456,7 +456,7 @@ discard block |
||
456 | 456 | ]; |
457 | 457 | |
458 | 458 | $this->setRequestOptions(); |
459 | - return $this->setHttpResponse('/customer/'. $customer_id, 'PUT', $data)->getResponse(); |
|
459 | + return $this->setHttpResponse('/customer/'.$customer_id, 'PUT', $data)->getResponse(); |
|
460 | 460 | } |
461 | 461 | |
462 | 462 | /** |
@@ -512,7 +512,7 @@ discard block |
||
512 | 512 | { |
513 | 513 | $this->setRequestOptions(); |
514 | 514 | |
515 | - return $this->setHttpResponse('/subscription?customer=' . $customer_id, 'GET', [])->getData(); |
|
515 | + return $this->setHttpResponse('/subscription?customer='.$customer_id, 'GET', [])->getData(); |
|
516 | 516 | } |
517 | 517 | |
518 | 518 | /** |
@@ -525,7 +525,7 @@ discard block |
||
525 | 525 | { |
526 | 526 | $this->setRequestOptions(); |
527 | 527 | |
528 | - return $this->setHttpResponse('/subscription?plan=' . $plan_id, 'GET', [])->getData(); |
|
528 | + return $this->setHttpResponse('/subscription?plan='.$plan_id, 'GET', [])->getData(); |
|
529 | 529 | } |
530 | 530 | |
531 | 531 | /** |
@@ -628,7 +628,7 @@ discard block |
||
628 | 628 | * @return array |
629 | 629 | */ |
630 | 630 | |
631 | - public function createSubAccount(){ |
|
631 | + public function createSubAccount() { |
|
632 | 632 | $data = [ |
633 | 633 | "business_name" => request()->business_name, |
634 | 634 | "settlement_bank" => request()->settlement_bank, |
@@ -651,10 +651,10 @@ discard block |
||
651 | 651 | * @param subaccount code |
652 | 652 | * @return array |
653 | 653 | */ |
654 | - public function fetchSubAccount($subaccount_code){ |
|
654 | + public function fetchSubAccount($subaccount_code) { |
|
655 | 655 | |
656 | 656 | $this->setRequestOptions(); |
657 | - return $this->setHttpResponse("/subaccount/{$subaccount_code}","GET",[])->getResponse(); |
|
657 | + return $this->setHttpResponse("/subaccount/{$subaccount_code}", "GET", [])->getResponse(); |
|
658 | 658 | |
659 | 659 | } |
660 | 660 | |
@@ -663,10 +663,10 @@ discard block |
||
663 | 663 | * @param $per_page - Specifies how many records to retrieve per page , $page - SPecifies exactly what page to retrieve |
664 | 664 | * @return array |
665 | 665 | */ |
666 | - public function listSubAccounts($per_page,$page){ |
|
666 | + public function listSubAccounts($per_page, $page) { |
|
667 | 667 | |
668 | 668 | $this->setRequestOptions(); |
669 | - return $this->setHttpResponse("/subaccount/?perPage=".(int) $per_page."&page=".(int) $page,"GET")->getResponse(); |
|
669 | + return $this->setHttpResponse("/subaccount/?perPage=".(int) $per_page."&page=".(int) $page, "GET")->getResponse(); |
|
670 | 670 | |
671 | 671 | } |
672 | 672 | |
@@ -677,7 +677,7 @@ discard block |
||
677 | 677 | * @return array |
678 | 678 | */ |
679 | 679 | |
680 | - public function updateSubAccount($subaccount_code){ |
|
680 | + public function updateSubAccount($subaccount_code) { |
|
681 | 681 | $data = [ |
682 | 682 | "business_name" => request()->business_name, |
683 | 683 | "settlement_bank" => request()->settlement_bank, |