@@ -1404,6 +1404,7 @@ protected function _doShipmentRequest(\Magento\Framework\DataObject $request)
1404
1404
* @param \Magento\Framework\DataObject $request
1405
1405
* @return $this|\Magento\Framework\DataObject|boolean
1406
1406
* @deprecated 100.2.3
1407
+ * @see use processAdditionalValidation method instead
1407
1408
*/
1408
1409
public function proccessAdditionalValidation (\Magento \Framework \DataObject $ request )
1409
1410
{
@@ -1532,7 +1533,7 @@ protected function _doRequest()
1532
1533
' xmlns:req="http://www.dhl.com" ' .
1533
1534
' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ' .
1534
1535
' xsi:schemaLocation="http://www.dhl.com ship-val-global-req.xsd" ' .
1535
- ' schemaVersion="6.2 " /> ' ;
1536
+ ' schemaVersion="10.0 " /> ' ;
1536
1537
$ xml = $ this ->_xmlElFactory ->create (['data ' => $ xmlStr ]);
1537
1538
1538
1539
$ nodeRequest = $ xml ->addChild ('Request ' , '' , '' );
@@ -1561,13 +1562,11 @@ protected function _doRequest()
1561
1562
$ xml ->addChild ('RegionCode ' , $ originRegion , '' );
1562
1563
}
1563
1564
$ xml ->addChild ('RequestedPickupTime ' , 'N ' , '' );
1564
- $ xml ->addChild ('NewShipper ' , 'N ' , '' );
1565
1565
$ xml ->addChild ('LanguageCode ' , 'EN ' , '' );
1566
- $ xml ->addChild ('PiecesEnabled ' , 'Y ' , '' );
1567
1566
1568
1567
/** Billing */
1569
1568
$ nodeBilling = $ xml ->addChild ('Billing ' , '' , '' );
1570
- $ nodeBilling ->addChild ('ShipperAccountNumber ' , (string )$ this ->getConfigData ('account ' ));
1569
+ $ nodeBilling ->addChild ('ShipperAccountNumber ' , (string )substr ( $ this ->getConfigData ('account ' ), 0 , 9 ));
1571
1570
/**
1572
1571
* Method of Payment:
1573
1572
* S (Shipper)
@@ -1579,9 +1578,13 @@ protected function _doRequest()
1579
1578
/**
1580
1579
* Shipment bill to account – required if Shipping PaymentType is other than 'S'
1581
1580
*/
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
+ }
1585
1588
1586
1589
/** Receiver */
1587
1590
$ nodeConsignee = $ xml ->addChild ('Consignee ' , '' , '' );
@@ -1595,11 +1598,16 @@ protected function _doRequest()
1595
1598
$ address = $ rawRequest ->getRecipientAddressStreet1 () . ' ' . $ rawRequest ->getRecipientAddressStreet2 ();
1596
1599
$ address = $ this ->string ->split ($ address , 45 , false , true );
1597
1600
if (is_array ($ address )) {
1601
+ $ addressLineNumber = 1 ;
1598
1602
foreach ($ address as $ addressLine ) {
1599
- $ nodeConsignee ->addChild ('AddressLine ' , $ addressLine );
1603
+ if ($ addressLineNumber > 3 ) {
1604
+ break ;
1605
+ }
1606
+ $ nodeConsignee ->addChild ('AddressLine ' .$ addressLineNumber , $ addressLine );
1607
+ $ addressLineNumber ++;
1600
1608
}
1601
1609
} else {
1602
- $ nodeConsignee ->addChild ('AddressLine ' , $ address );
1610
+ $ nodeConsignee ->addChild ('AddressLine1 ' , $ address );
1603
1611
}
1604
1612
1605
1613
$ nodeConsignee ->addChild ('City ' , $ rawRequest ->getRecipientAddressCity ());
@@ -1627,7 +1635,7 @@ protected function _doRequest()
1627
1635
* value should lie in between 1 to 9999.This field is mandatory.
1628
1636
*/
1629
1637
$ nodeCommodity = $ xml ->addChild ('Commodity ' , '' , '' );
1630
- $ nodeCommodity ->addChild ('CommodityCode ' , ' 1 ' );
1638
+ $ nodeCommodity ->addChild ('CommodityCode ' , substr ( ' 11 ' , 0 , 18 ) );
1631
1639
1632
1640
/** Dutiable */
1633
1641
if ($ this ->isDutiable (
@@ -1664,11 +1672,16 @@ protected function _doRequest()
1664
1672
$ address = $ rawRequest ->getShipperAddressStreet1 () . ' ' . $ rawRequest ->getShipperAddressStreet2 ();
1665
1673
$ address = $ this ->string ->split ($ address , 45 , false , true );
1666
1674
if (is_array ($ address )) {
1675
+ $ addressLineNumber = 1 ;
1667
1676
foreach ($ address as $ addressLine ) {
1668
- $ nodeShipper ->addChild ('AddressLine ' , $ addressLine );
1677
+ if ($ addressLineNumber > 3 ) {
1678
+ break ;
1679
+ }
1680
+ $ nodeShipper ->addChild ('AddressLine ' .$ addressLineNumber , $ addressLine );
1681
+ $ addressLineNumber ++;
1669
1682
}
1670
1683
} else {
1671
- $ nodeShipper ->addChild ('AddressLine ' , $ address );
1684
+ $ nodeShipper ->addChild ('AddressLine1 ' , $ address );
1672
1685
}
1673
1686
1674
1687
$ nodeShipper ->addChild ('City ' , $ rawRequest ->getShipperAddressCity ());
@@ -1736,7 +1749,6 @@ protected function _doRequest()
1736
1749
protected function _shipmentDetails ($ xml , $ rawRequest , $ originRegion = '' )
1737
1750
{
1738
1751
$ nodeShipmentDetails = $ xml ->addChild ('ShipmentDetails ' , '' , '' );
1739
- $ nodeShipmentDetails ->addChild ('NumberOfPieces ' , count ($ rawRequest ->getPackages ()));
1740
1752
1741
1753
$ nodePieces = $ nodeShipmentDetails ->addChild ('Pieces ' , '' , '' );
1742
1754
@@ -1770,7 +1782,6 @@ protected function _shipmentDetails($xml, $rawRequest, $originRegion = '')
1770
1782
$ nodePiece ->addChild ('PieceContents ' , $ this ->string ->substr (implode (', ' , $ content ), 0 , 34 ));
1771
1783
}
1772
1784
1773
- $ nodeShipmentDetails ->addChild ('Weight ' , sprintf ('%.3f ' , $ rawRequest ->getPackageWeight ()));
1774
1785
$ nodeShipmentDetails ->addChild ('WeightUnit ' , substr ($ this ->_getWeightUnit (), 0 , 1 ));
1775
1786
$ nodeShipmentDetails ->addChild ('GlobalProductCode ' , $ rawRequest ->getShippingMethod ());
1776
1787
$ nodeShipmentDetails ->addChild ('LocalProductCode ' , $ rawRequest ->getShippingMethod ());
@@ -1779,17 +1790,15 @@ protected function _shipmentDetails($xml, $rawRequest, $originRegion = '')
1779
1790
$ this ->_coreDate ->date ('Y-m-d ' , strtotime ('now + 1day ' ))
1780
1791
);
1781
1792
$ 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
+
1788
1794
$ nodeShipmentDetails ->addChild ('DimensionUnit ' , substr ($ this ->_getDimensionUnit (), 0 , 1 ));
1789
1795
$ contentType = isset ($ package ['params ' ]['container ' ]) ? $ package ['params ' ]['container ' ] : '' ;
1790
1796
$ packageType = $ contentType === self ::DHL_CONTENT_TYPE_NON_DOC ? 'CP ' : 'EE ' ;
1791
1797
$ nodeShipmentDetails ->addChild ('PackageType ' , $ packageType );
1792
- if ($ this ->isDutiable ($ rawRequest ->getOrigCountryId (), $ rawRequest ->getDestCountryId ())) {
1798
+ if ($ this ->isDutiable (
1799
+ $ rawRequest ->getShipperAddressCountryCode (),
1800
+ $ rawRequest ->getRecipientAddressCountryCode ()
1801
+ )) {
1793
1802
$ nodeShipmentDetails ->addChild ('IsDutiable ' , 'Y ' );
1794
1803
}
1795
1804
$ nodeShipmentDetails ->addChild (
@@ -2046,7 +2055,7 @@ protected function _checkDomesticStatus($origCountryCode, $destCountryCode)
2046
2055
$ destCountry = (string )$ this ->getCountryParams ($ destCountryCode )->getData ('name ' );
2047
2056
$ isDomestic = (string )$ this ->getCountryParams ($ destCountryCode )->getData ('domestic ' );
2048
2057
2049
- if (($ origCountry == $ destCountry && $ isDomestic )
2058
+ if (($ origCountry == $ destCountry )
2050
2059
|| (
2051
2060
$ this ->_carrierHelper ->isCountryInEU ($ origCountryCode )
2052
2061
&& $ this ->_carrierHelper ->isCountryInEU ($ destCountryCode )
0 commit comments