diff --git a/.gitignore b/.gitignore index d8be612..348d3b8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ /.idea /composer.lock /vendor -/Test/Coverage +/test/coverage /coverage diff --git a/src/Api/Data/RateRequestInterface.php b/src/Api/Data/RateRequestInterface.php index 749432b..e082c78 100644 --- a/src/Api/Data/RateRequestInterface.php +++ b/src/Api/Data/RateRequestInterface.php @@ -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. diff --git a/src/RequestBuilder/ShipmentDeleteRequestBuilder.php b/src/RequestBuilder/ShipmentDeleteRequestBuilder.php index 2650c19..fe4c32b 100644 --- a/src/RequestBuilder/ShipmentDeleteRequestBuilder.php +++ b/src/RequestBuilder/ShipmentDeleteRequestBuilder.php @@ -4,6 +4,7 @@ */ namespace Dhl\Express\RequestBuilder; +use DateTime; use Dhl\Express\Api\ShipmentDeleteRequestBuilderInterface; use Dhl\Express\Model\ShipmentDeleteRequest; @@ -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; @@ -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 = []; diff --git a/src/Webservice/Soap/ClassMap.php b/src/Webservice/Soap/ClassMap.php index c1f96c8..c8f616d 100644 --- a/src/Webservice/Soap/ClassMap.php +++ b/src/Webservice/Soap/ClassMap.php @@ -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, diff --git a/src/Webservice/Soap/Type/ShipmentRequest/Packages/RequestedPackages.php b/src/Webservice/Soap/Type/ShipmentRequest/Packages/RequestedPackages.php index 0e222fc..30e263d 100644 --- a/src/Webservice/Soap/Type/ShipmentRequest/Packages/RequestedPackages.php +++ b/src/Webservice/Soap/Type/ShipmentRequest/Packages/RequestedPackages.php @@ -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; diff --git a/src/Webservice/Soap/Type/ShipmentRequest/Ship/Address.php b/src/Webservice/Soap/Type/ShipmentRequest/Ship/Address.php index 1bc3994..6d05a0d 100644 --- a/src/Webservice/Soap/Type/ShipmentRequest/Ship/Address.php +++ b/src/Webservice/Soap/Type/ShipmentRequest/Ship/Address.php @@ -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. diff --git a/src/Webservice/Soap/Type/ShipmentRequest/Ship/Contact.php b/src/Webservice/Soap/Type/ShipmentRequest/Ship/Contact.php index e4bccd6..eae2aac 100644 --- a/src/Webservice/Soap/Type/ShipmentRequest/Ship/Contact.php +++ b/src/Webservice/Soap/Type/ShipmentRequest/Ship/Contact.php @@ -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; /** diff --git a/src/Webservice/Soap/Type/Tracking/PiecesEnabled.php b/src/Webservice/Soap/Type/Tracking/PiecesEnabled.php new file mode 100644 index 0000000..633a2ba --- /dev/null +++ b/src/Webservice/Soap/Type/Tracking/PiecesEnabled.php @@ -0,0 +1,13 @@ +getPieces(); $trackingPieces = []; if ($soapTrackingPieces !== null) { @@ -74,11 +75,17 @@ public function map(SoapTrackingResponse $soapTrackingResponse) $trackingPieces = $soapTrackingPieces->getPieceInfo()->getArrayOfPieceInfoItem(); } + if (($shipmentInfo !== null) && ($shipmentInfo->getShipmentEvent() instanceof ShipmentEventCollection)) { + $shipmentEvents = $this->convertTrackEventItems($shipmentInfo->getShipmentEvent()); + } else { + $shipmentEvents = []; + } + $trackingInfos[] = new TrackingInfo( $soapTrackingItem->getAWBNumber(), $soapTrackingItem->getStatus()->getActionStatus(), $shipmentDetails, - $shipmentInfo ? $this->convertTrackEventItems($shipmentInfo->getShipmentEvent()) : [], + $shipmentEvents, $trackingPieces ); } @@ -106,6 +113,7 @@ public function map(SoapTrackingResponse $soapTrackingResponse) private function convertTrackEventItems(ShipmentEventCollection $shipmentEvents) { $events = []; + foreach ($shipmentEvents->getArrayOfShipmentEventItem() as $shipmentEvent) { $events[] = new TrackingInfo\ShipmentEvent( $shipmentEvent->getDate(), diff --git a/test/phpunit.xml b/test/phpunit.xml index 872c3db..3e25f78 100644 --- a/test/phpunit.xml +++ b/test/phpunit.xml @@ -1,6 +1,6 @@ + xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/5.7/phpunit.xsd" columns="max" stderr="true"> ./Unit