Class DefaultNDCOrderFacade
java.lang.Object
de.hybris.platform.ndc182facades.facades.order.impl.DefaultNDCOrderFacade
- All Implemented Interfaces:
NDCOrderFacade
The ndc 18.2 implementation of
NDCOrderFacade interface.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidadjustStockreservation(OrderModel amendedOrder, OrderModel originalOrder) Reserve and release stock.protected voidamendOrder(IATAOrderChangeRQ orderChangeRQ, List<NDCBookingActionType> ndcBookingActionTypeList, OrderModel originalOrder, ReservationData reservationData, OrderModel amendedOrder, List<AbstractOrderEntryModel> orderEntries) This method validates the booking action list and amends the order.protected BigDecimalcalculateTotalToPay(AbstractOrderModel abstractOrderModel) Calculates difference between old total and amended total to know how much user should pay (or how much they should be refunded)changeOrder(IATAOrderChangeRQ orderChangeRQ) Retrieves the original order and calculates the difference between this and the new one and places the amended order.voidcheckIfProductCanBeAddedToTraveller(OrderModel order, String travellerCode, ProductModel product, long quantity, List<String> transportOfferings, String routeCode) Check if product can be added to traveller.protected BookingActionRequestDatacreateBookingActionrequestData(List<NDCBookingActionType> ndcBookingActionDataList, OrderModel orderModel) Create booking actionrequest data.createError(String errorMessage) Creates an error typecreateErrorResponse(List<ErrorType> errors) Creates an error IATAOrderViewRS responseprotected Map<String,List<NDCOfferData>> createNdcOfferDataMap(IATAOrderCreateRQ orderCreateRQ) This method retrieves all the offers from the cache and validates them.createOrder(IATAOrderCreateRQ orderCreateRQ) Creates an order from an OrderCreateRQ message.protected AccommodationMapServiceGets accommodation map service.protected ActionFacadeGets action facade.protected BookingServicegets booking serviceprotected de.hybris.platform.order.CalculationServiceGets calculation service.protected List<NDCChangeOrderValidationStrategy>Gets change order validation strategies.protected TravelCommerceStockServiceGets commerce stock service.protected de.hybris.platform.servicelayer.model.ModelServiceGets model service.protected Map<NDCBookingActionType,ActionTypeOption> Gets ndc booking action map.protected Map<NDCBookingActionType,NDCChangeOrderStrategy> Gets ndc booking action strategy map.protected List<NDCBookingActionType>getNDCBookingActionTypes(IATAOrderChangeRQ orderChangeRQ) Create ndc booking action data list.protected NDCCreatePaymentTransactionSrategyGets ndc create payment transaction strategy.protected NDCOfferFacadeGets ndc offer facade.protected NDCOrderCloningStrategyGets ndc order cloning strategy.protected NDCOrderServiceGets ndc order service.protected NDCPaymentFacadeGets ndc payment facade.protected OrderModelgetOrderByBookingReference(String bookingReference) 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 userprotected OrderCreatePipelineManagerGets order create pipeline manager.protected Map<String,OrderCreateRQValidationStrategy> Gets order create rq validation strategy map.protected de.hybris.platform.order.OrderServiceGets order service.protected OrderViewPipelineManagergets order view pipeline managerprotected ReservationFacadeGets reservation facade.protected de.hybris.platform.commercefacades.storesession.StoreSessionFacadeGets store session facade.protected TransportOfferingServiceGets transport offering service.protected TravellerServiceGets traveller service.protected TravelRestrictionFacadeGets travel restriction facade.protected de.hybris.platform.servicelayer.user.UserServiceGets user service.protected booleanisOrderPaid(OrderModel originalOrder) Checks if the order is paid.protected IATAOrderViewRSpayOriginalOrder(OrderModel originalOrder, IATAOrderChangeRQ orderChangeRQ, OrderModel amendedOrder) Pay original order.protected voidpopulateNDCPaymentCardInfoData(NDCPaymentCardInfoData ndcPaymentCardInfo, IATAOrderChangeRQ orderChangeRQ) Populate ndc payment card info data.retrieveOrder(IATAOrderRetrieveRQ orderRetrieveRQ) Retrieves the order from the booking reference specified in the OrderRetrieveRQ.voidsetAccommodationMapService(AccommodationMapService accommodationMapService) Sets accommodation map service.voidsetActionFacade(ActionFacade actionFacade) Sets action facade.voidsetBookingService(BookingService bookingService) sets booking servicevoidsetCalculationService(de.hybris.platform.order.CalculationService calculationService) Sets calculation service.voidsetChangeOrderValidationStrategies(List<NDCChangeOrderValidationStrategy> changeOrderValidationStrategies) Sets change order validation strategies.voidsetCommerceStockService(TravelCommerceStockService commerceStockService) Sets commerce stock service.protected voidsetCurrencyInSession(IATAOrderCreateRQ orderCreateRQ) Sets currency in session if it is present at least one currency code in a paymentInfo.voidsetModelService(de.hybris.platform.servicelayer.model.ModelService modelService) Sets model service.voidsetNdcBookingActionMap(Map<NDCBookingActionType, ActionTypeOption> ndcBookingActionMap) Sets ndc booking action map.voidsetNdcBookingActionStrategyMap(Map<NDCBookingActionType, NDCChangeOrderStrategy> ndcBookingActionStrategyMap) Sets ndc booking action strategy map.voidsetNdcCreatePaymentTransactionStrategy(NDCCreatePaymentTransactionSrategy ndcCreatePaymentTransactionStrategy) Sets ndc create payment transaction strategy.voidsetNdcOfferFacade(NDCOfferFacade ndcOfferFacade) Sets ndc offer facade.voidsetNdcOrderCloningStrategy(NDCOrderCloningStrategy ndcOrderCloningStrategy) Sets ndc order cloning strategy.voidsetNdcOrderService(NDCOrderService ndcOrderService) Sets ndc order service.voidsetNdcPaymentFacade(NDCPaymentFacade ndcPaymentFacade) Sets ndc payment facade.voidsetOrderCreatePipelineManager(OrderCreatePipelineManager orderCreatePipelineManager) Sets order create pipeline manager.voidsetOrderCreateRQValidationStrategyMap(Map<String, OrderCreateRQValidationStrategy> orderCreateRQValidationStrategyMap) Sets order create rq validation strategy map.voidsetOrderService(de.hybris.platform.order.OrderService orderService) Sets order service.voidsetOrderViewPipelineManager(OrderViewPipelineManager orderViewPipelineManager) sets order view pipeline managervoidsetReservationFacade(ReservationFacade reservationFacade) Sets reservation facade.voidsetStoreSessionFacade(de.hybris.platform.commercefacades.storesession.StoreSessionFacade storeSessionFacade) Sets store session facade.voidsetTransportOfferingService(TransportOfferingService transportOfferingService) Sets transport offering service.voidsetTravellerService(TravellerService travellerService) Sets traveller service.voidsetTravelRestrictionFacade(TravelRestrictionFacade travelRestrictionFacade) Sets travel restriction facade.voidsetUserService(de.hybris.platform.servicelayer.user.UserService userService) Sets user service.protected voidvalidateAmendedOrder(IATAOrderChangeRQ orderChangeRQ, List<AbstractOrderEntryModel> orderEntries, OrderModel amendedOrder) 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.protected voidvalidateCurrencyForOrderChange(IATAOrderChangeRQ orderChangeRQ, OrderModel originalOrder) Validate currency.
-
Constructor Details
-
DefaultNDCOrderFacade
public DefaultNDCOrderFacade()
-
-
Method Details
-
createOrder
Creates an order from an OrderCreateRQ message.- Specified by:
createOrderin interfaceNDCOrderFacade- Parameters:
orderCreateRQ- the orderCreateRQ- Returns:
- the orderViewRS
-
retrieveOrder
Retrieves the order from the booking reference specified in the OrderRetrieveRQ.- Specified by:
retrieveOrderin interfaceNDCOrderFacade- Parameters:
orderRetrieveRQ- the orderRetrieveRQ- Returns:
- the orderViewRS
- Throws:
NDCException- the ndc exception
-
changeOrder
Retrieves the original order and calculates the difference between this and the new one and places the amended order.- Specified by:
changeOrderin interfaceNDCOrderFacade- 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 orderoriginalOrder- 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 rqorderEntries- the order entriesamendedOrder- 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 rqndcBookingActionTypeList- the ndc booking action type listoriginalOrder- the original orderreservationData- the reservation dataamendedOrder- the amended orderorderEntries- 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 orderorderChangeRQ- the order change rqamendedOrder- 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 infoorderChangeRQ- 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:NDCOrderFacadeCheck if product can be added to traveller.- Specified by:
checkIfProductCanBeAddedToTravellerin interfaceNDCOrderFacade- Parameters:
order- the ordertravellerCode- the traveller codeproduct- the productquantity- the quantitytransportOfferings- the transport offeringsrouteCode- the route code- Throws:
NDCException- the ndc exception
-
calculateTotalToPay
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
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
Creates an error IATAOrderViewRS response- Specified by:
createErrorResponsein interfaceNDCOrderFacade- Parameters:
errors- the errors- Returns:
- an error IATAOrderViewRS response
-
createError
Creates an error type- Specified by:
createErrorin interfaceNDCOrderFacade- 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 rqoriginalOrder- the original order- Throws:
NDCException- the ndc exception
-
isOrderPaid
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 listorderModel- the order model- Returns:
- the booking action request data
-
getNDCBookingActionTypes
Create ndc booking action data list.- Parameters:
orderChangeRQ- the order change rq- Returns:
- the list
-
getOrderByBookingReference
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
Gets travel restriction facade.- Returns:
- the travel restriction facade
-
setTravelRestrictionFacade
Sets travel restriction facade.- Parameters:
travelRestrictionFacade- the travel restriction facade
-
getBookingService
gets booking service- Returns:
- booking service
-
setBookingService
sets booking service- Parameters:
bookingService- the booking service
-
getOrderViewPipelineManager
gets order view pipeline manager- Returns:
- order view pipeline manager
-
setOrderViewPipelineManager
sets order view pipeline manager- Parameters:
orderViewPipelineManager- the order view pipeline manager
-
getReservationFacade
Gets reservation facade.- Returns:
- the reservation facade
-
setReservationFacade
Sets reservation facade.- Parameters:
reservationFacade- the reservation facade
-
getNdcBookingActionMap
Gets ndc booking action map.- Returns:
- the ndc booking action map
-
setNdcBookingActionMap
Sets ndc booking action map.- Parameters:
ndcBookingActionMap- the ndc booking action map
-
getActionFacade
Gets action facade.- Returns:
- the action facade
-
setActionFacade
Sets action facade.- Parameters:
actionFacade- the action facade
-
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
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
Gets ndc order cloning strategy.- Returns:
- the ndc order cloning strategy
-
setNdcOrderCloningStrategy
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
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
Gets accommodation map service.- Returns:
- the accommodation map service
-
setAccommodationMapService
Sets accommodation map service.- Parameters:
accommodationMapService- the accommodation map service
-
getTransportOfferingService
Gets transport offering service.- Returns:
- the transport offering service
-
setTransportOfferingService
Sets transport offering service.- Parameters:
transportOfferingService- the transport offering service
-
getTravellerService
Gets traveller service.- Returns:
- the traveller service
-
setTravellerService
Sets traveller service.- Parameters:
travellerService- the traveller service
-
getNdcOrderService
Gets ndc order service.- Returns:
- the ndc order service
-
setNdcOrderService
Sets ndc order service.- Parameters:
ndcOrderService- the ndc order service
-
getNdcOfferFacade
Gets ndc offer facade.- Returns:
- the ndc offer facade
-
setNdcOfferFacade
Sets ndc offer facade.- Parameters:
ndcOfferFacade- the ndc offer facade
-
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
Gets order create pipeline manager.- Returns:
- the order create pipeline manager
-
setOrderCreatePipelineManager
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
Gets commerce stock service.- Returns:
- the commerce stock service
-
setCommerceStockService
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
Gets ndc payment facade.- Returns:
- the ndc payment facade
-
setNdcPaymentFacade
Sets ndc payment facade.- Parameters:
ndcPaymentFacade- the ndc payment facade
-