1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Daaner\NovaPoshta\Traits; |
4
|
|
|
|
5
|
|
|
use Carbon\Carbon; |
6
|
|
|
|
7
|
|
|
trait InternetDocumentProperty |
8
|
|
|
{ |
9
|
|
|
protected $PayerType; |
10
|
|
|
protected $ServiceType; |
11
|
|
|
protected $PaymentMethod; |
12
|
|
|
protected $CargoType; |
13
|
|
|
protected $SeatsAmount; |
14
|
|
|
protected $Cost; |
15
|
|
|
protected $Weight; |
16
|
|
|
protected $BackwardDeliveryData; |
17
|
|
|
protected $Note; |
18
|
|
|
protected $AdditionalInformation; |
19
|
|
|
|
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* @param string $PayerType |
23
|
|
|
* Устанавливаем значение плательщика. По умолчанию значение из конфига |
24
|
|
|
* @see https://devcenter.novaposhta.ua/docs/services/55702570a0fe4f0cf4fc53ed/operations/55702571a0fe4f0b64838913 |
25
|
|
|
* @return this |
26
|
|
|
*/ |
27
|
|
|
public function setPayerType($PayerType) |
28
|
|
|
{ |
29
|
|
|
$this->PayerType = $PayerType; |
30
|
|
|
|
31
|
|
|
return $this; |
32
|
|
|
} |
33
|
|
|
|
34
|
|
|
public function getPayerType() |
35
|
|
|
{ |
36
|
|
|
if (! $this->PayerType) { |
37
|
|
|
$this->PayerType = config('novaposhta.payer_type'); |
38
|
|
|
} |
39
|
|
|
$this->methodProperties['PayerType'] = $this->PayerType; |
|
|
|
|
40
|
|
|
|
41
|
|
|
return $this; |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* @param string $ServiceType |
47
|
|
|
* Устанавливаем тип доставки. По умолчанию значение из конфига |
48
|
|
|
* @see https://devcenter.novaposhta.ua/docs/services/55702570a0fe4f0cf4fc53ed/operations/55702571a0fe4f0b6483890e |
49
|
|
|
* @return this |
50
|
|
|
*/ |
51
|
|
|
public function setServiceType($ServiceType) |
52
|
|
|
{ |
53
|
|
|
$this->ServiceType = $ServiceType; |
54
|
|
|
|
55
|
|
|
return $this; |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
public function getServiceType() |
59
|
|
|
{ |
60
|
|
|
if (! $this->ServiceType) { |
61
|
|
|
$this->ServiceType = config('novaposhta.service_type'); |
62
|
|
|
} |
63
|
|
|
$this->methodProperties['ServiceType'] = $this->ServiceType; |
|
|
|
|
64
|
|
|
|
65
|
|
|
return $this; |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
|
69
|
|
|
/** |
70
|
|
|
* @param string $PaymentMethod |
71
|
|
|
* Устанавливаем форму оплаты. По умолчанию значение из конфига |
72
|
|
|
* @see https://devcenter.novaposhta.ua/docs/services/55702570a0fe4f0cf4fc53ed/operations/55702571a0fe4f0b6483890d |
73
|
|
|
* @return this |
74
|
|
|
*/ |
75
|
|
|
public function setPaymentMethod($PaymentMethod) |
76
|
|
|
{ |
77
|
|
|
$this->PaymentMethod = $PaymentMethod; |
78
|
|
|
|
79
|
|
|
return $this; |
80
|
|
|
} |
81
|
|
|
|
82
|
|
|
public function getPaymentMethod() |
83
|
|
|
{ |
84
|
|
|
if (! $this->PaymentMethod) { |
85
|
|
|
$this->PaymentMethod = config('novaposhta.payment_method'); |
86
|
|
|
} |
87
|
|
|
$this->methodProperties['PaymentMethod'] = $this->PaymentMethod; |
|
|
|
|
88
|
|
|
|
89
|
|
|
return $this; |
90
|
|
|
} |
91
|
|
|
|
92
|
|
|
|
93
|
|
|
/** |
94
|
|
|
* @param string $CargoType |
95
|
|
|
* Устанавливаем тип груза. По умолчанию значение из конфига |
96
|
|
|
* @see https://devcenter.novaposhta.ua/docs/services/55702570a0fe4f0cf4fc53ed/operations/55702571a0fe4f0b64838909 |
97
|
|
|
* @return this |
98
|
|
|
*/ |
99
|
|
|
public function setCargoType($CargoType) |
100
|
|
|
{ |
101
|
|
|
$this->CargoType = $CargoType; |
102
|
|
|
|
103
|
|
|
return $this; |
104
|
|
|
} |
105
|
|
|
|
106
|
|
|
public function getCargoType() |
107
|
|
|
{ |
108
|
|
|
if (! $this->CargoType) { |
109
|
|
|
$this->CargoType = config('novaposhta.cargo_type'); |
110
|
|
|
} |
111
|
|
|
$this->methodProperties['CargoType'] = $this->CargoType; |
|
|
|
|
112
|
|
|
|
113
|
|
|
return $this; |
114
|
|
|
} |
115
|
|
|
|
116
|
|
|
|
117
|
|
|
/** |
118
|
|
|
* @param string $Description |
119
|
|
|
* Устанавливаем описание груза. По умолчанию из конфига |
120
|
|
|
* @return this |
121
|
|
|
*/ |
122
|
|
|
public function setDescription($Description) |
123
|
|
|
{ |
124
|
|
|
if ($Description) { |
125
|
|
|
$this->methodProperties['Description'] = $Description; |
|
|
|
|
126
|
|
|
} else { |
127
|
|
|
$this->methodProperties['Description'] = config('novaposhta.description'); |
128
|
|
|
} |
129
|
|
|
|
130
|
|
|
return $this; |
131
|
|
|
} |
132
|
|
|
|
133
|
|
|
|
134
|
|
|
/** |
135
|
|
|
* @param string $SeatsAmount |
136
|
|
|
* Устанавливаем тип груза. По умолчанию значение из конфига |
137
|
|
|
* @see https://devcenter.novaposhta.ua/docs/services/55702570a0fe4f0cf4fc53ed/operations/55702571a0fe4f0b64838909 |
138
|
|
|
* @return this |
139
|
|
|
*/ |
140
|
|
|
public function setSeatsAmount($SeatsAmount) |
141
|
|
|
{ |
142
|
|
|
$this->SeatsAmount = $SeatsAmount; |
143
|
|
|
|
144
|
|
|
return $this; |
145
|
|
|
} |
146
|
|
|
|
147
|
|
|
public function getSeatsAmount() |
148
|
|
|
{ |
149
|
|
|
if (! $this->SeatsAmount) { |
150
|
|
|
$this->SeatsAmount = config('novaposhta.seats_amount'); |
151
|
|
|
} |
152
|
|
|
$this->methodProperties['SeatsAmount'] = $this->SeatsAmount; |
|
|
|
|
153
|
|
|
|
154
|
|
|
return $this; |
155
|
|
|
} |
156
|
|
|
|
157
|
|
|
|
158
|
|
|
/** |
159
|
|
|
* @param string $Cost |
160
|
|
|
* Устанавливаем стоимость груза. По умолчанию значение из конфига |
161
|
|
|
* @return this |
162
|
|
|
*/ |
163
|
|
|
public function setCost($Cost) |
164
|
|
|
{ |
165
|
|
|
$this->Cost = $Cost; |
166
|
|
|
|
167
|
|
|
return $this; |
168
|
|
|
} |
169
|
|
|
|
170
|
|
|
public function getCost() |
171
|
|
|
{ |
172
|
|
|
if (! $this->Cost) { |
173
|
|
|
$this->Cost = config('novaposhta.cost'); |
174
|
|
|
} |
175
|
|
|
$this->methodProperties['Cost'] = $this->Cost; |
|
|
|
|
176
|
|
|
|
177
|
|
|
return $this; |
178
|
|
|
} |
179
|
|
|
|
180
|
|
|
|
181
|
|
|
/** |
182
|
|
|
* @param string $Note |
183
|
|
|
* Описание к адресу для курьера или отделения |
184
|
|
|
* Применяется в основном, если нет текущей улицы при адресной доставке |
185
|
|
|
* @return this |
186
|
|
|
*/ |
187
|
|
|
public function setNote($Note) |
188
|
|
|
{ |
189
|
|
|
$this->Note = $Note; |
190
|
|
|
|
191
|
|
|
return $this; |
192
|
|
|
} |
193
|
|
|
|
194
|
|
|
public function getNote() |
195
|
|
|
{ |
196
|
|
|
if ($this->Note) { |
197
|
|
|
$this->methodProperties['Note'] = $this->Note; |
|
|
|
|
198
|
|
|
} |
199
|
|
|
|
200
|
|
|
return $this; |
201
|
|
|
} |
202
|
|
|
|
203
|
|
|
|
204
|
|
|
/** |
205
|
|
|
* @param string $AdditionalInformation |
206
|
|
|
* Описание к ТТН для отображения в кабинете |
207
|
|
|
* @return this |
208
|
|
|
*/ |
209
|
|
|
public function setAdditionalInformation($AdditionalInformation) |
210
|
|
|
{ |
211
|
|
|
$this->AdditionalInformation = $AdditionalInformation; |
212
|
|
|
|
213
|
|
|
return $this; |
214
|
|
|
} |
215
|
|
|
|
216
|
|
|
public function getAdditionalInformation() |
217
|
|
|
{ |
218
|
|
|
if ($this->AdditionalInformation) { |
219
|
|
|
$this->methodProperties['AdditionalInformation'] = $this->AdditionalInformation; |
|
|
|
|
220
|
|
|
} |
221
|
|
|
|
222
|
|
|
return $this; |
223
|
|
|
} |
224
|
|
|
|
225
|
|
|
|
226
|
|
|
/** |
227
|
|
|
* @param string||integer $RedeliveryString |
|
|
|
|
228
|
|
|
* @param string||null $PayerType |
229
|
|
|
* @param string||null $CargoType |
230
|
|
|
* @param array||null $addition |
231
|
|
|
* @see https://devcenter.novaposhta.ua/docs/services/556eef34a0fe4f02049c664e/operations/575fe852a0fe4f0aa0754760 |
232
|
|
|
* Услуга опбатной доставки. По умолчанию значения из конфига |
233
|
|
|
* @return this |
234
|
|
|
*/ |
235
|
|
|
public function setBackwardDeliveryData($RedeliveryString, $PayerType = null, $CargoType = null) |
236
|
|
|
{ |
237
|
|
|
if (! $PayerType) { |
238
|
|
|
$PayerType = config('novaposhta.back_delivery_payer_type'); |
239
|
|
|
} |
240
|
|
|
if (! $CargoType) { |
241
|
|
|
$CargoType = config('novaposhta.back_delivery_cargo_type'); |
242
|
|
|
} |
243
|
|
|
$this->BackwardDeliveryData = [ |
244
|
|
|
'PayerType' => $PayerType, |
245
|
|
|
'CargoType' => $CargoType, |
246
|
|
|
'RedeliveryString' => $RedeliveryString, |
247
|
|
|
]; |
248
|
|
|
|
249
|
|
|
return $this; |
250
|
|
|
} |
251
|
|
|
|
252
|
|
|
public function getBackwardDeliveryData() |
253
|
|
|
{ |
254
|
|
|
if ($this->BackwardDeliveryData) { |
255
|
|
|
$this->methodProperties['BackwardDeliveryData'][] = $this->BackwardDeliveryData; |
|
|
|
|
256
|
|
|
} |
257
|
|
|
|
258
|
|
|
return $this; |
259
|
|
|
} |
260
|
|
|
|
261
|
|
|
} |
262
|
|
|
|