superbrave /
omnipay-icepay-payments
| 1 | <?php |
||
| 2 | |||
| 3 | namespace Omnipay\IcepayPayments\Message; |
||
| 4 | |||
| 5 | /** |
||
| 6 | * The response after complete authorise and capture request. |
||
| 7 | * For this response, we explicitly check what the status is of the payment transaction at Icepay. |
||
| 8 | */ |
||
| 9 | class CompleteAuthoriseAndCaptureResponse extends AbstractResponse |
||
| 10 | { |
||
| 11 | /** |
||
| 12 | * {@inheritdoc} |
||
| 13 | */ |
||
| 14 | 2 | public function isSuccessful(): bool |
|
| 15 | { |
||
| 16 | 2 | return isset($this->data['status']) && in_array($this->data['status'], [ |
|
| 17 | 2 | self::RESPONSE_STATUS_COMPLETED, |
|
| 18 | 2 | self::RESPONSE_STATUS_SETTLED, |
|
| 19 | ]); |
||
| 20 | } |
||
| 21 | |||
| 22 | /** |
||
| 23 | * {@inheritdoc} |
||
| 24 | * |
||
| 25 | * In case there is no status 'cancelled' available in the response (yet), check if there is statusCode in the |
||
| 26 | * queryString. Icepay calls a postback to the completeUrl with data of the payment transaction as queryString. |
||
| 27 | */ |
||
| 28 | 1 | public function isCancelled(): bool |
|
| 29 | { |
||
| 30 | 1 | return isset($this->data['status']) && $this->data['status'] === self::RESPONSE_STATUS_CANCELLED |
|
| 31 | 1 | || $this->request->getHttpRequest()->get('statusCode') === self::RESPONSE_STATUS_CANCELLED; |
|
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 32 | } |
||
| 33 | |||
| 34 | /** |
||
| 35 | * {@inheritdoc} |
||
| 36 | */ |
||
| 37 | 1 | public function getTransactionReference(): ?string |
|
| 38 | { |
||
| 39 | 1 | return $this->request->getTransactionReference(); |
|
| 40 | } |
||
| 41 | } |
||
| 42 |