diff --git a/src/UlozenkaLib/APIv3/Enum/Attributes/ConsignmentAttr.php b/src/UlozenkaLib/APIv3/Enum/Attributes/ConsignmentAttr.php index b38e861..c1f4731 100644 --- a/src/UlozenkaLib/APIv3/Enum/Attributes/ConsignmentAttr.php +++ b/src/UlozenkaLib/APIv3/Enum/Attributes/ConsignmentAttr.php @@ -35,6 +35,7 @@ class ConsignmentAttr const TIME_RECEIVED = 'time_received'; const MAX_STORING_DATE = 'max_storing_date'; const TIME_CLOSED = 'time_closed'; + const STATUS = 'status'; const PARCEL_NUMBER = 'parcel_number'; const WEIGHT = 'weight'; const REQUIRE_FULL_AGE = 'require_full_age'; diff --git a/src/UlozenkaLib/APIv3/Formatter/JsonFormatter.php b/src/UlozenkaLib/APIv3/Formatter/JsonFormatter.php index c3d12c2..ab4e751 100644 --- a/src/UlozenkaLib/APIv3/Formatter/JsonFormatter.php +++ b/src/UlozenkaLib/APIv3/Formatter/JsonFormatter.php @@ -32,6 +32,7 @@ use UlozenkaLib\APIv3\Model\Consignment\Request\ConsignmentRequest; use UlozenkaLib\APIv3\Model\Consignment\Response\Consignment; use UlozenkaLib\APIv3\Model\Consignment\Response\CreateConsignmentResponse; +use UlozenkaLib\APIv3\Model\Consignment\Status as CreateConsignmentStatus; use UlozenkaLib\APIv3\Model\Error; use UlozenkaLib\APIv3\Model\Link; use UlozenkaLib\APIv3\Model\StatusHistory\Consignment as StatusHistoryConsignment; @@ -275,6 +276,11 @@ private function proccessConsignmentsResponseData($jsonObject) $consignment->setMaxStoringDateIncreasedByClient($this->getJsonAttr($dataObject, ConsignmentAttr::MAX_STORING_DATE_INCREASED_BY_CLIENT)); $consignment->setMaxStoringDateIncreasedByPartner($this->getJsonAttr($dataObject, ConsignmentAttr::MAX_STORING_DATE_INCREASED_BY_PARTNER)); + // status + $statusJsonAttr = $this->getJsonAttr($dataObject, ConsignmentAttr::STATUS); + $consignment->setStatus(new CreateConsignmentStatus($this->getJsonAttr($statusJsonAttr, 'id'), $this->getJsonAttr($statusJsonAttr, 'name'))); + + // datetime attributes $consignment->setTimeCreated($this->proccessDateTime($this->getJsonAttr($dataObject, ConsignmentAttr::TIME_CREATED))); $consignment->setTimeUpdated($this->proccessDateTime($this->getJsonAttr($dataObject, ConsignmentAttr::TIME_UPDATED))); $consignment->setTimeReceived($this->proccessDateTime($this->getJsonAttr($dataObject, ConsignmentAttr::TIME_RECEIVED)));