Interface InventoryProvider
-
- All Known Implementing Classes:
EmptyInventoryProvider,ExternalInventoryProvider
public interface InventoryProviderProvides a generic API to reserve inventory during checkout.- Author:
- Chad Harchar (charchar)
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Map<String,List<SkuInventoryAvailabilitySummary>>getInventorySummariesBySku(Map<String,Integer> skuCodesWithQuantity, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)Gets a map ofSkuInventoryAvailabilitySummariesby SKU.booleanisInventoryAvailable(String skuCode, int quantity, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)Determines whether Inventory is available for a particular SKU.Map<String,Boolean>isInventoryAvailable(Map<String,Integer> skuCodesWithQuantity, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)Determines whether Inventory is available for a list of SKUs.voidreserveInventory(com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)Decrement or otherwise "reserve" inventory for a cart during checkout.
-
-
-
Method Detail
-
reserveInventory
void reserveInventory(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)Decrement or otherwise "reserve" inventory for a cart during checkout.- Parameters:
cart- The cart for which to decrement inventory.contextInfo- Context information around sandbox and multitenant state.- Throws:
InventoryUnavailableException- if inventory is not available.
-
isInventoryAvailable
boolean isInventoryAvailable(@NonNull String skuCode, int quantity, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)Determines whether Inventory is available for a particular SKU.- Parameters:
skuCode- the sku code for which to check inventory availabilityquantity- the quantity of the sku code that will be requestedcontextInfo- context information surrounding sandboxing and multitenant state- Returns:
trueif inventory is available for the SKU and quantity,falseotherwise
-
isInventoryAvailable
Map<String,Boolean> isInventoryAvailable(@NonNull Map<String,Integer> skuCodesWithQuantity, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Determines whether Inventory is available for a list of SKUs.By default, if the SKU is available for one of the SKU locations or vendors, then it's considered available overall.
Use
getInventorySummariesBySku(Map, ContextInfo)for custom logic on SKU inventory availability.- Parameters:
skuCodesWithQuantity- a map of the sku codes and quantity for which to check inventory availabilitycontextInfo- context information surrounding sandboxing and multitenant state- Returns:
- a map of the sku code with
trueif inventory is available for the SKU and quantity, andfalseotherwise
-
getInventorySummariesBySku
Map<String,List<SkuInventoryAvailabilitySummary>> getInventorySummariesBySku(@NonNull Map<String,Integer> skuCodesWithQuantity, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Gets a map ofSkuInventoryAvailabilitySummariesby SKU.There can be multiple
SkuInventoryAvailabilitySummariesfor one SKU, if there are SKU inventories set up at multiple inventory locations or vendors.This is useful for custom SKU inventory availability logic.
- Parameters:
skuCodesWithQuantity- a map of the sku codes and quantity for which to check inventory availabilitycontextInfo- context information surrounding sandboxing and multitenant state- Returns:
- a map of
SkuInventoryAvailabilitySummariesby SKU
-
-