Esempio n. 1
0
        private UniversalRecordRetrieveRsp GetUniversalRecord()
        {
            var res = GetAirAvailability();

            UniversalRecordRetrieveRsp response = null;

            string someTraceId = "doesntmatter-8176";
            string originApp   = "UAPI";

            UniversalRecordRetrieveReq req = new UniversalRecordRetrieveReq();

            req.TraceId      = someTraceId;
            req.AuthorizedBy = "user";
            req.TargetBranch = "P7001182";
            req.RetrieveProviderReservationDetails = true;

            ATPI.TWME.SP.Lib.URService.BillingPointOfSaleInfo billSetInfo = new ATPI.TWME.SP.Lib.URService.BillingPointOfSaleInfo();
            billSetInfo.OriginApplication = originApp;

            UniversalRecordRetrieveReqProviderReservationInfo prov = new UniversalRecordRetrieveReqProviderReservationInfo();

            prov.ProviderCode        = "1G";
            prov.ProviderLocatorCode = "7BC4N4";
            //prov.ProviderLocatorCode = "C3829K";

            req.BillingPointOfSaleInfo = billSetInfo;
            req.Item = prov;


            try
            {
                BasicHttpBinding binding = new BasicHttpBinding(BasicHttpSecurityMode.Transport);

                binding.Security.Transport.ProxyCredentialType  = HttpProxyCredentialType.Basic;
                binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic;
                string          uri             = "https://americas.universal-api.pp.travelport.com/B2BGateway/connect/uAPI/UniversalRecordService";
                EndpointAddress endpointAddress = new EndpointAddress(uri);

                UniversalRecordRetrieveServicePortTypeClient client = new UniversalRecordRetrieveServicePortTypeClient(binding, endpointAddress);
                if (client.ClientCredentials != null)
                {
                    client.ClientCredentials.UserName.UserName = "******";
                    client.ClientCredentials.UserName.Password = "******";
                }

                response = client.service(null, null, req);
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(response);
        }
        internal UniversalRecordRetrieveRsp RetrieveRecord(string urLocatorCode)
        {
            UniversalRecordRetrieveReq univRetReq = new UniversalRecordRetrieveReq();
            UniversalRecordRetrieveRsp univRetRsp;

            univRetReq.TargetBranch = CommonUtility.GetConfigValue(ProjectConstants.G_TARGET_BRANCH);

            BillingPointOfSaleInfo billSaleInfo = new BillingPointOfSaleInfo();

            billSaleInfo.OriginApplication = "UAPI";

            univRetReq.BillingPointOfSaleInfo = billSaleInfo;

            univRetReq.Item = urLocatorCode;

            UniversalRecordRetrieveServicePortTypeClient client = new UniversalRecordRetrieveServicePortTypeClient("UniversalRecordRetrieveServicePort", WsdlService.UNIVERSAL_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));

                univRetRsp = client.service(null, univRetReq);
                //Console.WriteLine(lowFareSearchRsp.AirSegmentList.Count());

                IEnumerator airReservationDetails = univRetRsp.UniversalRecord.Items.GetEnumerator();

                String airLocatorCode;

                while (airReservationDetails.MoveNext())
                {
                    ConsoleApplication1.UniversalService.typeBaseAirReservation airReservation = (ConsoleApplication1.UniversalService.typeBaseAirReservation)airReservationDetails.Current;
                    airLocatorCode = airReservation.LocatorCode;

                    if (!string.IsNullOrEmpty(airLocatorCode))
                    {
                        AirTicketTest ticketing = new AirTicketTest();
                        ticketing.GenerateTicket(airLocatorCode);
                    }
                }

                return(univRetRsp);
            }
            catch (Exception se)
            {
                Console.WriteLine("Error : " + se.Message);
                client.Abort();
                return(null);
            }
        }
        internal UniversalRecordRetrieveRsp RetrieveRecord(string urLocatorCode)
        {
            UniversalRecordRetrieveReq univRetReq = new UniversalRecordRetrieveReq();
            UniversalRecordRetrieveRsp univRetRsp;

            univRetReq.TargetBranch = CommonUtility.GetConfigValue(ProjectConstants.G_TARGET_BRANCH);
            
            BillingPointOfSaleInfo billSaleInfo = new BillingPointOfSaleInfo();
            billSaleInfo.OriginApplication = "UAPI";

            univRetReq.BillingPointOfSaleInfo = billSaleInfo;

            univRetReq.Item = urLocatorCode;

            UniversalRecordRetrieveServicePortTypeClient client = new UniversalRecordRetrieveServicePortTypeClient("UniversalRecordRetrieveServicePort", WsdlService.UNIVERSAL_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));

                univRetRsp = client.service(null, univRetReq);
                //Console.WriteLine(lowFareSearchRsp.AirSegmentList.Count());

                IEnumerator airReservationDetails = univRetRsp.UniversalRecord.Items.GetEnumerator();

                String airLocatorCode;

                while (airReservationDetails.MoveNext())
                {
                    ConsoleApplication1.UniversalService.typeBaseAirReservation airReservation = (ConsoleApplication1.UniversalService.typeBaseAirReservation)airReservationDetails.Current;
                    airLocatorCode = airReservation.LocatorCode;

                    if (!string.IsNullOrEmpty(airLocatorCode))
                    {
                        AirTicketTest ticketing = new AirTicketTest();
                        ticketing.GenerateTicket(airLocatorCode);
                    }
                }

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

        }
        public UniversalRecordRetrieveRsp UniversalRecordRetrieveRequest(string LocatorCode)
        {
            try
            {
                UniversalRecordRetrieveReq request = new UniversalRecordRetrieveReq();
                UniversalRecordRetrieveRsp universalRecordRetrieveRsp = new UniversalRecordRetrieveRsp();

                request.AuthorizedBy = "user";
                request.TargetBranch = OFly.Utilities.CommonUtility.GetConfigValue(OFly.Utilities.ProjectConstants.G_TARGET_BRANCH);

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



                request.Item = LocatorCode;


                UniversalRecordRetrieveServicePortTypeClient client = new UniversalRecordRetrieveServicePortTypeClient("UniversalRecordRetrieveServicePort", OFly.Utilities.WsdlService.UNIVERSALRECORD_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";
                supportedVersions.urVersion = "universal_v31_0";
                universalRecordRetrieveRsp = client.service(supportedVersions, request);

                return universalRecordRetrieveRsp;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }