public class DefaultGuestCartProtectionService extends Object implements GuestCartProtectionService
GuestCartProtectionService
that clears typical customer
information and utilizes CartProvider
for storing guest tokens.Modifier and Type | Field and Description |
---|---|
protected static String |
INVALID_GUEST_TOKEN_FMT |
Constructor and Description |
---|
DefaultGuestCartProtectionService(GuestTokenProvider tokenProvider,
GuestTokenGenerator tokenGenerator) |
Modifier and Type | Method and Description |
---|---|
void |
clearCustomerInformation(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart)
Clears customer information from the provided cart.
|
com.broadleafcommerce.cart.client.domain.GuestToken |
createGuestToken(@NonNull String cartId,
com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Creates a new guest token for the cart with the provided ID.
|
protected GuestTokenGenerator |
getTokenGenerator() |
protected GuestTokenProvider |
getTokenProvider() |
protected boolean |
isTokenExpired(com.broadleafcommerce.cart.client.domain.GuestToken retrieved) |
com.broadleafcommerce.cart.client.domain.GuestToken |
validateGuestToken(@NonNull String cartId,
@NonNull String guestToken,
com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Validates the provided guest token string for the given cart ID.
|
protected static final String INVALID_GUEST_TOKEN_FMT
public DefaultGuestCartProtectionService(GuestTokenProvider tokenProvider, GuestTokenGenerator tokenGenerator)
public void clearCustomerInformation(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart)
GuestCartProtectionService
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.
clearCustomerInformation
in interface GuestCartProtectionService
cart
- the cart to clearpublic com.broadleafcommerce.cart.client.domain.GuestToken createGuestToken(@NonNull @NonNull String cartId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
GuestCartProtectionService
createGuestToken
in interface GuestCartProtectionService
cartId
- the cart IDcontextInfo
- the context infopublic com.broadleafcommerce.cart.client.domain.GuestToken validateGuestToken(@NonNull @NonNull String cartId, @NonNull @NonNull String guestToken, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
GuestCartProtectionService
GuestTokenValidationException
indicating the token failed to validate.validateGuestToken
in interface GuestCartProtectionService
cartId
- the cart IDguestToken
- the guest token stringcontextInfo
- the context infoprotected boolean isTokenExpired(com.broadleafcommerce.cart.client.domain.GuestToken retrieved)
protected GuestTokenProvider getTokenProvider()
protected GuestTokenGenerator getTokenGenerator()
Copyright © 2021. All rights reserved.