GuestCartItemRepositoryInterface.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Quote\Api;
  7. /**
  8. * Cart Item repository interface for guest carts.
  9. * @api
  10. * @since 100.0.2
  11. */
  12. interface GuestCartItemRepositoryInterface
  13. {
  14. /**
  15. * List items that are assigned to a specified cart.
  16. *
  17. * @param string $cartId The cart ID.
  18. * @return \Magento\Quote\Api\Data\CartItemInterface[] Array of items.
  19. * @throws \Magento\Framework\Exception\NoSuchEntityException The specified cart does not exist.
  20. */
  21. public function getList($cartId);
  22. /**
  23. * Add/update the specified cart item.
  24. *
  25. * @param \Magento\Quote\Api\Data\CartItemInterface $cartItem The item.
  26. * @return \Magento\Quote\Api\Data\CartItemInterface Item.
  27. * @throws \Magento\Framework\Exception\NoSuchEntityException The specified cart does not exist.
  28. * @throws \Magento\Framework\Exception\CouldNotSaveException The specified item could not be saved to the cart.
  29. * @throws \Magento\Framework\Exception\InputException The specified item or cart is not valid.
  30. */
  31. public function save(\Magento\Quote\Api\Data\CartItemInterface $cartItem);
  32. /**
  33. * Remove the specified item from the specified cart.
  34. *
  35. * @param string $cartId The cart ID.
  36. * @param int $itemId The item ID of the item to be removed.
  37. * @return bool
  38. * @throws \Magento\Framework\Exception\NoSuchEntityException The specified item or cart does not exist.
  39. * @throws \Magento\Framework\Exception\CouldNotSaveException The item could not be removed.
  40. */
  41. public function deleteById($cartId, $itemId);
  42. }