@@ -113,6 +113,10 @@ |
||
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | |
| 116 | + /** |
|
| 117 | + * @param string $relativeUrl |
|
| 118 | + * @param string $method |
|
| 119 | + */ |
|
| 116 | 120 | private function setHttpResponse($relativeUrl, $method, $body = []){ |
| 117 | 121 | |
| 118 | 122 | if(is_null($method)){ |
@@ -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' => [ |
@@ -113,15 +113,15 @@ discard block |
||
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | |
| 116 | - private function setHttpResponse($relativeUrl, $method, $body = []){ |
|
| 116 | + private function setHttpResponse($relativeUrl, $method, $body = []) { |
|
| 117 | 117 | |
| 118 | - if(is_null($method)){ |
|
| 118 | + if (is_null($method)) { |
|
| 119 | 119 | |
| 120 | 120 | throw new isNullException("Empty method not allowed"); |
| 121 | 121 | |
| 122 | - }else{ |
|
| 122 | + } else { |
|
| 123 | 123 | |
| 124 | - $this->response = $this->client->{strtolower($method)}($this->baseUrl . $relativeUrl, $body); |
|
| 124 | + $this->response = $this->client->{strtolower($method)}($this->baseUrl.$relativeUrl, $body); |
|
| 125 | 125 | |
| 126 | 126 | return $this; |
| 127 | 127 | |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | |
| 152 | 152 | $relativeUrl = "/transaction/verify/{$transactionRef}"; |
| 153 | 153 | |
| 154 | - $this->response = $this->client->get($this->baseUrl . $relativeUrl, []); |
|
| 154 | + $this->response = $this->client->get($this->baseUrl.$relativeUrl, []); |
|
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | /** |
@@ -274,7 +274,7 @@ discard block |
||
| 274 | 274 | /** |
| 275 | 275 | * Create a plan |
| 276 | 276 | */ |
| 277 | - public function createPlan(){ |
|
| 277 | + public function createPlan() { |
|
| 278 | 278 | |
| 279 | 279 | $data = [ |
| 280 | 280 | "name" => request()->name, |
@@ -297,11 +297,11 @@ discard block |
||
| 297 | 297 | * @param $plan_code |
| 298 | 298 | * @return array |
| 299 | 299 | */ |
| 300 | - public function fetchPlan($plan_code){ |
|
| 300 | + public function fetchPlan($plan_code) { |
|
| 301 | 301 | |
| 302 | 302 | $this->setRequestOptions(); |
| 303 | 303 | |
| 304 | - return $this->setHttpResponse('/plan/' . $plan_code, 'GET', [])->getResponse(); |
|
| 304 | + return $this->setHttpResponse('/plan/'.$plan_code, 'GET', [])->getResponse(); |
|
| 305 | 305 | |
| 306 | 306 | } |
| 307 | 307 | |
@@ -310,7 +310,7 @@ discard block |
||
| 310 | 310 | * @param $plan_code |
| 311 | 311 | * @return array |
| 312 | 312 | */ |
| 313 | - public function updatePlan($plan_code){ |
|
| 313 | + public function updatePlan($plan_code) { |
|
| 314 | 314 | |
| 315 | 315 | $data = [ |
| 316 | 316 | "name" => request()->name, |
@@ -324,7 +324,7 @@ discard block |
||
| 324 | 324 | |
| 325 | 325 | $this->setRequestOptions(); |
| 326 | 326 | |
| 327 | - return $this->setHttpResponse('/plan/' . $plan_code, 'PUT', $data)->getResponse(); |
|
| 327 | + return $this->setHttpResponse('/plan/'.$plan_code, 'PUT', $data)->getResponse(); |
|
| 328 | 328 | |
| 329 | 329 | } |
| 330 | 330 | |
@@ -332,7 +332,7 @@ discard block |
||
| 332 | 332 | * Create a customer |
| 333 | 333 | * @return array |
| 334 | 334 | */ |
| 335 | - public function createCustomer(){ |
|
| 335 | + public function createCustomer() { |
|
| 336 | 336 | |
| 337 | 337 | $data = [ |
| 338 | 338 | "email" => request()->email, |
@@ -354,11 +354,11 @@ discard block |
||
| 354 | 354 | * @param $customer_id |
| 355 | 355 | * @return array |
| 356 | 356 | */ |
| 357 | - public function fetchCustomer($customer_id){ |
|
| 357 | + public function fetchCustomer($customer_id) { |
|
| 358 | 358 | |
| 359 | 359 | $this->setRequestOptions(); |
| 360 | 360 | |
| 361 | - return $this->setHttpResponse('/customer/'. $customer_id, 'GET', [])->getResponse(); |
|
| 361 | + return $this->setHttpResponse('/customer/'.$customer_id, 'GET', [])->getResponse(); |
|
| 362 | 362 | |
| 363 | 363 | } |
| 364 | 364 | |
@@ -367,7 +367,7 @@ discard block |
||
| 367 | 367 | * @param $customer_id |
| 368 | 368 | * @return array |
| 369 | 369 | */ |
| 370 | - public function updateCustomer($customer_id){ |
|
| 370 | + public function updateCustomer($customer_id) { |
|
| 371 | 371 | |
| 372 | 372 | $data = [ |
| 373 | 373 | "email" => request()->email, |
@@ -380,7 +380,7 @@ discard block |
||
| 380 | 380 | |
| 381 | 381 | $this->setRequestOptions(); |
| 382 | 382 | |
| 383 | - return $this->setHttpResponse('/customer/'. $customer_id, 'PUT', $data)->getResponse(); |
|
| 383 | + return $this->setHttpResponse('/customer/'.$customer_id, 'PUT', $data)->getResponse(); |
|
| 384 | 384 | |
| 385 | 385 | } |
| 386 | 386 | |
@@ -388,7 +388,7 @@ discard block |
||
| 388 | 388 | * Export tranactions in .CSV |
| 389 | 389 | * @return array |
| 390 | 390 | */ |
| 391 | - public function exportTransactions(){ |
|
| 391 | + public function exportTransactions() { |
|
| 392 | 392 | |
| 393 | 393 | $data = [ |
| 394 | 394 | "from" => request()->from, |
@@ -406,7 +406,7 @@ discard block |
||
| 406 | 406 | * Create a subscription to a plan from a customer. |
| 407 | 407 | * @return array |
| 408 | 408 | */ |
| 409 | - public function createSubscription(){ |
|
| 409 | + public function createSubscription() { |
|
| 410 | 410 | |
| 411 | 411 | $data = [ |
| 412 | 412 | "customer" => request()->customer, //Customer email or code |
@@ -423,7 +423,7 @@ discard block |
||
| 423 | 423 | * Enable a subscription using the subscription code and token |
| 424 | 424 | * @return array |
| 425 | 425 | */ |
| 426 | - public function enableSubscription(){ |
|
| 426 | + public function enableSubscription() { |
|
| 427 | 427 | |
| 428 | 428 | $data = [ |
| 429 | 429 | "code" => request()->code, |
@@ -440,7 +440,7 @@ discard block |
||
| 440 | 440 | * Disable a subscription using the subscription code and token |
| 441 | 441 | * @return array |
| 442 | 442 | */ |
| 443 | - public function disableSubscription(){ |
|
| 443 | + public function disableSubscription() { |
|
| 444 | 444 | |
| 445 | 445 | $data = [ |
| 446 | 446 | "code" => request()->code, |
@@ -458,7 +458,7 @@ discard block |
||
| 458 | 458 | * @param $subscription_id |
| 459 | 459 | * @return array |
| 460 | 460 | */ |
| 461 | - public function fetchSubscription($subscription_id){ |
|
| 461 | + public function fetchSubscription($subscription_id) { |
|
| 462 | 462 | |
| 463 | 463 | $this->setRequestOptions(); |
| 464 | 464 | |
@@ -470,7 +470,7 @@ discard block |
||
| 470 | 470 | * Create pages you can share with users using the returned slug |
| 471 | 471 | * @return array |
| 472 | 472 | */ |
| 473 | - public function createPage(){ |
|
| 473 | + public function createPage() { |
|
| 474 | 474 | |
| 475 | 475 | $data = [ |
| 476 | 476 | "name" => request()->name, |
@@ -488,7 +488,7 @@ discard block |
||
| 488 | 488 | * Fetches all the pages the merchant has |
| 489 | 489 | * @return array |
| 490 | 490 | */ |
| 491 | - public function getAllPages(){ |
|
| 491 | + public function getAllPages() { |
|
| 492 | 492 | |
| 493 | 493 | $this->setRequestOptions(); |
| 494 | 494 | |
@@ -501,7 +501,7 @@ discard block |
||
| 501 | 501 | * @param $page_id |
| 502 | 502 | * @return array |
| 503 | 503 | */ |
| 504 | - public function fetchPage($page_id){ |
|
| 504 | + public function fetchPage($page_id) { |
|
| 505 | 505 | |
| 506 | 506 | $this->setRequestOptions(); |
| 507 | 507 | |
@@ -514,7 +514,7 @@ discard block |
||
| 514 | 514 | * @param $page_id |
| 515 | 515 | * @return array |
| 516 | 516 | */ |
| 517 | - public function updatePage($page_id){ |
|
| 517 | + public function updatePage($page_id) { |
|
| 518 | 518 | |
| 519 | 519 | $data = [ |
| 520 | 520 | "name" => request()->name, |
@@ -119,7 +119,7 @@ |
||
| 119 | 119 | |
| 120 | 120 | throw new isNullException("Empty method not allowed"); |
| 121 | 121 | |
| 122 | - }else{ |
|
| 122 | + } else{ |
|
| 123 | 123 | |
| 124 | 124 | $this->response = $this->client->{strtolower($method)}($this->baseUrl . $relativeUrl, $body); |
| 125 | 125 | |