1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Omnipay\EpsomAdelante; |
4
|
|
|
|
5
|
|
|
use Omnipay\Common\AbstractGateway; |
6
|
|
|
use Omnipay\EpsomAdelante\Message\CompletePurchaseRequest; |
7
|
|
|
use Omnipay\EpsomAdelante\Message\PurchaseRequest; |
8
|
|
|
|
9
|
|
|
/** |
10
|
|
|
* Epsom connector to Adelante Gateway |
11
|
|
|
* |
12
|
|
|
* @link http://www.adelante.co.uk/sell-online |
13
|
|
|
*/ |
14
|
|
|
class Gateway extends AbstractGateway |
15
|
|
|
{ |
16
|
1 |
|
public function getName() |
17
|
|
|
{ |
18
|
1 |
|
return 'EpsomAdelante'; |
19
|
|
|
} |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* Get the default parameters |
23
|
|
|
* |
24
|
|
|
* channel : supplied by Adelante |
25
|
|
|
* returnMethod : either 'post' or 'redirect'; anything blank/invalid will result in 'post' |
26
|
|
|
* sendMail : 'y' if gateway sends receipt to user; blank/invalid (or if no email address supplied) means no email |
27
|
|
|
* |
28
|
|
|
* currency should also be set to 'GBP' |
29
|
|
|
* |
30
|
|
|
* @return array |
31
|
|
|
*/ |
32
|
31 |
|
public function getDefaultParameters() |
33
|
|
|
{ |
34
|
|
|
return array( |
35
|
31 |
|
'channel' => '', |
36
|
31 |
|
'fundCode' => '', |
37
|
31 |
|
'returnMethod' => 'post', |
38
|
31 |
|
'sendMail' => '', |
39
|
31 |
|
'testEndpoint' => '', |
40
|
31 |
|
'liveEndpoint' => '', |
41
|
31 |
|
'testMode' => false, |
42
|
31 |
|
); |
43
|
|
|
} |
44
|
|
|
|
45
|
1 |
|
public function getChannel() |
46
|
|
|
{ |
47
|
1 |
|
return $this->getParameter('channel'); |
48
|
|
|
} |
49
|
|
|
|
50
|
3 |
|
public function setChannel($value) |
51
|
|
|
{ |
52
|
3 |
|
return $this->setParameter('channel', $value); |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* Default fund code if none supplied by the item |
57
|
|
|
*/ |
58
|
1 |
|
public function getFundCode() |
59
|
|
|
{ |
60
|
1 |
|
return $this->getParameter('fundCode'); |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
/** |
64
|
|
|
* Set the default fund code |
65
|
|
|
* |
66
|
|
|
* If this is left blank, or is unspecified a default fund code can be derived from the pre-set data selected by |
67
|
|
|
* the given channel code, but this is not enabled by default. |
68
|
|
|
*/ |
69
|
3 |
|
public function setFundCode($value) |
70
|
|
|
{ |
71
|
3 |
|
return $this->setParameter('fundCode', $value); |
72
|
|
|
} |
73
|
|
|
|
74
|
1 |
|
public function getReturnMethod() |
75
|
|
|
{ |
76
|
1 |
|
return $this->getParameter('returnMethod'); |
77
|
|
|
} |
78
|
|
|
|
79
|
3 |
|
public function setReturnMethod($value) |
80
|
|
|
{ |
81
|
3 |
|
return $this->setParameter('returnMethod', $value); |
82
|
|
|
} |
83
|
|
|
|
84
|
1 |
|
public function getSendMail() |
85
|
|
|
{ |
86
|
1 |
|
return $this->getParameter('sendMail'); |
87
|
|
|
} |
88
|
|
|
|
89
|
3 |
|
public function setSendMail($value) |
90
|
|
|
{ |
91
|
3 |
|
return $this->setParameter('sendMail', $value); |
92
|
|
|
} |
93
|
|
|
|
94
|
|
|
/** |
95
|
|
|
* Payment connector interface test endpoint for specific customer |
96
|
|
|
*/ |
97
|
1 |
|
public function getTestEndpoint() |
98
|
|
|
{ |
99
|
1 |
|
return $this->getParameter('testEndpoint'); |
100
|
|
|
} |
101
|
|
|
|
102
|
3 |
|
public function setTestEndpoint($value) |
103
|
|
|
{ |
104
|
3 |
|
return $this->setParameter('testEndpoint', $value); |
105
|
|
|
} |
106
|
|
|
|
107
|
|
|
/** |
108
|
|
|
* Payment connector interface live endpoint for specific customer |
109
|
|
|
*/ |
110
|
1 |
|
public function getLiveEndpoint() |
111
|
|
|
{ |
112
|
1 |
|
return $this->getParameter('liveEndpoint'); |
113
|
|
|
} |
114
|
|
|
|
115
|
3 |
|
public function setLiveEndpoint($value) |
116
|
|
|
{ |
117
|
3 |
|
return $this->setParameter('liveEndpoint', $value); |
118
|
|
|
} |
119
|
|
|
|
120
|
3 |
|
public function purchase(array $parameters = array()) |
121
|
|
|
{ |
122
|
3 |
|
return $this->createRequest('\Omnipay\EpsomAdelante\Message\PurchaseRequest', $parameters); |
123
|
|
|
} |
124
|
|
|
|
125
|
6 |
|
public function completePurchase(array $parameters = array()) |
126
|
|
|
{ |
127
|
6 |
|
return $this->createRequest('\Omnipay\EpsomAdelante\Message\CompletePurchaseRequest', $parameters); |
128
|
|
|
} |
129
|
|
|
} |
130
|
|
|
|