ReservationInterface.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. declare(strict_types=1);
  7. namespace Magento\InventoryReservationsApi\Model;
  8. /**
  9. * The entity responsible for reservations, created to keep inventory amount (product quantity) up-to-date.
  10. * It is created to have a state between order creation and inventory deduction (deduction of specific SourceItems).
  11. *
  12. * Reservations are designed to be immutable entities.
  13. *
  14. * @api
  15. */
  16. interface ReservationInterface
  17. {
  18. /**
  19. * Constants for keys of data array. Identical to the name of the getter in snake case
  20. */
  21. const RESERVATION_ID = 'reservation_id';
  22. const STOCK_ID = 'stock_id';
  23. const SKU = 'sku';
  24. const QUANTITY = 'quantity';
  25. const METADATA = 'metadata';
  26. /**
  27. * Get Reservation Id
  28. *
  29. * @return int|null
  30. */
  31. public function getReservationId(): ?int;
  32. /**
  33. * Get Stock Id
  34. *
  35. * @return int
  36. */
  37. public function getStockId(): int;
  38. /**
  39. * Get Product SKU
  40. *
  41. * @return string
  42. */
  43. public function getSku(): string;
  44. /**
  45. * Get Product Qty
  46. *
  47. * This value can be positive (>0) or negative (<0) depending on the Reservation semantic.
  48. *
  49. * For example, when an Order is placed, a Reservation with negative quantity is appended.
  50. * When that Order is processed and the SourceItems related to ordered products are updated, a Reservation with
  51. * positive quantity is appended to neglect the first one.
  52. *
  53. * @return float
  54. */
  55. public function getQuantity(): float;
  56. /**
  57. * Get Reservation Metadata
  58. *
  59. * Metadata is used to store serialized data that encapsulates the semantic of a Reservation.
  60. *
  61. * @return string|null
  62. */
  63. public function getMetadata(): ?string;
  64. }