Skip to content

Commit 32b3b58

Browse files
authored
Merge pull request #7657 from magento-gl/DHL_AC-3051_MAY_19_2022
Arrows Team- DHL API schema migration from 6.0 to 6.2
2 parents d74bbf7 + 3e71a66 commit 32b3b58

File tree

3 files changed

+22
-10
lines changed

3 files changed

+22
-10
lines changed

app/code/Magento/Dhl/Model/Carrier.php

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1522,6 +1522,7 @@ protected function _getMinDimension($dimensionUnit)
15221522
* @SuppressWarnings(PHPMD.NPathComplexity)
15231523
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
15241524
*/
1525+
15251526
protected function _doRequest()
15261527
{
15271528
$rawRequest = $this->_request;
@@ -1530,8 +1531,8 @@ protected function _doRequest()
15301531
'<req:ShipmentRequest' .
15311532
' xmlns:req="http://www.dhl.com"' .
15321533
' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' .
1533-
' xsi:schemaLocation="http://www.dhl.com ship-val-global-req-6.0.xsd"' .
1534-
' schemaVersion="6.0" />';
1534+
' xsi:schemaLocation="http://www.dhl.com ship-val-global-req.xsd"' .
1535+
' schemaVersion="6.2" />';
15351536
$xml = $this->_xmlElFactory->create(['data' => $xmlStr]);
15361537

15371538
$nodeRequest = $xml->addChild('Request', '', '');
@@ -1545,6 +1546,10 @@ protected function _doRequest()
15451546
$nodeServiceHeader->addChild('SiteID', (string)$this->getConfigData('id'));
15461547
$nodeServiceHeader->addChild('Password', (string)$this->getConfigData('password'));
15471548

1549+
$nodeMetaData = $nodeRequest->addChild('MetaData');
1550+
$nodeMetaData->addChild('SoftwareName', $this->buildSoftwareName());
1551+
$nodeMetaData->addChild('SoftwareVersion', $this->buildSoftwareVersion());
1552+
15481553
$originRegion = $this->getCountryParams(
15491554
$this->_scopeConfig->getValue(
15501555
Shipment::XML_PATH_STORE_COUNTRY_ID,
@@ -1585,10 +1590,10 @@ protected function _doRequest()
15851590
->getRecipientContactCompanyName() : $rawRequest
15861591
->getRecipientContactPersonName();
15871592

1588-
$nodeConsignee->addChild('CompanyName', is_string($companyName) ? substr($companyName, 0, 35) : '');
1593+
$nodeConsignee->addChild('CompanyName', is_string($companyName) ? substr($companyName, 0, 60) : '');
15891594

15901595
$address = $rawRequest->getRecipientAddressStreet1() . ' ' . $rawRequest->getRecipientAddressStreet2();
1591-
$address = $this->string->split($address, 35, false, true);
1596+
$address = $this->string->split($address, 45, false, true);
15921597
if (is_array($address)) {
15931598
foreach ($address as $addressLine) {
15941599
$nodeConsignee->addChild('AddressLine', $addressLine);
@@ -1657,7 +1662,7 @@ protected function _doRequest()
16571662
$nodeShipper->addChild('RegisteredAccount', (string)$this->getConfigData('account'));
16581663

16591664
$address = $rawRequest->getShipperAddressStreet1() . ' ' . $rawRequest->getShipperAddressStreet2();
1660-
$address = $this->string->split($address, 35, false, true);
1665+
$address = $this->string->split($address, 45, false, true);
16611666
if (is_array($address)) {
16621667
foreach ($address as $addressLine) {
16631668
$nodeShipper->addChild('AddressLine', $addressLine);
@@ -1714,7 +1719,6 @@ protected function _doRequest()
17141719
$this->_debug($debugData);
17151720
}
17161721
$this->_isShippingLabelFlag = true;
1717-
17181722
return $this->_parseResponse($responseBody);
17191723
}
17201724

@@ -1940,7 +1944,7 @@ protected function _parseXmlTrackingResponse($trackings, $response)
19401944
$shipmentEventArray['deliverydate'] = (string)$shipmentEvent->Date;
19411945
$shipmentEventArray['deliverytime'] = (string)$shipmentEvent->Time;
19421946
$shipmentEventArray['deliverylocation'] = (string)$shipmentEvent->ServiceArea
1943-
->Description . ' [' . (string)$shipmentEvent->ServiceArea->ServiceAreaCode . ']';
1947+
->Description . ' [' . (string)$shipmentEvent->ServiceArea->ServiceAreaCode . ']';
19441948
$packageProgress[] = $shipmentEventArray;
19451949
}
19461950
$awbinfoData['progressdetail'] = $packageProgress;

dev/tests/integration/testsuite/Magento/Dhl/_files/domestic_shipment_request.xml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,18 @@
66
*/
77
-->
88
<req:ShipmentRequest xmlns:req="http://www.dhl.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9-
xsi:schemaLocation="http://www.dhl.com ship-val-global-req-6.0.xsd" schemaVersion="6.0">
9+
xsi:schemaLocation="http://www.dhl.com ship-val-global-req.xsd" schemaVersion="6.2">
1010
<Request xmlns="">
1111
<ServiceHeader>
1212
<MessageTime>currentTime</MessageTime>
1313
<MessageReference>MAGE_SHIP_28TO32_Char_CHECKED</MessageReference>
1414
<SiteID>some ID</SiteID>
1515
<Password>some password</Password>
1616
</ServiceHeader>
17+
<MetaData>
18+
<SoftwareName>Magento</SoftwareName>
19+
<SoftwareVersion>1.0.0+no-v</SoftwareVersion>
20+
</MetaData>
1721
</Request>
1822
<RegionCode xmlns="">CHECKED</RegionCode>
1923
<RequestedPickupTime xmlns="">N</RequestedPickupTime>
@@ -85,4 +89,4 @@
8589
</Contact>
8690
</Shipper>
8791
<LabelImageFormat xmlns="">PDF</LabelImageFormat>
88-
</req:ShipmentRequest>
92+
</req:ShipmentRequest>

dev/tests/integration/testsuite/Magento/Dhl/_files/shipment_request.xml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,18 @@
66
*/
77
-->
88
<req:ShipmentRequest xmlns:req="http://www.dhl.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9-
xsi:schemaLocation="http://www.dhl.com ship-val-global-req-6.0.xsd" schemaVersion="6.0">
9+
xsi:schemaLocation="http://www.dhl.com ship-val-global-req.xsd" schemaVersion="6.2">
1010
<Request xmlns="">
1111
<ServiceHeader>
1212
<MessageTime>currentTime</MessageTime>
1313
<MessageReference>MAGE_SHIP_28TO32_Char_CHECKED</MessageReference>
1414
<SiteID>some ID</SiteID>
1515
<Password>some password</Password>
1616
</ServiceHeader>
17+
<MetaData>
18+
<SoftwareName>Magento</SoftwareName>
19+
<SoftwareVersion>1.0.0+no-v</SoftwareVersion>
20+
</MetaData>
1721
</Request>
1822
<RegionCode xmlns="">CHECKED</RegionCode>
1923
<RequestedPickupTime xmlns="">N</RequestedPickupTime>

0 commit comments

Comments
 (0)