public bool PlaceOrderCheckoutFlow(string paymentOption = "", bool changePaymentMode = true) { var changePayment = changePaymentMode; var url = AppConfigHelper.MainUrl.Equals("live"); var payPalStatus = AppConfigHelper.LivePaypalPurchase.Equals("N", StringComparison.CurrentCultureIgnoreCase); var cardStatus = AppConfigHelper.LiveCardPurchase.Equals("N", StringComparison.CurrentCultureIgnoreCase); if (url) { if (paymentOption.Equals("Paypal") && payPalStatus && !changePaymentMode && !string.IsNullOrEmpty(paymentOption)) { throw new CustomException("But, for namecheap production environment auto test verifies until payment confirmation page. until this page all streams works fine, because for production we don't have access for purchasing"); } if (paymentOption.Equals("Card") && cardStatus && !changePaymentMode && !string.IsNullOrEmpty(paymentOption)) { throw new CustomException("But, for namecheap production environment auto test verifies until payment confirmation page. until this page all streams works fine, because for production we don't have access for purchasing"); } if (string.IsNullOrEmpty(paymentOption)) { throw new CustomException("But, for namecheap production environment auto test verifies until payment confirmation page. until this page all streams works fine, because for production we don't have access for purchasing"); } } var pMode = string.IsNullOrEmpty(paymentOption) ? AppConfigHelper.PaymentMethod : paymentOption; var paymentMethodText = PageInitHelper <PurchaseFlow> .PageInit.PaymentMethod.Text; var paymentMethods = paymentMethodText.IndexOf(EnumHelper.PaymentMethod.Paypal.ToString(), StringComparison.CurrentCultureIgnoreCase) >= 0 || paymentMethodText.IndexOf(EnumHelper.PaymentMethod.Funds.ToString(), StringComparison.CurrentCultureIgnoreCase) >= 0 ? paymentMethodText : EnumHelper.PaymentMethod.Card.ToString(); var paymentMethod = paymentMethods.IndexOf(pMode, StringComparison.OrdinalIgnoreCase) != -1; if (paymentMethod) { return(changePayment); } PageInitHelper <PurchaseFlow> .PageInit.ChangeLnk.Click(); ICheckoutNav checkout = new BillingNav(); changePayment = checkout.PlaceOrderCheckoutFlow(paymentOption, changePaymentMode); return(changePayment); }
// private delegate void DelMethod(); public List <SortedDictionary <string, string> > PurchasingNcProducts( List <SortedDictionary <string, string> > mergedScAndCartWidgetList, string paymentOption = "", bool changePaymentMode = true) { var mergedPurchaseSummaryItemsAndScItemsList = new List <SortedDictionary <string, string> >(); bool changePayment = false; ICheckoutNav checkout; Check: var checkoutNavTxt = PageInitHelper <PurchaseFlow> .PageInit.CheckoutNav.Text.Trim(); if (checkoutNavTxt.Equals(UiConstantHelper.Account)) { checkout = new AccountNav(); checkout.PlaceOrderCheckoutFlow(paymentOption, changePaymentMode); goto Check; } if (checkoutNavTxt.Equals(UiConstantHelper.Setup)) { checkout = new SetupNav(); checkout.PlaceOrderCheckoutFlow(paymentOption, changePaymentMode); goto Check; } if (checkoutNavTxt.Equals(UiConstantHelper.Billing)) { checkout = new BillingNav(); changePayment = checkout.PlaceOrderCheckoutFlow(paymentOption, changePaymentMode); goto Check; } if (checkoutNavTxt.Equals(UiConstantHelper.Order)) { if (!changePayment) { //changePaymentMode = changePayment.Equals(false) ? false : true; checkout = new OrderNav(); checkout.PlaceOrderCheckoutFlow(paymentOption, changePaymentMode); // PageInitHelper<PurchaseFlow>.PageInit.PaymentContinueBtn.Click(); } var elemTermsAgree = BrowserInit.Driver.PageSource.Contains("your-cart-terms"); if (elemTermsAgree) { var chkTerms = PageInitHelper <PurchaseFlow> .PageInit.TermsAgreementsChk.Selected; if (chkTerms == false) { PageInitHelper <PurchaseFlow> .PageInit.TermsAgreementsChk.Click(); } } // PageInitHelper<PurchaseFlow>.PageInit.PaymentContinueBtn.Click(); var paymentMethodText = PageInitHelper <PurchaseFlow> .PageInit.PaymentMethod.Text.Trim(); PageInitHelper <PurchaseFlow> .PageInit.PayNowBtn.Click(); PageInitHelper <PageNavigationHelper> .PageInit.WaitForPageLoad(); var paymentMethods = paymentMethodText.IndexOf(EnumHelper.PaymentMethod.Paypal.ToString(), StringComparison.CurrentCultureIgnoreCase) >= 0 || paymentMethodText.IndexOf(EnumHelper.PaymentMethod.Funds.ToString(), StringComparison.CurrentCultureIgnoreCase) >= 0 ? paymentMethodText : EnumHelper.PaymentMethod.Card.ToString(); if (paymentMethods.IndexOf(EnumHelper.PaymentMethod.Paypal.ToString(), StringComparison.CurrentCultureIgnoreCase) >= 0) { IPaymentMethod paypal = new PaypalPayment(); paypal.PaymentMode(); } else { PageInitHelper <OrderProcessing> .PageInit.WaitForOrderProcessing(); } /* IPaymentMethod paypal = new PaypalPayment(); * (paymentMethods.Equals("PAYPAL", StringComparison.InvariantCultureIgnoreCase) * ? paypal.PaymentMode * : (Action)PageInitHelper<OrderProcessing>.PageInit.WaitForOrderProcessing)();*/ goto Check; } if (checkoutNavTxt.Equals("Done")) { mergedPurchaseSummaryItemsAndScItemsList = PageInitHelper <DoneNav> .PageInit.ValidateInPurchaseSumarypage(mergedScAndCartWidgetList); } return(mergedPurchaseSummaryItemsAndScItemsList); }