50 public function modelToDataObject($rateModel, $quoteCurrencyCode)
53 $currency = $this->storeManager->getStore()->getBaseCurrency();
55 $errorMessage = $rateModel->getErrorMessage();
56 return $this->shippingMethodDataFactory->create()
57 ->setCarrierCode($rateModel->getCarrier())
58 ->setMethodCode($rateModel->getMethod())
59 ->setCarrierTitle($rateModel->getCarrierTitle())
60 ->setMethodTitle($rateModel->getMethodTitle())
61 ->setAmount($currency->convert($rateModel->getPrice(), $quoteCurrencyCode))
62 ->setBaseAmount($rateModel->getPrice())
63 ->setAvailable(empty($errorMessage))
64 ->setErrorMessage(empty($errorMessage) ?
false : $errorMessage)
66 $currency->convert($this->getShippingPriceWithFlag($rateModel,
false), $quoteCurrencyCode)
69 $currency->convert($this->getShippingPriceWithFlag($rateModel,
true), $quoteCurrencyCode)
80 private function getShippingPriceWithFlag($rateModel, $flag)
82 return $this->taxHelper->getShippingPrice(
83 $rateModel->getPrice(),
85 $rateModel->getAddress(),
86 $rateModel->getAddress()->getQuote()->getCustomerTaxClassId()
__construct(\Magento\Quote\Api\Data\ShippingMethodInterfaceFactory $shippingMethodDataFactory, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Tax\Helper\Data $taxHelper)
$shippingMethodDataFactory