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

AbstractResponse::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 0
Metric Value
cc 2
eloc 1
c 0
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
declare(strict_types=1);
4
5
namespace Omnipay\IcepayPayments\Message;
6
7
use Omnipay\Common\Message\AbstractResponse as OmnipayAbstractResponse;
8
9
abstract class AbstractResponse extends OmnipayAbstractResponse
10
{
11
    /**
12
     * A transaction was initiated by the consumer. This is a temporary status only when the platform is busy initiating
13
     * the transaction.
14
     *
15
     * @var string
16
     */
17
    public const TRANSACTION_STATUS_PENDING = 'PENDING';
18
19
    /**
20
     * The payment process was started by the consumer after initiation of the transaction.
21
     *
22
     * @var string
23
     */
24
    public const TRANSACTION_STATUS_STARTED = 'STARTED';
25
26
    /**
27
     * The transaction was successfully processed and was cleared by the payments system.
28
     *
29
     * Funds have not (yet) been received by ICEPAY. It’s the customers own risk to deliver products and/or services
30
     * based on this status.
31
     *
32
     * @var string
33
     */
34
    public const TRANSACTION_STATUS_COMPLETED = 'COMPLETED';
35
36
    /**
37
     * The transaction has been cancelled by the consumer.
38
     *
39
     * @var string
40
     */
41
    public const TRANSACTION_STATUS_CANCELLED = 'CANCELLED';
42
43
    /**
44
     * The consumer did not complete the transaction in due time.
45
     *
46
     * @var string
47
     */
48
    public const TRANSACTION_STATUS_EXPIRED = 'EXPIRED';
49
50
    /**
51
     * The transaction failed due to technical reasons.
52
     *
53
     * @var string
54
     */
55
    public const TRANSACTION_STATUS_FAILED = 'FAILED';
56
57
    /**
58
     * The transaction failed due to functional reasons.
59
     *
60
     * @var string
61
     */
62
    public const TRANSACTION_STATUS_REJECTED = 'REJECTED';
63
64
    /**
65
     * The transaction was settled to ICEPAY, funds were received by ICEPAY and the transaction was fully reconciled in
66
     * the payments system. The transaction will be credited to the balance of the merchant and is available for payout.
67
     *
68
     * @var string
69
     */
70
    public const TRANSACTION_STATUS_SETTLED = 'SETTLED';
71
72
    /**
73
     * Get the transaction status.
74
     *
75
     * @see https://documentation.icepay.com/payments/payment-process/transaction-flow/
76
     *
77
     * @return string|null
78
     */
79
    abstract protected function getTransactionStatus(): ?string;
80
81
    /**
82
     * The transaction id that was given by ICEPAY.
83
     *
84
     * {@inheritdoc}
85
     */
86
    public function getTransactionReference(): ?string
87
    {
88
        return $this->data['transactionId'] ?? null;
89
    }
90
}
91