OrderParams   A
last analyzed

Complexity

Total Complexity 22

Size/Duplication

Total Lines 352
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 22
lcom 1
cbo 0
dl 0
loc 352
rs 10
c 0
b 0
f 0

21 Methods

Rating   Name   Duplication   Size   Complexity  
A getCurrency() 0 4 1
A setCurrency() 0 10 2
A getPaymentFromRecipient() 0 4 1
A setPaymentFromRecipient() 0 6 1
A getDeclaredOrderCost() 0 4 1
A setDeclaredOrderCost() 0 6 1
A getEstimatedDeliveryCost() 0 4 1
A setEstimatedDeliveryCost() 0 6 1
A getDeliveryService() 0 4 1
A setDeliveryService() 0 6 1
A getDeliveryServiceExternalId() 0 4 1
A setDeliveryServiceExternalId() 0 6 1
A getUniformPimpayDeliveryStatus() 0 4 1
A setUniformPimpayDeliveryStatus() 0 6 1
A getCustomDeliveryStatus() 0 4 1
A setCustomDeliveryStatus() 0 6 1
A getDeliveryServiceDeliveryStatus() 0 4 1
A setDeliveryServiceDeliveryStatus() 0 6 1
A getHistory() 0 4 1
A addHistory() 0 6 1
A setHistory() 0 6 1
1
<?php
2
3
namespace PimpayBundle\Model;
4
5
/**
6
 * Class OrderParams
7
 * @package PimpayBundle\Model
8
 */
9
class OrderParams
10
{
11
    /**
12
     * @var string
13
     */
14
    CONST CURRENCY_RUB = 'RUB';
15
16
    /**
17
     * @var string
18
     */
19
    CONST CURRENCY_KZT = 'KZT';
20
21
    /**
22
     * @var string
23
     */
24
    CONST COURIER_SHIPTOR = 'shiptor';
25
26
    /**
27
     * @var string
28
     */
29
    CONST COURIER_BOXBERY = 'boxberry';
30
31
    /**
32
     * @var string
33
     */
34
    CONST COURIER_SDEK = 'sdek';
35
36
    /**
37
     * @var string
38
     */
39
    CONST COURIER_DPD = 'dpd';
40
41
    /**
42
     * @var string
43
     */
44
    CONST COURIER_IML = 'iml';
45
46
    /**
47
     * @var string
48
     */
49
    CONST COURIER_PICKPOINT = 'pick_point';
50
51
    /**
52
     * @var string
53
     */
54
    CONST COURIER_RUSSIAN_POST = 'post';
55
56
    /**
57
     * @var string Создан запрос/черновик на отправку
58
     */
59
    CONST STATUS_PENDING = 'pending';
60
61
    /**
62
     * @var string Заказ принят/принят на склад
63
     */
64
    CONST STATUS_PREPARED = 'prepared';
65
66
    /**
67
     * @var string Заказ транспортируется
68
     */
69
    CONST STATUS_INTRANSIT = 'intransit';
70
71
    /**
72
     * @var string Заказ оставлен в ПВЗ
73
     */
74
    CONST STATUS_STORED = 'stored';
75
76
    /**
77
     * @var string Заказ доставлен до конечного покупателя
78
     */
79
    CONST STATUS_DELIVERED = 'delivered';
80
81
    /**
82
     * @var string Частичный возврат
83
     */
84
    CONST STATUS_PARTIAL_RETURN = 'partialReturn';
85
86
    /**
87
     * @var string Полный возврат
88
     */
89
    CONST STATUS_RETURN = 'return';
90
91
    /**
92
     * @var string Утеря/Порча
93
     */
94
    CONST STATUS_LOST = 'lost';
95
96
    /**
97
     * @var string Ошибка
98
     */
99
    CONST STATUS_ERROR = 'error';
100
101
    /**
102
     * @var string Неизвестно
103
     */
104
    CONST STATUS_UNKNOWN = 'unknown';
105
106
    /**
107
     * @var string
108
     */
109
    private $currency;
110
111
    /**
112
     * @var float
113
     */
114
    private $paymentFromRecipient;
115
116
    /**
117
     * @var float
118
     */
119
    private $declaredOrderCost;
120
121
    /**
122
     * @var float
123
     */
124
    private $estimatedDeliveryCost;
125
126
    /**
127
     * @var string
128
     */
129
    private $deliveryService;
130
131
    /**
132
     * @var string
133
     */
134
    private $deliveryServiceExternalId;
135
136
    /**
137
     * @var string
138
     */
139
    private $uniformPimpayDeliveryStatus;
140
141
    /**
142
     * @var string
143
     */
144
    private $customDeliveryStatus;
145
146
    /**
147
     * @var string
148
     */
149
    private $deliveryServiceDeliveryStatus;
150
151
    /**
152
     * @var DeliveryStatusHistoryItem[]
153
     */
154
    private $history = [];
155
156
    /**
157
     * @return string
158
     */
159
    public function getCurrency(): string
160
    {
161
        return $this->currency;
162
    }
163
164
    /**
165
     * @param string $currency
166
     * @return $this
167
     */
168
    public function setCurrency(string $currency)
169
    {
170
        if (!in_array($currency, [self::CURRENCY_RUB, self::CURRENCY_KZT], true)) {
171
            throw new \LogicException('Invalid currency');
172
        }
173
174
        $this->currency = $currency;
175
176
        return $this;
177
    }
178
179
    /**
180
     * @return float
181
     */
182
    public function getPaymentFromRecipient(): float
183
    {
184
        return $this->paymentFromRecipient;
185
    }
186
187
    /**
188
     * @param float $paymentFromRecipient
189
     * @return $this
190
     */
191
    public function setPaymentFromRecipient(float $paymentFromRecipient)
192
    {
193
        $this->paymentFromRecipient = $paymentFromRecipient;
194
195
        return $this;
196
    }
197
198
    /**
199
     * @return float
200
     */
201
    public function getDeclaredOrderCost(): float
202
    {
203
        return $this->declaredOrderCost;
204
    }
205
206
    /**
207
     * @param float $declaredOrderCost
208
     * @return $this
209
     */
210
    public function setDeclaredOrderCost(float $declaredOrderCost)
211
    {
212
        $this->declaredOrderCost = $declaredOrderCost;
213
214
        return $this;
215
    }
216
217
    /**
218
     * @return float
219
     */
220
    public function getEstimatedDeliveryCost(): float
221
    {
222
        return $this->estimatedDeliveryCost;
223
    }
224
225
    /**
226
     * @param float $estimatedDeliveryCost
227
     * @return $this
228
     */
229
    public function setEstimatedDeliveryCost(float $estimatedDeliveryCost)
230
    {
231
        $this->estimatedDeliveryCost = $estimatedDeliveryCost;
232
233
        return $this;
234
    }
235
236
    /**
237
     * @return string
238
     */
239
    public function getDeliveryService(): string
240
    {
241
        return $this->deliveryService;
242
    }
243
244
    /**
245
     * @param string $deliveryService
246
     * @return $this
247
     */
248
    public function setDeliveryService(string $deliveryService)
249
    {
250
        $this->deliveryService = $deliveryService;
251
252
        return $this;
253
    }
254
255
    /**
256
     * @return string
257
     */
258
    public function getDeliveryServiceExternalId(): string
259
    {
260
        return $this->deliveryServiceExternalId;
261
    }
262
263
    /**
264
     * @param string $deliveryServiceExternalId
265
     * @return $this
266
     */
267
    public function setDeliveryServiceExternalId(string $deliveryServiceExternalId)
268
    {
269
        $this->deliveryServiceExternalId = $deliveryServiceExternalId;
270
271
        return $this;
272
    }
273
274
    /**
275
     * @return string
276
     */
277
    public function getUniformPimpayDeliveryStatus(): string
278
    {
279
        return $this->uniformPimpayDeliveryStatus;
280
    }
281
282
    /**
283
     * @param string $uniformPimpayDeliveryStatus
284
     * @return $this
285
     */
286
    public function setUniformPimpayDeliveryStatus(string $uniformPimpayDeliveryStatus)
287
    {
288
        $this->uniformPimpayDeliveryStatus = $uniformPimpayDeliveryStatus;
289
290
        return $this;
291
    }
292
293
    /**
294
     * @return string
295
     */
296
    public function getCustomDeliveryStatus(): string
297
    {
298
        return $this->customDeliveryStatus;
299
    }
300
301
    /**
302
     * @param string $customDeliveryStatus
303
     * @return $this
304
     */
305
    public function setCustomDeliveryStatus(string $customDeliveryStatus)
306
    {
307
        $this->customDeliveryStatus = $customDeliveryStatus;
308
309
        return $this;
310
    }
311
312
    /**
313
     * @return string
314
     */
315
    public function getDeliveryServiceDeliveryStatus(): string
316
    {
317
        return $this->deliveryServiceDeliveryStatus;
318
    }
319
320
    /**
321
     * @param string $deliveryServiceDeliveryStatus
322
     * @return $this
323
     */
324
    public function setDeliveryServiceDeliveryStatus(string $deliveryServiceDeliveryStatus)
325
    {
326
        $this->deliveryServiceDeliveryStatus = $deliveryServiceDeliveryStatus;
327
328
        return $this;
329
    }
330
331
    /**
332
     * @return DeliveryStatusHistoryItem[]
333
     */
334
    public function getHistory(): array
335
    {
336
        return $this->history;
337
    }
338
339
    /**
340
     * @param DeliveryStatusHistoryItem $history
341
     * @return $this
342
     */
343
    public function addHistory(DeliveryStatusHistoryItem $history)
344
    {
345
        $this->history[] = $history;
346
347
        return $this;
348
    }
349
350
    /**
351
     * @param DeliveryStatusHistoryItem[] $history
352
     * @return $this
353
     */
354
    public function setHistory(array $history)
355
    {
356
        $this->history = $history;
357
358
        return $this;
359
    }
360
}
361