Skip to content
This repository has been archived by the owner on Nov 15, 2022. It is now read-only.

Update tracking response #5

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/Api/Data/RateRequestInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
*/
namespace Dhl\Express\Api\Data;

use Dhl\Express\Api\Data\Request\Rate\ShipperAddressInterface;
use Dhl\Express\Api\Data\Request\InsuranceInterface;
use Dhl\Express\Api\Data\Request\Rate\PackageInterface;
use Dhl\Express\Api\Data\Request\Rate\RecipientAddressInterface;
use Dhl\Express\Api\Data\Request\Rate\ShipmentDetailsInterface;
use Dhl\Express\Api\Data\Request\Rate\PackageInterface;
use Dhl\Express\Api\Data\Request\InsuranceInterface;
use Dhl\Express\Api\Data\Request\Rate\ShipperAddressInterface;

/**
* Rate Request Interface.
Expand Down
2 changes: 1 addition & 1 deletion src/Api/RateRequestBuilderInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

namespace Dhl\Express\Api;

use Dhl\Express\Api\Data\RateRequestInterface;
use InvalidArgumentException;
use Dhl\Express\Api\Data\RateRequestInterface;

/**
* Rate Request Builder.
Expand Down
2 changes: 1 addition & 1 deletion src/RequestBuilder/RateRequestBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@

namespace Dhl\Express\RequestBuilder;

use InvalidArgumentException;
use Dhl\Express\Api\RateRequestBuilderInterface;
use Dhl\Express\Model\RateRequest;
use Dhl\Express\Model\Request\Insurance;
use Dhl\Express\Model\Request\Rate\Package;
use Dhl\Express\Model\Request\Rate\RecipientAddress;
use Dhl\Express\Model\Request\Rate\ShipmentDetails;
use Dhl\Express\Model\Request\Rate\ShipperAddress;
use InvalidArgumentException;

/**
* Rate Request Builder.
Expand Down
7 changes: 4 additions & 3 deletions src/RequestBuilder/ShipmentDeleteRequestBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*/
namespace Dhl\Express\RequestBuilder;

use DateTime;
use Dhl\Express\Api\ShipmentDeleteRequestBuilderInterface;
use Dhl\Express\Model\ShipmentDeleteRequest;

Expand All @@ -22,7 +23,7 @@ class ShipmentDeleteRequestBuilder implements ShipmentDeleteRequestBuilderInterf
*/
private $data = [];

public function setPickupDate(\DateTime $pickupDate)
public function setPickupDate(DateTime $pickupDate)
{
$this->data['pickupDate'] = $pickupDate;
return $this;
Expand Down Expand Up @@ -62,8 +63,8 @@ public function build()
$this->data['requesterName']
);

if (isset($this->data['reason'])) {
$request->setReason($this->data['reason']);
if (isset($this->data['reasonCode'])) {
$request->setReason($this->data['reasonCode']);
}

$this->data = [];
Expand Down
1 change: 1 addition & 0 deletions src/Webservice/Soap/ClassMap.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public static function get()

// trackShipmentRequest
'ServiceHeader' => Type\Tracking\ServiceHeader::class,
'ResponseServiceHeader' => Type\Tracking\ServiceHeader::class,
'TrackingResponse' => Type\Tracking\TrackingResponse::class,
'Response' => Type\Tracking\Response::class,
'AWBInfo' => Type\Tracking\AWBInfo::class,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
*/
namespace Dhl\Express\Webservice\Soap\Type\ShipmentRequest\Packages;

use Dhl\Express\Webservice\Soap\Type\Common\Packages\RequestedPackages\Dimensions;
use Dhl\Express\Webservice\Soap\Type\Common\Money;
use Dhl\Express\Webservice\Soap\Type\Common\Packages\RequestedPackages\Dimensions;
use Dhl\Express\Webservice\Soap\Type\ShipmentRequest\Packages\RequestedPackages\CustomerReferences;
use Dhl\Express\Webservice\Soap\Type\ShipmentRequest\Packages\RequestedPackages\PackageContentDescription;
use Dhl\Express\Webservice\Soap\Type\ShipmentRequest\Packages\RequestedPackages\PieceIdentificationNumber;
Expand Down
2 changes: 1 addition & 1 deletion src/Webservice/Soap/Type/ShipmentRequest/Ship/Address.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/
namespace Dhl\Express\Webservice\Soap\Type\ShipmentRequest\Ship;

use \Dhl\Express\Webservice\Soap\Type\Common\Ship\Address as CommonAddress;
use Dhl\Express\Webservice\Soap\Type\Common\Ship\Address as CommonAddress;

/**
* An ship address.
Expand Down
2 changes: 1 addition & 1 deletion src/Webservice/Soap/Type/ShipmentRequest/Ship/Contact.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
*/
namespace Dhl\Express\Webservice\Soap\Type\ShipmentRequest\Ship;

use Dhl\Express\Webservice\Soap\Type\ShipmentRequest\Ship\Contact\PersonName;
use Dhl\Express\Webservice\Soap\Type\ShipmentRequest\Ship\Contact\CompanyName;
use Dhl\Express\Webservice\Soap\Type\ShipmentRequest\Ship\Contact\EmailAddress;
use Dhl\Express\Webservice\Soap\Type\ShipmentRequest\Ship\Contact\MobilePhoneNumber;
use Dhl\Express\Webservice\Soap\Type\ShipmentRequest\Ship\Contact\PersonName;
use Dhl\Express\Webservice\Soap\Type\ShipmentRequest\Ship\Contact\PhoneNumber;

/**
Expand Down
12 changes: 12 additions & 0 deletions src/Webservice/Soap/Type/Tracking/PiecesEnabled.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php


namespace Dhl\Express\Webservice\Soap\Type\Tracking;


class PiecesEnabled
{
const PIECE_AND_SHIPMENT_DETAIL = 'B';
const SHIPMENT_DETAIL = 'S';
const PIECE_DETAIL = 'P';
}
4 changes: 2 additions & 2 deletions src/Webservice/Soap/Type/Tracking/ShipmentInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class ShipmentInfo
protected $WeightUnit;

/**
* @var ShipmentEventCollection
* @var ShipmentEventCollection|null
*/
protected $ShipmentEvent;

Expand Down Expand Up @@ -276,7 +276,7 @@ public function setWeightUnit(WeightUnit $WeightUnit)
}

/**
* @return ShipmentEventCollection
* @return null|ShipmentEventCollection
*/
public function getShipmentEvent()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
use Dhl\Express\Api\Data\ShipmentDeleteResponseInterface;
use Dhl\Express\Exception\ShipmentDeleteRequestException;
use Dhl\Express\Model\ShipmentDeleteResponse;
use Dhl\Express\Webservice\Soap\Type\Common\Notification;
use Dhl\Express\Webservice\Soap\Type\SoapShipmentDeleteResponse;

/**
Expand Down
10 changes: 7 additions & 3 deletions src/Webservice/Soap/TypeMapper/TrackingResponseMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ public function map(SoapTrackingResponse $soapTrackingResponse)
$trackingPieces
);
}

$time = strtotime($soapResponseContent->getResponse()->getServiceHeader()->getMessageTime());
if (\is_bool($time)) {
throw new \InvalidArgumentException(
Expand All @@ -100,12 +99,17 @@ public function map(SoapTrackingResponse $soapTrackingResponse)
}

/**
* @param ShipmentEventCollection $shipmentEvents
* @param null|ShipmentEventCollection $shipmentEvents
* @return ShipmentEventInterface[]
*/
private function convertTrackEventItems(ShipmentEventCollection $shipmentEvents)
private function convertTrackEventItems($shipmentEvents)
{
$events = [];

if (!$shipmentEvents) {
return $events;
}

foreach ($shipmentEvents->getArrayOfShipmentEventItem() as $shipmentEvent) {
$events[] = new TrackingInfo\ShipmentEvent(
$shipmentEvent->getDate(),
Expand Down