@@ -1404,6 +1404,7 @@ protected function _doShipmentRequest(\Magento\Framework\DataObject $request)
14041404 * @param \Magento\Framework\DataObject $request
14051405 * @return $this|\Magento\Framework\DataObject|boolean
14061406 * @deprecated 100.2.3
1407+ * @see use processAdditionalValidation method instead
14071408 */
14081409 public function proccessAdditionalValidation (\Magento \Framework \DataObject $ request )
14091410 {
@@ -1532,7 +1533,7 @@ protected function _doRequest()
15321533 ' xmlns:req="http://www.dhl.com" ' .
15331534 ' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ' .
15341535 ' xsi:schemaLocation="http://www.dhl.com ship-val-global-req.xsd" ' .
1535- ' schemaVersion="6.2 " /> ' ;
1536+ ' schemaVersion="10.0 " /> ' ;
15361537 $ xml = $ this ->_xmlElFactory ->create (['data ' => $ xmlStr ]);
15371538
15381539 $ nodeRequest = $ xml ->addChild ('Request ' , '' , '' );
@@ -1561,13 +1562,11 @@ protected function _doRequest()
15611562 $ xml ->addChild ('RegionCode ' , $ originRegion , '' );
15621563 }
15631564 $ xml ->addChild ('RequestedPickupTime ' , 'N ' , '' );
1564- $ xml ->addChild ('NewShipper ' , 'N ' , '' );
15651565 $ xml ->addChild ('LanguageCode ' , 'EN ' , '' );
1566- $ xml ->addChild ('PiecesEnabled ' , 'Y ' , '' );
15671566
15681567 /** Billing */
15691568 $ nodeBilling = $ xml ->addChild ('Billing ' , '' , '' );
1570- $ nodeBilling ->addChild ('ShipperAccountNumber ' , (string )$ this ->getConfigData ('account ' ));
1569+ $ nodeBilling ->addChild ('ShipperAccountNumber ' , (string )substr ( $ this ->getConfigData ('account ' ), 0 , 9 ));
15711570 /**
15721571 * Method of Payment:
15731572 * S (Shipper)
@@ -1579,9 +1578,13 @@ protected function _doRequest()
15791578 /**
15801579 * Shipment bill to account – required if Shipping PaymentType is other than 'S'
15811580 */
1582- $ nodeBilling ->addChild ('BillingAccountNumber ' , (string )$ this ->getConfigData ('account ' ));
1583- $ nodeBilling ->addChild ('DutyPaymentType ' , 'S ' );
1584- $ nodeBilling ->addChild ('DutyAccountNumber ' , (string )$ this ->getConfigData ('account ' ));
1581+ $ nodeBilling ->addChild ('BillingAccountNumber ' , (string )substr ($ this ->getConfigData ('account ' ), 0 , 9 ));
1582+ if ($ this ->isDutiable (
1583+ $ rawRequest ->getShipperAddressCountryCode (),
1584+ $ rawRequest ->getRecipientAddressCountryCode ()
1585+ )) {
1586+ $ nodeBilling ->addChild ('DutyAccountNumber ' , (string )substr ($ this ->getConfigData ('account ' ), 0 , 9 ));
1587+ }
15851588
15861589 /** Receiver */
15871590 $ nodeConsignee = $ xml ->addChild ('Consignee ' , '' , '' );
@@ -1595,11 +1598,16 @@ protected function _doRequest()
15951598 $ address = $ rawRequest ->getRecipientAddressStreet1 () . ' ' . $ rawRequest ->getRecipientAddressStreet2 ();
15961599 $ address = $ this ->string ->split ($ address , 45 , false , true );
15971600 if (is_array ($ address )) {
1601+ $ addressLineNumber = 1 ;
15981602 foreach ($ address as $ addressLine ) {
1599- $ nodeConsignee ->addChild ('AddressLine ' , $ addressLine );
1603+ if ($ addressLineNumber > 3 ) {
1604+ break ;
1605+ }
1606+ $ nodeConsignee ->addChild ('AddressLine ' .$ addressLineNumber , $ addressLine );
1607+ $ addressLineNumber ++;
16001608 }
16011609 } else {
1602- $ nodeConsignee ->addChild ('AddressLine ' , $ address );
1610+ $ nodeConsignee ->addChild ('AddressLine1 ' , $ address );
16031611 }
16041612
16051613 $ nodeConsignee ->addChild ('City ' , $ rawRequest ->getRecipientAddressCity ());
@@ -1627,7 +1635,7 @@ protected function _doRequest()
16271635 * value should lie in between 1 to 9999.This field is mandatory.
16281636 */
16291637 $ nodeCommodity = $ xml ->addChild ('Commodity ' , '' , '' );
1630- $ nodeCommodity ->addChild ('CommodityCode ' , ' 1 ' );
1638+ $ nodeCommodity ->addChild ('CommodityCode ' , substr ( ' 11 ' , 0 , 18 ) );
16311639
16321640 /** Dutiable */
16331641 if ($ this ->isDutiable (
@@ -1664,11 +1672,16 @@ protected function _doRequest()
16641672 $ address = $ rawRequest ->getShipperAddressStreet1 () . ' ' . $ rawRequest ->getShipperAddressStreet2 ();
16651673 $ address = $ this ->string ->split ($ address , 45 , false , true );
16661674 if (is_array ($ address )) {
1675+ $ addressLineNumber = 1 ;
16671676 foreach ($ address as $ addressLine ) {
1668- $ nodeShipper ->addChild ('AddressLine ' , $ addressLine );
1677+ if ($ addressLineNumber > 3 ) {
1678+ break ;
1679+ }
1680+ $ nodeShipper ->addChild ('AddressLine ' .$ addressLineNumber , $ addressLine );
1681+ $ addressLineNumber ++;
16691682 }
16701683 } else {
1671- $ nodeShipper ->addChild ('AddressLine ' , $ address );
1684+ $ nodeShipper ->addChild ('AddressLine1 ' , $ address );
16721685 }
16731686
16741687 $ nodeShipper ->addChild ('City ' , $ rawRequest ->getShipperAddressCity ());
@@ -1736,7 +1749,6 @@ protected function _doRequest()
17361749 protected function _shipmentDetails ($ xml , $ rawRequest , $ originRegion = '' )
17371750 {
17381751 $ nodeShipmentDetails = $ xml ->addChild ('ShipmentDetails ' , '' , '' );
1739- $ nodeShipmentDetails ->addChild ('NumberOfPieces ' , count ($ rawRequest ->getPackages ()));
17401752
17411753 $ nodePieces = $ nodeShipmentDetails ->addChild ('Pieces ' , '' , '' );
17421754
@@ -1770,7 +1782,6 @@ protected function _shipmentDetails($xml, $rawRequest, $originRegion = '')
17701782 $ nodePiece ->addChild ('PieceContents ' , $ this ->string ->substr (implode (', ' , $ content ), 0 , 34 ));
17711783 }
17721784
1773- $ nodeShipmentDetails ->addChild ('Weight ' , sprintf ('%.3f ' , $ rawRequest ->getPackageWeight ()));
17741785 $ nodeShipmentDetails ->addChild ('WeightUnit ' , substr ($ this ->_getWeightUnit (), 0 , 1 ));
17751786 $ nodeShipmentDetails ->addChild ('GlobalProductCode ' , $ rawRequest ->getShippingMethod ());
17761787 $ nodeShipmentDetails ->addChild ('LocalProductCode ' , $ rawRequest ->getShippingMethod ());
@@ -1779,17 +1790,15 @@ protected function _shipmentDetails($xml, $rawRequest, $originRegion = '')
17791790 $ this ->_coreDate ->date ('Y-m-d ' , strtotime ('now + 1day ' ))
17801791 );
17811792 $ nodeShipmentDetails ->addChild ('Contents ' , 'DHL Parcel ' );
1782- /**
1783- * The DoorTo Element defines the type of delivery service that applies to the shipment.
1784- * The valid values are DD (Door to Door), DA (Door to Airport) , AA and DC (Door to
1785- * Door non-compliant)
1786- */
1787- $ nodeShipmentDetails ->addChild ('DoorTo ' , 'DD ' );
1793+
17881794 $ nodeShipmentDetails ->addChild ('DimensionUnit ' , substr ($ this ->_getDimensionUnit (), 0 , 1 ));
17891795 $ contentType = isset ($ package ['params ' ]['container ' ]) ? $ package ['params ' ]['container ' ] : '' ;
17901796 $ packageType = $ contentType === self ::DHL_CONTENT_TYPE_NON_DOC ? 'CP ' : 'EE ' ;
17911797 $ nodeShipmentDetails ->addChild ('PackageType ' , $ packageType );
1792- if ($ this ->isDutiable ($ rawRequest ->getOrigCountryId (), $ rawRequest ->getDestCountryId ())) {
1798+ if ($ this ->isDutiable (
1799+ $ rawRequest ->getShipperAddressCountryCode (),
1800+ $ rawRequest ->getRecipientAddressCountryCode ()
1801+ )) {
17931802 $ nodeShipmentDetails ->addChild ('IsDutiable ' , 'Y ' );
17941803 }
17951804 $ nodeShipmentDetails ->addChild (
@@ -2046,7 +2055,7 @@ protected function _checkDomesticStatus($origCountryCode, $destCountryCode)
20462055 $ destCountry = (string )$ this ->getCountryParams ($ destCountryCode )->getData ('name ' );
20472056 $ isDomestic = (string )$ this ->getCountryParams ($ destCountryCode )->getData ('domestic ' );
20482057
2049- if (($ origCountry == $ destCountry && $ isDomestic )
2058+ if (($ origCountry == $ destCountry )
20502059 || (
20512060 $ this ->_carrierHelper ->isCountryInEU ($ origCountryCode )
20522061 && $ this ->_carrierHelper ->isCountryInEU ($ destCountryCode )
0 commit comments