GetStockItemDataInterface.php 776 B

123456789101112131415161718192021222324252627282930313233343536
  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\InventorySalesApi\Model;
  8. use Magento\Framework\Exception\LocalizedException;
  9. /**
  10. * Responsible for retrieving StockItem Data
  11. *
  12. * @api
  13. */
  14. interface GetStockItemDataInterface
  15. {
  16. /**
  17. * Constants for represent fields in result array
  18. */
  19. const SKU = 'sku';
  20. const QUANTITY = 'quantity';
  21. const IS_SALABLE = 'is_salable';
  22. /**#@-*/
  23. /**
  24. * Given a product sku and a stock id, return stock item data.
  25. *
  26. * @param string $sku
  27. * @param int $stockId
  28. * @return array|null
  29. * @throws LocalizedException
  30. */
  31. public function execute(string $sku, int $stockId): ?array;
  32. }