Skip to content

Commit 5807fdd

Browse files
committed
20.53.2 SHQ23-1021 Fix issue with place order call not populating site details
1 parent 104a56e commit 5807fdd

File tree

7 files changed

+29
-7
lines changed

7 files changed

+29
-7
lines changed

CHANGELOG-PUBLIC.md

+4
Original file line numberDiff line numberDiff line change
@@ -764,3 +764,7 @@ SHQ23-531 Add support for PHP8.2
764764
SHQ23-1143 Minor enhancement to inventory logic
765765

766766

767+
## 20.53.2 (2023-10-02)
768+
SHQ23-1021 Fix issue with place order call not populating site details
769+
770+

CHANGELOG.MD

+4
Original file line numberDiff line numberDiff line change
@@ -764,3 +764,7 @@ SHQ23-531 Add support for PHP8.2
764764
SHQ23-1143 Minor enhancement to inventory logic
765765

766766

767+
## 20.53.2 (2023-10-02)
768+
SHQ23-1021 Fix issue with place order call not populating site details
769+
770+

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "shipperhq/module-shipper",
33
"description": "Magento Shipping integration with ShipperHQ",
44
"type": "magento2-module",
5-
"version": "20.53.1",
5+
"version": "20.53.2",
66
"license": [
77
"OSL-3.0",
88
"AFL-3.0"

src/Helper/PostOrder.php

+16-1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828

2929
namespace ShipperHQ\Shipper\Helper;
3030

31+
use Magento\Framework\Exception\NoSuchEntityException;
3132
use ShipperHQ\Shipper\Model\Carrier\Processor\ShipperMapper;
3233
use ShipperHQ\WS\Client\WebServiceClientFactory;
3334
use ShipperHQ\WS\PostOrder\Placeorder\Request\PlaceOrderRequestFactory;
@@ -194,13 +195,27 @@ private function getPlaceorderRequest($order, $rate)
194195
$methodCode = $carrierGroupDetail['code'];
195196
}
196197

198+
// SHQ23-1021 Need to add site details. Call can error although unlikely so wrapped in try/catch.
199+
$siteDetails = null;
200+
201+
try {
202+
$siteDetails = $this->shipperMapper->getSiteDetails();
203+
} catch (NoSuchEntityException $e) {
204+
$this->shipperLogger->postWarning(
205+
'Shipperhq_Shipper',
206+
'PostOrder::getPlaceorderRequest - failed to find site details',
207+
['error' => $e->getMessage()]
208+
);
209+
}
210+
197211
$request = $this->placeOrderRequestFactory->create([
198212
'orderNumber' => $order->getIncrementId(),
199213
'totalCharges' => $rate->getPrice(),
200214
'carrierCode' => $rate->getCarrier(),
201215
'methodCode' => $methodCode,
202216
'transId' => $transactionId,
203-
'recipient' => $this->getRecipient($order->getShippingAddress())
217+
'recipient' => $this->getRecipient($order->getShippingAddress()),
218+
'siteDetails' => $siteDetails,
204219
]);
205220

206221
$request->setCredentials($this->shipperMapper->getCredentials());

src/Model/Carrier/Processor/ShipperMapper.php

+2-3
Original file line numberDiff line numberDiff line change
@@ -895,7 +895,8 @@ public function getSiteDetails($storeId = null, $ipAddress = null)
895895
$edition = $this->shipperDataHelper->getConfigValue('carriers/shipper/magento_edition');
896896
$url = $this->storeManager->getStore($storeId)->getBaseUrl(UrlInterface::URL_TYPE_LINK);
897897
$mobilePrepend = $this->shipperDataHelper->isMobile($this->httpHeader->getHttpUserAgent()) ? 'm' : '';
898-
$siteDetails = $this->siteDetailsFactory->create([
898+
899+
return $this->siteDetailsFactory->create([
899900
'ecommerceCart' => 'Magento 2 ' . $edition,
900901
'ecommerceVersion' => $this->shipperDataHelper->getConfigValue('carriers/shipper/magento_version'),
901902
'websiteUrl' => $url,
@@ -906,8 +907,6 @@ public function getSiteDetails($storeId = null, $ipAddress = null)
906907
'appVersion' => $this->shipperDataHelper->getConfigValue('carriers/shipper/extension_version'),
907908
'ipAddress' => ($ipAddress === null) ? $mobilePrepend : $mobilePrepend . $ipAddress
908909
]);
909-
910-
return $siteDetails;
911910
}
912911

913912
/**

src/composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "shipperhq/module-shipper",
33
"description": "Magento Shipping integration with ShipperHQ",
44
"type": "magento2-module",
5-
"version": "20.53.1",
5+
"version": "20.53.2",
66
"license": [
77
"OSL-3.0",
88
"AFL-3.0"

src/etc/config.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
<ws_timeout>30</ws_timeout>
6868
<use_cache>0</use_cache>
6969
<always_use_cache>1</always_use_cache>
70-
<extension_version>20.53.1</extension_version>
70+
<extension_version>20.53.2</extension_version>
7171
<allowed_methods></allowed_methods>
7272
<magento_version></magento_version>
7373
<cache_timeout>300</cache_timeout>

0 commit comments

Comments
 (0)