Class ExternalInventoryProvider

java.lang.Object
com.broadleafcommerce.orderoperation.service.provider.external.AbstractExternalProvider
com.broadleafcommerce.orderoperation.service.provider.external.ExternalInventoryProvider
All Implemented Interfaces:
InventoryProvider

public class ExternalInventoryProvider extends AbstractExternalProvider implements InventoryProvider
  • Field Details

    • HARD_RESERVATION

      public static final String HARD_RESERVATION
      Represents the hard inventory reservation type, typically used after an order is placed.
      See Also:
    • DEFAULT_RESERVATION_REQUEST_TYPE

      protected static final String DEFAULT_RESERVATION_REQUEST_TYPE
      See Also:
    • DEFAULT_SKU_REF_FIELD_TYPE

      protected static final String DEFAULT_SKU_REF_FIELD_TYPE
      See Also:
  • Constructor Details

    • ExternalInventoryProvider

      public ExternalInventoryProvider(org.springframework.web.reactive.function.client.WebClient webClient, com.fasterxml.jackson.databind.ObjectMapper objectMapper, com.broadleafcommerce.common.extension.TypeFactory typeFactory, ExternalInventoryProperties properties)
  • Method Details

    • reserveInventory

      public boolean reserveInventory(@NonNull @NonNull com.broadleafcommerce.order.client.domain.Order order, @NonNull @NonNull com.broadleafcommerce.order.client.domain.OrderFulfillment fulfillment, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: InventoryProvider
      Reserves inventory for the given OrderFulfillment.
      Specified by:
      reserveInventory in interface InventoryProvider
      Parameters:
      order - the order associated to the fulfillment
      fulfillment - the fulfillment to reserve inventory for
      contextInfo - context information around sandbox and multitenant state.
      Returns:
      true, if the inventory was successfully reserved
    • buildInventoryReservationRequest

      protected Optional<SkuInventoryReservationRequest> buildInventoryReservationRequest(@NonNull @NonNull com.broadleafcommerce.order.client.domain.Order order, @NonNull @NonNull com.broadleafcommerce.order.client.domain.OrderFulfillment fulfillment, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    • populateInventoryReservationRequestGroup

      protected Optional<SkuInventoryReservationRequestGroup> populateInventoryReservationRequestGroup(@NotNull @NotNull com.broadleafcommerce.order.client.domain.OrderFulfillment fulfillment, Map<String,com.broadleafcommerce.order.client.domain.OrderItem> orderItemMap, Map<String,String> availabilityFailures, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    • buildSkuInventoryReservationRequestGroup

      protected SkuInventoryReservationRequestGroup buildSkuInventoryReservationRequestGroup(@NotNull @NotNull com.broadleafcommerce.order.client.domain.OrderFulfillment fulfillment, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    • getSkuReferenceFieldType

      protected String getSkuReferenceFieldType(@NonNull @NonNull com.broadleafcommerce.order.client.domain.Order order, @NonNull @NonNull com.broadleafcommerce.order.client.domain.OrderFulfillment orderFulfillment, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Hook point to determine the sku reference field type on inventory calls. SkuInventory records can be looked up or reference by a number of field types, including:
      SKU_CODE - Identifies a catalog item by a unique SKU code
      SKU_EXTERNAL_ID - An ID in another 1st or 3rd party system (e.g. in an ERP)
      SKU_CODE - Arbitrary SKU code UPC - Universal Product
      Code EAN - European Article Number (aka International Article Number)
      GTIN - Global Trade Item Number

      The default is SKU_CODE.

      Parameters:
      order - the order for the fulfillment
      orderFulfillment - the fulfillment being reserved
      contextInfo - context information surrounding sandboxing/multitenant state
      Returns:
      the sku reference field type
    • postProcessReservationResponse

      protected boolean postProcessReservationResponse(@NonNull @NonNull com.broadleafcommerce.order.client.domain.Order order, @NonNull @NonNull com.broadleafcommerce.order.client.domain.OrderFulfillment fulfillment, SkuInventoryReservationResponse reservationResponse, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    • getReservationUri

      protected String getReservationUri(@Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Return the POST URI for Inventory Reservations.
      Parameters:
      contextInfo - context information surrounding sandboxing/multitenant state
      Returns:
      the inventory reservation uri
    • getServiceClient

      protected String getServiceClient()
    • getProperties

      protected ExternalInventoryProperties getProperties()