Class DefaultRemoveTravellerFromCartValidationStrategy

java.lang.Object
de.hybris.platform.travelfacades.strategies.impl.DefaultRemoveTravellerFromCartValidationStrategy
All Implemented Interfaces:
RemoveTravellerFromCartValidationStrategy

public class DefaultRemoveTravellerFromCartValidationStrategy extends Object implements RemoveTravellerFromCartValidationStrategy
Strategy to validate removal of traveller from normal cart.
  • Constructor Details

    • DefaultRemoveTravellerFromCartValidationStrategy

      public DefaultRemoveTravellerFromCartValidationStrategy()
  • Method Details

    • validate

      public void validate(String travellerId) throws InvalidSessionCartException, InvalidTravellerException
      Validates if 1) the cart is empty 2) traveller is not linked with any cart entry 3) cart does not contain child only after removal of traveller.
      Specified by:
      validate in interface RemoveTravellerFromCartValidationStrategy
      Parameters:
      travellerId - the id of traveller
      Throws:
      InvalidSessionCartException - if session cart does not exist
      InvalidTravellerException - if traveller linked to cart entry or its last adult in cart
    • isLinkedTraveller

      protected boolean isLinkedTraveller(CartModel sessionCart, String travellerId)
      Is traveller linked to any cart entry.
      Parameters:
      sessionCart - the session cart
      travellerId - the id of traveller
      Returns:
      true when traveller is linked to any cart entry
    • isAdultExistAfterRemove

      protected boolean isAdultExistAfterRemove(CartModel sessionCart, String travellerId)
      Is any adult traveller exist after removal of traveller.
      Parameters:
      sessionCart - the session cart
      travellerId - the id of traveller
      Returns:
      true if any adult traveller exist after removal of traveller
    • getCartService

      protected de.hybris.platform.order.CartService getCartService()
      Gets cart service.
      Returns:
      the cart service
    • setCartService

      public void setCartService(de.hybris.platform.order.CartService cartService)
      Sets cart service.
      Parameters:
      cartService - the cart service