Class DefaultGuestCartProtectionService

java.lang.Object
com.broadleafcommerce.cartoperation.service.DefaultGuestCartProtectionService
All Implemented Interfaces:
GuestCartProtectionService

public class DefaultGuestCartProtectionService extends Object implements GuestCartProtectionService
Default implementation of GuestCartProtectionService that clears typical customer information and utilizes CartProvider for storing guest tokens.
Author:
Nick Crum (ncrum)
  • Field Details

  • Constructor Details

  • Method Details

    • clearCustomerInformation

      public com.broadleafcommerce.cart.client.domain.Cart clearCustomerInformation(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: GuestCartProtectionService
      If the Cart contains payment data, then this method should clone the original cart & remove any sensitive customer data. Otherwise, this method will remove any sensitive customer data and return the existing cart.
      Specified by:
      clearCustomerInformation in interface GuestCartProtectionService
      Parameters:
      cart - the cart to clear
      contextInfo - the context info
      Returns:
      Either the original cart or a cloned cart that has been cleansed of customer data.
    • clearCustomerInformation

      public com.broadleafcommerce.cart.client.domain.Cart clearCustomerInformation(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart)
      Description copied from interface: GuestCartProtectionService
      Clears customer information from the provided cart. This is typically used to filter out personal information from a guest cart when a guest token is not present, or when generating a new guest token.

      Note, this method will not persist any changes to the cart. Instead, CartOperationService.updateCart(Cart, boolean, boolean, boolean, ContextInfo) should be used to save the cart if the changes are meant to be permanent.

      Specified by:
      clearCustomerInformation in interface GuestCartProtectionService
      Parameters:
      cart - the cart to clear
    • createGuestToken

      public com.broadleafcommerce.cart.client.domain.GuestToken createGuestToken(@NonNull @NonNull String cartId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: GuestCartProtectionService
      Creates a new guest token for the cart with the provided ID. This typically creates or replaces a token within a token store for the given cart ID, and returns the resulting token details.
      Specified by:
      createGuestToken in interface GuestCartProtectionService
      Parameters:
      cartId - the cart ID
      contextInfo - the context info
      Returns:
      the token details
    • validateGuestToken

      public com.broadleafcommerce.cart.client.domain.GuestToken validateGuestToken(@NonNull @NonNull String cartId, @NonNull @NonNull String guestToken, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: GuestCartProtectionService
      Validates the provided guest token string for the given cart ID. This typically retrieves a the token details from a token store using the cart ID, and verifies they match up with the provided token string. If verified, this will return the token details. If not verified, this will throw a GuestTokenValidationException indicating the token failed to validate.
      Specified by:
      validateGuestToken in interface GuestCartProtectionService
      Parameters:
      cartId - the cart ID
      guestToken - the guest token string
      contextInfo - the context info
      Returns:
      the verified token details
    • clearCustomerPayments

      protected void clearCustomerPayments(String cartId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    • isTokenExpired

      protected boolean isTokenExpired(com.broadleafcommerce.cart.client.domain.GuestToken retrieved)
    • getTokenProvider

      protected GuestTokenProvider getTokenProvider()
    • getTokenGenerator

      protected GuestTokenGenerator getTokenGenerator()
    • getCsrCartOpService

      protected CsrCartOperationService getCsrCartOpService()
    • setCsrCartOpService

      @Autowired public void setCsrCartOpService(CsrCartOperationService csrCartOpService)
    • getCartProvider

      protected CartProvider getCartProvider()
    • setCartProvider

      @Autowired public void setCartProvider(CartProvider cartProvider)
    • getPaymentProvider

      protected PaymentProvider<PaymentSummary> getPaymentProvider()