Esempio n. 1
0
        internal AirCreateReservationRsp AirBook(AirPricingSolution lowestPrice, AirService.AirItinerary airItinerary)
        {
            AirCreateReservationReq reservationReq = new AirCreateReservationReq();
            AirCreateReservationRsp reservationRsp;

            BillingPointOfSaleInfo billSaleInfo = new BillingPointOfSaleInfo();

            billSaleInfo.OriginApplication = "UAPI";

            reservationReq.BillingPointOfSaleInfo = billSaleInfo;

            reservationReq.ContinuityCheckOverride = new ContinuityCheckOverride()
            {
                Key   = "1T",
                Value = "true"
            };

            reservationReq.BookingTraveler = AddBookingTraveler(airItinerary);

            reservationReq.FormOfPayment = AddFormOfPayment();

            reservationReq.AirPricingSolution = AddAirPriceSolution(lowestPrice, airItinerary);

            List <ActionStatus> statusList = new List <ActionStatus>();

            ActionStatus actionStatus = new ActionStatus()
            {
                ProviderCode = "1G",
                Type         = ActionStatusType.TAW,
                TicketDate   = reservationReq.AirPricingSolution.AirPricingInfo[0].LatestTicketingTime
            };

            statusList.Add(actionStatus);
            reservationReq.ActionStatus      = statusList.ToArray();
            reservationReq.TargetBranch      = CommonUtility.GetConfigValue(ProjectConstants.G_TARGET_BRANCH);
            reservationReq.RetainReservation = typeRetainReservation.Both;
            AirCreateReservationPortTypeClient client = new AirCreateReservationPortTypeClient("AirCreateReservationPort", WsdlService.AIR_ENDPOINT);

            client.ClientCredentials.UserName.UserName = Helper.RetrunUsername();
            client.ClientCredentials.UserName.Password = Helper.ReturnPassword();
            try
            {
                var httpHeaders = Helper.ReturnHttpHeader();
                client.Endpoint.EndpointBehaviors.Add(new HttpHeadersEndpointBehavior(httpHeaders));
                reservationRsp = client.service(null, reservationReq);
                return(reservationRsp);
            }
            catch (Exception se)
            {
                Console.WriteLine("Error : " + se.Message);
                client.Abort();
                return(null);
            }
        }
        public AirCreateReservationRsp AirBookingReservationRequest(OFly.AirService.AirPricingSolution airPricingSolution, OFly.AirService.AirItinerary airItinerary, string CommissionOrDiscount, string Amount, List<OFly.Models.BookingTravellerInfos> TravellerList, OFly.Models.FormOfPaymentInfo formOfPaymentInfo)
        {
            AirCreateReservationReq request = new AirCreateReservationReq();
            AirCreateReservationRsp airCreateReservationRsp = new AirCreateReservationRsp();

            try
            {

                OFly.AirService.AirPricingSolution aps = airPricingSolution;
                List<OFly.AirService.typeBaseAirSegment> segmentList = airItinerary.AirSegment.ToList();
                List<OFly.AirService.AirPricingInfo> pricingInfo = aps.AirPricingInfo.ToList();
                List<ActionStatus> actionStatus = new List<ActionStatus>();
                List<BookingTraveler> bookingTraveler = new List<BookingTraveler>();

                request.AuthorizedBy = "user";
                request.ProviderCode = segmentList[0].ProviderCode;
                request.RetainReservation = typeRetainReservation.Both;
                request.TargetBranch = OFly.Utilities.CommonUtility.GetConfigValue(OFly.Utilities.ProjectConstants.G_TARGET_BRANCH);

                BillingPointOfSaleInfo billSaleInfo = new BillingPointOfSaleInfo();
                billSaleInfo.OriginApplication = ConfigurationManager.AppSettings["OriginApplication"];
                request.BillingPointOfSaleInfo = billSaleInfo;

                AirPricingSolution apsu = new AirPricingSolution();

                //  converted SegmentList from AirService to UniversalRecordService
                string SegmentListXMLString = SegmentListConvertToXML(segmentList);
                List<typeBaseAirSegment> tbas = LoadFromXMLToSegmentList(SegmentListXMLString);


                //  converted PriceInfoList from AirService to UniversalRecordService
                string PricingInfoXMLString = PricingInfoListConvertToXML(pricingInfo);
                List<AirPricingInfo> api = LoadFromXMLToPricingInfo(PricingInfoXMLString);

                ////    need to add dynamic travelers as per textbox
                bookingTraveler = BookingTravelerList(TravellerList);
                request.BookingTraveler = bookingTraveler.ToArray();


                //apsu.AirItinerarySolutionRef
                apsu.AirPricingInfo = api.ToArray();
                //apsu.AirPricingResultMessage
                apsu.AirSegment = tbas.ToArray();
                apsu.AirSegmentRef = null;
                apsu.ApproximateBasePrice = aps.ApproximateBasePrice;
                apsu.ApproximateFees = aps.ApproximateFees;
                apsu.ApproximateTaxes = aps.ApproximateTaxes;
                apsu.ApproximateTotalPrice = aps.ApproximateTotalPrice;
                //apsu.AvailableSSR
                apsu.BasePrice = aps.BasePrice;
                apsu.CompleteItinerary = aps.CompleteItinerary;
                //apsu.Connection
                apsu.EquivalentBasePrice = aps.EquivalentBasePrice;
                apsu.FareNote = null;
                apsu.FareNoteRef = null;
                //apsu.FeeInfo
                apsu.Fees = aps.Fees;
                //apsu.HostToken
                //apsu.Itinerary
                apsu.ItinerarySpecified = aps.ItinerarySpecified;
                //apsu.Journey
                apsu.Key = aps.Key;
                //apsu.LegRef
                //apsu.MetaData
                //apsu.OptionalServices
                //apsu.PricingDetails
                apsu.QuoteDate = aps.QuoteDate;
                apsu.QuoteDateSpecified = aps.QuoteDateSpecified;
                apsu.Services = aps.Services;
                apsu.Taxes = aps.Taxes;
                //apsu.TaxInfo
                apsu.TotalPrice = aps.TotalPrice;


                request.AirPricingSolution = apsu;

                ////  Applying Commission/Discount if applicable.
                //if (CommissionOrDiscount != null && CommissionOrDiscount != "" && Amount != null && Amount != "")
                //{
                //    List<ManualFareAdjustment> fareAdjustmentList = new List<ManualFareAdjustment>();

                //    ManualFareAdjustment adjustment = new ManualFareAdjustment();

                //    if (CommissionOrDiscount == "Amount")
                //    {
                //        adjustment.AdjustmentType = typeAdjustmentType.Amount;
                //    }
                //    else
                //    {
                //        adjustment.AdjustmentType = typeAdjustmentType.Percentage;
                //    }

                //    adjustment.AppliedOn = typeAdjustmentTarget.Base;
                //    adjustment.Value = Convert.ToInt32(Amount);
                //    adjustment.PassengerRef = "1";
                //    fareAdjustmentList.Add(adjustment);

                //    api[0].AirPricingModifiers = new AirPricingModifiers()
                //    {
                //        ManualFareAdjustment = fareAdjustmentList.ToArray()
                //    };
                //}

                actionStatus.Add(new ActionStatus { Type = ActionStatusType.ACTIVE, TicketDate = "T*", ProviderCode = request.ProviderCode });
                request.ActionStatus = actionStatus.ToArray();

                request.FormOfPayment = AddFormOfPayment(formOfPaymentInfo);

                AirCreateReservationPortTypeClient client = new AirCreateReservationPortTypeClient("AirCreateReservationPort", OFly.Utilities.WsdlService.AIR_ENDPOINT);

                client.ClientCredentials.UserName.UserName = OFly.Utilities.Helper.RetrunUsername();
                client.ClientCredentials.UserName.Password = OFly.Utilities.Helper.ReturnPassword();


                var httpHeaders = OFly.Utilities.Helper.ReturnHttpHeader();
                client.Endpoint.EndpointBehaviors.Add(new HttpHeadersEndpointBehavior(httpHeaders));

                SupportedVersions supportedVersions = new SupportedVersions();
                supportedVersions.airVersion = "air_v31_0";
                airCreateReservationRsp = client.service(supportedVersions, request);

                return airCreateReservationRsp;
            }
            catch (Exception se)
            {
                throw se;
            }
        }
        internal AirCreateReservationRsp AirBook(AirService.AirPricingSolution lowestPrice, AirService.AirItinerary airItinerary)
        {
            AirCreateReservationReq reservationReq = new AirCreateReservationReq();
            AirCreateReservationRsp reservationRsp;

            BillingPointOfSaleInfo billSaleInfo = new BillingPointOfSaleInfo();
            billSaleInfo.OriginApplication = "UAPI";

            reservationReq.BillingPointOfSaleInfo = billSaleInfo;

            reservationReq.ContinuityCheckOverride = new ContinuityCheckOverride()
            {
                Key = "1T",
                Value = "true"
            };

            reservationReq.BookingTraveler = AddBookingTraveler(airItinerary);

            reservationReq.FormOfPayment = AddFormOfPayment();

            reservationReq.AirPricingSolution = AddAirPriceSolution(lowestPrice, airItinerary);

            List<ActionStatus> statusList = new List<ActionStatus>();

            ActionStatus actionStatus = new ActionStatus()
            {
                ProviderCode = "1G",
                Type = ActionStatusType.TAW,
                TicketDate = reservationReq.AirPricingSolution.AirPricingInfo[0].LatestTicketingTime
            };

            statusList.Add(actionStatus);

            reservationReq.ActionStatus = statusList.ToArray();



            reservationReq.TargetBranch = CommonUtility.GetConfigValue(ProjectConstants.G_TARGET_BRANCH);
            reservationReq.RetainReservation = typeRetainReservation.Both;

            AirCreateReservationPortTypeClient client = new AirCreateReservationPortTypeClient("AirCreateReservationPort", WsdlService.AIR_ENDPOINT);
            client.ClientCredentials.UserName.UserName = Helper.RetrunUsername();
            client.ClientCredentials.UserName.Password = Helper.ReturnPassword();
            try
            {
                var httpHeaders = Helper.ReturnHttpHeader();
                client.Endpoint.EndpointBehaviors.Add(new HttpHeadersEndpointBehavior(httpHeaders));

                /*SupportedVersions versions = new SupportedVersions();

                versions.airVersion = "air_v29_0";
                versions.urVersion = "universal_v29_0";*/                

                reservationRsp = client.service(null, reservationReq);
                //Console.WriteLine(lowFareSearchRsp.AirSegmentList.Count());

                return reservationRsp;
            }
            catch (Exception se)
            {
                Console.WriteLine("Error : " + se.Message);
                client.Abort();
                return null;
            }

        }