Passed
Pull Request — master (#20)
by Kiet
02:29
created

RefundResponse   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 4
c 2
b 0
f 0
dl 0
loc 24
ccs 0
cts 11
cp 0
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getTransactionStatus() 0 3 1
A isCancelled() 0 3 1
A isSuccessful() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Omnipay\IcepayPayments\Message;
6
7
/**
8
 * Do note: refunds implementation has not been tested.
9
 */
10
class RefundResponse extends AbstractResponse
11
{
12
    /**
13
     * {@inheritdoc}
14
     */
15
    public function isSuccessful(): bool
16
    {
17
        return $this->getTransactionStatus() === self::TRANSACTION_STATUS_COMPLETED;
18
    }
19
20
    /**
21
     * {@inheritdoc}
22
     */
23
    public function isCancelled(): bool
24
    {
25
        return $this->getTransactionStatus() === self::TRANSACTION_STATUS_CANCELLED;
26
    }
27
28
    /**
29
     * {@inheritdoc}
30
     */
31
    protected function getTransactionStatus(): ?string
32
    {
33
        return $this->data['refundStatusCode'] ?? null;
34
    }
35
}
36