protected void btnGetPaymentFields_Click(object sender, EventArgs e) { PaymentFields pf = new PaymentFields(); pf = p.GetPaymentFields(AmeriaPaymentFields); ltMessage.Text = new JavaScriptSerializer().Serialize(pf).ToString(); }
internal bool MakePayment_CreditCard(PaymentFields paymentFields) { var fillCcDetailsDiv = WaitAndGetBySelector("fillCCDetailsDiv", ApplicationSettings.TimeOut.Fast); if (fillCcDetailsDiv != null && fillCcDetailsDiv.Displayed) { Thread.Sleep(5000); var divPaymentBox = WaitAndGetBySelector("divPaymentBox", ApplicationSettings.TimeOut.Safe); if (divPaymentBox != null && divPaymentBox.Displayed) { ExecuteJavascript("$('#NameOnCard').val('" + paymentFields.CreditCard.NameOnCard + "')"); ExecuteJavascript("$('#CardNumber').val('" + paymentFields.CreditCard.CardNumber + "')"); ExecuteJavascript("$('#SecurityCode').val('" + paymentFields.CreditCard.SecurityCode + "')"); ExecuteJavascript("$('#ExpirationMonth').val('" + paymentFields.CreditCard.ExpirationMonth + "')"); ExecuteJavascript("$('#ExpirationYear').val('" + paymentFields.CreditCard.ExpirationYear + "')"); ExecuteJavascript("$('#Address1').val('" + paymentFields.Address.Address1 + "')"); ExecuteJavascript("$('#City').val('" + paymentFields.Address.City + "')"); ExecuteJavascript("$('#Country').val('" + paymentFields.Address.Country + "');$('#Country').change();"); var SpinningDiv = WaitAndGetBySelector("SpinningDiv", ApplicationSettings.TimeOut.Slow); while (SpinningDiv != null && SpinningDiv.Displayed) { Thread.Sleep(200); } ExecuteJavascript("$('#PostalCode').val('" + paymentFields.Address.PostalCode + "')"); ExecuteJavascript("$('#Provinces').val('" + paymentFields.Address.Provinces + "')"); ExecuteJavascript("$('#PhoneNumberArea').val('" + paymentFields.PhoneNumber.PhoneNumberArea + "')"); ExecuteJavascript("$('#PhoneNumberExchange').val('" + paymentFields.PhoneNumber.PhoneNumberExchange + "')"); ExecuteJavascript("$('#PhoneNumberDigits').val('" + paymentFields.PhoneNumber.PhoneNumberDigits + "')"); ExecuteJavascript("$('#EmailAddress').val('" + paymentFields.EmailAddress + "')"); Thread.Sleep(1000); WaitAndGetBySelector("SubmitPayment", ApplicationSettings.TimeOut.Fast).Click(); while (SpinningDiv != null && SpinningDiv.Displayed) { Thread.Sleep(2000); var confirmationDiv = WaitAndGetBySelector("ConfirmationDiv", ApplicationSettings.TimeOut.Slow); if (confirmationDiv != null && confirmationDiv.Displayed) { return(true); } } } } return(false); }
public void PreferedCust_BookingFlow_RoviaBucks_Success() { #region search for flight AirSearchScenario airScenario = new AirSearchScenario() { Adults = 1, Childs = 0, Infants = 0, SearchType = SearchType.OneWay, AirportPairs = new List <AirportPair> { new AirportPair() { FromLocation = "LAS", ToLocation = "MIA", DepartureDateTime = DateTime.Today.AddDays(7) } } }; _app.HomePage.DoAirSearch(airScenario); #endregion while (_app.AirResultsPage.IsWaitingVisible()) { Thread.Sleep(2000); if (_app.AirResultsPage.IsResultsVisible()) { //if results available add first flight to cart Assert.IsTrue(_app.AirResultsPage.AddToCart(), "Itinerary not available."); Assert.IsTrue(_app.TripFolderPage.Checkout(), "Error on loading TripFolder."); //for registered user can login Assert.IsTrue(_app.LoginDetailsPage.Login(), "Login Failed"); #region submit passenger details PassengerDetails pes = new PassengerDetails() { InsuranceData = new Insurance() { Country = "United States", IsInsuared = false }, FirstName = "Vikul", LastName = "Rathod", DOB = "09/16/1989", Gender = "Male", Emailid = "*****@*****.**" }; _app.PassengerInfoPage.SubmitPassengerDetails(pes); #endregion Thread.Sleep(1000); #region pay by credit card PaymentFields paymentFields = new PaymentFields() { EmailAddress = "*****@*****.**", Address = new Address() { Address1 = "888 main", City = "Plano", Country = "US", PostalCode = "77777", Provinces = "TX" }, PhoneNumber = new PhoneNumber() { PhoneNumberArea = "222", PhoneNumberExchange = "223", PhoneNumberDigits = "7777", } }; Assert.IsTrue(_app.CheckoutPage.IsPayNowSuccess_RB(paymentFields), "Booking failed with Rovia Bucks"); #endregion break; } } }
public void GuestUser_BookingFlow_CreditCard_Success() { #region search for flight AirSearchScenario airScenario = new AirSearchScenario() { Adults = 1, Childs = 0, Infants = 0, SearchType = SearchType.OneWay, AirportPairs = new List <AirportPair> { new AirportPair() { FromLocation = "LAS", ToLocation = "MIA", DepartureDateTime = DateTime.Today.AddDays(7) } } }; _app.HomePage.DoAirSearch(airScenario); #endregion while (_app.AirResultsPage.IsWaitingVisible()) { Thread.Sleep(2000); if (_app.AirResultsPage.IsResultsVisible()) { //if results available add first flight to cart Assert.IsTrue(_app.AirResultsPage.AddToCart(), "Itinerary not available."); Assert.IsTrue(_app.TripFolderPage.Checkout(), "Error on loading TripFolder."); #region Guest User Registration //for guest user asks for login on checkout page and he will register here //please change email id before run this test case NewUserRegistration newUser = new NewUserRegistration() { FName = "Vikul", LName = "Rathod", EmailId = "*****@*****.**", DOB = "09/16/1989", Password = "******" }; Assert.IsTrue(_app.LoginDetailsPage.NewUserRegistration(newUser), "Registration Failed"); Assert.IsTrue(_app.LoginDetailsPage.PreferedCustomerRegistration(), "Error during pref cust registration"); #endregion #region submit passenger details PassengerDetails pes = new PassengerDetails() { InsuranceData = new Insurance() { Country = "United States", IsInsuared = false }, FirstName = "Vikul", LastName = "Rathod", DOB = "09/16/1989", Gender = "Male", Emailid = "*****@*****.**" }; _app.PassengerInfoPage.SubmitPassengerDetails(pes); #endregion Thread.Sleep(1000); //check if itinerary available or price not changed before actual payment Assert.IsTrue(_app.CheckoutPage.IsPayNowSuccess_CreditCard(), "Itinerary not available or Price has changed."); #region pay by credit card PaymentFields paymentFields = new PaymentFields() { EmailAddress = "*****@*****.**", CreditCard = new CreditCard() { NameOnCard = "Vikul Rathod", CardNumber = "4111111111111111", SecurityCode = 999, ExpirationMonth = 10, ExpirationYear = 2015 }, Address = new Address() { Address1 = "888 main", City = "Plano", Country = "US", PostalCode = "77777", Provinces = "TX" }, PhoneNumber = new PhoneNumber() { PhoneNumberArea = "222", PhoneNumberExchange = "223", PhoneNumberDigits = "7777", } }; Assert.IsTrue(_app.CheckoutPage.MakePayment_CreditCard(paymentFields), "Payment Failed"); #endregion break; } } }
internal bool IsPayNowSuccess_RB(PaymentFields paymentFields) { var fillCcDetailsDiv = WaitAndGetBySelector("fillCCDetailsDiv", ApplicationSettings.TimeOut.Safe); while (fillCcDetailsDiv != null && !fillCcDetailsDiv.Displayed) { break; } var roviaBucksCheck = WaitAndGetBySelector("roviaBucksCheck", ApplicationSettings.TimeOut.Safe); if (roviaBucksCheck != null && roviaBucksCheck.Displayed) { WaitAndGetBySelector("roviaBucksCheck", ApplicationSettings.TimeOut.Fast).Click(); WaitAndGetBySelector("typeRB", ApplicationSettings.TimeOut.Fast).SelectFromDropDown("Standard"); WaitAndGetBySelector("address1", ApplicationSettings.TimeOut.Fast).SendKeys(paymentFields.Address.Address1); WaitAndGetBySelector("address2", ApplicationSettings.TimeOut.Fast).SendKeys(""); ExecuteJavascript("$('#drpCountry').val('" + paymentFields.Address.Country + "');$('#drpCountry').change();"); Thread.Sleep(2000); var txtstate = WaitAndGetBySelector("txtstate", ApplicationSettings.TimeOut.Slow); if (txtstate != null && txtstate.Displayed) { WaitAndGetBySelector("txtstate", ApplicationSettings.TimeOut.Safe).SendKeys(paymentFields.Address.Provinces); } else { ExecuteJavascript("$('#drpState').val('" + paymentFields.Address.Provinces + "')"); } WaitAndGetBySelector("city", ApplicationSettings.TimeOut.Fast).SendKeys(paymentFields.Address.City); WaitAndGetBySelector("zipcode", ApplicationSettings.TimeOut.Fast).SendKeys(paymentFields.Address.PostalCode); WaitAndGetBySelector("phnArea", ApplicationSettings.TimeOut.Fast).SendKeys(paymentFields.PhoneNumber.PhoneNumberArea); WaitAndGetBySelector("phnExchange", ApplicationSettings.TimeOut.Fast).SendKeys(paymentFields.PhoneNumber.PhoneNumberExchange); WaitAndGetBySelector("phnDigits", ApplicationSettings.TimeOut.Fast).SendKeys(paymentFields.PhoneNumber.PhoneNumberDigits); WaitAndGetBySelector("checkTerms", ApplicationSettings.TimeOut.Fast).Click(); WaitAndGetBySelector("paynow", ApplicationSettings.TimeOut.Fast).Click(); var preLoadingDiv = WaitAndGetBySelector("preloading", ApplicationSettings.TimeOut.Slow); while (preLoadingDiv != null && preLoadingDiv.Displayed) { Thread.Sleep(2000); var confirmationDiv = WaitAndGetBySelector("ConfirmationDiv", ApplicationSettings.TimeOut.Safe); if (confirmationDiv != null && confirmationDiv.Displayed) { return(true); } } var divPayNowfailed = WaitAndGetBySelector("divPayNowfailed", ApplicationSettings.TimeOut.Slow); if (divPayNowfailed != null && divPayNowfailed.Displayed) { return(false); } } return(false); }