Code Duplication    Length = 33-34 lines in 3 locations

src/SDK/Action/EWallet.php 1 location

@@ 8-41 (lines=34) @@
5
6
use MerchantSafeUnipay;
7
8
final class EWallet extends ActionAbstract implements ActionInterface
9
{
10
    static private $addCardKeys = [
11
        'CUSTOMER', 'NAMEONCARD', 'CARDPAN', 'CARDEXPIRY', 'CARDSAVENAME', 'CUSTOMERNAME', 'CUSTOMEREMAIL',
12
        'CUSTOMERPHONE'
13
    ];
14
    static private $editCardKeys = [
15
        'CARDTOKEN', 'CARDEXPIRY', 'NAMEONCARD', 'CARDSAVENAME'
16
    ];
17
    static private $deleteCardKeys = [
18
        'CARDTOKEN'
19
    ];
20
21
    public function addCard($args)
22
    {
23
        $this->action = 'EWALLETADDCARD';
24
        $args = MerchantSafeUnipay\filter(self::$addCardKeys, $args);
25
        $this->queryParameters = array_merge($this->merchantParams, $args);
26
    }
27
28
    public function editCard($args)
29
    {
30
        $this->action = 'EWALLETEDITCARD';
31
        $args = MerchantSafeUnipay\filter(self::$editCardKeys, $args);
32
        $this->queryParameters = array_merge($this->merchantParams, $args);
33
    }
34
35
    public function deleteCard($args)
36
    {
37
        $this->action = 'EWALLETDELETECARD';
38
        $args = MerchantSafeUnipay\filter(self::$deleteCardKeys, $args);
39
        $this->queryParameters = array_merge($this->merchantParams, $args);
40
    }
41
}
42

src/SDK/Action/MerchantUser.php 1 location

@@ 8-40 (lines=33) @@
5
6
use MerchantSafeUnipay;
7
8
final class MerchantUser extends ActionAbstract implements ActionInterface
9
{
10
    static private $addKeys = [
11
        'USERNAME', 'MERCHANTUSEREMAIL', 'ROLE', 'TIMEZONE'
12
    ];
13
    static private $editKeys = [
14
        'USERNAME', 'MERCHANTUSEREMAIL', 'ROLE', 'ISLOCKED', 'MERCHANTUSERPASSWORD', 'CONFIRMPASSWORD'
15
    ];
16
    static private $reinviteKeys = [
17
        'MERCHANTUSEREMAIL'
18
    ];
19
20
    public function add($args)
21
    {
22
        $this->action = 'MERCHANTUSERADD';
23
        $args = MerchantSafeUnipay\filter(self::$addKeys, $args);
24
        $this->queryParameters = array_merge($this->merchantParams, $args);
25
    }
26
27
    public function edit($args)
28
    {
29
        $this->action = 'MERCHANTUSEREDIT';
30
        $args = MerchantSafeUnipay\filter(self::$editKeys, $args);
31
        $this->queryParameters = array_merge($this->merchantParams, $args);
32
    }
33
34
    public function reinvite($args)
35
    {
36
        $this->action = 'MERCHANTUSERREINVITE';
37
        $args = MerchantSafeUnipay\filter(self::$reinviteKeys, $args);
38
        $this->queryParameters = array_merge($this->merchantParams, $args);
39
    }
40
}
41

src/SDK/Action/PayByLinkPayment.php 1 location

@@ 8-41 (lines=34) @@
5
6
use MerchantSafeUnipay;
7
8
final class PayByLinkPayment extends ActionAbstract implements ActionInterface
9
{
10
    static private $addKeys = [
11
        'SESSIONEXPIRY', 'MERCHANTPAYMENTID', 'AMOUNT', 'CURRENCY', 'CUSTOMER', 'RETURNURL', 'CUSTOMEREMAIL',
12
        'CUSTOMERNAME', 'CUSTOMERPHONE', 'TCKN', 'LANGUAGE', 'ORDERITEMS'
13
    ];
14
    static private $cancelKeys = [
15
        'PAYBYLINKTOKEN'
16
    ];
17
    static private $resendKeys = [
18
        'PAYBYLINKTOKEN'
19
    ];
20
21
    public function add($args)
22
    {
23
        $this->action = 'PAYBYLINKPAYMENT';
24
        $args = MerchantSafeUnipay\filter(self::$addKeys, $args);
25
        $this->queryParameters = array_merge($this->merchantParams, $args);
26
    }
27
28
    public function cancel($args)
29
    {
30
        $this->action = 'PAYBYLINKPAYMENTCANCEL';
31
        $args = MerchantSafeUnipay\filter(self::$cancelKeys, $args);
32
        $this->queryParameters = array_merge($this->merchantParams, $args);
33
    }
34
35
    public function resend($args)
36
    {
37
        $this->action = 'PAYBYLINKPAYMENTRESEND';
38
        $args = MerchantSafeUnipay\filter(self::$resendKeys, $args);
39
        $this->queryParameters = array_merge($this->merchantParams, $args);
40
    }
41
}
42