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\Property; |
10
|
|
|
use VasilDakov\Speedy\Speedy; |
11
|
|
|
use VasilDakov\Speedy\Traits\ToArray; |
12
|
|
|
|
13
|
|
|
/** |
14
|
|
|
* Class ShipmentPayment. |
15
|
|
|
* |
16
|
|
|
* @author Valentin Valkanov <[email protected]> |
17
|
|
|
* @author Vasil Dakov <[email protected]> |
18
|
|
|
* @copyright |
19
|
|
|
* |
20
|
|
|
* @version |
21
|
|
|
* |
22
|
|
|
* @Serializer\AccessType("public_method") |
23
|
|
|
*/ |
24
|
|
|
class ShipmentPayment |
25
|
|
|
{ |
26
|
|
|
use ToArray; |
|
|
|
|
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* @Serializer\Type("string") |
30
|
|
|
*/ |
31
|
|
|
private string $courierServicePayer; |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* @Serializer\Type("string") |
35
|
|
|
*/ |
36
|
|
|
private ?string $declaredValuePayer = ''; |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* @Serializer\Type("string") |
40
|
|
|
*/ |
41
|
|
|
private ?string $packagePayer = ''; |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* @Serializer\Type("integer") |
45
|
|
|
*/ |
46
|
|
|
private ?int $thirdPartyClientId = null; |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* @Serializer\Type("VasilDakov\Speedy\Service\Shipment\ShipmentDiscountCardId") |
50
|
|
|
*/ |
51
|
|
|
private ?ShipmentDiscountCardId $discountCardId = null; |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* @Serializer\Type("VasilDakov\Speedy\Model\BankAccount") |
55
|
|
|
*/ |
56
|
|
|
private ?BankAccount $senderBankAccount = null; |
57
|
|
|
|
58
|
2 |
|
public function __construct(string $courierServicePayer, string $declaredValuePayer) |
59
|
|
|
{ |
60
|
2 |
|
$this->courierServicePayer = $courierServicePayer; |
61
|
2 |
|
$this->declaredValuePayer = $declaredValuePayer; |
62
|
|
|
} |
63
|
|
|
|
64
|
2 |
|
public function setCourierServicePayer(string $courierServicePayer): void |
65
|
|
|
{ |
66
|
2 |
|
$this->courierServicePayer = $courierServicePayer; |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
public function getCourierServicePayer(): string |
70
|
|
|
{ |
71
|
|
|
return $this->courierServicePayer; |
72
|
|
|
} |
73
|
|
|
|
74
|
1 |
|
public function setDeclaredValuePayer(string $declaredValuePayer): void |
75
|
|
|
{ |
76
|
1 |
|
$this->declaredValuePayer = $declaredValuePayer; |
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
public function getDeclaredValuePayer(): ?string |
80
|
|
|
{ |
81
|
|
|
return $this->declaredValuePayer; |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
/** |
85
|
|
|
* @return $this |
86
|
|
|
*/ |
87
|
1 |
|
public function setPackagePayer(string $packagePayer): self |
88
|
|
|
{ |
89
|
1 |
|
$this->packagePayer = $packagePayer; |
90
|
|
|
|
91
|
1 |
|
return $this; |
92
|
|
|
} |
93
|
|
|
|
94
|
|
|
public function getPackagePayer(): ?string |
95
|
|
|
{ |
96
|
|
|
return $this->packagePayer; |
97
|
|
|
} |
98
|
|
|
|
99
|
|
|
/** |
100
|
|
|
* @return $this |
101
|
|
|
*/ |
102
|
1 |
|
public function setThirdPartyClientId(?int $thirdPartyClientId): self |
103
|
|
|
{ |
104
|
1 |
|
$this->thirdPartyClientId = $thirdPartyClientId; |
105
|
|
|
|
106
|
1 |
|
return $this; |
107
|
|
|
} |
108
|
|
|
|
109
|
|
|
public function getThirdPartyClientId(): ?int |
110
|
|
|
{ |
111
|
|
|
return $this->thirdPartyClientId; |
112
|
|
|
} |
113
|
|
|
|
114
|
1 |
|
public function setDiscountCardId(ShipmentDiscountCardId $discountCardId = null): self |
115
|
|
|
{ |
116
|
1 |
|
$this->discountCardId = $discountCardId; |
117
|
|
|
|
118
|
1 |
|
return $this; |
119
|
|
|
} |
120
|
|
|
|
121
|
|
|
public function getDiscountCardId(): ?ShipmentDiscountCardId |
122
|
|
|
{ |
123
|
|
|
return $this->discountCardId; |
124
|
|
|
} |
125
|
|
|
|
126
|
|
|
/** |
127
|
|
|
* @return $this |
128
|
|
|
*/ |
129
|
1 |
|
public function setSenderBankAccount(BankAccount $bankAccount = null): self |
130
|
|
|
{ |
131
|
1 |
|
$this->senderBankAccount = $bankAccount; |
132
|
|
|
|
133
|
1 |
|
return $this; |
134
|
|
|
} |
135
|
|
|
|
136
|
|
|
public function getSenderBankAccount(): ?BankAccount |
137
|
|
|
{ |
138
|
|
|
return $this->senderBankAccount; |
139
|
|
|
} |
140
|
|
|
|
141
|
3 |
|
public function toArray(): array |
142
|
|
|
{ |
143
|
3 |
|
return [ |
144
|
3 |
|
Property::COURIER_SERVICE_PAYER->value => $this->courierServicePayer, |
145
|
3 |
|
Property::DECLARED_VALUE_PAYER->value => $this->declaredValuePayer, |
146
|
3 |
|
]; |
147
|
|
|
} |
148
|
|
|
} |
149
|
|
|
|