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
|
|
|
|