Test Failed
Push — splits-transaction-status-to-c... ( 9fccda...66d580 )
by Kiet
01:36
created

getTransactionReference()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 0
cts 2
cp 0
crap 2
rs 10
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
 * @see http://docs2.icepay.com/payment-process/transaction-status-flow/transaction-statuses/
10
 */
11
class CompleteAuthoriseAndCaptureResponse extends AbstractResponse
12
{
13
    /**
14
     * {@inheritdoc}
15
     */
16 1
    public function isSuccessful(): bool
17
    {
18 1
        return isset($this->data['status']) && in_array($this->data['status'], [
19 1
            self::RESPONSE_STATUS_COMPLETED,
20 1
            self::RESPONSE_STATUS_SETTLED,
21
        ]);
22
    }
23
24
    /**
25
     * {@inheritdoc}
26
     *
27
     * In case there is no status 'cancelled' available yet, look up for a statusCode querystring in the HttpRequest.
28
     * Icepay will redirect you to the complete page with the statusCode query string.
29
     */
30 1
    public function isCancelled(): bool
31
    {
32 1
        return isset($this->data['status']) && $this->data['status'] === self::RESPONSE_STATUS_CANCELLED ||
33 1
            $this->getRequest()->getHttpRequest()->get('statusCode') === self::RESPONSE_STATUS_CANCELLED;
0 ignored issues
show
Bug introduced by
The method getHttpRequest() does not exist on Omnipay\Common\Message\RequestInterface. It seems like you code against a sub-type of Omnipay\Common\Message\RequestInterface such as Omnipay\IcepayPayments\M...horiseAndCaptureRequest. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

33
            $this->getRequest()->/** @scrutinizer ignore-call */ getHttpRequest()->get('statusCode') === self::RESPONSE_STATUS_CANCELLED;
Loading history...
34
    }
35
36
    /**
37
     * {@inheritdoc}
38
     */
39
    public function getTransactionReference(): ?string
40
    {
41
        return $this->request->getTransactionReference();
42
    }
43
}
44