/**
  * Get an estimated delivery message for a quote item.
  *
  * @param  Mage_Sales_Model_Quote_Item
  * @return string
  */
 public function getEddMessage(Mage_Sales_Model_Quote_Item $item)
 {
     /** @var string $singularOrPluralItem */
     $singularOrPluralItem = (int) $item->getQty() > 1 ? 's' : '';
     /** @var EbayEnterprise_Inventory_Model_Details_Item | Varien_Object | null $eddItem */
     $eddItem = $this->detailService->getDetailsForItem($item) ?: $this->inventoryHelper->getStreetDateForBackorderableItem($item);
     return $eddItem ? $this->inventoryHelper->__($this->inventoryConfig->estimatedDeliveryTemplate, $singularOrPluralItem, $eddItem->getDeliveryWindowFromDate()->format('m/d/y'), $eddItem->getDeliveryWindowToDate()->format('m/d/y')) : '';
 }
 /**
  * handle the case where there is not enough stock to allocate the
  * full amount requested
  *
  * @param EbayEnterprise_Inventory_Model_Allocation
  * @param Mage_Sales_Model_Order_Item
  * @throws EbayEnterprise_Inventory_Exception_Allocation_Availability_Exception
  */
 protected function handleInsufficientStock(Mage_Sales_Model_Order_Item $item)
 {
     $this->logger->debug('Unable to reserve desired quantity for item {sku}', $this->logContext->getMetaData(__CLASS__, ['sku' => $item->getSku()]));
     throw Mage::exception('EbayEnterprise_Inventory_Exception_Allocation_Availability', $this->invHelper->__(static::INSUFFICIENT_STOCK_MESSAGE));
 }
 /**
  * Add error info to an item when it is not available for purchase.
  *
  * @param Mage_Sales_Model_Quote_Item
  * @param int
  * @return self
  */
 protected function _addInsufficientStockErrorInfoForItem(Mage_Sales_Model_Quote_Item $item, $availableQuantity)
 {
     return $this->_addErrorInfoForItem($item, self::INSUFFICIENT_STOCK_ERROR_CODE, $this->_inventoryHelper->__(self::ITEM_INSUFFICIENT_STOCK_MESSAGE, $item->getName(), $availableQuantity), $this->_inventoryHelper->__(self::QUOTE_INSUFFICIENT_STOCK_MESSAGE));
 }
 /**
  * Add error info to an item when it is not available for purchase.
  *
  * @param Mage_Sales_Model_Quote_Item
  * @param int
  * @return self
  */
 protected function _addInsufficientStockErrorInfoForItem(Mage_Sales_Model_Quote_Item $item, $quantityAvailable)
 {
     return $this->_addErrorInfoForItem($item, EbayEnterprise_Inventory_Model_Quantity_Service::INSUFFICIENT_STOCK_ERROR_CODE, $this->inventoryHelper->__(EbayEnterprise_Inventory_Model_Quantity_Service::ITEM_INSUFFICIENT_STOCK_MESSAGE, $item->getName(), $quantityAvailable), $this->inventoryHelper->__(EbayEnterprise_Inventory_Model_Quantity_Service::QUOTE_INSUFFICIENT_STOCK_MESSAGE));
 }
 protected function handleDesynchedFromQuantity()
 {
     throw Mage::exception('EbayEnterprise_Inventory_Exception_Details_Unavailable', $this->invHelper->__(static::ITEM_UNAVAILABLE));
 }
 /**
  * Create a fairly generic exception for the inventory module indicating
  * that quantity collection via the SDK has failed.
  *
  * @return EbayEnterprise_Inventory_Exception_Quantity_Collector_Exception
  */
 protected function _failQuantityCollection()
 {
     return Mage::exception('EbayEnterprise_Inventory_Exception_Quantity_Collector', $this->_inventoryHelper->__(self::INVENTORY_QUANTITY_FAILED_MESSAGE));
 }