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\Dispatching\Endpoints\Orders\Entites; |
15
|
|
|
|
16
|
|
|
use Appwilio\RussianPostSDK\Dispatching\DataAware; |
17
|
|
|
use Appwilio\RussianPostSDK\Dispatching\Contracts\Arrayable; |
18
|
|
|
|
19
|
|
|
final class FiscalData implements Arrayable |
20
|
|
|
{ |
21
|
|
|
use DataAware; |
22
|
|
|
|
23
|
|
|
public function __construct(?string $email, ?string $phone, ?string $name, ?string $inn, ?int $prepaid) |
24
|
|
|
{ |
25
|
|
|
$this->data = [ |
26
|
|
|
'customer-email' => $email, |
27
|
|
|
'customer-inn' => $inn, |
28
|
|
|
'customer-name' => $name, |
29
|
|
|
'customer-phone' => $phone ? (int) \preg_replace('~\D+~', '', $phone) : null, |
30
|
|
|
'payment-amount' => $prepaid, |
31
|
|
|
]; |
32
|
|
|
} |
33
|
|
|
|
34
|
|
|
public function getCustomerEmail(): ?string |
35
|
|
|
{ |
36
|
|
|
return $this->get('customer-email'); |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
public function getCustomerInn(): ?string |
40
|
|
|
{ |
41
|
|
|
return $this->get('customer-inn'); |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
public function getCustomerName(): ?string |
45
|
|
|
{ |
46
|
|
|
return $this->get('customer-name'); |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
public function getCustomerPhone(): ?string |
50
|
|
|
{ |
51
|
|
|
return $this->get('customer-phone', 'string'); |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
public function getPrepaidAmount(): ?int |
55
|
|
|
{ |
56
|
|
|
return $this->get('payment-amount'); |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
public function toArray(): array |
60
|
|
|
{ |
61
|
|
|
return $this->data; |
62
|
|
|
} |
63
|
|
|
} |
64
|
|
|
|