Response::getCode()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
/**
3
 * @link https://github.com/phpviet/omnipay-vnpay
4
 *
5
 * @copyright (c) PHP Viet
6
 * @license [MIT](https://opensource.org/licenses/MIT)
7
 */
8
9
namespace Omnipay\VNPay\Message;
10
11
use Omnipay\Common\Message\AbstractResponse;
12
13
/**
14
 * @author Vuong Minh <[email protected]>
15
 * @since 1.0.0
16
 */
17
class Response extends AbstractResponse
18
{
19
    use Concerns\ResponseProperties;
20
21
    /**
22
     * {@inheritdoc}
23
     */
24
    public function isSuccessful(): bool
25
    {
26
        return '00' === $this->getCode();
27
    }
28
29
    /**
30
     * {@inheritdoc}
31
     */
32
    public function isCancelled(): bool
33
    {
34
        return '24' === $this->getCode();
35
    }
36
37
    /**
38
     * {@inheritdoc}
39
     */
40
    public function getCode(): ?string
41
    {
42
        return $this->data['vnp_ResponseCode'] ?? null;
43
    }
44
45
    /**
46
     * {@inheritdoc}
47
     */
48
    public function getTransactionId(): ?string
49
    {
50
        return $this->data['vnp_TxnRef'] ?? null;
51
    }
52
53
    /**
54
     * {@inheritdoc}
55
     */
56
    public function getTransactionReference(): ?string
57
    {
58
        return $this->data['vnp_TransactionNo'] ?? null;
59
    }
60
61
    /**
62
     * {@inheritdoc}
63
     */
64
    public function getMessage(): ?string
65
    {
66
        return $this->data['vnp_Message'] ?? null;
67
    }
68
}
69