Response::getTransactionReference()   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-onepay
4
 * @copyright (c) PHP Viet
5
 * @license [MIT](http://www.opensource.org/licenses/MIT)
6
 */
7
8
namespace Omnipay\OnePay\Message;
9
10
use Omnipay\Common\Message\AbstractResponse;
11
12
/**
13
 * @method AbstractRequest getRequest()
14
 *
15
 * @author Vuong Minh <[email protected]>
16
 * @since 1.0.0
17
 */
18
class Response extends AbstractResponse
19
{
20
    use Concerns\ResponseProperties;
21
22
    /**
23
     * {@inheritdoc}
24
     */
25
    public function isSuccessful(): bool
26
    {
27
        return '0' === $this->getCode();
28
    }
29
30
    /**
31
     * {@inheritdoc}
32
     */
33
    public function isCancelled(): bool
34
    {
35
        return '99' === $this->getCode();
36
    }
37
38
    /**
39
     * {@inheritdoc}
40
     */
41
    public function getMessage(): ?string
42
    {
43
        return $this->data['vpc_Message'] ?? null;
44
    }
45
46
    /**
47
     * {@inheritdoc}
48
     */
49
    public function getCode(): ?string
50
    {
51
        return $this->data['vpc_TxnResponseCode'] ?? null;
52
    }
53
54
    /**
55
     * {@inheritdoc}
56
     */
57
    public function getTransactionId(): ?string
58
    {
59
        return $this->data['vpc_MerchTxnRef'] ?? null;
60
    }
61
62
    /**
63
     * {@inheritdoc}
64
     */
65
    public function getTransactionReference(): ?string
66
    {
67
        return $this->data['vpc_TransactionNo'] ?? null;
68
    }
69
}
70