CouponRepositoryInterface.php 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\SalesRule\Api;
  7. /**
  8. * Coupon CRUD interface
  9. *
  10. * @api
  11. * @since 100.0.2
  12. */
  13. interface CouponRepositoryInterface
  14. {
  15. /**
  16. * Save a coupon.
  17. *
  18. * @param \Magento\SalesRule\Api\Data\CouponInterface $coupon
  19. * @return \Magento\SalesRule\Api\Data\CouponInterface
  20. * @throws \Magento\Framework\Exception\InputException If there is a problem with the input
  21. * @throws \Magento\Framework\Exception\NoSuchEntityException If a coupon ID is sent but the coupon does not exist
  22. * @throws \Magento\Framework\Exception\LocalizedException
  23. */
  24. public function save(\Magento\SalesRule\Api\Data\CouponInterface $coupon);
  25. /**
  26. * Get coupon by coupon id.
  27. *
  28. * @param int $couponId
  29. * @return \Magento\SalesRule\Api\Data\CouponInterface
  30. * @throws \Magento\Framework\Exception\NoSuchEntityException If $couponId is not found
  31. * @throws \Magento\Framework\Exception\LocalizedException
  32. */
  33. public function getById($couponId);
  34. /**
  35. * Retrieve a coupon using the specified search criteria.
  36. *
  37. * This call returns an array of objects, but detailed information about each object’s attributes might not be
  38. * included. See https://devdocs.magento.com/codelinks/attributes.html#CouponRepositoryInterface to
  39. * determine which call to use to get detailed information about all attributes for an object.
  40. *
  41. * @param \Magento\Framework\Api\SearchCriteriaInterface $searchCriteria
  42. * @return \Magento\SalesRule\Api\Data\CouponSearchResultInterface
  43. * @throws \Magento\Framework\Exception\LocalizedException
  44. */
  45. public function getList(\Magento\Framework\Api\SearchCriteriaInterface $searchCriteria);
  46. /**
  47. * Delete coupon by coupon id.
  48. *
  49. * @param int $couponId
  50. * @return bool true on success
  51. * @throws \Magento\Framework\Exception\NoSuchEntityException
  52. * @throws \Magento\Framework\Exception\LocalizedException
  53. */
  54. public function deleteById($couponId);
  55. }