Code Duplication    Length = 10-11 lines in 4 locations

src/Paystack.php 4 locations

@@ 456-466 (lines=11) @@
453
    /**
454
     * Create a subscription to a plan from a customer.
455
     */
456
    public function createSubscription()
457
    {
458
        $data = [
459
            "customer" => request()->customer, //Customer email or code
460
            "plan" => request()->plan,
461
            "authorization" => request()->authorization_code
462
        ];
463
464
        $this->setRequestOptions();
465
        $this->setHttpResponse('/subscription', 'POST', $data);
466
    }
467
468
    /**
469
     * Get all the subscriptions made on Paystack.
@@ 527-536 (lines=10) @@
524
     * Disable a subscription using the subscription code and token
525
     * @return array
526
     */
527
    public function disableSubscription()
528
    {
529
        $data = [
530
            "code" => request()->code,
531
            "token" => request()->token,
532
        ];
533
534
        $this->setRequestOptions();
535
        return $this->setHttpResponse('/subscription/disable', 'POST', $data)->getResponse();
536
    }
537
538
    /**
539
     * Fetch details about a certain subscription
@@ 552-562 (lines=11) @@
549
    /**
550
     * Create pages you can share with users using the returned slug
551
     */
552
    public function createPage()
553
    {
554
        $data = [
555
            "name" => request()->name,
556
            "description" => request()->description,
557
            "amount" => request()->amount
558
        ];
559
560
        $this->setRequestOptions();
561
        $this->setHttpResponse('/page', 'POST', $data);
562
    }
563
564
    /**
565
     * Fetches all the pages the merchant has
@@ 590-600 (lines=11) @@
587
     * @param $page_id
588
     * @return array
589
     */
590
    public function updatePage($page_id)
591
    {
592
        $data = [
593
            "name" => request()->name,
594
            "description" => request()->description,
595
            "amount" => request()->amount
596
        ];
597
598
        $this->setRequestOptions();
599
        return $this->setHttpResponse('/page/'.$page_id, 'PUT', $data)->getResponse();
600
    }
601
602
     /**
603
     * Creates a subaccount to be used for split payments . Required    params are business_name , settlement_bank , account_number ,   percentage_charge