1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file has been created by developers from BitBag. |
5
|
|
|
* Feel free to contact us once you face any issues or want to start |
6
|
|
|
* another great project. |
7
|
|
|
* You can find more information about us on https://bitbag.io and write us |
8
|
|
|
* an email on [email protected]. |
9
|
|
|
*/ |
10
|
|
|
|
11
|
|
|
declare(strict_types=1); |
12
|
|
|
|
13
|
|
|
namespace BitBag\SyliusVueStorefrontPlugin\Document\TaxRule\TaxRate; |
14
|
|
|
|
15
|
|
|
class Rate implements \JsonSerializable |
16
|
|
|
{ |
17
|
|
|
private const ID = 'id'; |
18
|
|
|
|
19
|
|
|
private const CODE = 'code'; |
20
|
|
|
|
21
|
|
|
private const RATE = 'rate'; |
22
|
|
|
|
23
|
|
|
private const COUNTRY_NAME = 'tax_country_id'; |
24
|
|
|
|
25
|
|
|
private const REGION_ID = 'tax_region_id'; |
26
|
|
|
|
27
|
|
|
private const POSTCODE = 'tax_postcode'; |
28
|
|
|
|
29
|
|
|
private const IS_ZIP_RANGE = 'zip_is_range'; |
30
|
|
|
|
31
|
|
|
private const ZIP_RANGE_START = 'zip_from'; |
32
|
|
|
|
33
|
|
|
private const ZIP_RANGE_END = 'zip_to'; |
34
|
|
|
|
35
|
|
|
/** @var int */ |
36
|
|
|
private $id; |
37
|
|
|
|
38
|
|
|
/** @var string */ |
39
|
|
|
private $code; |
40
|
|
|
|
41
|
|
|
/** @var int */ |
42
|
|
|
private $rate; |
43
|
|
|
|
44
|
|
|
/** @var string */ |
45
|
|
|
private $countryName; |
46
|
|
|
|
47
|
|
|
/** @var int */ |
48
|
|
|
private $regionId; |
49
|
|
|
|
50
|
|
|
/** @var int */ |
51
|
|
|
private $postcode; |
52
|
|
|
|
53
|
|
|
/** @var bool|null */ |
54
|
|
|
private $isZipRange; |
55
|
|
|
|
56
|
|
|
/** @var string|null */ |
57
|
|
|
private $zipRangeStart; |
58
|
|
|
|
59
|
|
|
/** @var string|null */ |
60
|
|
|
private $zipRangeEnd; |
61
|
|
|
|
62
|
|
|
public function __construct( |
63
|
|
|
int $id, |
64
|
|
|
string $code, |
65
|
|
|
int $rate, |
66
|
|
|
string $countryName, |
67
|
|
|
int $regionId, |
68
|
|
|
int $postcode, |
69
|
|
|
?bool $isZipRange, |
70
|
|
|
?string $zipRangeStart, |
71
|
|
|
?string $zipRangeEnd |
72
|
|
|
) { |
73
|
|
|
$this->id = $id; |
74
|
|
|
$this->code = $code; |
75
|
|
|
$this->rate = $rate; |
76
|
|
|
$this->countryName = $countryName; |
77
|
|
|
$this->regionId = $regionId; |
78
|
|
|
$this->postcode = $postcode; |
79
|
|
|
$this->isZipRange = $isZipRange; |
80
|
|
|
$this->zipRangeStart = $zipRangeStart; |
81
|
|
|
$this->zipRangeEnd = $zipRangeEnd; |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
public function jsonSerialize(): array |
85
|
|
|
{ |
86
|
|
|
return [ |
87
|
|
|
self::ID => $this->id, |
88
|
|
|
self::CODE => $this->code, |
89
|
|
|
self::RATE => $this->rate, |
90
|
|
|
self::COUNTRY_NAME => $this->countryName, |
91
|
|
|
self::REGION_ID => $this->regionId, |
92
|
|
|
self::POSTCODE => $this->postcode, |
93
|
|
|
self::IS_ZIP_RANGE => $this->isZipRange, |
94
|
|
|
self::ZIP_RANGE_START => $this->zipRangeStart, |
95
|
|
|
self::ZIP_RANGE_END => $this->zipRangeEnd, |
96
|
|
|
]; |
97
|
|
|
} |
98
|
|
|
} |
99
|
|
|
|