Esempio n. 1
0
        public virtual ActionResult PaymentForm(PaymentModel paymentModel, PaymentForm form = null)
        {
            if (form == null)
            {
                form = new PaymentForm {StrategyId = paymentModel.StrategyId};

                if (paymentModel.RelatedId.HasValue)
                    form.RelatedId = paymentModel.RelatedId.Value;

                if (AuthenticationHelper.IsAuthenticated)
                    form.ClonePayersDataFromPreviousTransfer(AuthenticationHelper.CurrentUser);
            }

            var model = new PaymentFormModel
                {
                    PaymentForm = form,
                    Provider = PaymentHelper.PaymentProvider
                };

            if (paymentModel.Value.HasValue)
            {
                model.HasEnoughFunds = PaymentHelper.HasEnoughFunds(paymentModel.Value.Value);
                model.Funds = PaymentHelper.GetFunds();
            }

            return PartialView(MVC.Payment.Views._PaymentForm, model);
        }
Esempio n. 2
0
        public virtual ActionResult PaymentModal(PaymentForm paymentForm)
        {
            if (!ModelState.IsValid)
            {
                var model = new PaymentFormModel
                    {
                        PaymentForm = paymentForm,
                        Provider = PaymentHelper.PaymentProvider
                    };
                return PartialView(MVC.Payment.Views._PaymentForm, model);
            }

            var redirectModel = paymentForm.PreparePayment(Url);
            return PartialView(MVC.Payment.Views.PaymentRedirect, redirectModel);
        }