1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Nexy\PayboxDirect\Response; |
4
|
|
|
|
5
|
|
|
/** |
6
|
|
|
* @author Sullivan Senechal <[email protected]> |
7
|
|
|
*/ |
8
|
|
|
abstract class AbstractResponse implements ResponseInterface |
9
|
|
|
{ |
10
|
|
|
/** |
11
|
|
|
* @var int |
12
|
|
|
*/ |
13
|
|
|
private $code; |
14
|
|
|
|
15
|
|
|
/** |
16
|
|
|
* @var string |
17
|
|
|
*/ |
18
|
|
|
private $comment; |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* @var string |
22
|
|
|
*/ |
23
|
|
|
private $site; |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* @var string |
27
|
|
|
*/ |
28
|
|
|
private $rank; |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* @var int |
32
|
|
|
*/ |
33
|
|
|
private $callNumber; |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* @var int |
37
|
|
|
*/ |
38
|
|
|
private $questionNumber; |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* @var int |
42
|
|
|
*/ |
43
|
|
|
private $transactionNumber; |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* @var string|null|false |
47
|
|
|
*/ |
48
|
|
|
private $country = null; |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* @var string|null|false |
52
|
|
|
*/ |
53
|
|
|
private $sha1 = null; |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* @var string|null|false |
57
|
|
|
*/ |
58
|
|
|
private $cardType = null; |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* @param string[] $data |
62
|
|
|
*/ |
63
|
|
|
public function __construct(array $data) |
64
|
|
|
{ |
65
|
|
|
$this->code = intval($data['CODEREPONSE']); |
66
|
|
|
$this->comment = $data['COMMENTAIRE']; |
67
|
|
|
$this->site = $data['SITE']; |
68
|
|
|
$this->rank = $data['RANG']; |
69
|
|
|
$this->callNumber = intval($data['NUMAPPEL']); |
70
|
|
|
$this->questionNumber = intval($data['NUMQUESTION']); |
71
|
|
|
$this->transactionNumber = intval($data['NUMTRANS']); |
72
|
|
|
|
73
|
|
|
if (array_key_exists('PAYS', $data)) { |
74
|
|
|
$this->country = in_array($data['PAYS'], ['', '???'], true) ? false : $data['PAYS']; |
75
|
|
|
} |
76
|
|
|
if (array_key_exists('SHA-1', $data)) { |
77
|
|
|
$this->sha1 = '' === $data['SHA-1'] ? false : $data['SHA-1']; |
78
|
|
|
} |
79
|
|
|
if (array_key_exists('TYPECARTE', $data)) { |
80
|
|
|
$this->cardType = '' === $data['TYPECARTE'] ? false : $data['TYPECARTE']; |
81
|
|
|
} |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
/** |
85
|
|
|
* {@inheritdoc} |
86
|
|
|
*/ |
87
|
|
|
final public function getCode() |
88
|
|
|
{ |
89
|
|
|
return $this->code; |
90
|
|
|
} |
91
|
|
|
|
92
|
|
|
/** |
93
|
|
|
* {@inheritdoc} |
94
|
|
|
*/ |
95
|
|
|
final public function getComment() |
96
|
|
|
{ |
97
|
|
|
return $this->comment; |
98
|
|
|
} |
99
|
|
|
|
100
|
|
|
/** |
101
|
|
|
* {@inheritdoc} |
102
|
|
|
*/ |
103
|
|
|
final public function getSite() |
104
|
|
|
{ |
105
|
|
|
return $this->site; |
106
|
|
|
} |
107
|
|
|
|
108
|
|
|
/** |
109
|
|
|
* {@inheritdoc} |
110
|
|
|
*/ |
111
|
|
|
final public function getRank() |
112
|
|
|
{ |
113
|
|
|
return $this->rank; |
114
|
|
|
} |
115
|
|
|
|
116
|
|
|
/** |
117
|
|
|
* {@inheritdoc} |
118
|
|
|
*/ |
119
|
|
|
final public function getCallNumber() |
120
|
|
|
{ |
121
|
|
|
return $this->callNumber; |
122
|
|
|
} |
123
|
|
|
|
124
|
|
|
/** |
125
|
|
|
* {@inheritdoc} |
126
|
|
|
*/ |
127
|
|
|
final public function getQuestionNumber() |
128
|
|
|
{ |
129
|
|
|
return $this->questionNumber; |
130
|
|
|
} |
131
|
|
|
|
132
|
|
|
/** |
133
|
|
|
* {@inheritdoc} |
134
|
|
|
*/ |
135
|
|
|
final public function getTransactionNumber() |
136
|
|
|
{ |
137
|
|
|
return $this->transactionNumber; |
138
|
|
|
} |
139
|
|
|
|
140
|
|
|
/** |
141
|
|
|
* {@inheritdoc} |
142
|
|
|
*/ |
143
|
|
|
public function getCountry() |
144
|
|
|
{ |
145
|
|
|
return $this->country; |
146
|
|
|
} |
147
|
|
|
|
148
|
|
|
/** |
149
|
|
|
* {@inheritdoc} |
150
|
|
|
*/ |
151
|
|
|
final public function getSha1() |
152
|
|
|
{ |
153
|
|
|
return $this->sha1; |
154
|
|
|
} |
155
|
|
|
|
156
|
|
|
/** |
157
|
|
|
* {@inheritdoc} |
158
|
|
|
*/ |
159
|
|
|
public function getCardType() |
160
|
|
|
{ |
161
|
|
|
return $this->cardType; |
162
|
|
|
} |
163
|
|
|
} |
164
|
|
|
|