1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* AcquiroPay Gateway. |
5
|
|
|
*/ |
6
|
|
|
|
7
|
|
|
namespace Omnipay\AcquiroPay; |
8
|
|
|
|
9
|
|
|
use Omnipay\AcquiroPay\Message\AuthorizeRequest; |
10
|
|
|
use Omnipay\AcquiroPay\Message\CaptureRequest; |
11
|
|
|
use Omnipay\AcquiroPay\Message\CompleteAuthorizeRequest; |
12
|
|
|
use Omnipay\AcquiroPay\Message\PurchaseRequest; |
13
|
|
|
use Omnipay\Common\AbstractGateway; |
14
|
|
|
use Omnipay\Common\Message\RequestInterface; |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* @method RequestInterface capture(array $options = array()) |
18
|
|
|
* @method RequestInterface purchase(array $options = array()) |
19
|
|
|
* @method RequestInterface completePurchase(array $options = array()) |
20
|
|
|
* @method RequestInterface refund(array $options = array()) |
21
|
|
|
* @method RequestInterface void(array $options = array()) |
22
|
|
|
* @method RequestInterface createCard(array $options = array()) |
23
|
|
|
* @method RequestInterface updateCard(array $options = array()) |
24
|
|
|
* @method RequestInterface deleteCard(array $options = array()) |
25
|
|
|
*/ |
26
|
|
|
class Gateway extends AbstractGateway |
27
|
|
|
{ |
28
|
|
|
/** |
29
|
|
|
* Get gateway display name. |
30
|
|
|
* |
31
|
|
|
* This can be used by carts to get the display name for each gateway. |
32
|
|
|
* |
33
|
|
|
* @return string |
34
|
|
|
*/ |
35
|
3 |
|
public function getName() |
36
|
|
|
{ |
37
|
3 |
|
return 'AcquiroPay'; |
38
|
|
|
} |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* Get the gateway parameters. |
42
|
|
|
* |
43
|
|
|
* @return array |
44
|
|
|
*/ |
45
|
81 |
|
public function getDefaultParameters() |
46
|
|
|
{ |
47
|
|
|
return array( |
48
|
81 |
|
'merchantId' => '', |
49
|
81 |
|
'productId' => '', |
50
|
81 |
|
'secretWord' => '', |
51
|
81 |
|
); |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* Get a merchant id. |
56
|
|
|
* |
57
|
|
|
* @return string |
58
|
|
|
*/ |
59
|
3 |
|
public function getMerchantId() |
60
|
|
|
{ |
61
|
3 |
|
return $this->getParameter('merchantId'); |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* Set a merchant id. |
66
|
|
|
* |
67
|
|
|
* @param string $value |
68
|
|
|
* |
69
|
|
|
* @return $this |
70
|
|
|
*/ |
71
|
24 |
|
public function setMerchantId($value) |
72
|
|
|
{ |
73
|
24 |
|
return $this->setParameter('merchantId', $value); |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* Get a merchant's product id. |
78
|
|
|
* |
79
|
|
|
* @return string |
80
|
|
|
*/ |
81
|
3 |
|
public function getProductId() |
82
|
|
|
{ |
83
|
3 |
|
return $this->getParameter('productId'); |
84
|
|
|
} |
85
|
|
|
|
86
|
|
|
/** |
87
|
|
|
* Set a merchant's product id. |
88
|
|
|
* |
89
|
|
|
* @param string $value |
90
|
|
|
* |
91
|
|
|
* @return $this |
92
|
|
|
*/ |
93
|
24 |
|
public function setProductId($value) |
94
|
|
|
{ |
95
|
24 |
|
return $this->setParameter('productId', $value); |
96
|
|
|
} |
97
|
|
|
|
98
|
|
|
/** |
99
|
|
|
* Get a secret word. |
100
|
|
|
* |
101
|
|
|
* @return string |
102
|
|
|
*/ |
103
|
3 |
|
public function getSecretWord() |
104
|
|
|
{ |
105
|
3 |
|
return $this->getParameter('secretWord'); |
106
|
|
|
} |
107
|
|
|
|
108
|
|
|
/** |
109
|
|
|
* Set a secret word. |
110
|
|
|
* |
111
|
|
|
* @param string $value |
112
|
|
|
* |
113
|
|
|
* @return $this |
114
|
|
|
*/ |
115
|
24 |
|
public function setSecretWord($value) |
116
|
|
|
{ |
117
|
24 |
|
return $this->setParameter('secretWord', $value); |
118
|
|
|
} |
119
|
|
|
|
120
|
|
|
/** |
121
|
|
|
* Authorize request. |
122
|
|
|
* |
123
|
|
|
* An Authorize request is similar to a purchase request but the |
124
|
|
|
* charge issues an authorization (or pre-authorization), and no money |
125
|
|
|
* is transferred. The transaction will need to be captured later |
126
|
|
|
* in order to effect payment. |
127
|
|
|
* |
128
|
|
|
* @param array $options |
129
|
|
|
* |
130
|
|
|
* @return AuthorizeRequest|RequestInterface |
131
|
|
|
*/ |
132
|
9 |
|
public function authorize(array $options = array()) |
133
|
|
|
{ |
134
|
9 |
|
return $this->createRequest('\Omnipay\AcquiroPay\Message\AuthorizeRequest', $options); |
135
|
|
|
} |
136
|
|
|
|
137
|
|
|
/** |
138
|
|
|
* Handle return from off-site gateways after authorization. |
139
|
|
|
* |
140
|
|
|
* @param array $options |
141
|
|
|
* |
142
|
|
|
* @return CompleteAuthorizeRequest|RequestInterface |
143
|
|
|
*/ |
144
|
6 |
|
public function completeAuthorize(array $options = array()) |
145
|
|
|
{ |
146
|
6 |
|
return $this->createRequest('\Omnipay\AcquiroPay\Message\CompleteAuthorizeRequest', $options); |
147
|
|
|
} |
148
|
|
|
|
149
|
|
|
/** |
150
|
|
|
* Capture Request. |
151
|
|
|
* |
152
|
|
|
* Use this request to capture and process a previously created authorization. |
153
|
|
|
* |
154
|
|
|
* @param array $options |
155
|
|
|
* |
156
|
|
|
* @return CaptureRequest|RequestInterface |
157
|
|
|
*/ |
158
|
6 |
|
public function capture(array $options = array()) |
159
|
|
|
{ |
160
|
6 |
|
return $this->createRequest('\Omnipay\AcquiroPay\Message\CaptureRequest', $options); |
161
|
|
|
} |
162
|
|
|
|
163
|
|
|
/** |
164
|
|
|
* Purchase request. |
165
|
|
|
* |
166
|
|
|
* Authorize and immediately capture an amount on the customers card. |
167
|
|
|
* |
168
|
|
|
* @param array $options |
169
|
|
|
* |
170
|
|
|
* @return PurchaseRequest |
171
|
|
|
*/ |
172
|
6 |
|
public function purchase(array $options = array()) |
173
|
|
|
{ |
174
|
6 |
|
return $this->createRequest('\Omnipay\AcquiroPay\Message\PurchaseRequest', $options); |
175
|
|
|
} |
176
|
|
|
|
177
|
|
|
/** |
178
|
|
|
* Complete purchase request. |
179
|
|
|
* |
180
|
|
|
* Handle return from off-site gateways after purchase. |
181
|
|
|
* |
182
|
|
|
* @param array $options |
183
|
|
|
* |
184
|
|
|
* @return RequestInterface|void |
185
|
|
|
*/ |
186
|
6 |
|
public function completePurchase(array $options = array()) |
187
|
|
|
{ |
188
|
6 |
|
return $this->createRequest('\Omnipay\AcquiroPay\Message\CompletePurchaseRequest', $options); |
189
|
|
|
} |
190
|
|
|
|
191
|
|
|
/** |
192
|
|
|
* Refund request. |
193
|
|
|
* |
194
|
|
|
* Refund an already processed transaction. |
195
|
|
|
* |
196
|
|
|
* @param array $options |
197
|
|
|
* |
198
|
|
|
* @return \Omnipay\Common\Message\AbstractRequest|RequestInterface |
199
|
|
|
*/ |
200
|
6 |
|
public function refund(array $options = array()) |
201
|
|
|
{ |
202
|
6 |
|
return $this->createRequest('\Omnipay\AcquiroPay\Message\RefundRequest', $options); |
203
|
|
|
} |
204
|
|
|
|
205
|
|
|
/** |
206
|
|
|
* Void request. |
207
|
|
|
* |
208
|
|
|
* Generally can only be called up to 24 hours after submitting a transaction. |
209
|
|
|
* |
210
|
|
|
* @param array $options |
211
|
|
|
* |
212
|
|
|
* @return \Omnipay\Common\Message\AbstractRequest|RequestInterface |
213
|
|
|
*/ |
214
|
6 |
|
public function void(array $options = array()) |
215
|
|
|
{ |
216
|
6 |
|
return $this->createRequest('\Omnipay\AcquiroPay\Message\VoidRequest', $options); |
217
|
|
|
} |
218
|
|
|
|
219
|
|
|
/** |
220
|
|
|
* Status request. |
221
|
|
|
* |
222
|
|
|
* @param array $options |
223
|
|
|
* |
224
|
|
|
* @return \Omnipay\Common\Message\AbstractRequest|RequestInterface |
225
|
|
|
*/ |
226
|
|
|
public function status(array $options = array()) { |
227
|
|
|
return $this->createRequest('\Omnipay\AcquiroPay\Message\StatusRequest', $options); |
228
|
|
|
} |
229
|
|
|
} |
230
|
|
|
|