Пример #1
0
        public ActionResult ResetPassword(LoginPage currentPage, string token)
        {
            var service = ServiceLocator.Current.GetInstance <IResetPasswordService>();

            MembershipUser user;

            bool isResetUrlValid = service.IsResetUrlValid(token, out user);

            if (isResetUrlValid)
            {
                ResetPasswordViewModel model = new ResetPasswordViewModel(currentPage);
                model.Token             = token;
                model.ResetPasswordForm = new RegisterForm()
                {
                    Token    = token,
                    UserName = user.UserName
                };
                return(View(model));
            }
            else
            {
                // Token is invalid, we redirect to the login page
                string loginUrl = _urlResolver.GetUrl(SiteConfiguration.Current().Settings.LoginPage);
                return(new RedirectResult(loginUrl));
            }
        }
Пример #2
0
        public GenericPaymentViewModel(Guid paymentMethod, T currentPage, OrderInfo orderInfo, Cart cart) : base(currentPage)
        {
            SiteConfiguration configuration = SiteConfiguration.Current();
            PaymentMethodDto  payment       = PaymentManager.GetPaymentMethod(paymentMethod);

            _paymentMethod = payment;
            _currentCart   = cart;

            DIBSPaymentGateway gw = new DIBSPaymentGateway();

            orderInfo.Merchant = gw.Merchant;

            Mediachase.Commerce.Orders.Payment[] payments;
            if (CurrentCart != null && CurrentCart.OrderForms != null && CurrentCart.OrderForms.Count > 0)
            {
                payments = CurrentCart.OrderForms[0].Payments.ToArray();
            }
            else
            {
                payments = new Mediachase.Commerce.Orders.Payment[0];
            }
            _payment = payments.FirstOrDefault(c => c.PaymentMethodId.Equals(payment.PaymentMethod.Rows[0]["PaymentMethodId"]));


            OrderID = orderInfo.OrderId;
        }
        public DibsPaymentViewModel(IContentRepository contentRepository, DibsPaymentPage currentPage, OrderInfo orderInfo, Cart cart) : base(new Guid(currentPage.PaymentMethod), currentPage, orderInfo, cart)
        {
            SiteConfiguration configuration = SiteConfiguration.Current();
            PaymentMethodDto  dibs          = PaymentManager.GetPaymentMethodBySystemName(DIBSSystemName, SiteContext.Current.LanguageName);

            _paymentMethod = dibs;
            _currentCart   = cart;

            DIBSPaymentGateway gw = new DIBSPaymentGateway();

            orderInfo.Merchant = gw.Merchant;

            var paymentRedirectUrl = GetViewUrl(currentPage.ContentLink);

            IsTest = orderInfo.IsTest;

            var baseUrl = GetBaseUrl();

            AcceptReturnUrl           = baseUrl + paymentRedirectUrl + "ProcessPayment";
            orderInfo.AcceptReturnUrl = AcceptReturnUrl;

            CancelReturnUrl           = baseUrl + paymentRedirectUrl + "CancelPayment";
            orderInfo.CancelReturnUrl = CancelReturnUrl;

            Mediachase.Commerce.Orders.Payment[] payments;
            if (CurrentCart != null && CurrentCart.OrderForms != null && CurrentCart.OrderForms.Count > 0)
            {
                payments = CurrentCart.OrderForms[0].Payments.ToArray();
            }
            else
            {
                payments = new Mediachase.Commerce.Orders.Payment[0];
            }
            _payment      = payments.FirstOrDefault(c => c.PaymentMethodId.Equals(dibs.PaymentMethod.Rows[0]["PaymentMethodId"]));
            ProcessingUrl = DIBSPaymentGateway.GetParameterByName(dibs, DIBSPaymentGateway.ProcessingUrl).Value;
            Key           = gw.Key;
            OrderID       = orderInfo.OrderId;

            ShaCalculator calculator = new ShaCalculator(Key);

            if (CurrentCart != null && CurrentCart.OrderForms != null && CurrentCart.OrderForms.Count > 0)
            {
                // Note, the orderinfo is changed inside this method
                Products = GenerateLineItemInformation(CurrentCart.OrderForms[0].LineItems, ref orderInfo);
            }
            else
            {
                Products = new List <string>();
            }

            MAC = calculator.GetMac(orderInfo);


            this.OrderInfo = orderInfo.ToString();
        }
 public DibsPaymentController(IContentRepository contentRepository, IOrderRepository orderRepository)
 {
     _contentRepository = contentRepository;
     _orderRepository   = orderRepository;
     _siteConfiguration = SiteConfiguration.Current();
 }