1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace VasilDakov\Speedy\Service\Shipment; |
6
|
|
|
|
7
|
|
|
use JMS\Serializer\Annotation as Serializer; |
8
|
|
|
use VasilDakov\Speedy\Model\BankAccount; |
9
|
|
|
use VasilDakov\Speedy\Traits\ToArray; |
10
|
|
|
|
11
|
|
|
/** |
12
|
|
|
* Class ShipmentPayment |
13
|
|
|
* |
14
|
|
|
* @Serializer\AccessType("public_method") |
15
|
|
|
* @author Valentin Valkanov <[email protected]> |
16
|
|
|
* @author Vasil Dakov <[email protected]> |
17
|
|
|
* @copyright |
18
|
|
|
* @version |
19
|
|
|
*/ |
20
|
|
|
class ShipmentPayment |
21
|
|
|
{ |
22
|
|
|
use ToArray; |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* @var string |
26
|
|
|
* @Serializer\Type("string") |
27
|
|
|
*/ |
28
|
|
|
private string $courierServicePayer; |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* @var string|null |
32
|
|
|
* @Serializer\Type("string") |
33
|
|
|
*/ |
34
|
|
|
private ?string $declaredValuePayer = ''; |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* @var string|null |
38
|
|
|
* @Serializer\Type("string") |
39
|
|
|
*/ |
40
|
|
|
private ?string $packagePayer = ''; |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* @var int|null |
44
|
|
|
* @Serializer\Type("integer") |
45
|
|
|
*/ |
46
|
|
|
private ?int $thirdPartyClientId = null; |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* @var ShipmentDiscountCardId|null |
50
|
|
|
* @Serializer\Type("VasilDakov\Speedy\Service\Shipment\ShipmentDiscountCardId") |
51
|
|
|
*/ |
52
|
|
|
private ?ShipmentDiscountCardId $discountCardId = null; |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* @var BankAccount|null |
56
|
|
|
* @Serializer\Type("VasilDakov\Speedy\Model\BankAccount") |
57
|
|
|
*/ |
58
|
|
|
private ?BankAccount $senderBankAccount = null; |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* @param string $courierServicePayer |
62
|
|
|
* @param string $declaredValuePayer |
63
|
|
|
*/ |
64
|
2 |
|
public function __construct(string $courierServicePayer, string $declaredValuePayer) |
65
|
|
|
{ |
66
|
2 |
|
$this->courierServicePayer = $courierServicePayer; |
67
|
2 |
|
$this->declaredValuePayer = $declaredValuePayer; |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* @param string $courierServicePayer |
72
|
|
|
* @return void |
73
|
|
|
*/ |
74
|
3 |
|
public function setCourierServicePayer(string $courierServicePayer): void |
75
|
|
|
{ |
76
|
3 |
|
$this->courierServicePayer = $courierServicePayer; |
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
/** |
80
|
|
|
* @return string |
81
|
|
|
*/ |
82
|
|
|
public function getCourierServicePayer(): string |
83
|
|
|
{ |
84
|
|
|
return $this->courierServicePayer; |
85
|
|
|
} |
86
|
|
|
|
87
|
|
|
/** |
88
|
|
|
* @param string $declaredValuePayer |
89
|
|
|
*/ |
90
|
1 |
|
public function setDeclaredValuePayer(string $declaredValuePayer): void |
91
|
|
|
{ |
92
|
1 |
|
$this->declaredValuePayer = $declaredValuePayer; |
93
|
|
|
} |
94
|
|
|
|
95
|
|
|
/** |
96
|
|
|
* @return string |
97
|
|
|
*/ |
98
|
|
|
public function getDeclaredValuePayer(): string |
99
|
|
|
{ |
100
|
|
|
return $this->declaredValuePayer; |
|
|
|
|
101
|
|
|
} |
102
|
|
|
|
103
|
|
|
/** |
104
|
|
|
* @param string $packagePayer |
105
|
|
|
* @return $this |
106
|
|
|
*/ |
107
|
1 |
|
public function setPackagePayer(string $packagePayer): self |
108
|
|
|
{ |
109
|
1 |
|
$this->packagePayer = $packagePayer; |
110
|
|
|
|
111
|
1 |
|
return $this; |
112
|
|
|
} |
113
|
|
|
/** |
114
|
|
|
* @return string|null |
115
|
|
|
*/ |
116
|
|
|
public function getPackagePayer(): ?string |
117
|
|
|
{ |
118
|
|
|
return $this->packagePayer; |
119
|
|
|
} |
120
|
|
|
|
121
|
|
|
/** |
122
|
|
|
* @param int|null $thirdPartyClientId |
123
|
|
|
* @return $this |
124
|
|
|
*/ |
125
|
1 |
|
public function setThirdPartyClientId(?int $thirdPartyClientId): self |
126
|
|
|
{ |
127
|
1 |
|
$this->thirdPartyClientId = $thirdPartyClientId; |
128
|
|
|
|
129
|
1 |
|
return $this; |
130
|
|
|
} |
131
|
|
|
|
132
|
|
|
/** |
133
|
|
|
* @return int|null |
134
|
|
|
*/ |
135
|
|
|
public function getThirdPartyClientId(): ?int |
136
|
|
|
{ |
137
|
|
|
return $this->thirdPartyClientId; |
138
|
|
|
} |
139
|
|
|
|
140
|
|
|
/** |
141
|
|
|
* @param ShipmentDiscountCardId|null $discountCardId |
142
|
|
|
* @return ShipmentPayment |
143
|
|
|
*/ |
144
|
1 |
|
public function setDiscountCardId(ShipmentDiscountCardId $discountCardId = null): self |
145
|
|
|
{ |
146
|
1 |
|
$this->discountCardId = $discountCardId; |
147
|
|
|
|
148
|
1 |
|
return $this; |
149
|
|
|
} |
150
|
|
|
|
151
|
|
|
/** |
152
|
|
|
* @return ShipmentDiscountCardId|null |
153
|
|
|
*/ |
154
|
|
|
public function getDiscountCardId(): ?ShipmentDiscountCardId |
155
|
|
|
{ |
156
|
|
|
return $this->discountCardId; |
157
|
|
|
} |
158
|
|
|
|
159
|
|
|
/** |
160
|
|
|
* @param BankAccount|null $bankAccount |
161
|
|
|
* @return $this |
162
|
|
|
*/ |
163
|
1 |
|
public function setSenderBankAccount(BankAccount $bankAccount = null): self |
164
|
|
|
{ |
165
|
1 |
|
$this->senderBankAccount = $bankAccount; |
166
|
|
|
|
167
|
1 |
|
return $this; |
168
|
|
|
} |
169
|
|
|
|
170
|
|
|
/** |
171
|
|
|
* @return BankAccount|null |
172
|
|
|
*/ |
173
|
|
|
public function getSenderBankAccount(): ?BankAccount |
174
|
|
|
{ |
175
|
|
|
return $this->senderBankAccount; |
176
|
|
|
} |
177
|
|
|
|
178
|
3 |
|
public function toArray(): array |
179
|
|
|
{ |
180
|
3 |
|
return [ |
181
|
3 |
|
'courierServicePayer' => $this->courierServicePayer, |
182
|
3 |
|
'declaredValuePayer' => $this->declaredValuePayer, |
183
|
3 |
|
]; |
184
|
|
|
} |
185
|
|
|
} |
186
|
|
|
|