コード例 #1
0
        public static void GetCancelBuying(Ticket ticket, Passenger passenger = null)
        {
            string xml = BuyingParsings.GetCancelBuying(ticket, passenger);

            CancelBuyingRequest.OnPopulated = (xmlResult) =>
            {
                CancelBuyingRequest.Response = BuyingParsings.ParseCancelBuying(xmlResult);
            };
            Global.OnRequestCalled("BuyingRequests.GetCancelBuying", new object[] { ticket, passenger });
            CancelBuyingRequest.GetResult(xml, ApiAction.CancelBuying);
        }
コード例 #2
0
        private static void prepareBrowser(Ticket ticket, Grid webBrowserGrid)
        {
            Is3DSecureBuyingCompleted = false;
            _webBrowser = new WebBrowser();
            webBrowserGrid.Background = new SolidColorBrush(Colors.White);
            var innerGrid = new Grid();

            innerGrid.Children.Add(_webBrowser);
            webBrowserGrid.Children.Add(innerGrid);

            string html = BuyingParsings.Get3DSecureBuying(ticket);

            _webBrowser.IsScriptEnabled = true;
            _webBrowser.NavigateToString(html);
            _webBrowser.Navigated += webBrowser_Navigated;
        }
コード例 #3
0
        public static void GetBuying(Ticket ticket)
        {
            PassengerRequests.OnListVerificationCompleted = (stateResponse) =>
            {
                var state = stateResponse.Result;
                if (!state && BuyingRequest.OnCompleted != null)
                {
                    var response = new BaseResponse <ActionResult>();
                    response.Status = ResponseStatus.InvalidTCKN;
                    BuyingRequest.OnCompleted(response);
                }
                else
                {
                    string xml;
                    if (ticket.Type == TicketType.BusJourney)
                    {
                        xml = BuyingParsings.GetBusBuying(ticket);
                    }
                    else
                    {
                        xml = BuyingParsings.GetAirplaneBuying(ticket);
                    }

                    BuyingRequest.OnPopulated = (xmlResult) =>
                    {
                        BuyingRequest.Response = BuyingParsings.ParseBuying(xmlResult);
                    };
                    Global.OnRequestCalled("BuyingRequests.GetBuying", new object[] { ticket });
                    if (ticket.Type == TicketType.BusJourney)
                    {
                        BuyingRequest.GetResult(xml, ApiAction.BusBuying);
                    }
                    else
                    {
                        BuyingRequest.GetResult(xml, ApiAction.AirplaneBuying);
                    }
                }
            };
            PassengerRequests.VerifyPassengers(ticket.Passengers);
        }
コード例 #4
0
 private static void webBrowser_Navigated(object sender, System.Windows.Navigation.NavigationEventArgs e)
 {
     try
     {
         var    uri    = e.Uri;
         string result = _webBrowser.SaveToString();
         Global.OnRequestReturned(uri.OriginalString + "=> " + result);
         if (uri.OriginalString.Contains("www.biletall.com/WS/3DSecure/SecurePay2.aspx"))
         {
             var doc = new HtmlDocument();
             doc.LoadHtml(result);
             var root   = doc.DocumentNode;
             var inputs = root.Descendants("input");
             if (getInputValue(inputs, "Sonuc") == "false")
             {
                 _webBrowser.Navigated -= webBrowser_Navigated;
                 _response              = BuyingParsings.Parse3DSecureBuying(result);
                 Global.OnResultParsed(_response);
                 //_webBrowser.Navigate(new Uri("about:blank", UriKind.RelativeOrAbsolute));
                 populate3DSecureBuying();
                 Global.OnRequestCompleted();
             }
             else
             {
                 postToUrl("https://sanalposprov.garanti.com.tr/servlet/gt3dengine", getPostData(result));
             }
         }
         else if (uri.OriginalString.Contains("bkm.com.tr"))
         {
             _webBrowser.RenderTransformOrigin = new Point(0.5, _webBrowser.RenderTransformOrigin.Y);
             _webBrowser.RenderTransform       = new ScaleTransform()
             {
                 ScaleX = 2, ScaleY = 2
             };
             _webBrowser.Margin = new Thickness(0, 50, 0, 0);
             if (OnPageLoaded != null)
             {
                 OnPageLoaded();
             }
         }
         else if (uri.OriginalString.Contains("www.biletall.com/WS/3DSecure/Secure3DSonuc.aspx"))
         {
             _webBrowser.Navigated -= webBrowser_Navigated;
             _response              = BuyingParsings.Parse3DSecureBuying(result);
             Global.OnResultParsed(_response);
             //_webBrowser.Navigate(new Uri("about:blank", UriKind.RelativeOrAbsolute));
             populate3DSecureBuying();
             Global.OnRequestCompleted();
         }
     }
     catch (Exception exp)
     {
         Global.Invoke(() =>
         {
             Is3DSecureBuyingCompleted = true;
             if (On3DSecureBuyingCompleted != null)
             {
                 On3DSecureBuyingCompleted(new BaseResponse <ActionResult>()
                 {
                     Status = ResponseStatus.Undefined
                 });
                 Global.OnRequestFailed(exp);
             }
         });
     }
 }