Passed
Push — master ( 025568...a4d989 )
by Orkhan
01:44 queued 11s
created

PaymentResult::getMerchantName()   A

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