8 #include <stdair/bom/BomKeyManager.hpp>
9 #include <stdair/bom/BookingClassKey.hpp>
10 #include <stdair/bom/BookingRequestStruct.hpp>
11 #include <stdair/bom/TravelSolutionStruct.hpp>
12 #include <stdair/bom/FareOptionStruct.hpp>
13 #include <stdair/service/Logger.hpp>
22 const stdair::BookingRequestStruct& iBookingRequest) {
23 stdair::TravelSolutionStruct* oChosenTS_ptr = NULL;
26 const stdair::NbOfSeats_T& lPartySize = iBookingRequest.getPartySize();
29 const stdair::WTP_T& lWTP = iBookingRequest.getWTP();
33 const stdair::ChangeFees_T& lCustomerChangeFees =
34 iBookingRequest.getChangeFees();
37 const stdair::NonRefundable_T& lCustomerNonRefundable =
38 iBookingRequest.getNonRefundable();
41 const stdair::Fare_T& lChangeFeesDisutility =
42 iBookingRequest.getChangeFeeDisutility();
43 const stdair::Fare_T& lNonRefundableDisutility =
44 iBookingRequest.getNonRefundableDisutility();
47 stdair::Fare_T lLowestFare = std::numeric_limits<stdair::Fare_T>::max();
48 for (stdair::TravelSolutionList_T::iterator itTS = ioTSList.begin();
49 itTS != ioTSList.end(); ++itTS) {
50 stdair::TravelSolutionStruct& lTS = *itTS;
53 const stdair::FareOptionList_T& lFOList = lTS.getFareOptionList();
54 for (stdair::FareOptionList_T::const_iterator itFO = lFOList.begin();
55 itFO != lFOList.end(); ++itFO) {
56 const stdair::FareOptionStruct& lFO = *itFO;
57 const stdair::Fare_T& lFOFare = lFO.getFare();
60 stdair::Fare_T lFODisutility = 0;
63 if (lCustomerChangeFees ==
false) {
64 const bool lFOChangeFees = lFO.getChangeFees();
65 if (lFOChangeFees ==
true){
66 lFODisutility += lChangeFeesDisutility;
71 if (lCustomerNonRefundable ==
false) {
72 const bool lFONonRefundable = lFO.getNonRefundable();
73 if (lFONonRefundable ==
true){
74 lFODisutility += lNonRefundableDisutility;
83 const stdair::Availability_T& lFOAvl = lFO.getAvailability();
84 const stdair::Fare_T lFOFareWithinDisutility = lFOFare + lFODisutility;
86 if (lFOFareWithinDisutility < lLowestFare
88 && lFOAvl >= lPartySize) {
103 lLowestFare = lFOFare + lFODisutility;
104 oChosenTS_ptr = &lTS;
105 oChosenTS_ptr->setChosenFareOption (lFO);
123 return oChosenTS_ptr;