Exemplo n.º 1
0
        private static void PopulateBuying(string xmlResult)
        {
            var buying = BuyingParsing.ParseBuying(xmlResult);

            IsBuyingCompleted = true;
            if (OnBuyingCompleted != null)
            {
                OnBuyingCompleted(buying);
            }
        }
Exemplo n.º 2
0
        public static void Get3DSecureBuying(Ticket ticket, Grid webBrowserGrid)
        {
            Is3DSecureBuyingCompleted = false;
            _webBrowser   = new WebBrowser();
            _actionResult = new ActionResult();
            webBrowserGrid.Children.Add(_webBrowser);

            string html = BuyingParsing.Get3DSecureBuying(ticket);

            _webBrowser.IsScriptEnabled = true;
            _webBrowser.NavigateToString(html);
            _webBrowser.Navigated += webBrowser_Navigated;
        }
Exemplo n.º 3
0
        private static void webBrowser_Navigated(object sender, System.Windows.Navigation.NavigationEventArgs e)
        {
            var    uri    = e.Uri;
            string result = _webBrowser.SaveToString();

            if (!string.IsNullOrEmpty(uri.OriginalString))
            {
                if (uri.OriginalString == _secureServiceURL || uri.OriginalString == _secureServiceResultURL)
                {
                    _actionResult = BuyingParsing.Parse3DSecureBuying(result);
                }
                if (uri.LocalPath == "/success")
                {
                    Populate3DSecureBuying(_actionResult);
                }
                else if (uri.LocalPath == "/fail")
                {
                    _webBrowser.Navigated -= webBrowser_Navigated;
                    Populate3DSecureBuying(_actionResult);
                }
            }
        }
Exemplo n.º 4
0
        public static void GetBuying(Ticket ticket)
        {
            IsBuyingCompleted = false;
            string xml;

            if (ticket.Type == TicketType.BusJourney)
            {
                xml = BuyingParsing.GetBusBuying(ticket);
            }
            else
            {
                xml = BuyingParsing.GetAirplaneBuying(ticket);
            }
            var client = new ServiceSoapClient();

            client.StrIsletAsync(xml, Global.Authorization);
            client.StrIsletCompleted += (c, e) =>
            {
                string xmlResult = e.Result;
                PopulateBuying(xmlResult);
            };
        }