コード例 #1
0
        public override IList<string> ValidatePaymentForm(FormCollection form)
        {
            var warnings = new List<string>();

            //validate
            var validator = new PayPalExpressPaymentInfoValidator(_localizationService);
            var model = new PayPalExpressPaymentInfoModel()
            {

            };
            var validationResult = validator.Validate(model);
            if (!validationResult.IsValid)
                foreach (var error in validationResult.Errors)
                    warnings.Add(error.ErrorMessage);

            return warnings;
        }
コード例 #2
0
        public ActionResult PaymentInfo()
        {
            var model = new PayPalExpressPaymentInfoModel();
            model.CurrentPageIsBasket = PayPalHelper.CurrentPageIsBasket(this.ControllerContext.ParentActionViewContext.RequestContext.RouteData);

            if (model.CurrentPageIsBasket)
            {
                var culture = _services.WorkContext.WorkingLanguage.LanguageCulture;
                var buttonUrl = "https://www.paypalobjects.com/{0}/i/btn/btn_xpressCheckout.gif".FormatWith(culture.Replace("-", "_"));
                model.SubmitButtonImageUrl = PayPalHelper.CheckIfButtonExists(buttonUrl);
            }

            return PartialView(model);
        }