Class DefaultTravelCartService

java.lang.Object
de.hybris.platform.servicelayer.internal.service.AbstractService
de.hybris.platform.servicelayer.internal.service.AbstractBusinessService
de.hybris.platform.order.impl.DefaultAbstractOrderService<CartModel,CartEntryModel>
de.hybris.platform.order.impl.DefaultCartService
de.hybris.platform.travelservices.order.impl.DefaultTravelCartService
All Implemented Interfaces:
de.hybris.platform.order.AbstractOrderService<CartModel,CartEntryModel>, de.hybris.platform.order.CartService, TravelCartService, Serializable, org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanNameAware, org.springframework.beans.factory.InitializingBean
Direct Known Subclasses:
DefaultShoppingTravelCartService

public class DefaultTravelCartService extends de.hybris.platform.order.impl.DefaultCartService implements TravelCartService
Extends DefaultCartService to handle travel specific services like creating cart from order
See Also:
  • Field Details

    • FIRST_ORDER_ENTRY_ID

      protected final Integer FIRST_ORDER_ENTRY_ID
  • Constructor Details

    • DefaultTravelCartService

      public DefaultTravelCartService()
  • Method Details

    • getSessionCart

      public CartModel getSessionCart()
      Specified by:
      getSessionCart in interface de.hybris.platform.order.CartService
      Overrides:
      getSessionCart in class de.hybris.platform.order.impl.DefaultCartService
    • createCartFromOrder

      public CartModel createCartFromOrder(String orderCode, String guid)
      Description copied from interface: TravelCartService
      Creates a cart from order which will contain a reference to cloned order by originalOrderCode attribute
      Specified by:
      createCartFromOrder in interface TravelCartService
      Parameters:
      orderCode - original order
      guid - the guid
      Returns:
      newly created Cart
    • createCartFromOrder

      public CartModel createCartFromOrder(OrderModel orderModel, UserModel userModel)
      Description copied from interface: TravelCartService
      Creates a cart from order which will contain a reference to cloned order by original order.
      Specified by:
      createCartFromOrder in interface TravelCartService
      userModel - the user
      Returns:
      newly created cart
    • resetPaymentInfo

      protected void resetPaymentInfo(CartModel cartModel)
      Resets the PaymentInfo on Amend carts.
      Parameters:
      cartModel - the cart model
    • populateOriginalOrderEntry

      protected void populateOriginalOrderEntry(OrderModel orderModel, CartModel cartModel)
      Populate original order entry.
      Parameters:
      orderModel - the order model
      cartModel - the cart model
    • getOriginalOrderEntry

      protected OrderEntryModel getOriginalOrderEntry(OrderModel orderModel, AbstractOrderEntryModel orderEntryModel)
      Gets original order entry.
      Parameters:
      orderModel - the order model
      orderEntryModel - the order entry model
      Returns:
      the original order entry
    • getOrder

      protected OrderModel getOrder(String orderCode)
      Gets order.
      Parameters:
      orderCode - the order code
      Returns:
      the order
    • cloneAccommodationOrderEntryGroup

      protected void cloneAccommodationOrderEntryGroup(AccommodationOrderEntryGroupModel orderEntryGroupModel)
      Clone accommodation order entry group.
      Parameters:
      orderEntryGroupModel - the order entry group model
    • cloneTravelOrderEntryInfo

      protected void cloneTravelOrderEntryInfo(AbstractOrderEntryModel orderEntry, Map<TravellerModel,TravellerModel> clonedTravellerModelMap)
      Clone travel order entry info.
      Parameters:
      orderEntry - the order entry
      clonedTravellerModelMap - the cloned traveller model map
    • cloneSelectedAccommodation

      protected void cloneSelectedAccommodation(SelectedAccommodationModel selectedAccommodationModel, CartModel cartModel, Map<TravellerModel,TravellerModel> travellerModelTravellerModelMap, List<SelectedAccommodationModel> clonedSelectedAccommodationList)
      Clone selected accommodation.
      Parameters:
      selectedAccommodationModel - the selected accommodation model
      cartModel - the cart model
      travellerModelTravellerModelMap - the traveller model traveller model map
      clonedSelectedAccommodationList - the cloned selected accommodation list
    • cloneTravelOrderEntryInfoAttributes

      protected void cloneTravelOrderEntryInfoAttributes(TravelOrderEntryInfoModel clonedInfo, TravelOrderEntryInfoModel travelOrderEntryInfo)
      Clone travel order entry info attributes.
      Parameters:
      clonedInfo - the cloned info
      travelOrderEntryInfo - the travel order entry info
    • cloneTravellers

      protected Map<TravellerModel,TravellerModel> cloneTravellers(CartModel cartModel, String cartCode)
      Clone travellers map.
      Parameters:
      cartModel - the cart model
      cartCode - the cart code
      Returns:
      the map
    • cloneTraveller

      protected void cloneTraveller(TravellerModel traveller, String cartCode, Map<TravellerModel,TravellerModel> clonedTravellersMap)
      Clone traveller.
      Parameters:
      traveller - the traveller
      cartCode - the cart code
      clonedTravellersMap - the cloned travellers map
    • forceCurrencyToOriginalOrderCurrency

      protected void forceCurrencyToOriginalOrderCurrency(String isocode)
      Changes currency so that amendment is done in the same currency as original order
      Parameters:
      isocode - the isocode
    • cancelTraveller

      public CartModel cancelTraveller(String orderCode, String cancelledTravellerCode, String cancelledTravellerUid, String guid)
      Description copied from interface: TravelCartService
      Creates cart from order and removes all entries related to traveller
      Specified by:
      cancelTraveller in interface TravelCartService
      Parameters:
      orderCode - the order code
      cancelledTravellerCode - the cancelled traveller code
      cancelledTravellerUid - the cancelled traveller uid
      guid - the guid
      Returns:
      Cart Model without entries related to given traveller
    • removeBookedSeatForTraveller

      protected void removeBookedSeatForTraveller(CartModel amendmentCart, String cancelledTravellerUid)
      Remove booked seat for traveller.
      Parameters:
      amendmentCart - the amendment cart
      cancelledTravellerUid - the cancelled traveller uid
    • removeDeliveryAddress

      public void removeDeliveryAddress()
      Description copied from interface: TravelCartService
      Removes delivery address from the cart
      Specified by:
      removeDeliveryAddress in interface TravelCartService
    • getCloneAbstractOrderStrategy

      public de.hybris.platform.order.strategies.ordercloning.CloneAbstractOrderStrategy getCloneAbstractOrderStrategy()
      Overrides:
      getCloneAbstractOrderStrategy in class de.hybris.platform.order.impl.DefaultAbstractOrderService<CartModel,CartEntryModel>
      Returns:
      the cloneAbstractOrderStrategy
    • setCloneAbstractOrderStrategy

      public void setCloneAbstractOrderStrategy(de.hybris.platform.order.strategies.ordercloning.CloneAbstractOrderStrategy cloneAbstractOrderStrategy)
      Overrides:
      setCloneAbstractOrderStrategy in class de.hybris.platform.order.impl.DefaultAbstractOrderService<CartModel,CartEntryModel>
      Parameters:
      cloneAbstractOrderStrategy - the cloneAbstractOrderStrategy to set
    • getAvailableStock

      public Long getAvailableStock(ProductModel productModel, TransportOfferingModel transportOfferingModel)
      Description copied from interface: TravelCartService
      Returns the available stock for Product in TransportOffering.
      Specified by:
      getAvailableStock in interface TravelCartService
      Parameters:
      productModel - the product model
      transportOfferingModel - the transport offering model
      Returns:
      Long, quantity available for the product.
    • getFareProductEntries

      public List<AbstractOrderEntryModel> getFareProductEntries(AbstractOrderModel abstractOrderModel)
      Description copied from interface: TravelCartService
      Returns the list of AbstractOrderEntryModel for fare product from the entries of abstractOrderModel
      Specified by:
      getFareProductEntries in interface TravelCartService
      Parameters:
      abstractOrderModel - the abstract order model
      Returns:
      list AbstractOrderEntryModel
    • getCurrentDestination

      public String getCurrentDestination()
      Description copied from interface: TravelCartService
      Retrieves current destination transport facility from items that are in the cart
      Specified by:
      getCurrentDestination in interface TravelCartService
      Returns:
      current destination
    • getPaymentOptions

      public List<PaymentOptionInfo> getPaymentOptions()
      Description copied from interface: TravelCartService
      Returns a list of payment options, in which every option is represented by a list of objects storing a subset of order entries, with the relative price to pay and the associated payment conditions
      Specified by:
      getPaymentOptions in interface TravelCartService
      Returns:
      payment options
    • getPaymentOptions

      public List<PaymentOptionInfo> getPaymentOptions(OrderEntryType orderEntryType)
      Description copied from interface: TravelCartService
      Returns a list of payment options, in which every option is represented by a list of objects storing a subset of order entries, with the relative price to pay and the associated payment conditions
      Specified by:
      getPaymentOptions in interface TravelCartService
      Parameters:
      orderEntryType - the order entry type
      Returns:
      payment options
    • deleteCurrentCart

      public void deleteCurrentCart()
      Description copied from interface: TravelCartService
      Deletes current cart model
      Specified by:
      deleteCurrentCart in interface TravelCartService
    • cancelPartialOrder

      public CartModel cancelPartialOrder(String orderCode, OrderEntryType orderEntryType, String guid)
      Description copied from interface: TravelCartService
      Creates cart from order and removes all entries of type orderEntryType
      Specified by:
      cancelPartialOrder in interface TravelCartService
      Parameters:
      orderCode - the booking reference
      orderEntryType - the order entry type
      guid - the guid
      Returns:
      Cart Model without entries of type orderEntryType
    • cancelPartialOrder

      public CartModel cancelPartialOrder(OrderModel order, OrderEntryType orderEntryType, UserModel user)
      Description copied from interface: TravelCartService
      Creates cart from order and removes all entries of type orderEntryType
      Specified by:
      cancelPartialOrder in interface TravelCartService
      Parameters:
      order - the order
      orderEntryType - the order entry type
      user - the user
      Returns:
      Cart Model without entries of type orderEntryType
    • getNextBundleNumberToUse

      public Integer getNextBundleNumberToUse()
      Description copied from interface: TravelCartService
      Calculates the next bundle number to be used while adding products belonging to bundle to the cart using directly methods requiring it.
      Specified by:
      getNextBundleNumberToUse in interface TravelCartService
      Returns:
      the next number to use when manually add bundle products to cart
    • updateBundleEntriesWithBundleNumber

      public void updateBundleEntriesWithBundleNumber(List<Integer> entryNumbers, Integer forcedBundleNumber)
      Description copied from interface: TravelCartService
      Updates order entries with the correct incremental bundle number after add to cart
      Specified by:
      updateBundleEntriesWithBundleNumber in interface TravelCartService
      Parameters:
      entryNumbers - the entry numbers
      forcedBundleNumber - the forced bundle number
    • validateCart

      public void validateCart(String departureLocation, String arrivalLocation, String departureDate, String returnDate)
      Description copied from interface: TravelCartService
      Validates cart to check if it transport details matches currently selected options. If not, the cart is cleared.
      Specified by:
      validateCart in interface TravelCartService
      Parameters:
      departureLocation - departure location
      arrivalLocation - arrival location
      departureDate - departure date
      returnDate - return date
    • setAdditionalSecurity

      public void setAdditionalSecurity(Boolean additionalSecurity)
      Description copied from interface: TravelCartService
      Sets the additional security active on the session cart
      Specified by:
      setAdditionalSecurity in interface TravelCartService
      Parameters:
      additionalSecurity - the additionalSecurity value
    • isCartValid

      protected boolean isCartValid(String departureLocation, String arrivalLocation, String departureDate, String returnDate, CartModel cartModel, AbstractOrderEntryModel outboundEntry)
      Is cart valid boolean.
      Parameters:
      departureLocation - the departure location
      arrivalLocation - the arrival location
      departureDate - the departure date
      returnDate - the return date
      cartModel - the cart model
      outboundEntry - the outbound entry
      Returns:
      the boolean
    • getTransportTotalByEntries

      public BigDecimal getTransportTotalByEntries(AbstractOrderModel order, List<AbstractOrderEntryModel> entries)
      Description copied from interface: TravelCartService
      calculates total by entries
      Specified by:
      getTransportTotalByEntries in interface TravelCartService
      Parameters:
      order - the order
      entries - the entries
      Returns:
      transport total by entries
    • isNetPricedEntry

      public Boolean isNetPricedEntry(AbstractOrderEntryModel entry)
      Description copied from interface: TravelCartService
      Returns true is the entry price is calculated as net, false otherwise
      Specified by:
      isNetPricedEntry in interface TravelCartService
      Parameters:
      entry - the entry
      Returns:
      boolean
    • getGlobalDiscountForEntryType

      public BigDecimal getGlobalDiscountForEntryType(AbstractOrderModel abstractOrder, OrderEntryType entryType)
      Description copied from interface: TravelCartService
      Return the portio of global discounts relative to the given entry type
      Specified by:
      getGlobalDiscountForEntryType in interface TravelCartService
      Parameters:
      abstractOrder - the abstract order
      entryType - the entry type
      Returns:
      global discount for entry type
    • calculateTotalExtras

      protected Double calculateTotalExtras(List<AbstractOrderEntryModel> entries)
      Calculate total extras double.
      Parameters:
      entries - the entries
      Returns:
      the double
    • getEntriesTotal

      public BigDecimal getEntriesTotal(List<AbstractOrderEntryModel> entries)
      Description copied from interface: TravelCartService
      Calculates the total price of given entries taking into consideration discounts and taxes
      Specified by:
      getEntriesTotal in interface TravelCartService
      Parameters:
      entries - the entries
      Returns:
      entries total
    • addTravellersToCart

      public void addTravellersToCart(Map<String,Integer> travellerQuantityMap) throws de.hybris.platform.servicelayer.exceptions.ModelSavingException, AddTravellerToCartExceptionService
      Adds travellers to the cart.
      Specified by:
      addTravellersToCart in interface TravelCartService
      Parameters:
      travellerQuantityMap - the travellerQuantityMap
      Throws:
      de.hybris.platform.servicelayer.exceptions.ModelSavingException - the model saving exception
      AddTravellerToCartExceptionService - the add traveller to cart exception service
    • removeTravellerFromCart

      public void removeTravellerFromCart(String travellerId)
      Description copied from interface: TravelCartService
      Remove traveller from the cart.
      Specified by:
      removeTravellerFromCart in interface TravelCartService
      Parameters:
      travellerId - the id of traveller
    • cancelTravellerInternal

      protected void cancelTravellerInternal(CartModel amendmentCart, String travellerId, List<AbstractOrderEntryModel> travellerEntries)
      Internal method to remove traveller from amendment cart.
      Parameters:
      amendmentCart - the amendment cart
      travellerId - the id of traveller
      travellerEntries - the entries with traveller for remove
    • isAmendmentCart

      public Boolean isAmendmentCart()
      Description copied from interface: TravelCartService
      Check if the current session cart is an amendment cart
      Specified by:
      isAmendmentCart in interface TravelCartService
      Returns:
      true if is an amendment cart
    • getEntryForId

      public AbstractOrderEntryModel getEntryForId(AbstractOrderModel order, Integer entryId)
      Description copied from interface: TravelCartService
      Gets entry for id.
      Specified by:
      getEntryForId in interface TravelCartService
      Parameters:
      order - the order
      entryId - the entry id
      Returns:
      the entry for id
    • generateOrderEntryId

      public Integer generateOrderEntryId(CartModel cartModel)
      Description copied from interface: TravelCartService
      Generate order entry id integer.
      Specified by:
      generateOrderEntryId in interface TravelCartService
      Parameters:
      cartModel - the cart model
      Returns:
      the integer
    • cloneAccommodationOrderEntryInfo

      protected void cloneAccommodationOrderEntryInfo(AbstractOrderEntryModel orderEntry)
      Clone the accommodation order entry info.
      Parameters:
      orderEntry - the order entry
    • getCustomerAccountService

      protected de.hybris.platform.commerceservices.customer.CustomerAccountService getCustomerAccountService()
      Gets customer account service.
      Returns:
      the customerAccountService
    • setCustomerAccountService

      public void setCustomerAccountService(de.hybris.platform.commerceservices.customer.CustomerAccountService customerAccountService)
      Sets customer account service.
      Parameters:
      customerAccountService - the customerAccountService to set
    • getBaseStoreService

      protected de.hybris.platform.store.services.BaseStoreService getBaseStoreService()
      Gets base store service.
      Returns:
      the baseStoreService
    • setBaseStoreService

      public void setBaseStoreService(de.hybris.platform.store.services.BaseStoreService baseStoreService)
      Sets base store service.
      Parameters:
      baseStoreService - the baseStoreService to set
    • getOrderCodeGenerator

      protected de.hybris.platform.servicelayer.keygenerator.KeyGenerator getOrderCodeGenerator()
      Gets order code generator.
      Returns:
      the orderCodeGenerator
    • setOrderCodeGenerator

      public void setOrderCodeGenerator(de.hybris.platform.servicelayer.keygenerator.KeyGenerator orderCodeGenerator)
      Sets order code generator.
      Parameters:
      orderCodeGenerator - the orderCodeGenerator to set
    • getUserService

      protected de.hybris.platform.servicelayer.user.UserService getUserService()
      Gets user service.
      Returns:
      the userService
    • setUserService

      public void setUserService(de.hybris.platform.servicelayer.user.UserService userService)
      Sets user service.
      Parameters:
      userService - the userService to set
    • getTravelCartDao

      protected TravelCartDao getTravelCartDao()
      Gets travel cart dao.
      Returns:
      the travelCartDao
    • setTravelCartDao

      public void setTravelCartDao(TravelCartDao travelCartDao)
      Sets travel cart dao.
      Parameters:
      travelCartDao - the travelCartDao to set
    • getCommerceCartCalculationStrategy

      protected de.hybris.platform.commerceservices.order.CommerceCartCalculationStrategy getCommerceCartCalculationStrategy()
      Gets commerce cart calculation strategy.
      Returns:
      the commerceCartCalculationStrategy
    • setCommerceCartCalculationStrategy

      public void setCommerceCartCalculationStrategy(de.hybris.platform.commerceservices.order.CommerceCartCalculationStrategy commerceCartCalculationStrategy)
      Sets commerce cart calculation strategy.
      Parameters:
      commerceCartCalculationStrategy - the commerceCartCalculationStrategy to set
    • getCommonI18NService

      protected de.hybris.platform.servicelayer.i18n.CommonI18NService getCommonI18NService()
      Gets common i 18 n service.
      Returns:
      the commonI18NService
    • setCommonI18NService

      public void setCommonI18NService(de.hybris.platform.servicelayer.i18n.CommonI18NService commonI18NService)
      Sets common i 18 n service.
      Parameters:
      commonI18NService - the commonI18NService to set
    • getStoreSessionService

      protected de.hybris.platform.commerceservices.storesession.StoreSessionService getStoreSessionService()
      Gets store session service.
      Returns:
      the storeSessionService
    • setStoreSessionService

      public void setStoreSessionService(de.hybris.platform.commerceservices.storesession.StoreSessionService storeSessionService)
      Sets store session service.
      Parameters:
      storeSessionService - the storeSessionService to set
    • getBookingService

      protected BookingService getBookingService()
      Gets booking service.
      Returns:
      the bookingService
    • setBookingService

      public void setBookingService(BookingService bookingService)
      Sets booking service.
      Parameters:
      bookingService - the bookingService to set
    • getTravelCommerceStockService

      protected TravelCommerceStockService getTravelCommerceStockService()
      Gets travel commerce stock service.
      Returns:
      the travelCommerceStockService
    • setTravelCommerceStockService

      public void setTravelCommerceStockService(TravelCommerceStockService travelCommerceStockService)
      Sets travel commerce stock service.
      Parameters:
      travelCommerceStockService - the travelCommerceStockService to set
    • getPaymentOptionCreationStrategies

      protected List<PaymentOptionCreationStrategy> getPaymentOptionCreationStrategies()
      Gets payment option creation strategies.
      Returns:
      the paymentOptionCreationStrategies
    • setPaymentOptionCreationStrategies

      public void setPaymentOptionCreationStrategies(List<PaymentOptionCreationStrategy> paymentOptionCreationStrategies)
      Sets payment option creation strategies.
      Parameters:
      paymentOptionCreationStrategies - the paymentOptionCreationStrategies to set
    • getTimeService

      protected de.hybris.platform.servicelayer.time.TimeService getTimeService()
      Gets time service.
      Returns:
      the time service
    • setTimeService

      public void setTimeService(de.hybris.platform.servicelayer.time.TimeService timeService)
      Sets time service.
      Parameters:
      timeService - the time service
    • getPaymentOptionsCreationStrategyMap

      protected Map<OrderEntryType,List<PaymentOptionCreationStrategy>> getPaymentOptionsCreationStrategyMap()
      Gets payment options creation strategy map.
      Returns:
      the paymentOptionsCreationStrategyMap
    • setPaymentOptionsCreationStrategyMap

      public void setPaymentOptionsCreationStrategyMap(Map<OrderEntryType,List<PaymentOptionCreationStrategy>> paymentOptionsCreationStrategyMap)
      Sets payment options creation strategy map.
      Parameters:
      paymentOptionsCreationStrategyMap - the paymentOptionsCreationStrategyMap to set
    • getTravellerService

      protected TravellerService getTravellerService()
      Gets traveller service.
      Returns:
      the travellerService
    • setTravellerService

      public void setTravellerService(TravellerService travellerService)
      Sets traveller service.
      Parameters:
      travellerService - the travellerService to set
    • getEnumerationService

      protected de.hybris.platform.enumeration.EnumerationService getEnumerationService()
      Gets enumeration service.
      Returns:
      the enumerationService
    • setEnumerationService

      public void setEnumerationService(de.hybris.platform.enumeration.EnumerationService enumerationService)
      Sets enumeration service.
      Parameters:
      enumerationService - the enumerationService to set
    • getTravelCommercePriceService

      protected TravelCommercePriceService getTravelCommercePriceService()
      Gets travel commerce price service.
      Returns:
      the travelCommercePriceService
    • setTravelCommercePriceService

      public void setTravelCommercePriceService(TravelCommercePriceService travelCommercePriceService)
      Sets travel commerce price service.
      Parameters:
      travelCommercePriceService - the travelCommercePriceService to set
    • getTaxCompensationStrategy

      protected TaxCompensationStrategy getTaxCompensationStrategy()
      Gets tax compensation strategy.
      Returns:
      the taxCompensationStrategy
    • setTaxCompensationStrategy

      public void setTaxCompensationStrategy(TaxCompensationStrategy taxCompensationStrategy)
      Sets tax compensation strategy.
      Parameters:
      taxCompensationStrategy - the taxCompensationStrategy to set
    • getGlobalDiscountCalculationStrategyMap

      protected Map<OrderEntryType,GlobalDiscountByEntryTypeCalculationStrategy> getGlobalDiscountCalculationStrategyMap()
      Gets global discount calculation strategy map.
      Returns:
      the globalDiscountCalculationStrategyMap
    • setGlobalDiscountCalculationStrategyMap

      public void setGlobalDiscountCalculationStrategyMap(Map<OrderEntryType,GlobalDiscountByEntryTypeCalculationStrategy> globalDiscountCalculationStrategyMap)
      Sets global discount calculation strategy map.
      Parameters:
      globalDiscountCalculationStrategyMap - the globalDiscountCalculationStrategyMap to set
    • getPassengerTypeService

      protected PassengerTypeService getPassengerTypeService()
      Gets passenger type service.
      Returns:
      the passenger type service
    • setPassengerTypeService

      public void setPassengerTypeService(PassengerTypeService passengerTypeService)
      Sets passenger type service.
      Parameters:
      passengerTypeService - the passenger type service