Skip to content

Commit

Permalink
20.53.2 SHQ23-1021 Fix issue with place order call not populating sit…
Browse files Browse the repository at this point in the history
…e details
  • Loading branch information
wsajosh committed Oct 2, 2023
1 parent 104a56e commit 5807fdd
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 7 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG-PUBLIC.md
Original file line number Diff line number Diff line change
Expand Up @@ -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


4 changes: 4 additions & 0 deletions CHANGELOG.MD
Original file line number Diff line number Diff line change
Expand Up @@ -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


2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
17 changes: 16 additions & 1 deletion src/Helper/PostOrder.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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());
Expand Down
5 changes: 2 additions & 3 deletions src/Model/Carrier/Processor/ShipperMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion src/etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
<ws_timeout>30</ws_timeout>
<use_cache>0</use_cache>
<always_use_cache>1</always_use_cache>
<extension_version>20.53.1</extension_version>
<extension_version>20.53.2</extension_version>
<allowed_methods></allowed_methods>
<magento_version></magento_version>
<cache_timeout>300</cache_timeout>
Expand Down

0 comments on commit 5807fdd

Please sign in to comment.