protected void btnPaypalExpress_Click(object sender, EventArgs e)
        {
            if ((NopContext.Current.User == null) || (NopContext.Current.User.IsGuest && !CustomerManager.AnonymousCheckoutAllowed))
            {
                string loginURL = SEOHelper.GetLoginPageUrl(true);
                Response.Redirect(loginURL);
            }

            var payPalExpress = new PayPalExpressPaymentProcessor();
            var ppePaymentMethod = PaymentMethodManager.GetPaymentMethodBySystemKeyword("PayPalExpress");
            if (ppePaymentMethod != null && ppePaymentMethod.IsActive)
            {
                //apply reward points
                CheckoutPaymentMethodControl checkoutPaymentMethodControl = CommonHelper.FindControlRecursive<CheckoutPaymentMethodControl>(this.Page.Controls);
                if (checkoutPaymentMethodControl != null)
                    checkoutPaymentMethodControl.ApplyRewardPoints();

                //payment
                var cart = ShoppingCartManager.GetCurrentShoppingCart(ShoppingCartTypeEnum.ShoppingCart);
                decimal? cartTotal = ShoppingCartManager.GetShoppingCartTotal(cart,
                    ppePaymentMethod.PaymentMethodId, NopContext.Current.User);
                if (cartTotal.HasValue && cartTotal.Value > decimal.Zero)
                {
                    string expressCheckoutURL = payPalExpress.SetExpressCheckout(cartTotal.Value,
                        CommonHelper.GetStoreLocation(false) + "paypalexpressreturn.aspx",
                        CommonHelper.GetStoreLocation(false));
                    Response.Redirect(expressCheckoutURL);
                }
            }
        }
        protected void btnPaypalExpress_Click(object sender, EventArgs e)
        {
            if ((NopContext.Current.User == null) || (NopContext.Current.User.IsGuest && !CustomerManager.AnonymousCheckoutAllowed))
            {
                string loginURL = CommonHelper.GetLoginPageURL(true);
                Response.Redirect(loginURL);
            }

            PayPalExpressPaymentProcessor payPalExpress = new PayPalExpressPaymentProcessor();

            //todo pass payment method identifier if paypal express requires additional payment fee
            decimal? cartTotal = ShoppingCartManager.GetShoppingCartTotal(Cart, NopContext.Current.User);
            if (cartTotal.HasValue)
            {
                string expressCheckoutURL = payPalExpress.SetExpressCheckout(cartTotal.Value,
                    CommonHelper.GetStoreLocation(false) + "PaypalExpressReturn.aspx",
                    CommonHelper.GetStoreLocation(false) + "Default.aspx");
                Response.Redirect(expressCheckoutURL);
            }
        }
        protected void btnNextStep_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {

                var payPalExpress = new PayPalExpressPaymentProcessor();
                var ppePaymentMethod = this.PaymentService.GetPaymentMethodBySystemKeyword("PayPalExpress");
                if (ppePaymentMethod != null && ppePaymentMethod.IsActive)
                {
                    //apply reward points
                    //CheckoutPaymentMethodControl checkoutPaymentMethodControl = CommonHelper.FindControlRecursive<CheckoutPaymentMethodControl>(this.Page.Controls);
                    //if (checkoutPaymentMethodControl != null)
                    //    checkoutPaymentMethodControl.ApplyRewardPoints();

                    //payment
                    var cart = this.ShoppingCartService.GetCurrentShoppingCart(ShoppingCartTypeEnum.ShoppingCart, vendorId);
                    decimal? cartTotal = this.ShoppingCartService.GetShoppingCartTotal(cart,
                        ppePaymentMethod.PaymentMethodId, NopContext.Current.User);

                    //TODO: If some of these are blank something is very wrong and needs to be addressed.
                    if (cartTotal.HasValue && cartTotal.Value > decimal.Zero)
                    {
                        string expressCheckoutURL = payPalExpress.SetExpressCheckout(cart, cartTotal.Value,
                            this.SettingManager.GetSettingValue("PaymentMethod.PaypalExpress.ReturnURL"),
                            this.SettingManager.GetSettingValue("PaymentMethod.PaypalExpress.CancelURL"),
                            this.SettingManager.GetSettingValue("PaymentMethod.PaypalExpress.NotifyURL"),
                            this.txtNoteToSeller.InnerText.Trim());
                        Response.Redirect(expressCheckoutURL);
                    }
                }
            }
            else
            {
                foreach (System.Web.UI.IValidator poo in Page.Validators)
                {
                    if (!poo.IsValid)
                    {
                        if (lConfirmOrderError.Text == String.Empty)
                        {
                            lConfirmOrderError.Text = poo.ErrorMessage;
                        }
                        else
                        {
                            lConfirmOrderError.Text += poo.ErrorMessage;
                        }
                    }
                }
            }
        }