Test Failed
Push — splits-transaction-status-to-c... ( 6a53f6 )
by Kiet
02:00
created

CompleteAuthoriseAndCaptureResponse::isCancelled()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 1
c 1
b 0
f 0
nc 2
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
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 1
    public function isCancelled(): bool
28
    {
29 1
        return isset($this->data['status']) && $this->data['status'] === self::RESPONSE_STATUS_CANCELLED;
30
    }
31
32
    /**
33
     * {@inheritdoc}
34
     */
35
    public function getTransactionReference(): ?string
36
    {
37
        return $this->request->getTransactionReference();
38
    }
39
}
40