1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* This file is part of RussianPost SDK package. |
5
|
|
|
* |
6
|
|
|
* © Appwilio (http://appwilio.com), greabock (https://github.com/greabock), JhaoDa (https://github.com/jhaoda) |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
declare(strict_types=1); |
13
|
|
|
|
14
|
|
|
namespace Appwilio\RussianPostSDK\Tracking\Single; |
15
|
|
|
|
16
|
|
|
final class CashOnDeliveryEvent |
17
|
|
|
{ |
18
|
|
|
/** @var string */ |
19
|
|
|
private $Number; |
20
|
|
|
|
21
|
|
|
/** @var string */ |
22
|
|
|
private $EventDateTime; |
23
|
|
|
|
24
|
|
|
/** @var string */ |
25
|
|
|
private $EventType; |
26
|
|
|
|
27
|
|
|
/** @var string */ |
28
|
|
|
private $EventName; |
29
|
|
|
|
30
|
|
|
/** @var string */ |
31
|
|
|
private $IndexTo; |
32
|
|
|
|
33
|
|
|
/** @var string */ |
34
|
|
|
private $IndexEvent; |
35
|
|
|
|
36
|
|
|
/** @var string */ |
37
|
|
|
private $SumPaymentForward; |
38
|
|
|
|
39
|
|
|
/** @var string */ |
40
|
|
|
private $CountryEventCode; |
41
|
|
|
|
42
|
|
|
/** @var string */ |
43
|
|
|
private $CountryToCode; |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* Номер почтового перевода наложенного платежа (Number). |
47
|
|
|
* |
48
|
|
|
* @return string |
49
|
|
|
*/ |
50
|
|
|
public function getNumber(): string |
51
|
|
|
{ |
52
|
|
|
return $this->Number; |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* Дата и время операции (EventDateTime). |
57
|
|
|
* |
58
|
|
|
* @return \DateTimeImmutable |
59
|
|
|
*/ |
60
|
|
|
public function getPerformedAt(): \DateTimeImmutable |
61
|
|
|
{ |
62
|
|
|
// Использовать \DATE_RFC3339_EXTENDED можно только в PHP 7.3+ |
63
|
|
|
// @see https://bugs.php.net/bug.php?id=76009 |
64
|
|
|
return \DateTimeImmutable::createFromFormat('Y-m-d\TH:i:s.???P', $this->EventDateTime); |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* Код операции с наложенным платежом (EventType). |
69
|
|
|
* |
70
|
|
|
* @link https://tracking.pochta.ru/support/dictionaries/event_type |
71
|
|
|
* |
72
|
|
|
* @return int |
73
|
|
|
*/ |
74
|
|
|
public function getOperationId(): int |
75
|
|
|
{ |
76
|
|
|
return (int) $this->EventType; |
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
/** |
80
|
|
|
* Название операции (EventName). |
81
|
|
|
* |
82
|
|
|
* @link https://tracking.pochta.ru/support/dictionaries/event_type |
83
|
|
|
* |
84
|
|
|
* @return string |
85
|
|
|
*/ |
86
|
|
|
public function getOperationName(): string |
87
|
|
|
{ |
88
|
|
|
return $this->EventName; |
89
|
|
|
} |
90
|
|
|
|
91
|
|
|
/** |
92
|
|
|
* @return string |
93
|
|
|
*/ |
94
|
|
|
public function getIndexTo(): string |
95
|
|
|
{ |
96
|
|
|
return $this->IndexTo; |
97
|
|
|
} |
98
|
|
|
|
99
|
|
|
/** |
100
|
|
|
* @return string |
101
|
|
|
*/ |
102
|
|
|
public function getEventPostalCode(): string |
103
|
|
|
{ |
104
|
|
|
return $this->IndexEvent; |
105
|
|
|
} |
106
|
|
|
|
107
|
|
|
/** |
108
|
|
|
* Сумма наложенного платежа в копейках (SumPaymentForward). |
109
|
|
|
* |
110
|
|
|
* @return int |
111
|
|
|
*/ |
112
|
|
|
public function getPayment(): int |
113
|
|
|
{ |
114
|
|
|
return (int) $this->SumPaymentForward; |
115
|
|
|
} |
116
|
|
|
|
117
|
|
|
/** |
118
|
|
|
* @return string |
119
|
|
|
*/ |
120
|
|
|
public function getEventCountryCode(): string |
121
|
|
|
{ |
122
|
|
|
return $this->CountryEventCode; |
123
|
|
|
} |
124
|
|
|
|
125
|
|
|
/** |
126
|
|
|
* @return string |
127
|
|
|
*/ |
128
|
|
|
public function getDestinationCountryCode(): string |
129
|
|
|
{ |
130
|
|
|
return $this->CountryToCode; |
131
|
|
|
} |
132
|
|
|
} |
133
|
|
|
|