@@ -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 | |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | */ |
| 88 | 88 | private function setRequestOptions() |
| 89 | 89 | { |
| 90 | - $authBearer = 'Bearer ' . $this->secretKey; |
|
| 90 | + $authBearer = 'Bearer '.$this->secretKey; |
|
| 91 | 91 | |
| 92 | 92 | $this->client = new Client( |
| 93 | 93 | [ |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | $this->response = $this->client->{strtolower($method)}( |
| 175 | - $this->baseUrl . $relativeUrl, |
|
| 175 | + $this->baseUrl.$relativeUrl, |
|
| 176 | 176 | ["body" => json_encode($body)] |
| 177 | 177 | ); |
| 178 | 178 | |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | } |
| 245 | 245 | |
| 246 | 246 | return $validate; |
| 247 | - }catch (RequestException $exception){ |
|
| 247 | + } catch (RequestException $exception) { |
|
| 248 | 248 | return false; |
| 249 | 249 | } |
| 250 | 250 | } |
@@ -262,11 +262,11 @@ discard block |
||
| 262 | 262 | //for a parameter of 'trxref' |
| 263 | 263 | $transactionRef = $trxref ?: request()->query('trxref'); |
| 264 | 264 | |
| 265 | - if(!$transactionRef) throw new PaymentVerificationFailedException("Payment reference not provided"); |
|
| 265 | + if (!$transactionRef) throw new PaymentVerificationFailedException("Payment reference not provided"); |
|
| 266 | 266 | |
| 267 | 267 | $relativeUrl = "/transaction/verify/{$transactionRef}"; |
| 268 | 268 | |
| 269 | - $this->response = $this->client->get($this->baseUrl . $relativeUrl, []); |
|
| 269 | + $this->response = $this->client->get($this->baseUrl.$relativeUrl, []); |
|
| 270 | 270 | |
| 271 | 271 | } |
| 272 | 272 | |
@@ -371,7 +371,7 @@ discard block |
||
| 371 | 371 | public function fetchPlan($plan_code) |
| 372 | 372 | { |
| 373 | 373 | $this->setRequestOptions(); |
| 374 | - return $this->setHttpResponse('/plan/' . $plan_code, 'GET', [])->getResponse(); |
|
| 374 | + return $this->setHttpResponse('/plan/'.$plan_code, 'GET', [])->getResponse(); |
|
| 375 | 375 | } |
| 376 | 376 | |
| 377 | 377 | /** |
@@ -393,7 +393,7 @@ discard block |
||
| 393 | 393 | ]; |
| 394 | 394 | |
| 395 | 395 | $this->setRequestOptions(); |
| 396 | - return $this->setHttpResponse('/plan/' . $plan_code, 'PUT', $data)->getResponse(); |
|
| 396 | + return $this->setHttpResponse('/plan/'.$plan_code, 'PUT', $data)->getResponse(); |
|
| 397 | 397 | } |
| 398 | 398 | |
| 399 | 399 | /** |
@@ -423,7 +423,7 @@ discard block |
||
| 423 | 423 | public function fetchCustomer($customer_id) |
| 424 | 424 | { |
| 425 | 425 | $this->setRequestOptions(); |
| 426 | - return $this->setHttpResponse('/customer/' . $customer_id, 'GET', [])->getResponse(); |
|
| 426 | + return $this->setHttpResponse('/customer/'.$customer_id, 'GET', [])->getResponse(); |
|
| 427 | 427 | } |
| 428 | 428 | |
| 429 | 429 | /** |
@@ -444,7 +444,7 @@ discard block |
||
| 444 | 444 | ]; |
| 445 | 445 | |
| 446 | 446 | $this->setRequestOptions(); |
| 447 | - return $this->setHttpResponse('/customer/' . $customer_id, 'PUT', $data)->getResponse(); |
|
| 447 | + return $this->setHttpResponse('/customer/'.$customer_id, 'PUT', $data)->getResponse(); |
|
| 448 | 448 | } |
| 449 | 449 | |
| 450 | 450 | /** |
@@ -503,7 +503,7 @@ discard block |
||
| 503 | 503 | { |
| 504 | 504 | $this->setRequestOptions(); |
| 505 | 505 | |
| 506 | - return $this->setHttpResponse('/subscription?customer=' . $customer_id, 'GET', [])->getData(); |
|
| 506 | + return $this->setHttpResponse('/subscription?customer='.$customer_id, 'GET', [])->getData(); |
|
| 507 | 507 | } |
| 508 | 508 | |
| 509 | 509 | /** |
@@ -517,7 +517,7 @@ discard block |
||
| 517 | 517 | { |
| 518 | 518 | $this->setRequestOptions(); |
| 519 | 519 | |
| 520 | - return $this->setHttpResponse('/subscription?plan=' . $plan_id, 'GET', [])->getData(); |
|
| 520 | + return $this->setHttpResponse('/subscription?plan='.$plan_id, 'GET', [])->getData(); |
|
| 521 | 521 | } |
| 522 | 522 | |
| 523 | 523 | /** |
@@ -561,7 +561,7 @@ discard block |
||
| 561 | 561 | public function fetchSubscription($subscription_id) |
| 562 | 562 | { |
| 563 | 563 | $this->setRequestOptions(); |
| 564 | - return $this->setHttpResponse('/subscription/' . $subscription_id, 'GET', [])->getResponse(); |
|
| 564 | + return $this->setHttpResponse('/subscription/'.$subscription_id, 'GET', [])->getResponse(); |
|
| 565 | 565 | } |
| 566 | 566 | |
| 567 | 567 | /** |
@@ -599,7 +599,7 @@ discard block |
||
| 599 | 599 | public function fetchPage($page_id) |
| 600 | 600 | { |
| 601 | 601 | $this->setRequestOptions(); |
| 602 | - return $this->setHttpResponse('/page/' . $page_id, 'GET', [])->getResponse(); |
|
| 602 | + return $this->setHttpResponse('/page/'.$page_id, 'GET', [])->getResponse(); |
|
| 603 | 603 | } |
| 604 | 604 | |
| 605 | 605 | /** |
@@ -617,7 +617,7 @@ discard block |
||
| 617 | 617 | ]; |
| 618 | 618 | |
| 619 | 619 | $this->setRequestOptions(); |
| 620 | - return $this->setHttpResponse('/page/' . $page_id, 'PUT', $data)->getResponse(); |
|
| 620 | + return $this->setHttpResponse('/page/'.$page_id, 'PUT', $data)->getResponse(); |
|
| 621 | 621 | } |
| 622 | 622 | |
| 623 | 623 | /** |
@@ -671,7 +671,7 @@ discard block |
||
| 671 | 671 | public function listSubAccounts($per_page, $page) |
| 672 | 672 | { |
| 673 | 673 | $this->setRequestOptions(); |
| 674 | - return $this->setHttpResponse("/subaccount/?perPage=" . (int)$per_page . "&page=" . (int)$page, "GET")->getResponse(); |
|
| 674 | + return $this->setHttpResponse("/subaccount/?perPage=".(int) $per_page."&page=".(int) $page, "GET")->getResponse(); |
|
| 675 | 675 | } |
| 676 | 676 | |
| 677 | 677 | |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | } |
| 245 | 245 | |
| 246 | 246 | return $validate; |
| 247 | - }catch (RequestException $exception){ |
|
| 247 | + } catch (RequestException $exception){ |
|
| 248 | 248 | return false; |
| 249 | 249 | } |
| 250 | 250 | } |
@@ -262,7 +262,9 @@ discard block |
||
| 262 | 262 | //for a parameter of 'trxref' |
| 263 | 263 | $transactionRef = $trxref ?: request()->query('trxref'); |
| 264 | 264 | |
| 265 | - if(!$transactionRef) throw new PaymentVerificationFailedException("Payment reference not provided"); |
|
| 265 | + if(!$transactionRef) { |
|
| 266 | + throw new PaymentVerificationFailedException("Payment reference not provided"); |
|
| 267 | + } |
|
| 266 | 268 | |
| 267 | 269 | $relativeUrl = "/transaction/verify/{$transactionRef}"; |
| 268 | 270 | |