@@ 443-454 (lines=12) @@ | ||
440 | /** |
|
441 | * Create a subscription to a plan from a customer. |
|
442 | */ |
|
443 | public function createSubscription() |
|
444 | { |
|
445 | $data = [ |
|
446 | "customer" => request()->customer, //Customer email or code |
|
447 | "plan" => request()->plan, |
|
448 | "authorization" => request()->authorization_code |
|
449 | ]; |
|
450 | ||
451 | $this->setRequestOptions(); |
|
452 | $this->setHttpResponse('/subscription', 'POST', $data); |
|
453 | } |
|
454 | ||
455 | /** |
|
456 | * Get all the subscriptions made on Paystack. |
|
457 | * |
|
@@ 497-508 (lines=12) @@ | ||
494 | * Enable a subscription using the subscription code and token |
|
495 | * @return array |
|
496 | */ |
|
497 | public function enableSubscription() |
|
498 | { |
|
499 | $data = [ |
|
500 | "code" => request()->code, |
|
501 | "token" => request()->token, |
|
502 | ]; |
|
503 | ||
504 | $this->setRequestOptions(); |
|
505 | return $this->setHttpResponse('/subscription/enable', 'POST', $data)->getResponse(); |
|
506 | } |
|
507 | ||
508 | /** |
|
509 | * Disable a subscription using the subscription code and token |
|
510 | * @return array |
|
511 | */ |
|
@@ 512-523 (lines=12) @@ | ||
509 | * Disable a subscription using the subscription code and token |
|
510 | * @return array |
|
511 | */ |
|
512 | public function disableSubscription() |
|
513 | { |
|
514 | $data = [ |
|
515 | "code" => request()->code, |
|
516 | "token" => request()->token, |
|
517 | ]; |
|
518 | ||
519 | $this->setRequestOptions(); |
|
520 | return $this->setHttpResponse('/subscription/disable', 'POST', $data)->getResponse(); |
|
521 | } |
|
522 | ||
523 | /** |
|
524 | * Fetch details about a certain subscription |
|
525 | * @param mixed $subscription_id |
|
526 | * @return array |
|
@@ 537-549 (lines=13) @@ | ||
534 | /** |
|
535 | * Create pages you can share with users using the returned slug |
|
536 | */ |
|
537 | public function createPage() |
|
538 | { |
|
539 | $data = [ |
|
540 | "name" => request()->name, |
|
541 | "description" => request()->description, |
|
542 | "amount" => request()->amount |
|
543 | ]; |
|
544 | ||
545 | $this->setRequestOptions(); |
|
546 | $this->setHttpResponse('/page', 'POST', $data); |
|
547 | } |
|
548 | ||
549 | /** |
|
550 | * Fetches all the pages the merchant has |
|
551 | * @return array |
|
552 | */ |
|
@@ 575-587 (lines=13) @@ | ||
572 | * @param $page_id |
|
573 | * @return array |
|
574 | */ |
|
575 | public function updatePage($page_id) |
|
576 | { |
|
577 | $data = [ |
|
578 | "name" => request()->name, |
|
579 | "description" => request()->description, |
|
580 | "amount" => request()->amount |
|
581 | ]; |
|
582 | ||
583 | $this->setRequestOptions(); |
|
584 | return $this->setHttpResponse('/page/'.$page_id, 'PUT', $data)->getResponse(); |
|
585 | } |
|
586 | } |
|
587 |