| @@ 386-397 (lines=12) @@ | ||
| 383 | * Create a subscription to a plan from a customer. |
|
| 384 | * @return array |
|
| 385 | */ |
|
| 386 | public function createSubscription(){ |
|
| 387 | $data = [ |
|
| 388 | "customer" => request()->customer, //Customer email or code |
|
| 389 | "plan" => request()->plan, |
|
| 390 | "authorization" => request()->authorization_code |
|
| 391 | ]; |
|
| 392 | ||
| 393 | $this->setRequestOptions(); |
|
| 394 | $this->setHttpResponse('/subscription', 'POST', $data); |
|
| 395 | } |
|
| 396 | ||
| 397 | /** |
|
| 398 | * Enable a subscription using the subscription code and token |
|
| 399 | * @return array |
|
| 400 | */ |
|
| @@ 401-412 (lines=12) @@ | ||
| 398 | * Enable a subscription using the subscription code and token |
|
| 399 | * @return array |
|
| 400 | */ |
|
| 401 | public function enableSubscription(){ |
|
| 402 | $data = [ |
|
| 403 | "code" => request()->code, |
|
| 404 | "token" => request()->token, |
|
| 405 | ]; |
|
| 406 | ||
| 407 | $this->setRequestOptions(); |
|
| 408 | return $this->setHttpResponse('/subscription/enable', 'POST', $data)->getResponse(); |
|
| 409 | } |
|
| 410 | ||
| 411 | /** |
|
| 412 | * Disable a subscription using the subscription code and token |
|
| 413 | * @return array |
|
| 414 | */ |
|
| 415 | public function disableSubscription(){ |
|
| @@ 415-426 (lines=12) @@ | ||
| 412 | * Disable a subscription using the subscription code and token |
|
| 413 | * @return array |
|
| 414 | */ |
|
| 415 | public function disableSubscription(){ |
|
| 416 | $data = [ |
|
| 417 | "code" => request()->code, |
|
| 418 | "token" => request()->token, |
|
| 419 | ]; |
|
| 420 | ||
| 421 | $this->setRequestOptions(); |
|
| 422 | return $this->setHttpResponse('/subscription/disable', 'POST', $data)->getResponse(); |
|
| 423 | } |
|
| 424 | ||
| 425 | /** |
|
| 426 | * Fetch details about a certain subscription |
|
| 427 | * @param $subscription_id |
|
| 428 | * @return array |
|
| 429 | */ |
|
| @@ 440-452 (lines=13) @@ | ||
| 437 | * Create pages you can share with users using the returned slug |
|
| 438 | * @return array |
|
| 439 | */ |
|
| 440 | public function createPage(){ |
|
| 441 | $data = [ |
|
| 442 | "name" => request()->name, |
|
| 443 | "description" => request()->description, |
|
| 444 | "amount" => request()->amount |
|
| 445 | ]; |
|
| 446 | ||
| 447 | $this->setRequestOptions(); |
|
| 448 | $this->setHttpResponse('/page', 'POST', $data); |
|
| 449 | } |
|
| 450 | ||
| 451 | /** |
|
| 452 | * Fetches all the pages the merchant has |
|
| 453 | * @return array |
|
| 454 | */ |
|
| 455 | public function getAllPages() |
|
| @@ 477-489 (lines=13) @@ | ||
| 474 | * @param $page_id |
|
| 475 | * @return array |
|
| 476 | */ |
|
| 477 | public function updatePage($page_id){ |
|
| 478 | $data = [ |
|
| 479 | "name" => request()->name, |
|
| 480 | "description" => request()->description, |
|
| 481 | "amount" => request()->amount |
|
| 482 | ]; |
|
| 483 | ||
| 484 | $this->setRequestOptions(); |
|
| 485 | return $this->setHttpResponse('/page/'.$page_id, 'PUT', $data)->getResponse(); |
|
| 486 | } |
|
| 487 | ||
| 488 | } |
|
| 489 | ||
| 490 | ||
| 491 | ||
| 492 | ||