@@ -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 | } |
@@ -150,35 +150,35 @@ discard block |
||
| 150 | 150 | $data['storeCard'] = (bool) $this->getStoreCard() ?? false; |
| 151 | 151 | $data['callbackUrls'] = []; |
| 152 | 152 | |
| 153 | - if ( is_array($this->getPaymentMethods()) ) { |
|
| 153 | + if (is_array($this->getPaymentMethods())) { |
|
| 154 | 154 | $data['methods'] = $this->getPaymentMethods(); |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | - if ( is_array($this->getCardTypes()) ) { |
|
| 157 | + if (is_array($this->getCardTypes())) { |
|
| 158 | 158 | $data['cardTypes'] = $this->getCardTypes(); |
| 159 | 159 | } |
| 160 | 160 | |
| 161 | - if ( is_array($this->getMetadata()) ) { |
|
| 161 | + if (is_array($this->getMetadata())) { |
|
| 162 | 162 | $data['metaData'] = $this->getMetadata(); |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | - if ( $this->getMerchantReference() ) { |
|
| 165 | + if ($this->getMerchantReference()) { |
|
| 166 | 166 | $data['merchantReference'] = $this->getMerchantReference(); |
| 167 | 167 | } |
| 168 | 168 | |
| 169 | - if ( $this->getReturnUrl() ) { |
|
| 169 | + if ($this->getReturnUrl()) { |
|
| 170 | 170 | $data['callbackUrls']['approved'] = $this->getReturnUrl(); |
| 171 | 171 | } |
| 172 | 172 | |
| 173 | - if ( $this->getDeclineUrl() ) { |
|
| 173 | + if ($this->getDeclineUrl()) { |
|
| 174 | 174 | $data['callbackUrls']['declined'] = $this->getDeclineUrl(); |
| 175 | 175 | } |
| 176 | 176 | |
| 177 | - if ( $this->getCancelUrl() ) { |
|
| 177 | + if ($this->getCancelUrl()) { |
|
| 178 | 178 | $data['callbackUrls']['cancelled'] = $this->getCancelUrl(); |
| 179 | 179 | } |
| 180 | 180 | |
| 181 | - if ( $this->getNotifyUrl() ) { |
|
| 181 | + if ($this->getNotifyUrl()) { |
|
| 182 | 182 | $data['notificationUrl'] = $this->getNotifyUrl(); |
| 183 | 183 | } |
| 184 | 184 | |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | $headers = [ |
| 191 | 191 | 'Accept' => 'application/json', |
| 192 | 192 | 'Content-Type' => 'application/json', |
| 193 | - 'Authorization' => 'Basic ' . $this->getAuthorization() |
|
| 193 | + 'Authorization' => 'Basic '.$this->getAuthorization() |
|
| 194 | 194 | ]; |
| 195 | 195 | |
| 196 | 196 | $httpResponse = $this->httpClient->request('POST', $this->getEndpoint('sessions'), $headers, json_encode($data)); |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | */ |
| 215 | 215 | protected function getEndpoint($path = '') |
| 216 | 216 | { |
| 217 | - return ($this->getTestMode() ? self::endpointTest : self::endpointLive) . '/' . $path; |
|
| 217 | + return ($this->getTestMode() ? self::endpointTest : self::endpointLive).'/'.$path; |
|
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | protected function getAuthorization() |
@@ -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 | } |