Skip to content

Commit 1e3bde4

Browse files
authored
Merge pull request #9800 from magento-gl/AC-14601-V1
AC-14601 - in case of Regular Size, hight/width/depth fields should n…
2 parents fbc9275 + 16c151a commit 1e3bde4

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

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

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1436,11 +1436,12 @@ protected function _getQuotesRest()
14361436
"packages" => [
14371437
[
14381438
"typeCode" => "3BX",
1439-
"weight" => (int) $this->_getWeight($rawRequest->getWeight()),
1439+
"weight" => (float) $this->_getWeight($rawRequest->getWeight()),
14401440
"dimensions" => [
1441-
"length" => $this->_getDimension($this->getConfigData('depth')),
1442-
"width" => $this->_getDimension($this->getConfigData('width')),
1443-
"height" => $this->_getDimension($this->getConfigData('height'))
1441+
// If no value is provided for the dimension, a default size of 3 will be used
1442+
"length" => $this->_getDimension(max(3, $this->getConfigData('depth'))),
1443+
"width" => $this->_getDimension(max(3, $this->getConfigData('width'))),
1444+
"height" => $this->_getDimension(max(3, $this->getConfigData('height')))
14441445
]
14451446
]
14461447
]
@@ -1575,7 +1576,7 @@ protected function _addRestRate(array $product, array $exchangeRates): self
15751576
$dhlProduct = (string)$product['productCode'];
15761577
$totalPrice = $product['totalPrice'];
15771578
$billic_price = array_column(
1578-
array_filter($totalPrice, fn($price) => $price['currencyType'] === 'BILLC'),
1579+
array_filter($totalPrice, fn ($price) => $price['currencyType'] === 'BILLC'),
15791580
'price'
15801581
);
15811582

@@ -2245,7 +2246,7 @@ protected function _doShipmentRequestRest(): DataObject
22452246
"invoice" => [
22462247
"number" => $rawRequest->getOrderShipment()->getOrder()->getIncrementId(),
22472248
"date" => date('Y-m-d')
2248-
]
2249+
]
22492250
]
22502251
];
22512252
}

dev/tests/integration/testsuite/Magento/Dhl/Model/CarrierTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -803,9 +803,9 @@ public function testCollectRestRates()
803803
}
804804
$requestRest = $this->httpClient->getLastRequest()->getBody();
805805
self::assertStringContainsString('"weight": 18', $requestRest);
806-
self::assertStringContainsString('"height": 0.63', $requestRest);
807-
self::assertStringContainsString('"width": 0.63', $requestRest);
808-
self::assertStringContainsString('"length": 0', $requestRest);
806+
self::assertStringContainsString('"height": 1.181', $requestRest);
807+
self::assertStringContainsString('"width": 1.181', $requestRest);
808+
self::assertStringContainsString('"length": 1.181', $requestRest);
809809
}
810810

811811
/**

0 commit comments

Comments
 (0)