Passed
Push — authorization ( 669a46...4a3fc4 )
by
unknown
09:47
created

RedirectGateway   A

Complexity

Total Complexity 16

Size/Duplication

Total Lines 86
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 22
c 1
b 0
f 1
dl 0
loc 86
rs 10
wmc 16

16 Methods

Rating   Name   Duplication   Size   Complexity  
A setMerchantId() 0 3 1
A getHmacKey() 0 3 1
A getName() 0 3 1
A setHmacKey() 0 3 1
A getDefaultParameters() 0 8 1
A purchase() 0 3 1
A setMerchantName() 0 3 1
A getTerminalId() 0 3 1
A getMerchantId() 0 3 1
A completePurchase() 0 3 1
A setTerminalId() 0 3 1
A getMerchantName() 0 3 1
A refund() 0 3 1
A completeAuthorize() 0 3 1
A authorize() 0 3 1
A void() 0 3 1
1
<?php
2
3
namespace Omnipay\Redsys;
4
5
use Omnipay\Common\AbstractGateway;
6
7
/**
8
 * Redsys Redirect Gateway.
9
 *
10
 * @see http://www.redsys.es/
11
 */
12
class RedirectGateway extends AbstractGateway
13
{
14
    public function getName()
15
    {
16
        return 'Redsys Redirect';
17
    }
18
19
    public function getDefaultParameters()
20
    {
21
        return [
22
            'merchantId' => '',
23
            'merchantName' => '',
24
            'terminalId' => '',
25
            'hmacKey' => '',
26
            'testMode' => false,
27
        ];
28
    }
29
30
    public function getMerchantId()
31
    {
32
        return $this->getParameter('merchantId');
33
    }
34
35
    public function setMerchantId($value)
36
    {
37
        return $this->setParameter('merchantId', $value);
38
    }
39
40
    public function getMerchantName()
41
    {
42
        return $this->getParameter('merchantName');
43
    }
44
45
    public function setMerchantName($value)
46
    {
47
        return $this->setParameter('merchantName', $value);
48
    }
49
50
    public function getTerminalId()
51
    {
52
        return $this->getParameter('terminalId');
53
    }
54
55
    public function setTerminalId($value)
56
    {
57
        return $this->setParameter('terminalId', $value);
58
    }
59
60
    public function getHmacKey()
61
    {
62
        return $this->getParameter('hmacKey');
63
    }
64
65
    public function setHmacKey($value)
66
    {
67
        return $this->setParameter('hmacKey', $value);
68
    }
69
70
    public function purchase(array $parameters = [])
71
    {
72
        return $this->createRequest(\Omnipay\Redsys\Message\PurchaseRequest::class, $parameters);
73
    }
74
75
    public function completePurchase(array $parameters = [])
76
    {
77
        return $this->createRequest(\Omnipay\Redsys\Message\CompletePurchaseRequest::class, $parameters);
78
    }
79
80
    public function refund(array $parameters = [])
81
    {
82
        return $this->createRequest(\Omnipay\Redsys\Message\RefundRequest::class, $parameters);
83
    }
84
85
    public function authorize(array $parameters = [])
86
    {
87
        return $this->createRequest(\Omnipay\Redsys\Message\AuthorizeRequest::class, $parameters);
88
    }
89
90
    public function completeAuthorize(array $parameters = [])
91
    {
92
        return $this->createRequest(\Omnipay\Redsys\Message\CompleteAuthorizeRequest::class, $parameters);
93
    }
94
95
    public function void(array $parameters = [])
96
    {
97
        return $this->createRequest(\Omnipay\Redsys\Message\VoidAuthorizeRequest::class, $parameters);
98
    }
99
}
100