diff --git a/CHANGELOG-PUBLIC.md b/CHANGELOG-PUBLIC.md index a5bf2cc..0f20a06 100644 --- a/CHANGELOG-PUBLIC.md +++ b/CHANGELOG-PUBLIC.md @@ -764,3 +764,7 @@ SHQ23-531 Add support for PHP8.2 SHQ23-1143 Minor enhancement to inventory logic +## 20.53.2 (2023-10-02) +SHQ23-1021 Fix issue with place order call not populating site details + + diff --git a/CHANGELOG.MD b/CHANGELOG.MD index a5bf2cc..0f20a06 100755 --- a/CHANGELOG.MD +++ b/CHANGELOG.MD @@ -764,3 +764,7 @@ SHQ23-531 Add support for PHP8.2 SHQ23-1143 Minor enhancement to inventory logic +## 20.53.2 (2023-10-02) +SHQ23-1021 Fix issue with place order call not populating site details + + diff --git a/composer.json b/composer.json index 21cb8ac..dc2732b 100755 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "shipperhq/module-shipper", "description": "Magento Shipping integration with ShipperHQ", "type": "magento2-module", - "version": "20.53.1", + "version": "20.53.2", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/src/Helper/PostOrder.php b/src/Helper/PostOrder.php index df22cce..1812134 100644 --- a/src/Helper/PostOrder.php +++ b/src/Helper/PostOrder.php @@ -28,6 +28,7 @@ namespace ShipperHQ\Shipper\Helper; +use Magento\Framework\Exception\NoSuchEntityException; use ShipperHQ\Shipper\Model\Carrier\Processor\ShipperMapper; use ShipperHQ\WS\Client\WebServiceClientFactory; use ShipperHQ\WS\PostOrder\Placeorder\Request\PlaceOrderRequestFactory; @@ -194,13 +195,27 @@ private function getPlaceorderRequest($order, $rate) $methodCode = $carrierGroupDetail['code']; } + // SHQ23-1021 Need to add site details. Call can error although unlikely so wrapped in try/catch. + $siteDetails = null; + + try { + $siteDetails = $this->shipperMapper->getSiteDetails(); + } catch (NoSuchEntityException $e) { + $this->shipperLogger->postWarning( + 'Shipperhq_Shipper', + 'PostOrder::getPlaceorderRequest - failed to find site details', + ['error' => $e->getMessage()] + ); + } + $request = $this->placeOrderRequestFactory->create([ 'orderNumber' => $order->getIncrementId(), 'totalCharges' => $rate->getPrice(), 'carrierCode' => $rate->getCarrier(), 'methodCode' => $methodCode, 'transId' => $transactionId, - 'recipient' => $this->getRecipient($order->getShippingAddress()) + 'recipient' => $this->getRecipient($order->getShippingAddress()), + 'siteDetails' => $siteDetails, ]); $request->setCredentials($this->shipperMapper->getCredentials()); diff --git a/src/Model/Carrier/Processor/ShipperMapper.php b/src/Model/Carrier/Processor/ShipperMapper.php index ab7861f..dfacfca 100755 --- a/src/Model/Carrier/Processor/ShipperMapper.php +++ b/src/Model/Carrier/Processor/ShipperMapper.php @@ -895,7 +895,8 @@ public function getSiteDetails($storeId = null, $ipAddress = null) $edition = $this->shipperDataHelper->getConfigValue('carriers/shipper/magento_edition'); $url = $this->storeManager->getStore($storeId)->getBaseUrl(UrlInterface::URL_TYPE_LINK); $mobilePrepend = $this->shipperDataHelper->isMobile($this->httpHeader->getHttpUserAgent()) ? 'm' : ''; - $siteDetails = $this->siteDetailsFactory->create([ + + return $this->siteDetailsFactory->create([ 'ecommerceCart' => 'Magento 2 ' . $edition, 'ecommerceVersion' => $this->shipperDataHelper->getConfigValue('carriers/shipper/magento_version'), 'websiteUrl' => $url, @@ -906,8 +907,6 @@ public function getSiteDetails($storeId = null, $ipAddress = null) 'appVersion' => $this->shipperDataHelper->getConfigValue('carriers/shipper/extension_version'), 'ipAddress' => ($ipAddress === null) ? $mobilePrepend : $mobilePrepend . $ipAddress ]); - - return $siteDetails; } /** diff --git a/src/composer.json b/src/composer.json index 1e44712..6af5270 100644 --- a/src/composer.json +++ b/src/composer.json @@ -2,7 +2,7 @@ "name": "shipperhq/module-shipper", "description": "Magento Shipping integration with ShipperHQ", "type": "magento2-module", - "version": "20.53.1", + "version": "20.53.2", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/src/etc/config.xml b/src/etc/config.xml index 125f8db..efe6cfd 100755 --- a/src/etc/config.xml +++ b/src/etc/config.xml @@ -67,7 +67,7 @@ 30 0 1 - 20.53.1 + 20.53.2 300