예제 #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);
        }
예제 #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);
        }
예제 #3
0
        public static User CreateUser(PaymentForm form, UrlHelper url)
        {
            var repository = HttpContext.Current.GetDbRepository();

            var user = new User
                           {
                               Email = form.PersonalData.Email
                           };

            if (form.SignUp)
            {
                user.Password = form.PasswordForm.Password;
            }
            else
            {
                user.IsNoSignUpUser = true;
            }

            repository.User.Add(user);
            repository.User.AddEmailConfigurationDefaultValue(user);

            if (form.SignUp)
            {
                Flash.Info(Resources.Account.AccountCreatedFromPayment);
                Email.Send<ActivationEmail>(user);
            }
            else
            {
                Flash.Info(Resources.Account.AnonymousAccountCreated);
                Email.Send<ActivationEmail>(user);
            }

            AuthenticationHelper.Authenticate(user.Email);

            return user;
        }