@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | */ |
| 29 | 29 | public function boot(): void |
| 30 | 30 | { |
| 31 | - $config = realpath(__DIR__ . '/../resources/config/paystack.php'); |
|
| 31 | + $config = realpath(__DIR__.'/../resources/config/paystack.php'); |
|
| 32 | 32 | |
| 33 | 33 | $this->publishes([ |
| 34 | 34 | $config => config_path('paystack.php') |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | */ |
| 41 | 41 | public function register(): void |
| 42 | 42 | { |
| 43 | - $this->app->bind('laravel-paystack', function () { |
|
| 43 | + $this->app->bind('laravel-paystack', function() { |
|
| 44 | 44 | return new Paystack; |
| 45 | 45 | }); |
| 46 | 46 | } |
@@ -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 | return app()->make('laravel-paystack'); |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | */ |
| 94 | 94 | private function setRequestOptions(): void |
| 95 | 95 | { |
| 96 | - $authBearer = 'Bearer ' . $this->secretKey; |
|
| 96 | + $authBearer = 'Bearer '.$this->secretKey; |
|
| 97 | 97 | |
| 98 | 98 | $this->client = new Client( |
| 99 | 99 | [ |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | "first_name" => request()->first_name, |
| 129 | 129 | "last_name" => request()->last_name, |
| 130 | 130 | "callback_url" => request()->callback_url, |
| 131 | - "currency" => (request()->currency != "" ? request()->currency : "NGN"), |
|
| 131 | + "currency" => (request()->currency != "" ? request()->currency : "NGN"), |
|
| 132 | 132 | |
| 133 | 133 | /* |
| 134 | 134 | Paystack allows for transactions to be split into a subaccount - |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | } |
| 200 | 200 | |
| 201 | 201 | $this->response = $this->client->{strtolower($method)}( |
| 202 | - $this->baseUrl . $relativeUrl, |
|
| 202 | + $this->baseUrl.$relativeUrl, |
|
| 203 | 203 | ["body" => json_encode($body)] |
| 204 | 204 | ); |
| 205 | 205 | |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | { |
| 238 | 238 | $transactionRef = $transaction_id ?? request()->query('trxref'); |
| 239 | 239 | $relativeUrl = "/transaction/verify/{$transactionRef}"; |
| 240 | - $this->response = $this->client->get($this->baseUrl . $relativeUrl, []); |
|
| 240 | + $this->response = $this->client->get($this->baseUrl.$relativeUrl, []); |
|
| 241 | 241 | } |
| 242 | 242 | |
| 243 | 243 | /** |
@@ -385,7 +385,7 @@ discard block |
||
| 385 | 385 | public function fetchPlan($plan_code) |
| 386 | 386 | { |
| 387 | 387 | $this->setRequestOptions(); |
| 388 | - return $this->setHttpResponse('/plan/' . $plan_code, 'GET', [])->getResponse(); |
|
| 388 | + return $this->setHttpResponse('/plan/'.$plan_code, 'GET', [])->getResponse(); |
|
| 389 | 389 | } |
| 390 | 390 | |
| 391 | 391 | /** |
@@ -406,7 +406,7 @@ discard block |
||
| 406 | 406 | ]; |
| 407 | 407 | |
| 408 | 408 | $this->setRequestOptions(); |
| 409 | - return $this->setHttpResponse('/plan/' . $plan_code, 'PUT', $data)->getResponse(); |
|
| 409 | + return $this->setHttpResponse('/plan/'.$plan_code, 'PUT', $data)->getResponse(); |
|
| 410 | 410 | } |
| 411 | 411 | |
| 412 | 412 | /** |
@@ -438,7 +438,7 @@ discard block |
||
| 438 | 438 | public function fetchCustomer($customer_id) |
| 439 | 439 | { |
| 440 | 440 | $this->setRequestOptions(); |
| 441 | - return $this->setHttpResponse('/customer/' . $customer_id, 'GET', [])->getResponse(); |
|
| 441 | + return $this->setHttpResponse('/customer/'.$customer_id, 'GET', [])->getResponse(); |
|
| 442 | 442 | } |
| 443 | 443 | |
| 444 | 444 | /** |
@@ -458,7 +458,7 @@ discard block |
||
| 458 | 458 | ]; |
| 459 | 459 | |
| 460 | 460 | $this->setRequestOptions(); |
| 461 | - return $this->setHttpResponse('/customer/' . $customer_id, 'PUT', $data)->getResponse(); |
|
| 461 | + return $this->setHttpResponse('/customer/'.$customer_id, 'PUT', $data)->getResponse(); |
|
| 462 | 462 | } |
| 463 | 463 | |
| 464 | 464 | /** |
@@ -514,7 +514,7 @@ discard block |
||
| 514 | 514 | { |
| 515 | 515 | $this->setRequestOptions(); |
| 516 | 516 | |
| 517 | - return $this->setHttpResponse('/subscription?customer=' . $customer_id, 'GET', [])->getData(); |
|
| 517 | + return $this->setHttpResponse('/subscription?customer='.$customer_id, 'GET', [])->getData(); |
|
| 518 | 518 | } |
| 519 | 519 | |
| 520 | 520 | /** |
@@ -527,7 +527,7 @@ discard block |
||
| 527 | 527 | { |
| 528 | 528 | $this->setRequestOptions(); |
| 529 | 529 | |
| 530 | - return $this->setHttpResponse('/subscription?plan=' . $plan_id, 'GET', [])->getData(); |
|
| 530 | + return $this->setHttpResponse('/subscription?plan='.$plan_id, 'GET', [])->getData(); |
|
| 531 | 531 | } |
| 532 | 532 | |
| 533 | 533 | /** |
@@ -568,7 +568,7 @@ discard block |
||
| 568 | 568 | public function fetchSubscription($subscription_id) |
| 569 | 569 | { |
| 570 | 570 | $this->setRequestOptions(); |
| 571 | - return $this->setHttpResponse('/subscription/' . $subscription_id, 'GET', [])->getResponse(); |
|
| 571 | + return $this->setHttpResponse('/subscription/'.$subscription_id, 'GET', [])->getResponse(); |
|
| 572 | 572 | } |
| 573 | 573 | |
| 574 | 574 | /** |
@@ -604,7 +604,7 @@ discard block |
||
| 604 | 604 | public function fetchPage($page_id) |
| 605 | 605 | { |
| 606 | 606 | $this->setRequestOptions(); |
| 607 | - return $this->setHttpResponse('/page/' . $page_id, 'GET', [])->getResponse(); |
|
| 607 | + return $this->setHttpResponse('/page/'.$page_id, 'GET', [])->getResponse(); |
|
| 608 | 608 | } |
| 609 | 609 | |
| 610 | 610 | /** |
@@ -621,7 +621,7 @@ discard block |
||
| 621 | 621 | ]; |
| 622 | 622 | |
| 623 | 623 | $this->setRequestOptions(); |
| 624 | - return $this->setHttpResponse('/page/' . $page_id, 'PUT', $data)->getResponse(); |
|
| 624 | + return $this->setHttpResponse('/page/'.$page_id, 'PUT', $data)->getResponse(); |
|
| 625 | 625 | } |
| 626 | 626 | |
| 627 | 627 | /** |
@@ -669,7 +669,7 @@ discard block |
||
| 669 | 669 | { |
| 670 | 670 | |
| 671 | 671 | $this->setRequestOptions(); |
| 672 | - return $this->setHttpResponse("/subaccount/?perPage=" . (int) $per_page . "&page=" . (int) $page, "GET")->getResponse(); |
|
| 672 | + return $this->setHttpResponse("/subaccount/?perPage=".(int) $per_page."&page=".(int) $page, "GET")->getResponse(); |
|
| 673 | 673 | } |
| 674 | 674 | |
| 675 | 675 | |
@@ -711,7 +711,7 @@ discard block |
||
| 711 | 711 | $country = request()->country ?? 'nigeria'; |
| 712 | 712 | |
| 713 | 713 | $this->setRequestOptions(); |
| 714 | - return $this->setHttpResponse("/bank/?country=" . $country . "&use_cursor=" . $use_cursor . "&perPage=" . (int) $per_page, "GET")->getResponse(); |
|
| 714 | + return $this->setHttpResponse("/bank/?country=".$country."&use_cursor=".$use_cursor."&perPage=".(int) $per_page, "GET")->getResponse(); |
|
| 715 | 715 | } |
| 716 | 716 | |
| 717 | 717 | /** |
@@ -723,6 +723,6 @@ discard block |
||
| 723 | 723 | { |
| 724 | 724 | |
| 725 | 725 | $this->setRequestOptions(); |
| 726 | - return $this->setHttpResponse("/bank/resolve/?account_number=" . $account_number . "&bank_code=" . $bank_code, "GET")->getResponse(); |
|
| 726 | + return $this->setHttpResponse("/bank/resolve/?account_number=".$account_number."&bank_code=".$bank_code, "GET")->getResponse(); |
|
| 727 | 727 | } |
| 728 | 728 | } |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | $pool = '2345679ACDEFHJKLMNPRSTUVWXYZ'; |
| 43 | 43 | break; |
| 44 | 44 | default: |
| 45 | - $pool = (string)$type; |
|
| 45 | + $pool = (string) $type; |
|
| 46 | 46 | break; |
| 47 | 47 | } |
| 48 | 48 | |
@@ -65,9 +65,9 @@ discard block |
||
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | $log = log($range, 2); |
| 68 | - $bytes = (int)($log / 8) + 1; // length in bytes |
|
| 69 | - $bits = (int)$log + 1; // length in bits |
|
| 70 | - $filter = (int)(1 << $bits) - 1; // set all lower bits to 1 |
|
| 68 | + $bytes = (int) ($log / 8) + 1; // length in bytes |
|
| 69 | + $bits = (int) $log + 1; // length in bits |
|
| 70 | + $filter = (int) (1 << $bits) - 1; // set all lower bits to 1 |
|
| 71 | 71 | do { |
| 72 | 72 | $rnd = hexdec(bin2hex(openssl_random_pseudo_bytes($bytes))); |
| 73 | 73 | $rnd = $rnd & $filter; // discard irrelevant bits |