1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace zaporylie\Vipps\Model\Error; |
4
|
|
|
|
5
|
|
|
use JMS\Serializer\Annotation as Serializer; |
6
|
|
|
|
7
|
|
|
class AuthorizationError implements ErrorInterface |
8
|
|
|
{ |
9
|
|
|
|
10
|
|
|
/** |
11
|
|
|
* @var string |
12
|
|
|
* @Serializer\Type("string") |
13
|
|
|
*/ |
14
|
|
|
protected $error; |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* @var string |
18
|
|
|
* @Serializer\Type("string") |
19
|
|
|
*/ |
20
|
|
|
protected $errorDescription; |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* @var array |
24
|
|
|
* @Serializer\Type("array") |
25
|
|
|
*/ |
26
|
|
|
protected $errorCodes; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* @var \DateTimeInterface |
30
|
|
|
* @Serializer\Type("DateTime<'Y-m-d H:i:s\Z'>") |
31
|
|
|
*/ |
32
|
|
|
protected $timestamp; |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* @var string |
36
|
|
|
* @Serializer\Type("string") |
37
|
|
|
*/ |
38
|
|
|
protected $traceId; |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* @var string |
42
|
|
|
* @Serializer\Type("string") |
43
|
|
|
*/ |
44
|
|
|
protected $correlationId; |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* Gets error value. |
48
|
|
|
* |
49
|
|
|
* @return string |
50
|
|
|
*/ |
51
|
|
|
public function getError() |
52
|
|
|
{ |
53
|
|
|
return $this->error; |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* Gets errorDescription value. |
58
|
|
|
* |
59
|
|
|
* @return string |
60
|
|
|
*/ |
61
|
|
|
public function getErrorDescription() |
62
|
|
|
{ |
63
|
|
|
return $this->errorDescription; |
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* Gets errorCodes value. |
68
|
|
|
* |
69
|
|
|
* @return array |
70
|
|
|
*/ |
71
|
|
|
public function getErrorCodes() |
72
|
|
|
{ |
73
|
|
|
return $this->errorCodes; |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* Gets timestamp value. |
78
|
|
|
* |
79
|
|
|
* @return \DateTimeInterface |
80
|
|
|
*/ |
81
|
|
|
public function getTimestamp() |
82
|
|
|
{ |
83
|
|
|
return $this->timestamp; |
84
|
|
|
} |
85
|
|
|
|
86
|
|
|
/** |
87
|
|
|
* Gets traceId value. |
88
|
|
|
* |
89
|
|
|
* @return string |
90
|
|
|
*/ |
91
|
|
|
public function getTraceId() |
92
|
|
|
{ |
93
|
|
|
return $this->traceId; |
94
|
|
|
} |
95
|
|
|
|
96
|
|
|
/** |
97
|
|
|
* Gets correlationId value. |
98
|
|
|
* |
99
|
|
|
* @return string |
100
|
|
|
*/ |
101
|
|
|
public function getCorrelationId() |
102
|
|
|
{ |
103
|
|
|
return $this->correlationId; |
104
|
|
|
} |
105
|
|
|
|
106
|
|
|
/** |
107
|
|
|
* {@inheritdoc} |
108
|
|
|
*/ |
109
|
|
|
public function getCode() |
110
|
|
|
{ |
111
|
|
|
return implode(',', $this->getErrorCodes()); |
112
|
|
|
} |
113
|
|
|
|
114
|
|
|
/** |
115
|
|
|
* {@inheritdoc} |
116
|
|
|
*/ |
117
|
|
|
public function getMessage() |
118
|
|
|
{ |
119
|
|
|
return $this->getErrorDescription(); |
120
|
|
|
} |
121
|
|
|
} |
122
|
|
|
|