Class DefaultNDCOrderFacade

java.lang.Object
de.hybris.platform.ndc182facades.facades.order.impl.DefaultNDCOrderFacade
All Implemented Interfaces:
NDCOrderFacade

public class DefaultNDCOrderFacade extends Object implements NDCOrderFacade
The ndc 18.2 implementation of NDCOrderFacade interface.
  • Constructor Details

    • DefaultNDCOrderFacade

      public DefaultNDCOrderFacade()
  • Method Details

    • createOrder

      public IATAOrderViewRS createOrder(IATAOrderCreateRQ orderCreateRQ)
      Creates an order from an OrderCreateRQ message.
      Specified by:
      createOrder in interface NDCOrderFacade
      Parameters:
      orderCreateRQ - the orderCreateRQ
      Returns:
      the orderViewRS
    • retrieveOrder

      public IATAOrderViewRS retrieveOrder(IATAOrderRetrieveRQ orderRetrieveRQ) throws NDCException
      Retrieves the order from the booking reference specified in the OrderRetrieveRQ.
      Specified by:
      retrieveOrder in interface NDCOrderFacade
      Parameters:
      orderRetrieveRQ - the orderRetrieveRQ
      Returns:
      the orderViewRS
      Throws:
      NDCException - the ndc exception
    • changeOrder

      public IATAOrderViewRS changeOrder(IATAOrderChangeRQ orderChangeRQ) throws NDCException
      Retrieves the original order and calculates the difference between this and the new one and places the amended order.
      Specified by:
      changeOrder in interface NDCOrderFacade
      Parameters:
      orderChangeRQ - the orderChangeRQ
      Returns:
      the orderViewRS
      Throws:
      NDCException - the ndc exception
    • adjustStockreservation

      protected void adjustStockreservation(OrderModel amendedOrder, OrderModel originalOrder) throws de.hybris.platform.stock.exception.InsufficientStockLevelException
      Reserve and release stock.
      Parameters:
      amendedOrder - the amended order
      originalOrder - the original order
      Throws:
      de.hybris.platform.stock.exception.InsufficientStockLevelException
    • validateAmendedOrder

      protected void validateAmendedOrder(IATAOrderChangeRQ orderChangeRQ, List<AbstractOrderEntryModel> orderEntries, OrderModel amendedOrder) throws NDCException
      Validates the amended order: compares if the total amount of the paymentInfos in the orderChangeRQ is equal to the total amount of the amended order entries. If there are some entries that have been removed, it creates the refund transaction associated to them.
      Parameters:
      orderChangeRQ - the order change rq
      orderEntries - the order entries
      amendedOrder - the amended order
      Throws:
      NDCException - the ndc exception
    • amendOrder

      protected void amendOrder(IATAOrderChangeRQ orderChangeRQ, List<NDCBookingActionType> ndcBookingActionTypeList, OrderModel originalOrder, ReservationData reservationData, OrderModel amendedOrder, List<AbstractOrderEntryModel> orderEntries) throws NDCException
      This method validates the booking action list and amends the order.
      Parameters:
      orderChangeRQ - the order change rq
      ndcBookingActionTypeList - the ndc booking action type list
      originalOrder - the original order
      reservationData - the reservation data
      amendedOrder - the amended order
      orderEntries - the order entries
      Throws:
      NDCException - the ndc exception
    • payOriginalOrder

      protected IATAOrderViewRS payOriginalOrder(OrderModel originalOrder, IATAOrderChangeRQ orderChangeRQ, OrderModel amendedOrder) throws NDCException
      Pay original order.
      Parameters:
      originalOrder - the original order
      orderChangeRQ - the order change rq
      amendedOrder - the amended order
      Returns:
      the iata order view rs
      Throws:
      NDCException - the ndc exception
    • populateNDCPaymentCardInfoData

      protected void populateNDCPaymentCardInfoData(NDCPaymentCardInfoData ndcPaymentCardInfo, IATAOrderChangeRQ orderChangeRQ) throws NDCException
      Populate ndc payment card info data.
      Parameters:
      ndcPaymentCardInfo - the ndc payment card info
      orderChangeRQ - the order change rq
      Throws:
      NDCException - the ndc exception
    • checkIfProductCanBeAddedToTraveller

      public void checkIfProductCanBeAddedToTraveller(OrderModel order, String travellerCode, ProductModel product, long quantity, List<String> transportOfferings, String routeCode) throws NDCException
      Description copied from interface: NDCOrderFacade
      Check if product can be added to traveller.
      Specified by:
      checkIfProductCanBeAddedToTraveller in interface NDCOrderFacade
      Parameters:
      order - the order
      travellerCode - the traveller code
      product - the product
      quantity - the quantity
      transportOfferings - the transport offerings
      routeCode - the route code
      Throws:
      NDCException - the ndc 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)
    • setCurrencyInSession

      protected void setCurrencyInSession(IATAOrderCreateRQ orderCreateRQ) throws NDCException
      Sets currency in session if it is present at least one currency code in a paymentInfo.
      Parameters:
      orderCreateRQ - the order create request
      Throws:
      NDCException - the ndc exception
    • createNdcOfferDataMap

      protected Map<String,List<NDCOfferData>> createNdcOfferDataMap(IATAOrderCreateRQ orderCreateRQ) throws NDCException
      This method retrieves all the offers from the cache and validates them. It will throws an exception if: 1) one of the offer is not found in the cache. 2) there is no offer related to a flight (no carrierOfferData found). 3) there are more than 2 carrierOfferData, because we can place an order only for one outbound and one inbound. 4) One of the validations in the strategy is not valid.
      Parameters:
      orderCreateRQ - the orderCreateRQ
      Returns:
      the ndcOfferDataMap
      Throws:
      NDCException - the ndc exception
    • createErrorResponse

      public IATAOrderViewRS createErrorResponse(List<ErrorType> errors)
      Creates an error IATAOrderViewRS response
      Specified by:
      createErrorResponse in interface NDCOrderFacade
      Parameters:
      errors - the errors
      Returns:
      an error IATAOrderViewRS response
    • createError

      public ErrorType createError(String errorMessage)
      Creates an error type
      Specified by:
      createError in interface NDCOrderFacade
      Parameters:
      errorMessage - the error message
      Returns:
      an ErrorType
    • validateCurrencyForOrderChange

      protected void validateCurrencyForOrderChange(IATAOrderChangeRQ orderChangeRQ, OrderModel originalOrder) throws NDCException
      Validate currency.
      Parameters:
      orderChangeRQ - the order change rq
      originalOrder - the original order
      Throws:
      NDCException - the ndc exception
    • isOrderPaid

      protected boolean isOrderPaid(OrderModel originalOrder)
      Checks if the order is paid.
      Parameters:
      originalOrder - the original order
      Returns:
      the boolean
    • createBookingActionrequestData

      protected BookingActionRequestData createBookingActionrequestData(List<NDCBookingActionType> ndcBookingActionDataList, OrderModel orderModel)
      Create booking actionrequest data.
      Parameters:
      ndcBookingActionDataList - the ndc booking action data list
      orderModel - the order model
      Returns:
      the booking action request data
    • getNDCBookingActionTypes

      protected List<NDCBookingActionType> getNDCBookingActionTypes(IATAOrderChangeRQ orderChangeRQ)
      Create ndc booking action data list.
      Parameters:
      orderChangeRQ - the order change rq
      Returns:
      the list
    • getOrderByBookingReference

      protected OrderModel getOrderByBookingReference(String bookingReference) throws NDCException
      Retrieves an order based on the bookingReference number and the current user, Error field in the response is populated in case the booking was not place by the current user
      Parameters:
      bookingReference - the booking reference
      Returns:
      order by booking reference
      Throws:
      NDCException - the ndc exception
    • getTravelRestrictionFacade

      protected TravelRestrictionFacade getTravelRestrictionFacade()
      Gets travel restriction facade.
      Returns:
      the travel restriction facade
    • setTravelRestrictionFacade

      public void setTravelRestrictionFacade(TravelRestrictionFacade travelRestrictionFacade)
      Sets travel restriction facade.
      Parameters:
      travelRestrictionFacade - the travel restriction facade
    • getBookingService

      protected BookingService getBookingService()
      gets booking service
      Returns:
      booking service
    • setBookingService

      public void setBookingService(BookingService bookingService)
      sets booking service
      Parameters:
      bookingService - the booking service
    • getOrderViewPipelineManager

      protected OrderViewPipelineManager getOrderViewPipelineManager()
      gets order view pipeline manager
      Returns:
      order view pipeline manager
    • setOrderViewPipelineManager

      public void setOrderViewPipelineManager(OrderViewPipelineManager orderViewPipelineManager)
      sets order view pipeline manager
      Parameters:
      orderViewPipelineManager - the order view pipeline manager
    • getReservationFacade

      protected ReservationFacade getReservationFacade()
      Gets reservation facade.
      Returns:
      the reservation facade
    • setReservationFacade

      public void setReservationFacade(ReservationFacade reservationFacade)
      Sets reservation facade.
      Parameters:
      reservationFacade - the reservation facade
    • getNdcBookingActionMap

      protected Map<NDCBookingActionType,ActionTypeOption> getNdcBookingActionMap()
      Gets ndc booking action map.
      Returns:
      the ndc booking action map
    • setNdcBookingActionMap

      public void setNdcBookingActionMap(Map<NDCBookingActionType,ActionTypeOption> ndcBookingActionMap)
      Sets ndc booking action map.
      Parameters:
      ndcBookingActionMap - the ndc booking action map
    • getActionFacade

      protected ActionFacade getActionFacade()
      Gets action facade.
      Returns:
      the action facade
    • setActionFacade

      public void setActionFacade(ActionFacade actionFacade)
      Sets action facade.
      Parameters:
      actionFacade - the action facade
    • getNdcBookingActionStrategyMap

      protected Map<NDCBookingActionType,NDCChangeOrderStrategy> getNdcBookingActionStrategyMap()
      Gets ndc booking action strategy map.
      Returns:
      the ndc booking action strategy map
    • setNdcBookingActionStrategyMap

      public void setNdcBookingActionStrategyMap(Map<NDCBookingActionType,NDCChangeOrderStrategy> ndcBookingActionStrategyMap)
      Sets ndc booking action strategy map.
      Parameters:
      ndcBookingActionStrategyMap - the ndc booking action strategy map
    • getChangeOrderValidationStrategies

      protected List<NDCChangeOrderValidationStrategy> getChangeOrderValidationStrategies()
      Gets change order validation strategies.
      Returns:
      the change order validation strategies
    • setChangeOrderValidationStrategies

      public void setChangeOrderValidationStrategies(List<NDCChangeOrderValidationStrategy> changeOrderValidationStrategies)
      Sets change order validation strategies.
      Parameters:
      changeOrderValidationStrategies - the change order validation strategies
    • getNdcOrderCloningStrategy

      protected NDCOrderCloningStrategy getNdcOrderCloningStrategy()
      Gets ndc order cloning strategy.
      Returns:
      the ndc order cloning strategy
    • setNdcOrderCloningStrategy

      public void setNdcOrderCloningStrategy(NDCOrderCloningStrategy ndcOrderCloningStrategy)
      Sets ndc order cloning strategy.
      Parameters:
      ndcOrderCloningStrategy - the ndc order cloning strategy
    • getUserService

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

      public void setUserService(de.hybris.platform.servicelayer.user.UserService userService)
      Sets user service.
      Parameters:
      userService - the user service
    • 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
    • getCalculationService

      protected de.hybris.platform.order.CalculationService getCalculationService()
      Gets calculation service.
      Returns:
      the calculation service
    • setCalculationService

      public void setCalculationService(de.hybris.platform.order.CalculationService calculationService)
      Sets calculation service.
      Parameters:
      calculationService - the calculation service
    • getNdcCreatePaymentTransactionStrategy

      protected NDCCreatePaymentTransactionSrategy getNdcCreatePaymentTransactionStrategy()
      Gets ndc create payment transaction strategy.
      Returns:
      the ndc create payment transaction strategy
    • setNdcCreatePaymentTransactionStrategy

      public void setNdcCreatePaymentTransactionStrategy(NDCCreatePaymentTransactionSrategy ndcCreatePaymentTransactionStrategy)
      Sets ndc create payment transaction strategy.
      Parameters:
      ndcCreatePaymentTransactionStrategy - the ndc create payment transaction strategy
    • 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
    • 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
    • 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
    • getNdcOrderService

      protected NDCOrderService getNdcOrderService()
      Gets ndc order service.
      Returns:
      the ndc order service
    • setNdcOrderService

      public void setNdcOrderService(NDCOrderService ndcOrderService)
      Sets ndc order service.
      Parameters:
      ndcOrderService - the ndc order service
    • getNdcOfferFacade

      protected NDCOfferFacade getNdcOfferFacade()
      Gets ndc offer facade.
      Returns:
      the ndc offer facade
    • setNdcOfferFacade

      public void setNdcOfferFacade(NDCOfferFacade ndcOfferFacade)
      Sets ndc offer facade.
      Parameters:
      ndcOfferFacade - the ndc offer facade
    • getOrderCreateRQValidationStrategyMap

      protected Map<String,OrderCreateRQValidationStrategy> getOrderCreateRQValidationStrategyMap()
      Gets order create rq validation strategy map.
      Returns:
      the order create rq validation strategy map
    • setOrderCreateRQValidationStrategyMap

      public void setOrderCreateRQValidationStrategyMap(Map<String,OrderCreateRQValidationStrategy> orderCreateRQValidationStrategyMap)
      Sets order create rq validation strategy map.
      Parameters:
      orderCreateRQValidationStrategyMap - the order create rq validation strategy map
    • getOrderCreatePipelineManager

      protected OrderCreatePipelineManager getOrderCreatePipelineManager()
      Gets order create pipeline manager.
      Returns:
      the order create pipeline manager
    • setOrderCreatePipelineManager

      public void setOrderCreatePipelineManager(OrderCreatePipelineManager orderCreatePipelineManager)
      Sets order create pipeline manager.
      Parameters:
      orderCreatePipelineManager - the order create pipeline manager
    • getStoreSessionFacade

      protected de.hybris.platform.commercefacades.storesession.StoreSessionFacade getStoreSessionFacade()
      Gets store session facade.
      Returns:
      the store session facade
    • setStoreSessionFacade

      public void setStoreSessionFacade(de.hybris.platform.commercefacades.storesession.StoreSessionFacade storeSessionFacade)
      Sets store session facade.
      Parameters:
      storeSessionFacade - the store session facade
    • getCommerceStockService

      protected TravelCommerceStockService getCommerceStockService()
      Gets commerce stock service.
      Returns:
      the commerce stock service
    • setCommerceStockService

      public void setCommerceStockService(TravelCommerceStockService commerceStockService)
      Sets commerce stock service.
      Parameters:
      commerceStockService - the commerce stock service
    • getOrderService

      protected de.hybris.platform.order.OrderService getOrderService()
      Gets order service.
      Returns:
      the order service
    • setOrderService

      public void setOrderService(de.hybris.platform.order.OrderService orderService)
      Sets order service.
      Parameters:
      orderService - the order service
    • getNdcPaymentFacade

      protected NDCPaymentFacade getNdcPaymentFacade()
      Gets ndc payment facade.
      Returns:
      the ndc payment facade
    • setNdcPaymentFacade

      public void setNdcPaymentFacade(NDCPaymentFacade ndcPaymentFacade)
      Sets ndc payment facade.
      Parameters:
      ndcPaymentFacade - the ndc payment facade