PaymentResult::getDescription()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Orkhanahmadov\Goldenpay\Response;
4
5
use DateTimeImmutable;
6
7
class PaymentResult extends Response
8
{
9
    /**
10
     * @var PaymentKey
11
     */
12
    private $paymentKey;
13
    /**
14
     * @var string
15
     */
16
    private $merchantName;
17
    /**
18
     * @var int
19
     */
20
    private $amount;
21
    /**
22
     * @var int
23
     */
24
    private $checkCount;
25
    /**
26
     * @var DateTimeImmutable|null
27
     */
28
    private $paymentDate = null;
29
    /**
30
     * @var string|null
31
     */
32
    private $cardNumber = null;
33
    /**
34
     * @var string
35
     */
36
    private $language;
37
    /**
38
     * @var string
39
     */
40
    private $description;
41
    /**
42
     * @var string|null
43
     */
44
    private $referenceNumber = null;
45
46
    /**
47
     * PaymentResult constructor.
48
     *
49
     * @param array  $data
50
     * @param int    $code
51
     * @param string $message
52
     */
53
    public function __construct(array $data, int $code, string $message)
54
    {
55
        parent::__construct($code, $message);
56
57
        $this->paymentKey = new PaymentKey($data['paymentKey']);
58
        $this->merchantName = $data['merchantName'];
59
        $this->amount = $data['amount'];
60
        $this->checkCount = $data['checkCount'];
61
        $this->cardNumber = $data['cardNumber'];
62
        $this->language = $data['language'];
63
        $this->description = $data['description'];
64
        $this->referenceNumber = $data['rrn'];
65
66
        if ($data['paymentDate']) {
67
            $this->paymentDate = new DateTimeImmutable($data['paymentDate']);
68
        }
69
    }
70
71
    /**
72
     * @return PaymentKey
73
     */
74
    public function getPaymentKey(): PaymentKey
75
    {
76
        return $this->paymentKey;
77
    }
78
79
    /**
80
     * @return string
81
     */
82
    public function getMerchantName(): string
83
    {
84
        return $this->merchantName;
85
    }
86
87
    /**
88
     * @return int
89
     */
90
    public function getAmount(): int
91
    {
92
        return $this->amount;
93
    }
94
95
    /**
96
     * @return int
97
     */
98
    public function getCheckCount(): int
99
    {
100
        return $this->checkCount;
101
    }
102
103
    /**
104
     * @return DateTimeImmutable|null
105
     */
106
    public function getPaymentDate(): ?DateTimeImmutable
107
    {
108
        return $this->paymentDate;
109
    }
110
111
    /**
112
     * @return string|null
113
     */
114
    public function getCardNumber(): ?string
115
    {
116
        return $this->cardNumber;
117
    }
118
119
    /**
120
     * @return string
121
     */
122
    public function getLanguage(): string
123
    {
124
        return $this->language;
125
    }
126
127
    /**
128
     * @return string
129
     */
130
    public function getDescription(): string
131
    {
132
        return $this->description;
133
    }
134
135
    /**
136
     * @return string|null
137
     */
138
    public function getReferenceNumber(): ?string
139
    {
140
        return $this->referenceNumber;
141
    }
142
}
143