1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of gpupo/netshoes-sdk |
5
|
|
|
* Created by Gilmar Pupo <[email protected]> |
6
|
|
|
* For the information of copyright and license you should read the file |
7
|
|
|
* LICENSE which is distributed with this source code. |
8
|
|
|
* Para a informação dos direitos autorais e de licença você deve ler o arquivo |
9
|
|
|
* LICENSE que é distribuído com este código-fonte. |
10
|
|
|
* Para obtener la información de los derechos de autor y la licencia debe leer |
11
|
|
|
* el archivo LICENSE que se distribuye con el código fuente. |
12
|
|
|
* For more information, see <http://www.g1mr.com/>. |
13
|
|
|
*/ |
14
|
|
|
|
15
|
|
|
namespace Gpupo\NetshoesSdk\Entity\Order\Shippings; |
16
|
|
|
|
17
|
|
|
use Gpupo\CommonSdk\Entity\EntityAbstract; |
18
|
|
|
use Gpupo\CommonSdk\Entity\EntityInterface; |
19
|
|
|
use Gpupo\NetshoesSdk\Traits\DateTimeTrait; |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* @method string getCarrier() Acesso a carrier |
23
|
|
|
* @method setCarrier(string $carrier) Define carrier |
24
|
|
|
* @method setDeliveryDate(string $deliveryDate) Define deliveryDate |
25
|
|
|
* @method string getDeliveryService() Acesso a deliveryService |
26
|
|
|
* @method setDeliveryService(string $deliveryService) Define deliveryService |
27
|
|
|
* @method setShipDate(string $shipDate) Define shipDate |
28
|
|
|
* @method string getTrackingLink() Acesso a trackingLink |
29
|
|
|
* @method setTrackingLink(string $trackingLink) Define trackingLink |
30
|
|
|
* @method string getTrackingNumber() Acesso a trackingNumber |
31
|
|
|
* @method setTrackingNumber(string $trackingNumber) Define trackingNumber |
32
|
|
|
* @method setTrackingShipDate(string $trackingShipDate) Define trackingShipDate |
33
|
|
|
*/ |
34
|
|
|
class Transport extends EntityAbstract implements EntityInterface |
35
|
|
|
{ |
36
|
|
|
use DateTimeTrait; |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* @codeCoverageIgnore |
40
|
|
|
*/ |
41
|
|
|
public function getSchema() |
42
|
|
|
{ |
43
|
|
|
return [ |
44
|
|
|
'carrier' => 'string', |
45
|
|
|
'deliveryDate' => 'datetime', |
46
|
|
|
'estimatedDeliveryDate' => 'datetime', |
47
|
|
|
'deliveryService' => 'string', |
48
|
|
|
'shipDate' => 'datetime', |
49
|
|
|
'trackingLink' => 'string', |
50
|
|
|
'trackingNumber' => 'string', |
51
|
|
|
'trackingShipDate' => 'datetime', |
52
|
|
|
]; |
53
|
|
|
} |
54
|
|
|
|
55
|
1 |
|
public function getDeliveryDate() |
56
|
|
|
{ |
57
|
1 |
|
return $this->dateGet('deliveryDate'); |
58
|
|
|
} |
59
|
|
|
|
60
|
1 |
|
public function getEstimatedDeliveryDate() |
61
|
|
|
{ |
62
|
1 |
|
return $this->dateGet('estimatedDeliveryDate'); |
63
|
|
|
} |
64
|
|
|
|
65
|
1 |
|
public function getShipDate() |
66
|
|
|
{ |
67
|
1 |
|
return $this->dateGet('shipDate'); |
68
|
|
|
} |
69
|
|
|
|
70
|
1 |
|
public function getTrackingShipDate() |
71
|
|
|
{ |
72
|
1 |
|
return $this->dateGet('trackingShipDate'); |
73
|
|
|
} |
74
|
|
|
|
75
|
1 |
|
public function check($status = null) |
76
|
|
|
{ |
77
|
1 |
|
$list = ['deliveryDate']; |
78
|
|
|
|
79
|
1 |
|
if ('shipped' === $status) { |
80
|
|
|
$list = ['carrier', 'trackingNumber', 'deliveredDate', 'estimatedDelivery']; |
81
|
|
|
} |
82
|
|
|
|
83
|
1 |
|
$this->setRequiredSchema($list); |
84
|
|
|
|
85
|
1 |
|
return $this->validate(); |
86
|
|
|
} |
87
|
|
|
} |
88
|
|
|
|