Class DefaultPROSTravelCartService

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
All Implemented Interfaces:
de.hybris.platform.order.AbstractOrderService<CartModel,CartEntryModel>, de.hybris.platform.order.CartService, ShoppingTravelCartService, TravelCartService, Serializable, org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanNameAware, org.springframework.beans.factory.InitializingBean

public class DefaultPROSTravelCartService extends DefaultShoppingTravelCartService
The type Default pros travel cart service.
See Also:
  • Constructor Details

    • DefaultPROSTravelCartService

      public DefaultPROSTravelCartService()
  • Method Details

    • validateCart

      public void validateCart() throws de.hybris.platform.order.InvalidCartException
      Description copied from class: DefaultShoppingTravelCartService
      Validate cart.
      Specified by:
      validateCart in interface ShoppingTravelCartService
      Overrides:
      validateCart in class DefaultShoppingTravelCartService
      Throws:
      de.hybris.platform.order.InvalidCartException - the invalid cart exception
    • validateFareProducts

      protected void validateFareProducts(CartModel cartModel) throws de.hybris.platform.order.InvalidCartException
      Validate fare products.
      Parameters:
      cartModel - the cart model
      Throws:
      de.hybris.platform.order.InvalidCartException - the invalid cart exception
    • calculateBasePriceForSegment

      protected Double calculateBasePriceForSegment(SegmentPrice segmentPrice)
      Calculate base price for segment
      Parameters:
      segmentPrice - the segment price
      Returns:
      the base price
    • cancelSolution

      public double cancelSolution(CartModel cartModel, RepricingRequestData repricingRequestData, ShoppingRepricingResponseMessage repricerResponseMessage) throws CancelFlightException, de.hybris.platform.order.exceptions.CalculationException
      This method deletes a solution fom the cart for all the associated passengers. As first step, the entries in the cart are filtered by 1) either by solutionId or by transport offering codes, since the ancillary/baggage products added after an add solution to the cart don't have a solutionId associated to them; 2) consignment status of the related consignment entries different from SHIPPED/FLOWN/CANCELLED. As second step, a strategy is performed to evaluate the removal of the order entry from the cart. As third step, the method checks if there are at least one penalty fee in the repricer response to pay in order to allow the cancel flight operation and if it is present adds the RefundFee to the cart. After that, a comparison between the refund tax breakdown in the repricer response and the taxes of the order entries is done: if there is at least a tax which has not been fully refundable, an additional tax with same code and price equal to the non-refunded amount is added to the cart (in the list of total tax values).
      Specified by:
      cancelSolution in interface ShoppingTravelCartService
      Overrides:
      cancelSolution in class DefaultShoppingTravelCartService
      Parameters:
      cartModel - the cartModel
      repricingRequestData - the solutionId
      repricerResponseMessage - the repricerResponseMessage
      Returns:
      the total to Refund after the cancel flight.
      Throws:
      CancelFlightException - thrown if an error occur during the removal of the order entry or during the addition of an ancillaryChange/Refund/CompensationTax fee.
      de.hybris.platform.order.exceptions.CalculationException
    • removeOrderEntriesBySolutionId

      public void removeOrderEntriesBySolutionId(Integer solutionId, CartModel cartModel, List<String> passengerIds) throws CancelFlightException
      Removes all the order entries by solution id or all the order entries having the same transport offering for the solution id.
      Specified by:
      removeOrderEntriesBySolutionId in interface ShoppingTravelCartService
      Overrides:
      removeOrderEntriesBySolutionId in class DefaultShoppingTravelCartService
      Parameters:
      solutionId - the solution id
      cartModel - the cart model
      passengerIds - the list of passengers
      Throws:
      CancelFlightException - the cancel flight exception
    • calculateTotalToPay

      protected BigDecimal calculateTotalToPay(AbstractOrderModel abstractOrderModel)
      Calculates difference between old total and amended total to know how much user should pay (or how much they should be refunded)
      Parameters:
      abstractOrderModel - the abstract order model
      Returns:
      price to pay (or to be refunded)
    • addRefundFeeToTheCart

      protected void addRefundFeeToTheCart(CartModel cartModel, ShoppingRepricingResponseMessage repricerResponseMessage) throws CancelFlightException
      Checks if there is at least on refund penalty in the repricer response message and add a RefundFee to the cart. After the fee is added to the cart and set the active status to ACTIVE.
      Parameters:
      cartModel - the cart model
      repricerResponseMessage - the repricer response message
      Throws:
      CancelFlightException
    • getTravellersForRefundFee

      protected List<TravellerModel> getTravellersForRefundFee(CartModel cartModel, List<ChangedTktSolution> changedTktSolutions)
      Gets travellers with refund fee not null.
      Parameters:
      cartModel -
      changedTktSolutions - the changed tkt solutions
      Returns:
      the travellers for refund fee
    • removeOrderEntries

      protected void removeOrderEntries(CartModel cartModel, List<AbstractOrderEntryModel> orderEntries) throws CancelFlightException
      Removes order entries which belong to the same solution in the cart. The order entries will be removed basing on a strategy list performed on them.
      Parameters:
      cartModel - the
      orderEntries - the order entries
      Throws:
      CancelFlightException - the cancel flight exception
    • addChangeFee

      public void addChangeFee(CartModel cartModel, TravellerData traveller) throws ChangeFlightException
      Adds a change fee to the cart for a specific traveller.
      Specified by:
      addChangeFee in interface ShoppingTravelCartService
      Overrides:
      addChangeFee in class DefaultShoppingTravelCartService
      Parameters:
      cartModel - the cart model
      traveller - the traveller
      Throws:
      ChangeFlightException - thrown when an error occurs during the addition of the changeFee product in the cart.
    • addEvenExchangeFee

      public void addEvenExchangeFee(CartModel cartModel, TravellerModel traveller) throws ChangeFlightException
      Adds an even exchange fee to the cart.
      Specified by:
      addEvenExchangeFee in interface ShoppingTravelCartService
      Overrides:
      addEvenExchangeFee in class DefaultShoppingTravelCartService
      Parameters:
      cartModel - the cart model
      traveller - the traveller
      Throws:
      ChangeFlightException - thrown when an error occurs during the addition of the EvenExchangeFee product in the cart.
    • getProsSearchResponseService

      protected PROSSearchResponseService getProsSearchResponseService()
      Gets pros search response service.
      Returns:
      the pros search response service
    • setProsSearchResponseService

      public void setProsSearchResponseService(PROSSearchResponseService prosSearchResponseService)
      Sets pros search response service.
      Parameters:
      prosSearchResponseService - the pros search response service
    • getProsRemoveOrderEntryStrategyMap

      protected Map<String,PROSRemoveOrderEntryStrategy> getProsRemoveOrderEntryStrategyMap()
      Gets pros remove order entry strategy map.
      Returns:
      the pros remove order entry strategy map
    • setProsRemoveOrderEntryStrategyMap

      public void setProsRemoveOrderEntryStrategyMap(Map<String,PROSRemoveOrderEntryStrategy> prosRemoveOrderEntryStrategyMap)
      Sets pros remove order entry strategy map.
      Parameters:
      prosRemoveOrderEntryStrategyMap - the pros remove order entry strategy map
    • getProductService

      protected de.hybris.platform.product.ProductService getProductService()
      Gets product service.
      Returns:
      the product service
    • setProductService

      public void setProductService(de.hybris.platform.product.ProductService productService)
      Sets product service.
      Parameters:
      productService - the product service
    • getTravelCommerceCartService

      protected TravelCommerceCartService getTravelCommerceCartService()
      Gets travel commerce cart service.
      Returns:
      the travel commerce cart service
    • setTravelCommerceCartService

      public void setTravelCommerceCartService(TravelCommerceCartService travelCommerceCartService)
      Sets travel commerce cart service.
      Parameters:
      travelCommerceCartService - the travel commerce cart service
    • getNotAllowedStatusesForConsignmentEntries

      protected List<String> getNotAllowedStatusesForConsignmentEntries()
      Gets not allowed statuses for consignment entries.
      Returns:
      the not allowed statuses for consignment entries
    • setNotAllowedStatusesForConsignmentEntries

      public void setNotAllowedStatusesForConsignmentEntries(List<String> notAllowedStatusesForConsignmentEntries)
      Sets not allowed statuses for consignment entries.
      Parameters:
      notAllowedStatusesForConsignmentEntries - the not allowed statuses for consignment entries