![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/Ecombricks/InventoryQuote/Model/GuestCart/ |
<?php /** * Copyright © eComBricks. All rights reserved. * See LICENSE.txt for license details. */ namespace Ecombricks\InventoryQuote\Model\GuestCart; /** * Guest shipping method management */ class GuestShippingMethodManagement extends \Magento\Quote\Model\GuestCart\GuestShippingMethodManagement implements \Ecombricks\InventoryQuote\Api\GuestShippingMethodManagementInterface, \Ecombricks\InventoryQuote\Model\GuestCart\GuestShippingMethodManagementInterface, \Ecombricks\InventoryQuote\Api\GuestShipmentEstimationInterface { /** * Shipping method management * * @var \Ecombricks\InventoryQuote\Api\ShippingMethodManagementInterface */ protected $shippingMethodManagement; /** * Quote ID mask factory * * @var \Magento\Quote\Model\QuoteIdMaskFactory */ protected $quoteIdMaskFactory; /** * Constructor * * @param \Ecombricks\InventoryQuote\Api\ShippingMethodManagementInterface $shippingMethodManagement * @param \Magento\Quote\Model\QuoteIdMaskFactory $quoteIdMaskFactory * @return void */ public function __construct( \Ecombricks\InventoryQuote\Api\ShippingMethodManagementInterface $shippingMethodManagement, \Magento\Quote\Model\QuoteIdMaskFactory $quoteIdMaskFactory ) { parent::__construct($shippingMethodManagement, $quoteIdMaskFactory); $this->shippingMethodManagement = $shippingMethodManagement; $this->quoteIdMaskFactory = $quoteIdMaskFactory; } /** * Get quote ID by masked ID * * @param string $maskedId * @return int */ protected function getQuoteIdByMaskedId($maskedId) { return (int) $this->quoteIdMaskFactory->create()->load($maskedId, 'masked_id')->getQuoteId(); } /** * Get * * @param string $cartId * @return \Ecombricks\InventoryQuote\Api\Data\ShippingMethodInterface|null * @throws \Magento\Framework\Exception\NoSuchEntityException * @throws \Magento\Framework\Exception\StateException */ public function get($cartId) { return parent::get($cartId); } /** * Get * * @param integer $cartId * @return \Ecombricks\InventoryQuote\Api\Data\ShippingMethodInterface[] * @throws \Magento\Framework\Exception\NoSuchEntityException * @throws \Magento\Framework\Exception\StateException */ public function inventoryGet($cartId) { return $this->shippingMethodManagement->inventoryGet($this->getQuoteIdByMaskedId($cartId)); } /** * Get list * * @param string $cartId * @return \Ecombricks\InventoryQuote\Api\Data\ShippingMethodInterface[] * @throws \Magento\Framework\Exception\NoSuchEntityException * @throws \Magento\Framework\Exception\StateException */ public function getList($cartId) { return parent::getList($cartId); } /** * Estimate by address * * @param string $cartId * @param \Magento\Quote\Api\Data\EstimateAddressInterface $address * @return \Ecombricks\InventoryQuote\Api\Data\ShippingMethodInterface[] */ public function estimateByAddress($cartId, \Magento\Quote\Api\Data\EstimateAddressInterface $address) { return parent::estimateByAddress($cartId, $address); } /** * Estimate by extended address * * @param mixed $cartId * @param \Magento\Quote\Api\Data\AddressInterface $address * @return \Ecombricks\InventoryQuote\Api\Data\ShippingMethodInterface[] */ public function estimateByExtendedAddress($cartId, \Magento\Quote\Api\Data\AddressInterface $address) { return $this->shippingMethodManagement->estimateByExtendedAddress($this->getQuoteIdByMaskedId($cartId), $address); } }