|
28 | 28 |
|
29 | 29 | namespace ShipperHQ\Shipper\Helper;
|
30 | 30 |
|
| 31 | +use Magento\Framework\Exception\NoSuchEntityException; |
31 | 32 | use ShipperHQ\Shipper\Model\Carrier\Processor\ShipperMapper;
|
32 | 33 | use ShipperHQ\WS\Client\WebServiceClientFactory;
|
33 | 34 | use ShipperHQ\WS\PostOrder\Placeorder\Request\PlaceOrderRequestFactory;
|
@@ -194,13 +195,27 @@ private function getPlaceorderRequest($order, $rate)
|
194 | 195 | $methodCode = $carrierGroupDetail['code'];
|
195 | 196 | }
|
196 | 197 |
|
| 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 | + |
197 | 211 | $request = $this->placeOrderRequestFactory->create([
|
198 | 212 | 'orderNumber' => $order->getIncrementId(),
|
199 | 213 | 'totalCharges' => $rate->getPrice(),
|
200 | 214 | 'carrierCode' => $rate->getCarrier(),
|
201 | 215 | 'methodCode' => $methodCode,
|
202 | 216 | 'transId' => $transactionId,
|
203 |
| - 'recipient' => $this->getRecipient($order->getShippingAddress()) |
| 217 | + 'recipient' => $this->getRecipient($order->getShippingAddress()), |
| 218 | + 'siteDetails' => $siteDetails, |
204 | 219 | ]);
|
205 | 220 |
|
206 | 221 | $request->setCredentials($this->shipperMapper->getCredentials());
|
|
0 commit comments