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

public class ExternalInventoryProvider extends AbstractExternalProvider implements InventoryProvider
  • Field Details

    • AVAILABILITY_CHECK_UNEXPECTED_FAILURE_ERROR_MSG

      protected static final String AVAILABILITY_CHECK_UNEXPECTED_FAILURE_ERROR_MSG
      See Also:
  • Constructor Details

    • ExternalInventoryProvider

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

    • determineProductsInventoryAvailability

      public <P extends Product> Collection<P> determineProductsInventoryAvailability(@NonNull @NonNull Collection<P> products, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: InventoryProvider
      Hydrates the SkuInventoryAvailabilitySummary for the provided Products and its Variants.
      Specified by:
      determineProductsInventoryAvailability in interface InventoryProvider
      Parameters:
      products - The products to check inventory for
      contextInfo - Context information around sandbox and multitenant state.
      Returns:
      The products with inventory availability hydrated
    • getInventorySummaries

      protected <P extends Product> List<SkuInventoryAvailabilitySummary> getInventorySummaries(@NonNull @NonNull Collection<P> products, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    • buildSkuInventoryAvailabilityRequests

      protected <P extends Product> Collection<SkuInventoryAvailabilityRequest> buildSkuInventoryAvailabilityRequests(@NonNull @NonNull Collection<P> products, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Builds a list SkuInventoryAvailabilityRequest to verify the availability of the SKU for the provided quantity.
      Parameters:
      products - The products to check inventory for
      contextInfo - Context information around sandbox and multitenant state.
      Returns:
      a list of sku inventory availability requests
    • productRequiresInventoryCheck

      protected <P extends Product> boolean productRequiresInventoryCheck(@NonNull P product, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    • variantRequiresInventoryCheck

      protected <V extends Variant> boolean variantRequiresInventoryCheck(@NonNull V variant, @NonNull @NonNull Product product, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    • attachSummariesToProducts

      protected <P extends Product> Collection<P> attachSummariesToProducts(@NonNull @NonNull Collection<P> products, @NonNull @NonNull Collection<SkuInventoryAvailabilitySummary> summaries, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Attaches inventory availability summaries to the products.
      Parameters:
      products - The products to check inventory for
      summaries - The inventory summaries to attach
      contextInfo - Context information around sandbox and multitenant state.
      Returns:
      The products with inventory availability hydrated
    • getSkuRefIdentifier

      protected String getSkuRefIdentifier(@NonNull @NonNull SkuInventoryAvailabilitySummary summary, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    • getListType

      protected org.springframework.core.ParameterizedTypeReference<List<SkuInventoryAvailabilitySummary>> getListType()
      Gets the type reference for a list of SkuInventoryAvailabilitySummary.
      Returns:
      type reference for a list of SkuInventoryAvailabilitySummary
    • getBulkAvailabilityCheckUri

      protected String getBulkAvailabilityCheckUri(@Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Return the GET URI for Inventory Availability. By default, this looks for shipping locations only for the provided skuCodes.
      Parameters:
      contextInfo - Context information around sandbox and multitenant state.
      Returns:
    • getServiceClient

      protected String getServiceClient()
    • getCatalogBrowseWebClient

      protected org.springframework.web.reactive.function.client.WebClient getCatalogBrowseWebClient()
    • getTypeFactory

      protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory()
    • getProperties

      protected ExternalInventoryProperties getProperties()