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