Code Duplication    Length = 12-14 lines in 6 locations

src/Paystack.php 6 locations

@@ 405-417 (lines=13) @@
402
     * Export tranactions in .CSV
403
     * @return array
404
     */
405
    public function exportTransactions(){
406
407
        $data = [
408
            "from" => request()->from,
409
            "to" => request()->to,
410
            'settled' => request()->settled
411
        ];
412
413
        $this->setRequestOptions();
414
415
        return $this->setGetResponse('/transaction/export', $data)->getResponse();
416
417
    }
418
419
    /**
420
     * Create a subscription to a plan from a customer.
@@ 423-434 (lines=12) @@
420
     * Create a subscription to a plan from a customer.
421
     * @return array
422
     */
423
    public function createSubscription(){
424
425
        $data = [
426
            "customer" => request()->customer, //Customer email or code
427
            "plan" => request()->plan,
428
            "authorization" => request()->authorization_code
429
        ];
430
431
        $this->setRequestOptions();
432
433
        return $this->setGetResponse('/subscription', $data)->getResponse();
434
    }
435
436
    /**
437
     * Enable a subscription using the subscription code and token
@@ 440-451 (lines=12) @@
437
     * Enable a subscription using the subscription code and token
438
     * @return array
439
     */
440
    public function enableSubscription(){
441
442
        $data = [
443
            "code" => request()->code,
444
            "token" => request()->token,
445
        ];
446
447
        $this->setRequestOptions();
448
449
        return $this->setGetResponse('/subscription/enable', $data)->getResponse();
450
451
    }
452
453
    /**
454
     * Disable a subscription using the subscription code and token
@@ 457-468 (lines=12) @@
454
     * Disable a subscription using the subscription code and token
455
     * @return array
456
     */
457
    public function disableSubscription(){
458
459
        $data = [
460
            "code" => request()->code,
461
            "token" => request()->token,
462
        ];
463
464
        $this->setRequestOptions();
465
466
        return $this->setGetResponse('/subscription/disable', $data)->getResponse();
467
468
    }
469
470
    /**
471
     * Fetch details about a certain subscription
@@ 487-500 (lines=14) @@
484
     * Create pages you can share with users using the returned slug
485
     * @return array
486
     */
487
    public function createPage(){
488
489
        $data = [
490
491
            "name" => request()->name,
492
            "description" => request()->description,
493
            "amount" => request()->amount
494
        ];
495
496
        $this->setRequestOptions();
497
498
        return $this->setGetResponse('/page', $data)->getResponse();
499
500
    }
501
502
    /**
503
     * Fetches all the pages the merchant has
@@ 532-545 (lines=14) @@
529
     * @param $page_id
530
     * @return array
531
     */
532
    public function updatePage($page_id){
533
534
        $data = [
535
536
            "name" => request()->name,
537
            "description" => request()->description,
538
            "amount" => request()->amount
539
        ];
540
541
        $this->setRequestOptions();
542
543
        return $this->setGetResponse('/page/'.$page_id, $data)->getResponse();
544
545
    }
546
547
}
548