CartInterface.php 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Quote\Api\Data;
  7. /**
  8. * Interface CartInterface
  9. * @api
  10. * @since 100.0.2
  11. */
  12. interface CartInterface extends \Magento\Framework\Api\ExtensibleDataInterface
  13. {
  14. /**#@+
  15. * Constants defined for keys of array, makes typos less likely
  16. */
  17. const KEY_ID = 'id';
  18. const KEY_ENTITY_ID = 'entity_id';
  19. const KEY_CREATED_AT = 'created_at';
  20. const KEY_UPDATED_AT = 'updated_at';
  21. const KEY_CONVERTED_AT = 'converted_at';
  22. const KEY_IS_ACTIVE = 'is_active';
  23. const KEY_IS_VIRTUAL = 'is_virtual';
  24. const KEY_ITEMS = 'items';
  25. const KEY_ITEMS_COUNT = 'items_count';
  26. const KEY_ITEMS_QTY = 'items_qty';
  27. const KEY_CUSTOMER = 'customer';
  28. const KEY_CHECKOUT_METHOD = 'checkout_method';
  29. const KEY_SHIPPING_ADDRESS = 'shipping_address';
  30. const KEY_BILLING_ADDRESS = 'billing_address';
  31. const KEY_RESERVED_ORDER_ID = 'reserved_order_id';
  32. const KEY_ORIG_ORDER_ID = 'orig_order_id';
  33. const KEY_CURRENCY = 'currency';
  34. const KEY_CUSTOMER_IS_GUEST = 'customer_is_guest';
  35. const KEY_CUSTOMER_NOTE = 'customer_note';
  36. const KEY_CUSTOMER_NOTE_NOTIFY = 'customer_note_notify';
  37. const KEY_CUSTOMER_TAX_CLASS_ID = 'customer_tax_class_id';
  38. const KEY_STORE_ID = 'store_id';
  39. /**#@-*/
  40. /**
  41. * Returns the cart/quote ID.
  42. *
  43. * @return int Cart/quote ID.
  44. */
  45. public function getId();
  46. /**
  47. * Sets the cart/quote ID.
  48. *
  49. * @param int $id
  50. * @return $this
  51. */
  52. public function setId($id);
  53. /**
  54. * Returns the cart creation date and time.
  55. *
  56. * @return string|null Cart creation date and time. Otherwise, null.
  57. */
  58. public function getCreatedAt();
  59. /**
  60. * Sets the cart creation date and time.
  61. *
  62. * @param string $createdAt
  63. * @return $this
  64. */
  65. public function setCreatedAt($createdAt);
  66. /**
  67. * Returns the cart last update date and time.
  68. *
  69. * @return string|null Cart last update date and time. Otherwise, null.
  70. */
  71. public function getUpdatedAt();
  72. /**
  73. * Sets the cart last update date and time.
  74. *
  75. * @param string $updatedAt
  76. * @return $this
  77. */
  78. public function setUpdatedAt($updatedAt);
  79. /**
  80. * Returns the cart conversion date and time.
  81. *
  82. * @return string|null Cart conversion date and time. Otherwise, null.
  83. */
  84. public function getConvertedAt();
  85. /**
  86. * Sets the cart conversion date and time.
  87. *
  88. * @param string $convertedAt
  89. * @return $this
  90. */
  91. public function setConvertedAt($convertedAt);
  92. /**
  93. * Determines whether the cart is still active.
  94. *
  95. * @return bool|null Active status flag value. Otherwise, null.
  96. */
  97. public function getIsActive();
  98. /**
  99. * Sets whether the cart is still active.
  100. *
  101. * @param bool $isActive
  102. * @return $this
  103. */
  104. public function setIsActive($isActive);
  105. /**
  106. * Determines whether the cart is a virtual cart.
  107. *
  108. * A virtual cart contains virtual items.
  109. *
  110. * @return bool|null Virtual flag value. Otherwise, null.
  111. */
  112. public function getIsVirtual();
  113. /**
  114. * Lists items in the cart.
  115. *
  116. * @return \Magento\Quote\Api\Data\CartItemInterface[]|null Array of items. Otherwise, null.
  117. */
  118. public function getItems();
  119. /**
  120. * Sets items in the cart.
  121. *
  122. * @param \Magento\Quote\Api\Data\CartItemInterface[] $items
  123. * @return $this
  124. */
  125. public function setItems(array $items = null);
  126. /**
  127. * Returns the number of different items or products in the cart.
  128. *
  129. * @return int|null Number of different items or products in the cart. Otherwise, null.
  130. */
  131. public function getItemsCount();
  132. /**
  133. * Sets the number of different items or products in the cart.
  134. *
  135. * @param int $itemsCount
  136. * @return $this
  137. */
  138. public function setItemsCount($itemsCount);
  139. /**
  140. * Returns the total quantity of all cart items.
  141. *
  142. * @return float|null Total quantity of all cart items. Otherwise, null.
  143. */
  144. public function getItemsQty();
  145. /**
  146. * Sets the total quantity of all cart items.
  147. *
  148. * @param float $itemQty
  149. * @return $this
  150. */
  151. public function setItemsQty($itemQty);
  152. /**
  153. * Returns information about the customer who is assigned to the cart.
  154. *
  155. * @return \Magento\Customer\Api\Data\CustomerInterface Information about the customer who is assigned to the cart.
  156. */
  157. public function getCustomer();
  158. /**
  159. * Sets information about the customer who is assigned to the cart.
  160. *
  161. * @param \Magento\Customer\Api\Data\CustomerInterface $customer
  162. * @return $this
  163. */
  164. public function setCustomer(\Magento\Customer\Api\Data\CustomerInterface $customer = null);
  165. /**
  166. * Returns the cart billing address.
  167. *
  168. * @return \Magento\Quote\Api\Data\AddressInterface|null Cart billing address. Otherwise, null.
  169. */
  170. public function getBillingAddress();
  171. /**
  172. * Sets the cart billing address.
  173. *
  174. * @param \Magento\Quote\Api\Data\AddressInterface $billingAddress
  175. * @return $this
  176. */
  177. public function setBillingAddress(\Magento\Quote\Api\Data\AddressInterface $billingAddress = null);
  178. /**
  179. * Returns the reserved order ID for the cart.
  180. *
  181. * @return string|null Reserved order ID. Otherwise, null.
  182. */
  183. public function getReservedOrderId();
  184. /**
  185. * Sets the reserved order ID for the cart.
  186. *
  187. * @param string $reservedOrderId
  188. * @return $this
  189. */
  190. public function setReservedOrderId($reservedOrderId);
  191. /**
  192. * Returns the original order ID for the cart.
  193. *
  194. * @return int|null Original order ID. Otherwise, null.
  195. */
  196. public function getOrigOrderId();
  197. /**
  198. * Sets the original order ID for the cart.
  199. *
  200. * @param int $origOrderId
  201. * @return $this
  202. */
  203. public function setOrigOrderId($origOrderId);
  204. /**
  205. * Returns information about quote currency, such as code, exchange rate, and so on.
  206. *
  207. * @return \Magento\Quote\Api\Data\CurrencyInterface|null Quote currency information. Otherwise, null.
  208. */
  209. public function getCurrency();
  210. /**
  211. * Sets information about quote currency, such as code, exchange rate, and so on.
  212. *
  213. * @param \Magento\Quote\Api\Data\CurrencyInterface $currency
  214. * @return $this
  215. */
  216. public function setCurrency(\Magento\Quote\Api\Data\CurrencyInterface $currency = null);
  217. /**
  218. * True for guest customers, false for logged in customers
  219. *
  220. * @return bool|null
  221. */
  222. public function getCustomerIsGuest();
  223. /**
  224. * Sets true for guest customers, false for logged in customers
  225. *
  226. * @param bool $customerIsGuest
  227. * @return $this
  228. */
  229. public function setCustomerIsGuest($customerIsGuest);
  230. /**
  231. * Customer notice text
  232. *
  233. * @return string|null
  234. */
  235. public function getCustomerNote();
  236. /**
  237. * Sets Customer notice text
  238. *
  239. * @param string $customerNote
  240. * @return $this
  241. */
  242. public function setCustomerNote($customerNote);
  243. /**
  244. * Send customer notification flag
  245. *
  246. * @return bool|null
  247. */
  248. public function getCustomerNoteNotify();
  249. /**
  250. * Sets send customer notification flag
  251. *
  252. * @param bool $customerNoteNotify
  253. * @return $this
  254. */
  255. public function setCustomerNoteNotify($customerNoteNotify);
  256. /**
  257. * Get customer tax class ID.
  258. *
  259. * @return int|null
  260. */
  261. public function getCustomerTaxClassId();
  262. /**
  263. * Set customer tax class ID.
  264. *
  265. * @param int $customerTaxClassId
  266. * @return $this
  267. */
  268. public function setCustomerTaxClassId($customerTaxClassId);
  269. /**
  270. * Get store identifier
  271. *
  272. * @return int
  273. */
  274. public function getStoreId();
  275. /**
  276. * Sets store identifier
  277. *
  278. * @param int $storeId
  279. * @return $this
  280. */
  281. public function setStoreId($storeId);
  282. /**
  283. * Retrieve existing extension attributes object or create a new one.
  284. *
  285. * @return \Magento\Quote\Api\Data\CartExtensionInterface|null
  286. */
  287. public function getExtensionAttributes();
  288. /**
  289. * Set an extension attributes object.
  290. *
  291. * @param \Magento\Quote\Api\Data\CartExtensionInterface $extensionAttributes
  292. * @return $this
  293. */
  294. public function setExtensionAttributes(\Magento\Quote\Api\Data\CartExtensionInterface $extensionAttributes);
  295. }