1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Omnipay\Redsys; |
4
|
|
|
|
5
|
|
|
use Omnipay\Common\AbstractGateway; |
6
|
|
|
use Omnipay\Redsys\Message\CompletePurchaseRequest; |
7
|
|
|
use Omnipay\Redsys\Message\PurchaseRequest; |
8
|
|
|
|
9
|
|
|
/** |
10
|
|
|
* Redsys Redirect Gateway |
11
|
|
|
* |
12
|
|
|
* @link http://www.redsys.es/ |
13
|
|
|
*/ |
14
|
|
|
class RedirectGateway extends AbstractGateway |
15
|
|
|
{ |
16
|
1 |
|
public function getName() |
17
|
|
|
{ |
18
|
1 |
|
return 'Redsys Redirect'; |
19
|
|
|
} |
20
|
|
|
|
21
|
30 |
|
public function getDefaultParameters() |
22
|
|
|
{ |
23
|
|
|
return array( |
24
|
30 |
|
'merchantId' => '', |
25
|
30 |
|
'merchantName' => '', |
26
|
30 |
|
'terminalId' => '', |
27
|
30 |
|
'hmacKey' => '', |
28
|
30 |
|
'testMode' => false, |
29
|
30 |
|
); |
30
|
|
|
} |
31
|
|
|
|
32
|
1 |
|
public function getMerchantId() |
33
|
|
|
{ |
34
|
1 |
|
return $this->getParameter('merchantId'); |
35
|
|
|
} |
36
|
|
|
|
37
|
3 |
|
public function setMerchantId($value) |
38
|
|
|
{ |
39
|
3 |
|
return $this->setParameter('merchantId', $value); |
40
|
|
|
} |
41
|
|
|
|
42
|
1 |
|
public function getMerchantName() |
43
|
|
|
{ |
44
|
1 |
|
return $this->getParameter('merchantName'); |
45
|
|
|
} |
46
|
|
|
|
47
|
3 |
|
public function setMerchantName($value) |
48
|
|
|
{ |
49
|
3 |
|
return $this->setParameter('merchantName', $value); |
50
|
|
|
} |
51
|
|
|
|
52
|
1 |
|
public function getTerminalId() |
53
|
|
|
{ |
54
|
1 |
|
return $this->getParameter('terminalId'); |
55
|
|
|
} |
56
|
|
|
|
57
|
3 |
|
public function setTerminalId($value) |
58
|
|
|
{ |
59
|
3 |
|
return $this->setParameter('terminalId', $value); |
60
|
|
|
} |
61
|
|
|
|
62
|
1 |
|
public function getHmacKey() |
63
|
|
|
{ |
64
|
1 |
|
return $this->getParameter('hmacKey'); |
65
|
|
|
} |
66
|
|
|
|
67
|
3 |
|
public function setHmacKey($value) |
68
|
|
|
{ |
69
|
3 |
|
return $this->setParameter('hmacKey', $value); |
70
|
|
|
} |
71
|
|
|
|
72
|
3 |
|
public function purchase(array $parameters = array()) |
73
|
|
|
{ |
74
|
3 |
|
return $this->createRequest('\Omnipay\Redsys\Message\PurchaseRequest', $parameters); |
75
|
|
|
} |
76
|
|
|
|
77
|
5 |
|
public function completePurchase(array $parameters = array()) |
78
|
|
|
{ |
79
|
5 |
|
return $this->createRequest('\Omnipay\Redsys\Message\CompletePurchaseRequest', $parameters); |
80
|
|
|
} |
81
|
|
|
} |
82
|
|
|
|