Class NDCProductAvailabilityOrderValidationStrategy

java.lang.Object
de.hybris.platform.ndc182facades.facades.order.strategies.impl.NDCProductAvailabilityOrderValidationStrategy
All Implemented Interfaces:
NDCChangeOrderValidationStrategy

public class NDCProductAvailabilityOrderValidationStrategy extends Object implements NDCChangeOrderValidationStrategy
The Ndc product availability order validation strategy.
  • Constructor Details

    • NDCProductAvailabilityOrderValidationStrategy

      public NDCProductAvailabilityOrderValidationStrategy()
  • Method Details

    • validateAmendOrder

      public boolean validateAmendOrder(OrderModel order, String productCode, Long qty, String travellerCode, List<String> transportOfferingCodes, String travelRouteCode)
      Description copied from interface: NDCChangeOrderValidationStrategy
      Method that validates if an ancillary can be added or removed to the specified order
      Specified by:
      validateAmendOrder in interface NDCChangeOrderValidationStrategy
      Parameters:
      order - the order to which the ancillary needs to be added
      productCode - as the product to be added or removed from the order
      qty - as the quantity to add/remove
      travellerCode - as the code of the traveller to whom the product is added or removed
      transportOfferingCodes - as the codes of the transportOfferings the product is added to or removed from
      travelRouteCode - as the travelRouteCode the product is added to or removed from
      Returns:
      valid add to order if true, false otherwise.
    • isProductAvailable

      protected boolean isProductAvailable(String productCode, List<String> transportOfferingCodes, Long quantity, OrderModel order)
      Checks if products are available. This method first calculates the total number of unique products in the request and then substracts the quantity already reserved in the original order.
      Parameters:
      productCode - the product code
      transportOfferingCodes - the transport offering codes
      quantity - the quantity
      order - the order
      Returns:
      the boolean
    • getAvailableStock

      protected Long getAvailableStock(ProductModel productModel, TransportOfferingModel transportOfferingModel, OrderModel order)
      Gets available stock.
      Parameters:
      productModel - the product model
      transportOfferingModel - the transport offering model
      order - the order
      Returns:
      the available stock
    • getQuantityToOffer

      protected Long getQuantityToOffer(ProductModel productModel, List<TransportOfferingModel> transportOfferingModels, Long quantity, OrderModel order)
      This method calculates the total quantity of a particular product in a request.
      Parameters:
      productModel - the product model
      transportOfferingModels - the transport offering models
      quantity - the quantity
      order - the order
      Returns:
      a Long
    • 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
    • getTransportOfferingService

      protected TransportOfferingService getTransportOfferingService()
      Gets transport offering service.
      Returns:
      the transport offering service
    • setTransportOfferingService

      public void setTransportOfferingService(TransportOfferingService transportOfferingService)
      Sets transport offering service.
      Parameters:
      transportOfferingService - the transport offering service
    • getTravelCommerceStockService

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

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

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

      public void setBookingService(BookingService bookingService)
      Sets booking service.
      Parameters:
      bookingService - the booking service