RuleInterface.php 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\SalesRule\Api\Data;
  7. /**
  8. * Interface RuleInterface
  9. *
  10. * @api
  11. * @since 100.0.2
  12. */
  13. interface RuleInterface extends \Magento\Framework\Api\ExtensibleDataInterface
  14. {
  15. const FREE_SHIPPING_NONE = 'NONE';
  16. const FREE_SHIPPING_MATCHING_ITEMS_ONLY = 'MATCHING_ITEMS_ONLY';
  17. const FREE_SHIPPING_WITH_MATCHING_ITEMS = 'FREE_WITH_MATCHING_ITEMS';
  18. const DISCOUNT_ACTION_BY_PERCENT = 'by_percent';
  19. const DISCOUNT_ACTION_FIXED_AMOUNT = 'by_fixed';
  20. const DISCOUNT_ACTION_FIXED_AMOUNT_FOR_CART = 'cart_fixed';
  21. const DISCOUNT_ACTION_BUY_X_GET_Y = 'buy_x_get_y';
  22. const COUPON_TYPE_NO_COUPON = 'NO_COUPON';
  23. const COUPON_TYPE_SPECIFIC_COUPON = 'SPECIFIC_COUPON';
  24. const COUPON_TYPE_AUTO = 'AUTO';
  25. /**
  26. * Return rule id
  27. *
  28. * @return int|null
  29. */
  30. public function getRuleId();
  31. /**
  32. * Set rule id
  33. *
  34. * @param int $ruleId
  35. * @return $this
  36. */
  37. public function setRuleId($ruleId);
  38. /**
  39. * Get rule name
  40. *
  41. * @return string|null
  42. */
  43. public function getName();
  44. /**
  45. * Set rule name
  46. *
  47. * @param string $name
  48. * @return $this
  49. */
  50. public function setName($name);
  51. /**
  52. * Get display label
  53. *
  54. * @return \Magento\SalesRule\Api\Data\RuleLabelInterface[]|null
  55. */
  56. public function getStoreLabels();
  57. /**
  58. * Set display label
  59. *
  60. * @param \Magento\SalesRule\Api\Data\RuleLabelInterface[]|null $storeLabels
  61. * @return $this
  62. */
  63. public function setStoreLabels(array $storeLabels = null);
  64. /**
  65. * Get description
  66. *
  67. * @return string|null
  68. */
  69. public function getDescription();
  70. /**
  71. * Set description
  72. *
  73. * @param string $description
  74. * @return $this
  75. */
  76. public function setDescription($description);
  77. /**
  78. * Get a list of websites the rule applies to
  79. *
  80. * @return int[]
  81. */
  82. public function getWebsiteIds();
  83. /**
  84. * Set the websites the rule applies to
  85. *
  86. * @param int[] $websiteIds
  87. * @return $this
  88. */
  89. public function setWebsiteIds(array $websiteIds);
  90. /**
  91. * Get ids of customer groups that the rule applies to
  92. *
  93. * @return int[]
  94. */
  95. public function getCustomerGroupIds();
  96. /**
  97. * Set the customer groups that the rule applies to
  98. *
  99. * @param int[] $customerGroupIds
  100. * @return $this
  101. */
  102. public function setCustomerGroupIds(array $customerGroupIds);
  103. /**
  104. * Get the start date when the coupon is active
  105. *
  106. * @return string|null
  107. */
  108. public function getFromDate();
  109. /**
  110. * Set the star date when the coupon is active
  111. *
  112. * @param string $fromDate
  113. * @return $this
  114. */
  115. public function setFromDate($fromDate);
  116. /**
  117. * Get the end date when the coupon is active
  118. *
  119. * @return string|null
  120. */
  121. public function getToDate();
  122. /**
  123. * Set the end date when the coupon is active
  124. *
  125. * @param string $fromDate
  126. * @return $this
  127. */
  128. public function setToDate($fromDate);
  129. /**
  130. * Get number of uses per customer
  131. *
  132. * @return int
  133. */
  134. public function getUsesPerCustomer();
  135. /**
  136. * Get number of uses per customer
  137. *
  138. * @param int $usesPerCustomer
  139. * @return $this
  140. */
  141. public function setUsesPerCustomer($usesPerCustomer);
  142. /**
  143. * Whether the coupon is active
  144. *
  145. * @return bool
  146. * @SuppressWarnings(PHPMD.BooleanGetMethodName)
  147. */
  148. public function getIsActive();
  149. /**
  150. * Set whether the coupon is active
  151. *
  152. * @param bool $isActive
  153. * @return bool
  154. */
  155. public function setIsActive($isActive);
  156. /**
  157. * Get condition for the rule
  158. *
  159. * @return \Magento\SalesRule\Api\Data\ConditionInterface|null
  160. */
  161. public function getCondition();
  162. /**
  163. * Set condition for the rule
  164. *
  165. * @param \Magento\SalesRule\Api\Data\ConditionInterface|null $condition
  166. * @return $this
  167. */
  168. public function setCondition(ConditionInterface $condition = null);
  169. /**
  170. * Get action condition
  171. *
  172. * @return \Magento\SalesRule\Api\Data\ConditionInterface|null
  173. */
  174. public function getActionCondition();
  175. /**
  176. * Set action condition
  177. *
  178. * @param \Magento\SalesRule\Api\Data\ConditionInterface|null $actionCondition
  179. * @return $this
  180. */
  181. public function setActionCondition(ConditionInterface $actionCondition = null);
  182. /**
  183. * Whether to stop rule processing
  184. *
  185. * @return bool
  186. * @SuppressWarnings(PHPMD.BooleanGetMethodName)
  187. */
  188. public function getStopRulesProcessing();
  189. /**
  190. * Set whether to stop rule processing
  191. *
  192. * @param bool $stopRulesProcessing
  193. * @return $this
  194. */
  195. public function setStopRulesProcessing($stopRulesProcessing);
  196. /**
  197. * TODO: is this field needed
  198. *
  199. * @return bool
  200. * @SuppressWarnings(PHPMD.BooleanGetMethodName)
  201. */
  202. public function getIsAdvanced();
  203. /**
  204. * @param bool $isAdvanced
  205. * @return $this
  206. */
  207. public function setIsAdvanced($isAdvanced);
  208. /**
  209. * Return product ids
  210. *
  211. * @return int[]|null
  212. */
  213. public function getProductIds();
  214. /**
  215. * Set product ids
  216. *
  217. * @param int[]|null $productIds
  218. * @return $this
  219. */
  220. public function setProductIds(array $productIds = null);
  221. /**
  222. * Get sort order
  223. *
  224. * @return int
  225. */
  226. public function getSortOrder();
  227. /**
  228. * @param int $sortOrder
  229. * @return $this
  230. */
  231. public function setSortOrder($sortOrder);
  232. /**
  233. * Get simple action of the rule
  234. *
  235. * @return string|null
  236. */
  237. public function getSimpleAction();
  238. /**
  239. * Set simple action
  240. *
  241. * @param string $simpleAction
  242. * @return $this
  243. */
  244. public function setSimpleAction($simpleAction);
  245. /**
  246. * Get discount amount
  247. *
  248. * @return float
  249. */
  250. public function getDiscountAmount();
  251. /**
  252. * Set discount amount
  253. *
  254. * @param float $discountAmount
  255. * @return $this
  256. */
  257. public function setDiscountAmount($discountAmount);
  258. /**
  259. * Return maximum qty discount is applied
  260. *
  261. * @return float|null
  262. */
  263. public function getDiscountQty();
  264. /**
  265. * Set maximum qty discount is applied
  266. *
  267. * @param float $discountQty
  268. * @return $this
  269. */
  270. public function setDiscountQty($discountQty);
  271. /**
  272. * Get discount step
  273. *
  274. * @return int
  275. */
  276. public function getDiscountStep();
  277. /**
  278. * Set discount step
  279. *
  280. * @param int $discountStep
  281. * @return $this
  282. */
  283. public function setDiscountStep($discountStep);
  284. /**
  285. * Whether the rule applies to shipping
  286. *
  287. * @return bool
  288. * @SuppressWarnings(PHPMD.BooleanGetMethodName)
  289. */
  290. public function getApplyToShipping();
  291. /**
  292. * Set whether the rule applies to shipping
  293. *
  294. * @param bool $applyToShipping
  295. * @return $this
  296. */
  297. public function setApplyToShipping($applyToShipping);
  298. /**
  299. * Return how many times the rule has been used
  300. *
  301. * @return int
  302. */
  303. public function getTimesUsed();
  304. /**
  305. * Set how many times the rule has been used
  306. *
  307. * @param int $timesUsed
  308. * @return $this
  309. */
  310. public function setTimesUsed($timesUsed);
  311. /**
  312. * Return whether the rule is in RSS
  313. *
  314. * @return bool
  315. * @SuppressWarnings(PHPMD.BooleanGetMethodName)
  316. */
  317. public function getIsRss();
  318. /**
  319. * Set whether the rule is shown in RSS
  320. *
  321. * @param bool $isRss
  322. * @return $this
  323. */
  324. public function setIsRss($isRss);
  325. /**
  326. * Get coupon type
  327. *
  328. * @return string
  329. */
  330. public function getCouponType();
  331. /**
  332. * Set coupon type
  333. *
  334. * @param string $couponType
  335. * @return $this
  336. */
  337. public function setCouponType($couponType);
  338. /**
  339. * Whether to auto generate coupon
  340. *
  341. * @return bool
  342. * @SuppressWarnings(PHPMD.BooleanGetMethodName)
  343. */
  344. public function getUseAutoGeneration();
  345. /**
  346. * Set whether the rule uses auto coupon generation
  347. *
  348. * @param bool $useAutoGeneration
  349. * @return $this
  350. */
  351. public function setUseAutoGeneration($useAutoGeneration);
  352. /**
  353. * Return limit of uses per coupon
  354. *
  355. * @return int
  356. */
  357. public function getUsesPerCoupon();
  358. /**
  359. * Set the limit of uses per coupon
  360. *
  361. * @param int $usesPerCoupon
  362. * @return $this
  363. */
  364. public function setUsesPerCoupon($usesPerCoupon);
  365. /**
  366. * When to grant free shipping
  367. *
  368. * @return string|null
  369. */
  370. public function getSimpleFreeShipping();
  371. /**
  372. * Set when to grant free shipping
  373. *
  374. * @param string $simpleFreeShipping
  375. * @return $this
  376. */
  377. public function setSimpleFreeShipping($simpleFreeShipping);
  378. /**
  379. * Retrieve existing extension attributes object or create a new one.
  380. *
  381. * @return \Magento\SalesRule\Api\Data\RuleExtensionInterface|null
  382. */
  383. public function getExtensionAttributes();
  384. /**
  385. * Set an extension attributes object.
  386. *
  387. * @param \Magento\SalesRule\Api\Data\RuleExtensionInterface $extensionAttributes
  388. * @return $this
  389. */
  390. public function setExtensionAttributes(\Magento\SalesRule\Api\Data\RuleExtensionInterface $extensionAttributes);
  391. }