@@ 424-435 (lines=12) @@ | ||
421 | /** |
|
422 | * Create a subscription to a plan from a customer. |
|
423 | */ |
|
424 | public function createSubscription() |
|
425 | { |
|
426 | $data = [ |
|
427 | "customer" => request()->customer, //Customer email or code |
|
428 | "plan" => request()->plan, |
|
429 | "authorization" => request()->authorization_code |
|
430 | ]; |
|
431 | ||
432 | $this->setRequestOptions(); |
|
433 | $this->setHttpResponse('/subscription', 'POST', $data); |
|
434 | } |
|
435 | ||
436 | /** |
|
437 | * Get all the subscriptions made on Paystack. |
|
438 | * |
|
@@ 478-489 (lines=12) @@ | ||
475 | * Enable a subscription using the subscription code and token |
|
476 | * @return array |
|
477 | */ |
|
478 | public function enableSubscription() |
|
479 | { |
|
480 | $data = [ |
|
481 | "code" => request()->code, |
|
482 | "token" => request()->token, |
|
483 | ]; |
|
484 | ||
485 | $this->setRequestOptions(); |
|
486 | return $this->setHttpResponse('/subscription/enable', 'POST', $data)->getResponse(); |
|
487 | } |
|
488 | ||
489 | /** |
|
490 | * Disable a subscription using the subscription code and token |
|
491 | * @return array |
|
492 | */ |
|
@@ 493-504 (lines=12) @@ | ||
490 | * Disable a subscription using the subscription code and token |
|
491 | * @return array |
|
492 | */ |
|
493 | public function disableSubscription() |
|
494 | { |
|
495 | $data = [ |
|
496 | "code" => request()->code, |
|
497 | "token" => request()->token, |
|
498 | ]; |
|
499 | ||
500 | $this->setRequestOptions(); |
|
501 | return $this->setHttpResponse('/subscription/disable', 'POST', $data)->getResponse(); |
|
502 | } |
|
503 | ||
504 | /** |
|
505 | * Fetch details about a certain subscription |
|
506 | * @param mixed $subscription_id |
|
507 | * @return array |
|
@@ 518-530 (lines=13) @@ | ||
515 | /** |
|
516 | * Create pages you can share with users using the returned slug |
|
517 | */ |
|
518 | public function createPage() |
|
519 | { |
|
520 | $data = [ |
|
521 | "name" => request()->name, |
|
522 | "description" => request()->description, |
|
523 | "amount" => request()->amount |
|
524 | ]; |
|
525 | ||
526 | $this->setRequestOptions(); |
|
527 | $this->setHttpResponse('/page', 'POST', $data); |
|
528 | } |
|
529 | ||
530 | /** |
|
531 | * Fetches all the pages the merchant has |
|
532 | * @return array |
|
533 | */ |
|
@@ 556-568 (lines=13) @@ | ||
553 | * @param $page_id |
|
554 | * @return array |
|
555 | */ |
|
556 | public function updatePage($page_id) |
|
557 | { |
|
558 | $data = [ |
|
559 | "name" => request()->name, |
|
560 | "description" => request()->description, |
|
561 | "amount" => request()->amount |
|
562 | ]; |
|
563 | ||
564 | $this->setRequestOptions(); |
|
565 | return $this->setHttpResponse('/page/'.$page_id, 'PUT', $data)->getResponse(); |
|
566 | } |
|
567 | } |
|
568 |