Code Duplication    Length = 10-11 lines in 6 locations

src/Paystack.php 6 locations

@@ 466-476 (lines=11) @@
463
     * Export transactions in .CSV
464
     * @return array
465
     */
466
    public function exportTransactions()
467
    {
468
        $data = [
469
            "from" => request()->from,
470
            "to" => request()->to,
471
            'settled' => request()->settled
472
        ];
473
474
        $this->setRequestOptions();
475
        return $this->setHttpResponse('/transaction/export', 'GET', $data)->getResponse();
476
    }
477
478
    /**
479
     * Create a subscription to a plan from a customer.
@@ 481-491 (lines=11) @@
478
    /**
479
     * Create a subscription to a plan from a customer.
480
     */
481
    public function createSubscription()
482
    {
483
        $data = [
484
            "customer" => request()->customer, //Customer email or code
485
            "plan" => request()->plan,
486
            "authorization" => request()->authorization_code
487
        ];
488
489
        $this->setRequestOptions();
490
        return $this->setHttpResponse('/subscription', 'POST', $data)->getResponse();
491
    }
492
493
    /**
494
     * Get all the subscriptions made on Paystack.
@@ 535-544 (lines=10) @@
532
     * Enable a subscription using the subscription code and token
533
     * @return array
534
     */
535
    public function enableSubscription()
536
    {
537
        $data = [
538
            "code" => request()->code,
539
            "token" => request()->token,
540
        ];
541
542
        $this->setRequestOptions();
543
        return $this->setHttpResponse('/subscription/enable', 'POST', $data)->getResponse();
544
    }
545
546
    /**
547
     * Disable a subscription using the subscription code and token
@@ 550-559 (lines=10) @@
547
     * Disable a subscription using the subscription code and token
548
     * @return array
549
     */
550
    public function disableSubscription()
551
    {
552
        $data = [
553
            "code" => request()->code,
554
            "token" => request()->token,
555
        ];
556
557
        $this->setRequestOptions();
558
        return $this->setHttpResponse('/subscription/disable', 'POST', $data)->getResponse();
559
    }
560
561
    /**
562
     * Fetch details about a certain subscription
@@ 575-585 (lines=11) @@
572
    /**
573
     * Create pages you can share with users using the returned slug
574
     */
575
    public function createPage()
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', 'POST', $data)->getResponse();
585
    }
586
587
    /**
588
     * Fetches all the pages the merchant has
@@ 613-623 (lines=11) @@
610
     * @param $page_id
611
     * @return array
612
     */
613
    public function updatePage($page_id)
614
    {
615
        $data = [
616
            "name" => request()->name,
617
            "description" => request()->description,
618
            "amount" => request()->amount
619
        ];
620
621
        $this->setRequestOptions();
622
        return $this->setHttpResponse('/page/'.$page_id, 'PUT', $data)->getResponse();
623
    }
624
625
     /**
626
     * Creates a subaccount to be used for split payments . Required    params are business_name , settlement_bank , account_number ,   percentage_charge