app/code/Magento/Dhl/Model/Carrier.php | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/vendor/magento/module-dhl/Model/Carrier.php b/vendor/magento/module-dhl/Model/Carrier.php index 7ea0e670d0d1..835311fd2641 100644 --- a/vendor/magento/module-dhl/Model/Carrier.php +++ b/vendor/magento/module-dhl/Model/Carrier.php @@ -1522,6 +1522,7 @@ protected function _getMinDimension($dimensionUnit) * @SuppressWarnings(PHPMD.NPathComplexity) * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ + protected function _doRequest() { $rawRequest = $this->_request; @@ -1530,8 +1531,8 @@ protected function _doRequest() ''; + ' xsi:schemaLocation="http://www.dhl.com ship-val-global-req.xsd"' . + ' schemaVersion="6.2" />'; $xml = $this->_xmlElFactory->create(['data' => $xmlStr]); $nodeRequest = $xml->addChild('Request', '', ''); @@ -1545,6 +1546,10 @@ protected function _doRequest() $nodeServiceHeader->addChild('SiteID', (string)$this->getConfigData('id')); $nodeServiceHeader->addChild('Password', (string)$this->getConfigData('password')); + $nodeMetaData = $nodeRequest->addChild('MetaData'); + $nodeMetaData->addChild('SoftwareName', $this->buildSoftwareName()); + $nodeMetaData->addChild('SoftwareVersion', $this->buildSoftwareVersion()); + $originRegion = $this->getCountryParams( $this->_scopeConfig->getValue( Shipment::XML_PATH_STORE_COUNTRY_ID, @@ -1585,10 +1590,10 @@ protected function _doRequest() ->getRecipientContactCompanyName() : $rawRequest ->getRecipientContactPersonName(); - $nodeConsignee->addChild('CompanyName', substr($companyName, 0, 35)); + $nodeConsignee->addChild('CompanyName', is_string($companyName) ? substr($companyName, 0, 60) : ''); $address = $rawRequest->getRecipientAddressStreet1() . ' ' . $rawRequest->getRecipientAddressStreet2(); - $address = $this->string->split($address, 35, false, true); + $address = $this->string->split($address, 45, false, true); if (is_array($address)) { foreach ($address as $addressLine) { $nodeConsignee->addChild('AddressLine', $addressLine); @@ -1657,7 +1662,7 @@ protected function _doRequest() $nodeShipper->addChild('RegisteredAccount', (string)$this->getConfigData('account')); $address = $rawRequest->getShipperAddressStreet1() . ' ' . $rawRequest->getShipperAddressStreet2(); - $address = $this->string->split($address, 35, false, true); + $address = $this->string->split($address, 45, false, true); if (is_array($address)) { foreach ($address as $addressLine) { $nodeShipper->addChild('AddressLine', $addressLine); @@ -1714,7 +1719,6 @@ protected function _doRequest() $this->_debug($debugData); } $this->_isShippingLabelFlag = true; - return $this->_parseResponse($responseBody); } @@ -1940,7 +1944,7 @@ protected function _parseXmlTrackingResponse($trackings, $response) $shipmentEventArray['deliverydate'] = (string)$shipmentEvent->Date; $shipmentEventArray['deliverytime'] = (string)$shipmentEvent->Time; $shipmentEventArray['deliverylocation'] = (string)$shipmentEvent->ServiceArea - ->Description . ' [' . (string)$shipmentEvent->ServiceArea->ServiceAreaCode . ']'; + ->Description . ' [' . (string)$shipmentEvent->ServiceArea->ServiceAreaCode . ']'; $packageProgress[] = $shipmentEventArray; } $awbinfoData['progressdetail'] = $packageProgress;