@@ -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 | [ |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | "first_name" => request()->first_name, |
| 125 | 125 | "last_name" => request()->last_name, |
| 126 | 126 | "callback_url" => request()->callback_url, |
| 127 | - "currency" => (request()->currency != "" ? request()->currency : "NGN"), |
|
| 127 | + "currency" => (request()->currency != "" ? request()->currency : "NGN"), |
|
| 128 | 128 | |
| 129 | 129 | /* |
| 130 | 130 | Paystack allows for transactions to be split into a subaccount - |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | $this->response = $this->client->{strtolower($method)}( |
| 198 | - $this->baseUrl . $relativeUrl, |
|
| 198 | + $this->baseUrl.$relativeUrl, |
|
| 199 | 199 | ["body" => json_encode($body)] |
| 200 | 200 | ); |
| 201 | 201 | |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | |
| 240 | 240 | $relativeUrl = "/transaction/verify/{$transactionRef}"; |
| 241 | 241 | |
| 242 | - $this->response = $this->client->get($this->baseUrl . $relativeUrl, []); |
|
| 242 | + $this->response = $this->client->get($this->baseUrl.$relativeUrl, []); |
|
| 243 | 243 | } |
| 244 | 244 | |
| 245 | 245 | /** |
@@ -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 | /** |
@@ -439,7 +439,7 @@ discard block |
||
| 439 | 439 | public function fetchCustomer($customer_id) |
| 440 | 440 | { |
| 441 | 441 | $this->setRequestOptions(); |
| 442 | - return $this->setHttpResponse('/customer/' . $customer_id, 'GET', [])->getResponse(); |
|
| 442 | + return $this->setHttpResponse('/customer/'.$customer_id, 'GET', [])->getResponse(); |
|
| 443 | 443 | } |
| 444 | 444 | |
| 445 | 445 | /** |
@@ -459,7 +459,7 @@ discard block |
||
| 459 | 459 | ]; |
| 460 | 460 | |
| 461 | 461 | $this->setRequestOptions(); |
| 462 | - return $this->setHttpResponse('/customer/' . $customer_id, 'PUT', $data)->getResponse(); |
|
| 462 | + return $this->setHttpResponse('/customer/'.$customer_id, 'PUT', $data)->getResponse(); |
|
| 463 | 463 | } |
| 464 | 464 | |
| 465 | 465 | /** |
@@ -515,7 +515,7 @@ discard block |
||
| 515 | 515 | { |
| 516 | 516 | $this->setRequestOptions(); |
| 517 | 517 | |
| 518 | - return $this->setHttpResponse('/subscription?customer=' . $customer_id, 'GET', [])->getData(); |
|
| 518 | + return $this->setHttpResponse('/subscription?customer='.$customer_id, 'GET', [])->getData(); |
|
| 519 | 519 | } |
| 520 | 520 | |
| 521 | 521 | /** |
@@ -528,7 +528,7 @@ discard block |
||
| 528 | 528 | { |
| 529 | 529 | $this->setRequestOptions(); |
| 530 | 530 | |
| 531 | - return $this->setHttpResponse('/subscription?plan=' . $plan_id, 'GET', [])->getData(); |
|
| 531 | + return $this->setHttpResponse('/subscription?plan='.$plan_id, 'GET', [])->getData(); |
|
| 532 | 532 | } |
| 533 | 533 | |
| 534 | 534 | /** |
@@ -569,7 +569,7 @@ discard block |
||
| 569 | 569 | public function fetchSubscription($subscription_id) |
| 570 | 570 | { |
| 571 | 571 | $this->setRequestOptions(); |
| 572 | - return $this->setHttpResponse('/subscription/' . $subscription_id, 'GET', [])->getResponse(); |
|
| 572 | + return $this->setHttpResponse('/subscription/'.$subscription_id, 'GET', [])->getResponse(); |
|
| 573 | 573 | } |
| 574 | 574 | |
| 575 | 575 | /** |
@@ -605,7 +605,7 @@ discard block |
||
| 605 | 605 | public function fetchPage($page_id) |
| 606 | 606 | { |
| 607 | 607 | $this->setRequestOptions(); |
| 608 | - return $this->setHttpResponse('/page/' . $page_id, 'GET', [])->getResponse(); |
|
| 608 | + return $this->setHttpResponse('/page/'.$page_id, 'GET', [])->getResponse(); |
|
| 609 | 609 | } |
| 610 | 610 | |
| 611 | 611 | /** |
@@ -622,7 +622,7 @@ discard block |
||
| 622 | 622 | ]; |
| 623 | 623 | |
| 624 | 624 | $this->setRequestOptions(); |
| 625 | - return $this->setHttpResponse('/page/' . $page_id, 'PUT', $data)->getResponse(); |
|
| 625 | + return $this->setHttpResponse('/page/'.$page_id, 'PUT', $data)->getResponse(); |
|
| 626 | 626 | } |
| 627 | 627 | |
| 628 | 628 | /** |
@@ -670,7 +670,7 @@ discard block |
||
| 670 | 670 | { |
| 671 | 671 | |
| 672 | 672 | $this->setRequestOptions(); |
| 673 | - return $this->setHttpResponse("/subaccount/?perPage=" . (int) $per_page . "&page=" . (int) $page, "GET")->getResponse(); |
|
| 673 | + return $this->setHttpResponse("/subaccount/?perPage=".(int) $per_page."&page=".(int) $page, "GET")->getResponse(); |
|
| 674 | 674 | } |
| 675 | 675 | |
| 676 | 676 | |
@@ -712,7 +712,7 @@ discard block |
||
| 712 | 712 | $country = request()->country ?? 'nigeria'; |
| 713 | 713 | |
| 714 | 714 | $this->setRequestOptions(); |
| 715 | - return $this->setHttpResponse("/bank/?country=" . $country . "&use_cursor=" . $use_cursor . "&perPage=" . (int) $per_page, "GET")->getResponse(); |
|
| 715 | + return $this->setHttpResponse("/bank/?country=".$country."&use_cursor=".$use_cursor."&perPage=".(int) $per_page, "GET")->getResponse(); |
|
| 716 | 716 | } |
| 717 | 717 | |
| 718 | 718 | /** |
@@ -724,7 +724,7 @@ discard block |
||
| 724 | 724 | { |
| 725 | 725 | |
| 726 | 726 | $this->setRequestOptions(); |
| 727 | - return $this->setHttpResponse("/bank/resolve/?account_number=" . $account_number . "&bank_code=" . $bank_code, "GET")->getResponse(); |
|
| 727 | + return $this->setHttpResponse("/bank/resolve/?account_number=".$account_number."&bank_code=".$bank_code, "GET")->getResponse(); |
|
| 728 | 728 | } |
| 729 | 729 | |
| 730 | 730 | /** |
@@ -708,8 +708,9 @@ discard block |
||
| 708 | 708 | */ |
| 709 | 709 | public function getBanks(?string $country, int $per_page = 50, bool $use_cursor = false) |
| 710 | 710 | { |
| 711 | - if (!$country) |
|
| 712 | - $country = request()->country ?? 'nigeria'; |
|
| 711 | + if (!$country) { |
|
| 712 | + $country = request()->country ?? 'nigeria'; |
|
| 713 | + } |
|
| 713 | 714 | |
| 714 | 715 | $this->setRequestOptions(); |
| 715 | 716 | return $this->setHttpResponse("/bank/?country=" . $country . "&use_cursor=" . $use_cursor . "&perPage=" . (int) $per_page, "GET")->getResponse(); |
@@ -735,8 +736,8 @@ discard block |
||
| 735 | 736 | |
| 736 | 737 | public function assignDedicatedAccount($data = null) |
| 737 | 738 | { |
| 738 | - if (!$data) |
|
| 739 | - $data = [ |
|
| 739 | + if (!$data) { |
|
| 740 | + $data = [ |
|
| 740 | 741 | "email" => request()->email, |
| 741 | 742 | "first_name" => request()->first_name, |
| 742 | 743 | "middle_name" => request()->middle_name, |
@@ -745,6 +746,7 @@ discard block |
||
| 745 | 746 | "preferred_bank" => request()->preferred_bank, |
| 746 | 747 | "country" => request()->country ?? "NG" |
| 747 | 748 | ]; |
| 749 | + } |
|
| 748 | 750 | |
| 749 | 751 | $this->setRequestOptions(); |
| 750 | 752 | return $this->setHttpResponse('/dedicated_account/assign', 'POST', array_filter($data))->getResponse(); |
@@ -758,8 +760,8 @@ discard block |
||
| 758 | 760 | |
| 759 | 761 | public function createDedicatedAccount($data = null) |
| 760 | 762 | { |
| 761 | - if (!$data) |
|
| 762 | - $data = [ |
|
| 763 | + if (!$data) { |
|
| 764 | + $data = [ |
|
| 763 | 765 | "customer" => request()->customer, |
| 764 | 766 | "first_name" => request()->first_name, |
| 765 | 767 | "middle_name" => request()->middle_name, |
@@ -768,6 +770,7 @@ discard block |
||
| 768 | 770 | "preferred_bank" => request()->preferred_bank, |
| 769 | 771 | "country" => request()->country ?? "NG" |
| 770 | 772 | ]; |
| 773 | + } |
|
| 771 | 774 | |
| 772 | 775 | $this->setRequestOptions(); |
| 773 | 776 | return $this->setHttpResponse('/dedicated_account', 'POST', array_filter($data))->getResponse(); |