Class ExternalCartOperationProvider<C extends com.broadleafcommerce.cart.client.domain.Cart>

java.lang.Object
com.broadleafcommerce.subscriptionoperation.service.provider.external.AbstractExternalProvider
com.broadleafcommerce.subscriptionoperation.service.provider.external.ExternalCartOperationProvider<C>
All Implemented Interfaces:
CartOperationProvider<C>

public class ExternalCartOperationProvider<C extends com.broadleafcommerce.cart.client.domain.Cart> extends AbstractExternalProvider implements CartOperationProvider<C>
Default implementation of CartOperationProvider for interacting with an external service.
Author:
Nathan Moore (nathandmoore)
  • Field Details

    • CUSTOMER_REF_HEADER

      public static final String CUSTOMER_REF_HEADER
      Header used to build the CustomerRef for the authenticated user while using a service client to call CartOps.
      See Also:
  • Constructor Details

    • ExternalCartOperationProvider

      public ExternalCartOperationProvider(org.springframework.web.reactive.function.client.WebClient webClient, com.fasterxml.jackson.databind.ObjectMapper objectMapper, com.broadleafcommerce.common.extension.TypeFactory typeFactory, ExternalCartOperationProviderProperties properties, com.broadleafcommerce.resource.security.utils.service.AuthenticationUtils authenticationUtils)
  • Method Details

    • createCart

      public C createCart(@NonNull @NonNull CreateCartRequest request, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: CartOperationProvider
      Method used to create a new Cart.
      Specified by:
      createCart in interface CartOperationProvider<C extends com.broadleafcommerce.cart.client.domain.Cart>
      Parameters:
      request - The information needed to create a new cart.
      contextInfo - The sandbox and multitenant context
      Returns:
      The created cart.
    • addAdditionalHeaders

      protected void addAdditionalHeaders(org.springframework.http.HttpHeaders headers)
    • buildCustomerRef

      protected com.broadleafcommerce.order.common.domain.CustomerRef buildCustomerRef()
    • buildCustomerRefForCSR

      protected com.broadleafcommerce.order.common.domain.CustomerRef buildCustomerRefForCSR()
      Builds a CustomerRef specifically for a CSR operating as themselves rather than impersonating a customer or anonymous guest.l
      Returns:
      The CustomerRef object.
    • populateAccountFields

      protected void populateAccountFields(@NonNull @NonNull com.broadleafcommerce.order.common.domain.CustomerRef customerRef)
      Populates the account-related fields for the given CustomerRef from current authentication context.
      Parameters:
      customerRef - the CustomerRef to populate the account-related fields for
    • getBaseUri

      protected org.springframework.web.util.UriComponentsBuilder getBaseUri()
      Gets the base URI common to all requests this provider will make.
      Returns:
      a URI components builder with the base URI set up
    • getServiceClient

      protected String getServiceClient()
      Gets the name of the authorized client for this service making the call.
      Returns:
      The name of the authorized client for this service making the call.
    • getCartType

      protected org.springframework.core.ParameterizedTypeReference<C> getCartType()
      Gets the type reference for a page generator of item list items.
      Returns:
      type reference for a page generator of item list items
    • getProperties

      protected ExternalCartOperationProviderProperties getProperties()
    • getAuthenticationUtils

      protected com.broadleafcommerce.resource.security.utils.service.AuthenticationUtils getAuthenticationUtils()
    • getHttpServletRequest

      protected jakarta.servlet.http.HttpServletRequest getHttpServletRequest()
    • setHttpServletRequest

      @Autowired public void setHttpServletRequest(jakarta.servlet.http.HttpServletRequest httpServletRequest)