public void VerifyCheckoutTax(double taxAmountToVerify, string taxLabel, MoneyTool.CurrencyCode currency = MoneyTool.CurrencyCode.USD)
 {
     string expectedAmount = MoneyTool.FormatMoney(taxAmountToVerify, currency);
     string actualAmount = UIUtil.DefaultProvider.GetText(string.Format(TaxLocatorCheckout, taxLabel), LocateBy.XPath);
     VerifyTool.VerifyValue(expectedAmount, actualAmount, taxLabel + " = {0}");
 }
        public void VerifyCheckoutSaving(double savingToVerify, MoneyTool.CurrencyCode currency = MoneyTool.CurrencyCode.USD)
        {
            string amount = MoneyTool.FormatMoney(savingToVerify, currency);
            string expectedValue = string.Format("By using a discount code, you have saved: {0}.", amount);
            string actualValue = string.Empty;

            UIUtil.DefaultProvider.VerifyOnPage(OnCheckoutPage(), "Checkout");

            actualValue = UIUtil.DefaultProvider.GetText(CheckoutDiscountMessage, LocateBy.XPath);

            VerifyTool.VerifyValue(expectedValue, actualValue, "CheckoutSaving : {0}");
        }
        public void VerifyCheckoutSubTotal(double subTotalToVerify, MoneyTool.CurrencyCode currency = MoneyTool.CurrencyCode.USD)
        {
            string expectedValue = MoneyTool.FormatMoney(subTotalToVerify, currency);
            string actualValue = string.Empty;

            UIUtil.DefaultProvider.VerifyOnPage(OnCheckoutPage(), "Checkout");

            actualValue = UIUtil.DefaultProvider.GetText(CheckoutSubTotal, LocateBy.XPath);

            VerifyTool.VerifyValue(expectedValue, actualValue, "CheckoutSubTotal : {0}");
        }
        public void VerifyCheckoutGroupAndDiscountSaving(double groupSavingToVerify, double codeSavingToVerify, MoneyTool.CurrencyCode currency = MoneyTool.CurrencyCode.USD)
        {
            string groupAmount = MoneyTool.FormatMoney(groupSavingToVerify, currency);
            string codeAmount = MoneyTool.FormatMoney(codeSavingToVerify, currency);
            string expectedValue = string.Format("Your total includes a group discount savings of {0} and a discount code savings of {1}.", groupAmount, codeAmount);
            string actualValue = string.Empty;

            UIUtil.DefaultProvider.VerifyOnPage(OnCheckoutPage(), "Checkout");

            actualValue = UIUtil.DefaultProvider.GetText(CheckoutDiscountMessage, LocateBy.XPath);

            VerifyTool.VerifyValue(expectedValue, actualValue, "CheckoutSaving : {0}");
        }
        // Verify Fees on Confirmation page, pulls data from TransactionIntegrityData
        private void VerifyConfirmationFeeTotals(
            IFeeCalculation feeCalculation, 
            MoneyTool.CurrencyCode currency = MoneyTool.CurrencyCode.USD)
        {
            RegisterMgr.ConfirmRegistration();
            RegisterMgr.VerifyConfirmationSubTotal(feeCalculation.Subtotal.Value, currency);
            RegisterMgr.VerifyConfirmationTax(feeCalculation.Tax1Amount.Value, ProEvent.Tax.Name.TaxOne, currency);
            RegisterMgr.VerifyConfirmationTax(feeCalculation.Tax2Amount.Value, ProEvent.Tax.Name.TaxTwo, currency);

            if (feeCalculation.ServiceFeeTotal.HasValue)
            {
                RegisterMgr.VerifyConfirmationSerivceFee(feeCalculation.ServiceFeeTotal.Value, currency);
            }

            if (feeCalculation.ShippingFeeTotal.HasValue)
            {
                RegisterMgr.VerifyConfirmationShippingFee(feeCalculation.ShippingFeeTotal.Value, currency);
            }

            if (feeCalculation.LodgingSubtotal.HasValue)
            {
                RegisterMgr.VerifyConfirmationLodgingFeeTotal(feeCalculation.LodgingSubtotal.Value, currency);
            }

            if (feeCalculation.LodgingBookingFee.HasValue)
            {
                RegisterMgr.VerifyConfirmationLodgingBookingFeeTotal(feeCalculation.LodgingBookingFee.Value, currency);
            }

            if (feeCalculation.DiscountCodeSavings.HasValue)
            {
                if (feeCalculation.GroupDiscountSavings.HasValue)
                {
                    RegisterMgr.VerifyConfirmationGroupAndDiscountSaving(
                    feeCalculation.GroupDiscountSavings.Value,
                    feeCalculation.DiscountCodeSavings.Value,
                    currency);
                }
                else
                {
                    RegisterMgr.VerifyConfirmationSaving(feeCalculation.DiscountCodeSavings.Value, currency);
                }
            }

            if (feeCalculation.RecurringSubtotal.HasValue)
            {
                RegisterMgr.VerifyConfirmationMembershipRecurringSubtotal(feeCalculation.RecurringSubtotal.Value, currency);
            }

            if (feeCalculation.RecurringTax1Amount.HasValue)
            {
                RegisterMgr.VerifyConfirmationMembershipReccuringTax(
                    feeCalculation.RecurringTax1Amount.Value,
                    ProEvent.Tax.Name.TaxOne,
                    currency);
            }

            if (feeCalculation.RecurringTax2Amount.HasValue)
            {
                RegisterMgr.VerifyConfirmationMembershipReccuringTax(
                    feeCalculation.RecurringTax2Amount.Value,
                    ProEvent.Tax.Name.TaxTwo,
                    currency);
            }

            if (feeCalculation.YearlyFees.HasValue)
            {
                RegisterMgr.VerifyConfirmationMembershipRecurringTotal(feeCalculation.YearlyFees.Value, currency);
            }

            if (feeCalculation.YearlyFeesDiscount.HasValue)
            {
                RegisterMgr.VerifyConfirmationMembershipRecurringSaving(feeCalculation.YearlyFeesDiscount.Value, currency);
            }

            RegisterMgr.VerifyConfirmationTotal(feeCalculation.TotalCharges.Value, currency);
        }
        public void VerifyConfirmationShippingFee(double subTotalToVerify, MoneyTool.CurrencyCode currency = MoneyTool.CurrencyCode.USD)
        {
            string expectedValue = MoneyTool.FormatMoney(subTotalToVerify, currency);
            string actualValue;

            UIUtil.DefaultProvider.VerifyOnPage(OnConfirmationPage(), "Confirmation");

            actualValue = UIUtil.DefaultProvider.GetText(ConfirmationShippingFee, LocateBy.XPath);

            VerifyTool.VerifyValue(expectedValue, actualValue, "Confirmation Shipping Fee : {0}");
        }
        public void VerifyConfirmationMembershipRecurringTotal(
            double totalToVerify,
            MoneyTool.CurrencyCode currency = MoneyTool.CurrencyCode.USD)
        {
            string expectedValue = MoneyTool.FormatMoney(totalToVerify, currency);
            string actualValue = string.Empty;

            UIUtil.DefaultProvider.VerifyOnPage(OnConfirmationPage(), "Confirmation");

            actualValue = UIUtil.DefaultProvider.GetText(ConfirmationMembershipYearlyFees, LocateBy.XPath);

            VerifyTool.VerifyValue(expectedValue, actualValue, "MembershipYearlyFees : {0}");
        }
        public void VerifyEnduranceReportTotalChargeAndBalanceDueByRegId(
            int eventId, 
            int regId, 
            double expectedTotalCharge, 
            double expectedBalanceDue, 
            MoneyTool.CurrencyCode currencySymbol = MoneyTool.CurrencyCode.USD)
        {
            string locator_XPath = string.Format("//b[text()='{0}']/..", regId);
            UIUtil.DefaultProvider.WaitForElementPresent(locator_XPath, LocateBy.XPath);
            string actualValueTotalCharge = UIUtil.DefaultProvider.GetText(locator_XPath + "/../following-sibling::td[8]", LocateBy.XPath);

            VerifyTool.VerifyValue(MoneyTool.FormatMoney(expectedTotalCharge, currencySymbol), actualValueTotalCharge, "Total Charge : {0}");
            string actualValueBalanceDue = UIUtil.DefaultProvider.GetText(locator_XPath + "/../following-sibling::td[9]", LocateBy.XPath);
            VerifyTool.VerifyValue(MoneyTool.FormatMoney(expectedBalanceDue, currencySymbol), actualValueBalanceDue, "Balance Due: {0}");
        }