CartRepositoryInterface.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\GiftMessage\Api;
  7. /**
  8. * Interface CartRepositoryInterface
  9. * @api
  10. * @since 100.0.2
  11. */
  12. interface CartRepositoryInterface
  13. {
  14. /**
  15. * Return the gift message for a specified order.
  16. *
  17. * @param int $cartId The shopping cart ID.
  18. * @return \Magento\GiftMessage\Api\Data\MessageInterface Gift message.
  19. */
  20. public function get($cartId);
  21. /**
  22. * Set the gift message for an entire order.
  23. *
  24. * @param int $cartId The cart ID.
  25. * @param \Magento\GiftMessage\Api\Data\MessageInterface $giftMessage The gift message.
  26. * @return bool
  27. * @throws \Magento\Framework\Exception\NoSuchEntityException The specified cart does not exist.
  28. * @throws \Magento\Framework\Exception\InputException You cannot add gift messages to empty carts.
  29. * @throws \Magento\Framework\Exception\State\InvalidTransitionException You cannot add gift messages to
  30. * virtual products.
  31. * @throws \Magento\Framework\Exception\CouldNotSaveException The specified gift message could not be saved.
  32. */
  33. public function save($cartId, \Magento\GiftMessage\Api\Data\MessageInterface $giftMessage);
  34. }