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

CompleteAuthoriseAndCaptureResponse   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Test Coverage

Coverage 75%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 27
ccs 6
cts 8
cp 0.75
rs 10
wmc 5

3 Methods

Rating   Name   Duplication   Size   Complexity  
A isCancelled() 0 3 2
A getTransactionReference() 0 3 1
A isSuccessful() 0 5 2
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