1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace Appwilio\RussianPostSDK\Dispatching\Endpoints\Services\Entities; |
6
|
|
|
|
7
|
|
|
use Appwilio\RussianPostSDK\Dispatching\DataAware; |
8
|
|
|
use Appwilio\RussianPostSDK\Dispatching\Instantiator; |
9
|
|
|
use Appwilio\RussianPostSDK\Dispatching\Entities\Tariff; |
10
|
|
|
use Appwilio\RussianPostSDK\Dispatching\Contracts\Arrayable; |
11
|
|
|
use Appwilio\RussianPostSDK\Dispatching\Entities\DeliveryTime; |
12
|
|
|
|
13
|
|
|
final class Calculation implements Arrayable |
14
|
|
|
{ |
15
|
|
|
use DataAware; |
16
|
|
|
|
17
|
|
|
public function getPaymentMethod(): string |
18
|
|
|
{ |
19
|
|
|
return $this->get('payment-method'); |
20
|
|
|
} |
21
|
|
|
|
22
|
|
|
public function getNoticePaymentMethod(): string |
23
|
|
|
{ |
24
|
|
|
return $this->get('notice-payment-method'); |
25
|
|
|
} |
26
|
|
|
|
27
|
|
|
public function getDeliveryTime(): ?DeliveryTime |
28
|
|
|
{ |
29
|
|
|
return Instantiator::instantiate(DeliveryTime::class, $this->get('delivery-time')); |
30
|
|
|
} |
31
|
|
|
|
32
|
|
|
public function getSmsNoticeRate(): ?Tariff |
33
|
|
|
{ |
34
|
|
|
return Instantiator::instantiate(Tariff::class, $this->get('sms-notice-recipient-rate')); |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
public function getNoticeRate(): ?Tariff |
38
|
|
|
{ |
39
|
|
|
return Instantiator::instantiate(Tariff::class, $this->get('notice-rate')); |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
public function getCompletenessCheckingRate(): ?Tariff |
43
|
|
|
{ |
44
|
|
|
return Instantiator::instantiate(Tariff::class, $this->get('completeness-checking-rate')); |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
public function getContentCheckingRate(): ?Tariff |
48
|
|
|
{ |
49
|
|
|
return Instantiator::instantiate(Tariff::class, $this->get('content-checking-rate')); |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
public function getOversizeRate(): ?Tariff |
53
|
|
|
{ |
54
|
|
|
return Instantiator::instantiate(Tariff::class, $this->get('oversize-rate')); |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
public function getInsuranceRate(): ?Tariff |
58
|
|
|
{ |
59
|
|
|
return Instantiator::instantiate(Tariff::class, $this->get('insurance-rate')); |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
public function getInventoryRate(): ?Tariff |
63
|
|
|
{ |
64
|
|
|
return Instantiator::instantiate(Tariff::class, $this->get('inventory-rate')); |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
public function getAviaRate(): ?Tariff |
68
|
|
|
{ |
69
|
|
|
return Instantiator::instantiate(Tariff::class, $this->get('avia-rate')); |
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
public function getGroundRate(): ?Tariff |
73
|
|
|
{ |
74
|
|
|
return Instantiator::instantiate(Tariff::class, $this->get('ground-rate')); |
75
|
|
|
} |
76
|
|
|
|
77
|
|
|
public function getFragileRate(): ?Tariff |
78
|
|
|
{ |
79
|
|
|
return Instantiator::instantiate(Tariff::class, $this->get('fragile-rate')); |
80
|
|
|
} |
81
|
|
|
|
82
|
|
|
public function getVsdRate(): ?Tariff |
83
|
|
|
{ |
84
|
|
|
return Instantiator::instantiate(Tariff::class, $this->get('vsd-rate')); |
85
|
|
|
} |
86
|
|
|
|
87
|
|
|
public function getTotal(): Tariff |
88
|
|
|
{ |
89
|
|
|
return Instantiator::instantiate(Tariff::class, [ |
90
|
|
|
'rate' => $this->get('total-rate'), |
91
|
|
|
'vat' => $this->get('total-vat'), |
92
|
|
|
]); |
93
|
|
|
} |
94
|
|
|
} |
95
|
|
|
|