@@ -6,10 +6,10 @@ |
||
6 | 6 | |
7 | 7 | class PaystackFacade extends Facade { |
8 | 8 | /** |
9 | - * Get the registered name of the component. |
|
10 | - * |
|
11 | - * @return string |
|
12 | - */ |
|
9 | + * Get the registered name of the component. |
|
10 | + * |
|
11 | + * @return string |
|
12 | + */ |
|
13 | 13 | protected static function getFacadeAccessor() |
14 | 14 | { |
15 | 15 | return 'laravel-paystack'; |
@@ -20,9 +20,9 @@ |
||
20 | 20 | * @param string $type |
21 | 21 | * @return string |
22 | 22 | */ |
23 | - private static function getPool( $type = 'alnum') |
|
23 | + private static function getPool($type = 'alnum') |
|
24 | 24 | { |
25 | - switch ( $type ) { |
|
25 | + switch ($type) { |
|
26 | 26 | case 'alnum': |
27 | 27 | $pool = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; |
28 | 28 | break; |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | |
99 | 99 | /** |
100 | 100 | * Initiate a payment request to Paystack |
101 | - * @return Unicodeveloper\Paystack\Paystack |
|
101 | + * @return Paystack |
|
102 | 102 | */ |
103 | 103 | public function makePaymentRequest() |
104 | 104 | { |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | /** |
111 | 111 | * Make the client request and get the response |
112 | 112 | * @param string $relativeUrl |
113 | - * @return Unicodeveloper\Paystack\Paystack |
|
113 | + * @return Paystack |
|
114 | 114 | */ |
115 | 115 | public function setResponse($relativeUrl) |
116 | 116 | { |
@@ -127,6 +127,9 @@ discard block |
||
127 | 127 | return $this; |
128 | 128 | } |
129 | 129 | |
130 | + /** |
|
131 | + * @param string $relativeUrl |
|
132 | + */ |
|
130 | 133 | private function setGetResponse($relativeUrl) |
131 | 134 | { |
132 | 135 | $this->response = $this->client->get($this->baseUrl . $relativeUrl, []); |
@@ -136,7 +139,7 @@ discard block |
||
136 | 139 | |
137 | 140 | /** |
138 | 141 | * Get the authorization url from the callback response |
139 | - * @return Unicodeveloper\Paystack\Paystack |
|
142 | + * @return Paystack |
|
140 | 143 | */ |
141 | 144 | public function getAuthorizationUrl() |
142 | 145 | { |
@@ -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(['base_uri' => $this->baseUrl, |
92 | 92 | 'headers' => [ |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | "email" => request()->email |
121 | 121 | ]; |
122 | 122 | |
123 | - $this->response = $this->client->post($this->baseUrl . $relativeUrl, [ |
|
123 | + $this->response = $this->client->post($this->baseUrl.$relativeUrl, [ |
|
124 | 124 | 'body' => json_encode($data) |
125 | 125 | ]); |
126 | 126 | |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | |
130 | 130 | private function setGetResponse($relativeUrl, $body = array()) |
131 | 131 | { |
132 | - $this->response = $this->client->get($this->baseUrl . $relativeUrl, $body); |
|
132 | + $this->response = $this->client->get($this->baseUrl.$relativeUrl, $body); |
|
133 | 133 | |
134 | 134 | return $this; |
135 | 135 | } |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | |
158 | 158 | $relativeUrl = "/transaction/verify/{$transactionRef}"; |
159 | 159 | |
160 | - $this->response = $this->client->get($this->baseUrl . $relativeUrl, []); |
|
160 | + $this->response = $this->client->get($this->baseUrl.$relativeUrl, []); |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | /** |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | * Create a plan |
285 | 285 | * @return array |
286 | 286 | */ |
287 | - public function createPlan(){ |
|
287 | + public function createPlan() { |
|
288 | 288 | |
289 | 289 | $data = [ |
290 | 290 | |
@@ -308,11 +308,11 @@ discard block |
||
308 | 308 | * @param $plan_code |
309 | 309 | * @return array |
310 | 310 | */ |
311 | - public function fetchPlan($plan_code){ |
|
311 | + public function fetchPlan($plan_code) { |
|
312 | 312 | |
313 | 313 | $this->setRequestOptions(); |
314 | 314 | |
315 | - return $this->setGetResponse('/plan/' . $plan_code, [])->getResponse(); |
|
315 | + return $this->setGetResponse('/plan/'.$plan_code, [])->getResponse(); |
|
316 | 316 | |
317 | 317 | } |
318 | 318 | |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | * @param $plan_code |
322 | 322 | * @return array |
323 | 323 | */ |
324 | - public function updatePlan($plan_code){ |
|
324 | + public function updatePlan($plan_code) { |
|
325 | 325 | |
326 | 326 | $data = [ |
327 | 327 | |
@@ -336,7 +336,7 @@ discard block |
||
336 | 336 | |
337 | 337 | $this->setRequestOptions(); |
338 | 338 | |
339 | - return $this->setGetResponse('/plan/' . $plan_code, $data)->getResponse(); |
|
339 | + return $this->setGetResponse('/plan/'.$plan_code, $data)->getResponse(); |
|
340 | 340 | |
341 | 341 | } |
342 | 342 | |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | * Create a customer |
345 | 345 | * @return array |
346 | 346 | */ |
347 | - public function createCustomer(){ |
|
347 | + public function createCustomer() { |
|
348 | 348 | |
349 | 349 | $data = [ |
350 | 350 | |
@@ -367,11 +367,11 @@ discard block |
||
367 | 367 | * @param $customer_id |
368 | 368 | * @return array |
369 | 369 | */ |
370 | - public function fetchCustomer($customer_id){ |
|
370 | + public function fetchCustomer($customer_id) { |
|
371 | 371 | |
372 | 372 | $this->setRequestOptions(); |
373 | 373 | |
374 | - return $this->setGetResponse('/customer/'. $customer_id, [])->getResponse(); |
|
374 | + return $this->setGetResponse('/customer/'.$customer_id, [])->getResponse(); |
|
375 | 375 | |
376 | 376 | } |
377 | 377 | |
@@ -380,7 +380,7 @@ discard block |
||
380 | 380 | * @param $customer_id |
381 | 381 | * @return array |
382 | 382 | */ |
383 | - public function updateCustomer($customer_id){ |
|
383 | + public function updateCustomer($customer_id) { |
|
384 | 384 | |
385 | 385 | $data = [ |
386 | 386 | |
@@ -394,7 +394,7 @@ discard block |
||
394 | 394 | |
395 | 395 | $this->setRequestOptions(); |
396 | 396 | |
397 | - return $this->setGetResponse('/customer/'. $customer_id, $data)->getResponse(); |
|
397 | + return $this->setGetResponse('/customer/'.$customer_id, $data)->getResponse(); |
|
398 | 398 | |
399 | 399 | } |
400 | 400 | |
@@ -402,7 +402,7 @@ discard block |
||
402 | 402 | * Export tranactions in .CSV |
403 | 403 | * @return array |
404 | 404 | */ |
405 | - public function exportTransactions(){ |
|
405 | + public function exportTransactions() { |
|
406 | 406 | |
407 | 407 | $data = [ |
408 | 408 | "from" => request()->from, |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | * Create a subscription to a plan from a customer. |
421 | 421 | * @return array |
422 | 422 | */ |
423 | - public function createSubscription(){ |
|
423 | + public function createSubscription() { |
|
424 | 424 | |
425 | 425 | $data = [ |
426 | 426 | "customer" => request()->customer, //Customer email or code |
@@ -437,7 +437,7 @@ discard block |
||
437 | 437 | * Enable a subscription using the subscription code and token |
438 | 438 | * @return array |
439 | 439 | */ |
440 | - public function enableSubscription(){ |
|
440 | + public function enableSubscription() { |
|
441 | 441 | |
442 | 442 | $data = [ |
443 | 443 | "code" => request()->code, |
@@ -454,7 +454,7 @@ discard block |
||
454 | 454 | * Disable a subscription using the subscription code and token |
455 | 455 | * @return array |
456 | 456 | */ |
457 | - public function disableSubscription(){ |
|
457 | + public function disableSubscription() { |
|
458 | 458 | |
459 | 459 | $data = [ |
460 | 460 | "code" => request()->code, |
@@ -472,7 +472,7 @@ discard block |
||
472 | 472 | * @param $subscription_id |
473 | 473 | * @return array |
474 | 474 | */ |
475 | - public function fetchSubscription($subscription_id){ |
|
475 | + public function fetchSubscription($subscription_id) { |
|
476 | 476 | |
477 | 477 | $this->setRequestOptions(); |
478 | 478 | |
@@ -484,7 +484,7 @@ discard block |
||
484 | 484 | * Create pages you can share with users using the returned slug |
485 | 485 | * @return array |
486 | 486 | */ |
487 | - public function createPage(){ |
|
487 | + public function createPage() { |
|
488 | 488 | |
489 | 489 | $data = [ |
490 | 490 | |
@@ -503,7 +503,7 @@ discard block |
||
503 | 503 | * Fetches all the pages the merchant has |
504 | 504 | * @return array |
505 | 505 | */ |
506 | - public function getAllPages(){ |
|
506 | + public function getAllPages() { |
|
507 | 507 | |
508 | 508 | $this->setRequestOptions(); |
509 | 509 | |
@@ -516,7 +516,7 @@ discard block |
||
516 | 516 | * @param $page_id |
517 | 517 | * @return array |
518 | 518 | */ |
519 | - public function fetchPage($page_id){ |
|
519 | + public function fetchPage($page_id) { |
|
520 | 520 | |
521 | 521 | $this->setRequestOptions(); |
522 | 522 | |
@@ -529,7 +529,7 @@ discard block |
||
529 | 529 | * @param $page_id |
530 | 530 | * @return array |
531 | 531 | */ |
532 | - public function updatePage($page_id){ |
|
532 | + public function updatePage($page_id) { |
|
533 | 533 | |
534 | 534 | $data = [ |
535 | 535 |