Skip to content

Commit

Permalink
parse status in CreateConsignmentResponse
Browse files Browse the repository at this point in the history
  • Loading branch information
jaroslavlibal committed Nov 29, 2015
1 parent ffa3131 commit fc7f46c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/UlozenkaLib/APIv3/Enum/Attributes/ConsignmentAttr.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
6 changes: 6 additions & 0 deletions src/UlozenkaLib/APIv3/Formatter/JsonFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)));
Expand Down

0 comments on commit fc7f46c

Please sign in to comment.