@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | return ( |
32 | 32 | $transaction && |
33 | 33 | ($transaction['authorised'] ?? false) && |
34 | - ( strtoupper($transaction['responseText'] ?? '') ) === 'APPROVED' |
|
34 | + (strtoupper($transaction['responseText'] ?? '')) === 'APPROVED' |
|
35 | 35 | ) ?? false; |
36 | 36 | } |
37 | 37 | |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | |
91 | 91 | public function getCardExpiry() |
92 | 92 | { |
93 | - return ($this->getCard()['dateExpiryMonth'] ?? '') . '/' . ($this->getCard()['dateExpiryYear'] ?? ''); |
|
93 | + return ($this->getCard()['dateExpiryMonth'] ?? '').'/'.($this->getCard()['dateExpiryYear'] ?? ''); |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | public function getCardType() |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | } |
17 | 17 | public function sendData($data) |
18 | 18 | { |
19 | - if ( !$data['sessionId'] ) { |
|
19 | + if (!$data['sessionId']) { |
|
20 | 20 | throw new InvalidRequestException('Session id is required'); |
21 | 21 | } |
22 | 22 | |
@@ -25,11 +25,11 @@ discard block |
||
25 | 25 | $headers = [ |
26 | 26 | 'Accept' => 'application/json', |
27 | 27 | 'Content-Type' => 'application/json', |
28 | - 'Authorization' => 'Basic ' . $this->getAuthorization() |
|
28 | + 'Authorization' => 'Basic '.$this->getAuthorization() |
|
29 | 29 | ]; |
30 | 30 | |
31 | 31 | try { |
32 | - $httpResponse = $this->httpClient->request('GET', $this->getEndpoint('sessions/' . $sessionId), $headers); |
|
32 | + $httpResponse = $this->httpClient->request('GET', $this->getEndpoint('sessions/'.$sessionId), $headers); |
|
33 | 33 | } catch (\Exception $exception) { |
34 | 34 | throw new InvalidRequestException($exception->getMessage()); |
35 | 35 | } |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | use Omnipay\Common\Message\NotificationInterface; |
9 | 9 | use Symfony\Component\HttpFoundation\Request as HttpRequest; |
10 | 10 | |
11 | -class AcceptNotification extends PurchaseRequest implements NotificationInterface{ |
|
11 | +class AcceptNotification extends PurchaseRequest implements NotificationInterface { |
|
12 | 12 | protected $data; |
13 | 13 | |
14 | 14 | protected $transaction; |
@@ -21,18 +21,18 @@ discard block |
||
21 | 21 | { |
22 | 22 | $sessionId = $this->httpRequest->query->get('sessionId') ?? $this->httpRequest->request->get('sessionId') ?? ''; |
23 | 23 | |
24 | - if ( empty($sessionId) ) { |
|
24 | + if (empty($sessionId)) { |
|
25 | 25 | throw new InvalidRequestException('Session id is required'); |
26 | 26 | } |
27 | 27 | |
28 | 28 | $headers = [ |
29 | 29 | 'Accept' => 'application/json', |
30 | 30 | 'Content-Type' => 'application/json', |
31 | - 'Authorization' => 'Basic ' . $this->getAuthorization() |
|
31 | + 'Authorization' => 'Basic '.$this->getAuthorization() |
|
32 | 32 | ]; |
33 | 33 | |
34 | 34 | try { |
35 | - $httpResponse = $this->httpClient->request('GET', $this->getEndpoint('sessions/' . $sessionId), $headers); |
|
35 | + $httpResponse = $this->httpClient->request('GET', $this->getEndpoint('sessions/'.$sessionId), $headers); |
|
36 | 36 | } catch (\Exception $exception) { |
37 | 37 | throw new InvalidRequestException($exception->getMessage()); |
38 | 38 | } |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | |
58 | 58 | public function getTransactionStatus() |
59 | 59 | { |
60 | - if ( $this->getTransaction() && $this->getAuthorised() && $this->getResponseText() === 'APPROVED' ) { |
|
60 | + if ($this->getTransaction() && $this->getAuthorised() && $this->getResponseText() === 'APPROVED') { |
|
61 | 61 | return static::STATUS_COMPLETED; |
62 | 62 | } |
63 | 63 |
@@ -23,8 +23,8 @@ |
||
23 | 23 | |
24 | 24 | public function getRedirectUrl() |
25 | 25 | { |
26 | - foreach ( $this->data->links ?? [] as $link ) { |
|
27 | - if ( $link->rel === 'hpp' ) { |
|
26 | + foreach ($this->data->links ?? [] as $link) { |
|
27 | + if ($link->rel === 'hpp') { |
|
28 | 28 | return $link->href; |
29 | 29 | } |
30 | 30 | } |
@@ -85,8 +85,8 @@ discard block |
||
85 | 85 | 'oxipay', 'visacheckout', 'wechat' |
86 | 86 | ]; |
87 | 87 | |
88 | - foreach ( $list as $method ) { |
|
89 | - if ( !in_array($method, $options) ) { |
|
88 | + foreach ($list as $method) { |
|
89 | + if (!in_array($method, $options)) { |
|
90 | 90 | throw new InvalidRequestException("Unknown payment method: {$method}"); |
91 | 91 | } |
92 | 92 | } |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | 'resubmission', 'reauthorisation', 'delayedcharges', 'noshow' |
149 | 149 | ]; |
150 | 150 | |
151 | - if ( ! in_array($value, $options) ) { |
|
151 | + if (!in_array($value, $options)) { |
|
152 | 152 | throw new InvalidRequestException("Invalid option '{$value}' set for StoredCardIndicator."); |
153 | 153 | } |
154 | 154 | |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | 'twomonthly', 'threemonthly', 'fourmonthly', 'sixmonthly', 'annually' |
180 | 180 | ]; |
181 | 181 | |
182 | - if ( ! in_array($value, $options) ) { |
|
182 | + if (!in_array($value, $options)) { |
|
183 | 183 | throw new InvalidRequestException("Invalid option '{$value}' set for RecurringFrequency."); |
184 | 184 | } |
185 | 185 | |
@@ -203,35 +203,35 @@ discard block |
||
203 | 203 | $data['storeCard'] = (bool) $this->getStoreCard() ?? false; |
204 | 204 | $data['callbackUrls'] = []; |
205 | 205 | |
206 | - if ( is_array($this->getPaymentMethods()) ) { |
|
206 | + if (is_array($this->getPaymentMethods())) { |
|
207 | 207 | $data['methods'] = $this->getPaymentMethods(); |
208 | 208 | } |
209 | 209 | |
210 | - if ( is_array($this->getCardTypes()) ) { |
|
210 | + if (is_array($this->getCardTypes())) { |
|
211 | 211 | $data['cardTypes'] = $this->getCardTypes(); |
212 | 212 | } |
213 | 213 | |
214 | - if ( is_array($this->getMetadata()) ) { |
|
214 | + if (is_array($this->getMetadata())) { |
|
215 | 215 | $data['metaData'] = $this->getMetadata(); |
216 | 216 | } |
217 | 217 | |
218 | - if ( $this->getMerchantReference() ) { |
|
218 | + if ($this->getMerchantReference()) { |
|
219 | 219 | $data['merchantReference'] = $this->getMerchantReference(); |
220 | 220 | } |
221 | 221 | |
222 | - if ( $this->getReturnUrl() ) { |
|
222 | + if ($this->getReturnUrl()) { |
|
223 | 223 | $data['callbackUrls']['approved'] = $this->getReturnUrl(); |
224 | 224 | } |
225 | 225 | |
226 | - if ( $this->getDeclineUrl() ) { |
|
226 | + if ($this->getDeclineUrl()) { |
|
227 | 227 | $data['callbackUrls']['declined'] = $this->getDeclineUrl(); |
228 | 228 | } |
229 | 229 | |
230 | - if ( $this->getCancelUrl() ) { |
|
230 | + if ($this->getCancelUrl()) { |
|
231 | 231 | $data['callbackUrls']['cancelled'] = $this->getCancelUrl(); |
232 | 232 | } |
233 | 233 | |
234 | - if ( $this->getNotifyUrl() ) { |
|
234 | + if ($this->getNotifyUrl()) { |
|
235 | 235 | $data['notificationUrl'] = $this->getNotifyUrl(); |
236 | 236 | } |
237 | 237 | |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | $headers = [ |
244 | 244 | 'Accept' => 'application/json', |
245 | 245 | 'Content-Type' => 'application/json', |
246 | - 'Authorization' => 'Basic ' . $this->getAuthorization() |
|
246 | + 'Authorization' => 'Basic '.$this->getAuthorization() |
|
247 | 247 | ]; |
248 | 248 | |
249 | 249 | $httpResponse = $this->httpClient->request('POST', $this->getEndpoint('sessions'), $headers, json_encode($data)); |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | */ |
268 | 268 | protected function getEndpoint($path = '') |
269 | 269 | { |
270 | - return ($this->getTestMode() ? self::endpointTest : self::endpointLive) . '/' . $path; |
|
270 | + return ($this->getTestMode() ? self::endpointTest : self::endpointLive).'/'.$path; |
|
271 | 271 | } |
272 | 272 | |
273 | 273 | protected function getAuthorization() |