@@ -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 | $data = [ |
116 | 116 | "amount" => intval(request()->amount), |
117 | 117 | "reference" => request()->reference, |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | "first_name" => request()->first_name, |
121 | 121 | "last_name" => request()->last_name, |
122 | 122 | "callback_url" => request()->callback_url, |
123 | - "currency" => (request()->currency != "" ? request()->currency : "NGN"), |
|
123 | + "currency" => (request()->currency != "" ? request()->currency : "NGN"), |
|
124 | 124 | /* |
125 | 125 | Paystack allows for transactions to be split into a subaccount - |
126 | 126 | The following lines trap the subaccount ID - as well as the ammount to charge the subaccount (if overriden in the form) |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | } |
169 | 169 | |
170 | 170 | $this->response = $this->client->{strtolower($method)}( |
171 | - $this->baseUrl . $relativeUrl, |
|
171 | + $this->baseUrl.$relativeUrl, |
|
172 | 172 | ["body" => json_encode($body)] |
173 | 173 | ); |
174 | 174 | |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | |
213 | 213 | $relativeUrl = "/transaction/verify/{$transactionRef}"; |
214 | 214 | |
215 | - $this->response = $this->client->get($this->baseUrl . $relativeUrl, []); |
|
215 | + $this->response = $this->client->get($this->baseUrl.$relativeUrl, []); |
|
216 | 216 | } |
217 | 217 | |
218 | 218 | /** |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | public function fetchPlan($plan_code) |
361 | 361 | { |
362 | 362 | $this->setRequestOptions(); |
363 | - return $this->setHttpResponse('/plan/' . $plan_code, 'GET', [])->getResponse(); |
|
363 | + return $this->setHttpResponse('/plan/'.$plan_code, 'GET', [])->getResponse(); |
|
364 | 364 | } |
365 | 365 | |
366 | 366 | /** |
@@ -381,7 +381,7 @@ discard block |
||
381 | 381 | ]; |
382 | 382 | |
383 | 383 | $this->setRequestOptions(); |
384 | - return $this->setHttpResponse('/plan/' . $plan_code, 'PUT', $data)->getResponse(); |
|
384 | + return $this->setHttpResponse('/plan/'.$plan_code, 'PUT', $data)->getResponse(); |
|
385 | 385 | } |
386 | 386 | |
387 | 387 | /** |
@@ -410,7 +410,7 @@ discard block |
||
410 | 410 | public function fetchCustomer($customer_id) |
411 | 411 | { |
412 | 412 | $this->setRequestOptions(); |
413 | - return $this->setHttpResponse('/customer/'. $customer_id, 'GET', [])->getResponse(); |
|
413 | + return $this->setHttpResponse('/customer/'.$customer_id, 'GET', [])->getResponse(); |
|
414 | 414 | } |
415 | 415 | |
416 | 416 | /** |
@@ -430,7 +430,7 @@ discard block |
||
430 | 430 | ]; |
431 | 431 | |
432 | 432 | $this->setRequestOptions(); |
433 | - return $this->setHttpResponse('/customer/'. $customer_id, 'PUT', $data)->getResponse(); |
|
433 | + return $this->setHttpResponse('/customer/'.$customer_id, 'PUT', $data)->getResponse(); |
|
434 | 434 | } |
435 | 435 | |
436 | 436 | /** |
@@ -486,7 +486,7 @@ discard block |
||
486 | 486 | { |
487 | 487 | $this->setRequestOptions(); |
488 | 488 | |
489 | - return $this->setHttpResponse('/subscription?customer=' . $customer_id, 'GET', [])->getData(); |
|
489 | + return $this->setHttpResponse('/subscription?customer='.$customer_id, 'GET', [])->getData(); |
|
490 | 490 | } |
491 | 491 | |
492 | 492 | /** |
@@ -499,7 +499,7 @@ discard block |
||
499 | 499 | { |
500 | 500 | $this->setRequestOptions(); |
501 | 501 | |
502 | - return $this->setHttpResponse('/subscription?plan=' . $plan_id, 'GET', [])->getData(); |
|
502 | + return $this->setHttpResponse('/subscription?plan='.$plan_id, 'GET', [])->getData(); |
|
503 | 503 | } |
504 | 504 | |
505 | 505 | /** |
@@ -602,7 +602,7 @@ discard block |
||
602 | 602 | * @return array |
603 | 603 | */ |
604 | 604 | |
605 | - public function createSubAccount(){ |
|
605 | + public function createSubAccount() { |
|
606 | 606 | $data = [ |
607 | 607 | "business_name" => request()->business_name, |
608 | 608 | "settlement_bank" => request()->settlement_bank, |
@@ -625,10 +625,10 @@ discard block |
||
625 | 625 | * @param subaccount code |
626 | 626 | * @return array |
627 | 627 | */ |
628 | - public function fetchSubAccount($subaccount_code){ |
|
628 | + public function fetchSubAccount($subaccount_code) { |
|
629 | 629 | |
630 | 630 | $this->setRequestOptions(); |
631 | - return $this->setHttpResponse("/subaccount/{$subaccount_code}","GET",[])->getResponse(); |
|
631 | + return $this->setHttpResponse("/subaccount/{$subaccount_code}", "GET", [])->getResponse(); |
|
632 | 632 | |
633 | 633 | } |
634 | 634 | |
@@ -637,10 +637,10 @@ discard block |
||
637 | 637 | * @param $per_page - Specifies how many records to retrieve per page , $page - SPecifies exactly what page to retrieve |
638 | 638 | * @return array |
639 | 639 | */ |
640 | - public function listSubAccounts($per_page,$page){ |
|
640 | + public function listSubAccounts($per_page, $page) { |
|
641 | 641 | |
642 | 642 | $this->setRequestOptions(); |
643 | - return $this->setHttpResponse("/subaccount/?perPage=".(int) $per_page."&page=".(int) $page,"GET")->getResponse(); |
|
643 | + return $this->setHttpResponse("/subaccount/?perPage=".(int) $per_page."&page=".(int) $page, "GET")->getResponse(); |
|
644 | 644 | |
645 | 645 | } |
646 | 646 | |
@@ -651,7 +651,7 @@ discard block |
||
651 | 651 | * @return array |
652 | 652 | */ |
653 | 653 | |
654 | - public function updateSubAccount($subaccount_code){ |
|
654 | + public function updateSubAccount($subaccount_code) { |
|
655 | 655 | $data = [ |
656 | 656 | "business_name" => request()->business_name, |
657 | 657 | "settlement_bank" => request()->settlement_bank, |