Class DefaultNDCOrderService

java.lang.Object
de.hybris.platform.ndc182services.services.impl.DefaultNDCOrderService
All Implemented Interfaces:
NDCOrderService

public class DefaultNDCOrderService extends Object implements NDCOrderService
The ndc 18.2 implementation of NDCOrderService interface.
  • Constructor Details

    • DefaultNDCOrderService

      public DefaultNDCOrderService()
  • Method Details

    • removeOrder

      public void removeOrder(OrderModel order)
      Checks if the order has already been saved and, in case, deletes it.
      Specified by:
      removeOrder in interface NDCOrderService
      Parameters:
      order - the order
    • validatePaymentInfoAgainstOrderEntries

      public void validatePaymentInfoAgainstOrderEntries(OrderModel order, List<AbstractOrderEntryModel> orderEntries, BigDecimal paymentInfoAmount) throws NDCException
      Validates the amount of the payment info against the total amount of the order entries associated to it.
      Specified by:
      validatePaymentInfoAgainstOrderEntries in interface NDCOrderService
      Parameters:
      order - the order
      orderEntries - the order entries
      paymentInfoAmount - the payment info amount
      Throws:
      NDCException - the ndc exception
    • createSelectedAccommodations

      public void createSelectedAccommodations(ProductModel product, BigDecimal rowSeat, String columnSeat, List<String> transportOfferingCodes, TravellerModel traveller, OrderModel order, String routeCode) throws NDCException
      Creates a selected accommodation for each transport offering associated to the selected seat. Verifies if the seat belongs to the right class of the fare product, is already present in the order for the same traveller and if it is already occupied by someone else.
      Specified by:
      createSelectedAccommodations in interface NDCOrderService
      Parameters:
      product - the product
      rowSeat - the row seat
      columnSeat - the column seat
      transportOfferingCodes - the transport offering codes
      traveller - the traveller
      order - the order
      routeCode - the route code
      Throws:
      NDCException - the ndc exception
    • updateEntriesAmendStatus

      public void updateEntriesAmendStatus(List<AbstractOrderEntryModel> entries, AmendStatus status)
      Update entries amend status.
      Specified by:
      updateEntriesAmendStatus in interface NDCOrderService
      Parameters:
      entries - the entries
      status - the status
    • getCategoryMapping

      public String getCategoryMapping(ProductModel ancillaryProduct)
      Returns the mapping extracted from the category that the provided ProductModel belongs to.
      Parameters:
      ancillaryProduct - the ancillary product
      Returns:
      category mapping
    • isSeatNotAvailable

      protected boolean isSeatNotAvailable(ConfiguredAccommodationModel configuredAccommodation, String transportOfferingCode, String travellerCode, ProductModel product, OrderModel order, String travellerLabel)
      Checks if 1) the accommodation is configured in the system. 2) the accomodation is bookable. 3) the accommodation is already booked by any other passenger in the transport offering. 4) the accommodation refers to a valid class of the fare product. 5) the same traveller has already a seat in the order.
      Parameters:
      configuredAccommodation - the configured accommodation
      transportOfferingCode - the transport offering code
      travellerCode - the traveller code
      product - the product
      order - the order
      travellerLabel - the traveller label
      Returns:
      true if one of these check fails.
    • createSeatIdentifier

      protected String createSeatIdentifier(BigDecimal seatRowNumber, String columnSeat, String transportOfferingCode, String routeCode, OrderModel order) throws NDCException
      Creates the seat identifier as concatenation of vehicle configuration + row + column.
      Parameters:
      seatRowNumber - the seat row number
      columnSeat - the column seat
      transportOfferingCode - the transport offering code
      routeCode - the route code
      order - the order
      Returns:
      the string
      Throws:
      NDCException - the ndc exception
    • createSelectedAccommodation

      protected SelectedAccommodationModel createSelectedAccommodation(String transportOfferingCode, TravellerModel traveller, OrderModel order, ConfiguredAccommodationModel configuredAccommodation) throws NDCException
      Creates the selected accommodation and set the configured accommodation and the traveller.
      Parameters:
      transportOfferingCode - the transport offering code
      traveller - the traveller
      order - the order
      configuredAccommodation - the configured accommodation
      Returns:
      the selected accommodation model
      Throws:
      NDCException - the ndc exception
    • validateProductAgainstMaximumQuantityRestriction

      public void validateProductAgainstMaximumQuantityRestriction(long selectedOfferItemQty, AbstractOrderEntryModel existingProduct, ProductModel product, OrderModel order) throws NDCException
      Validates the product against the maximum quantity restriction.
      Specified by:
      validateProductAgainstMaximumQuantityRestriction in interface NDCOrderService
      Parameters:
      selectedOfferItemQty - the selectedOfferItemQty
      existingProduct - the existing product
      product - the product
      order - the order
      Throws:
      NDCException - the ndc exception
    • isSameTransportOfferingList

      public boolean isSameTransportOfferingList(AbstractOrderEntryModel orderEntry, List<String> transportOfferings, int originDestiRefNumber)
      Checks if the list of transport offerings is the same with the one in the order entry, together with the originDestinationRefNumber.
      Specified by:
      isSameTransportOfferingList in interface NDCOrderService
      Parameters:
      orderEntry - the order entry
      transportOfferings - the transport offerings
      originDestiRefNumber - the origin desti ref number
      Returns:
      true if the transport offerings and the originDestinationRefNumber is the same.
    • isSamePassenger

      public boolean isSamePassenger(AbstractOrderEntryModel orderEntry, TravellerModel traveller)
      Checks if the traveller in the orderEntry is the same.
      Specified by:
      isSamePassenger in interface NDCOrderService
      Parameters:
      orderEntry - the order entry
      traveller - the traveller
      Returns:
      the boolean
    • isAmendedOrderEntry

      public boolean isAmendedOrderEntry(AbstractOrderEntryModel orderEntry)
      Checks if the order entry has amend status equal to NEW or CHANGED.
      Specified by:
      isAmendedOrderEntry in interface NDCOrderService
      Parameters:
      orderEntry - the order entry
      Returns:
      the boolean
    • isAmendmentOrder

      public Boolean isAmendmentOrder(OrderModel orderModel)
      Description copied from interface: NDCOrderService
      Is amendment order boolean.
      Specified by:
      isAmendmentOrder in interface NDCOrderService
      Parameters:
      orderModel - the order model
      Returns:
      the boolean
    • getOriginalOrderCode

      public String getOriginalOrderCode(OrderModel orderModel)
      Description copied from interface: NDCOrderService
      Gets original order code.
      Specified by:
      getOriginalOrderCode in interface NDCOrderService
      Parameters:
      orderModel - the order model
      Returns:
      the original order code
    • getProductCatalogIdFromBaseSite

      public String getProductCatalogIdFromBaseSite() throws NDCException
      Gets product catalog id from baseSite.
      Specified by:
      getProductCatalogIdFromBaseSite in interface NDCOrderService
      Returns:
      the product catalog
      Throws:
      NDCException - the ndc exception
    • createOrderEntry

      public OrderEntryModel createOrderEntry(OrderModel order, ProductModel product, Set<Integer> orderEntryGroupNumber, List<TransportOfferingModel> transportOfferings, TravellerModel traveller, String routeCode, int originDestinationRefNumber, long quantity, Integer bundleNumber, BundleTemplateModel bundleTemplate)
      Creates an order entry.
      Specified by:
      createOrderEntry in interface NDCOrderService
      Parameters:
      order - the order
      product - the product
      orderEntryGroupNumber - the order entry group number
      transportOfferings - the transport offerings
      traveller - the traveller
      routeCode - the route code
      originDestinationRefNumber - the origin destination ref number
      quantity - the quantity
      bundleNumber - the bundleNumber
      bundleTemplate - the bundleTemplate
      Returns:
      the order entry model
    • createTravelOrderEntryInfoModel

      protected TravelOrderEntryInfoModel createTravelOrderEntryInfoModel(ProductModel product, int originDestinationRefNumber, List<TransportOfferingModel> transportOfferings, String routeCode, TravellerModel traveller)
      Creates the travel order entry info.
      Parameters:
      product - the product
      originDestinationRefNumber - the origin destination ref number
      transportOfferings - the transport offerings
      routeCode - the route code
      traveller - the traveller
      Returns:
      the travel order entry info model
    • getPriceLevelCode

      protected String getPriceLevelCode(ProductModel product, List<TransportOfferingModel> transportOfferings, String routeCode)
      Returns the price level associated to a particular product
      Parameters:
      product - the product
      transportOfferings - the transport offerings
      routeCode - the route code
      Returns:
      price level code
    • getModelService

      protected de.hybris.platform.servicelayer.model.ModelService getModelService()
      Gets model service.
      Returns:
      the model service
    • setModelService

      public void setModelService(de.hybris.platform.servicelayer.model.ModelService modelService)
      Sets model service.
      Parameters:
      modelService - the model 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
    • getAccommodationMapService

      protected AccommodationMapService getAccommodationMapService()
      Gets accommodation map service.
      Returns:
      the accommodation map service
    • setAccommodationMapService

      public void setAccommodationMapService(AccommodationMapService accommodationMapService)
      Sets accommodation map service.
      Parameters:
      accommodationMapService - the accommodation map service
    • getTravellerService

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

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

      protected de.hybris.platform.product.UnitService getUnitService()
      Gets unit service.
      Returns:
      the unit service
    • setUnitService

      public void setUnitService(de.hybris.platform.product.UnitService unitService)
      Sets unit service.
      Parameters:
      unitService - the unit service
    • getTravelRouteService

      protected TravelRouteService getTravelRouteService()
      Gets travel route service.
      Returns:
      the travel route service
    • setTravelRouteService

      public void setTravelRouteService(TravelRouteService travelRouteService)
      Sets travel route service.
      Parameters:
      travelRouteService - the travel route service
    • getTravelCommercePriceService

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

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

      protected Map<String,String> getOfferGroupToOriginDestinationMapping()
      Gets offer group to origin destination mapping.
      Returns:
      the offer group to origin destination mapping
    • setOfferGroupToOriginDestinationMapping

      public void setOfferGroupToOriginDestinationMapping(Map<String,String> offerGroupToOriginDestinationMapping)
      Sets offer group to origin destination mapping.
      Parameters:
      offerGroupToOriginDestinationMapping - the offer group to origin destination mapping
    • getBaseSiteService

      protected de.hybris.platform.site.BaseSiteService getBaseSiteService()
      Gets base site service.
      Returns:
      the base site service
    • setBaseSiteService

      public void setBaseSiteService(de.hybris.platform.site.BaseSiteService baseSiteService)
      Sets base site service.
      Parameters:
      baseSiteService - the base site service