Beispiel #1
0
        private async Task SaveAsync()
        {
            if (PaymentMethodViewModel.ValidateForm())
            {
                string errorMessage = string.Empty;

                try
                {
                    await PaymentMethodViewModel.ProcessFormAsync();

                    _navigationService.GoBack();
                }
                catch (ModelValidationException mvex)
                {
                    DisplayValidationErrors(mvex.ValidationResult);
                }
                catch (Exception ex)
                {
                    errorMessage = string.Format(CultureInfo.CurrentCulture, _resourceLoader.GetString("GeneralServiceErrorMessage"), Environment.NewLine, ex.Message);
                }

                if (!string.IsNullOrWhiteSpace(errorMessage))
                {
                    await _alertMessageService.ShowAsync(errorMessage, _resourceLoader.GetString("ErrorServiceUnreachable"));
                }
            }
        }
        public ActionResult Edit(PaymentMethodViewModel model, string returnUrl)
        {
            ActionResult action;

            try
            {
                if (!ModelState.IsValid)
                {
                    ModelState.AddModelError("", MessageUI.ErrorMessage);
                    return(View(model));
                }

                var byId = _paymentMethodService.Get(x => x.Id == model.Id);

                ImageHandler(model);

                //if (model.Image != null && model.Image.ContentLength > 0)
                //{
                //    var fileExtension = Path.GetExtension(model.Image.FileName);
                //    var fileNameOriginal = Path.GetFileNameWithoutExtension(model.Image.FileName);

                //    var fileName = fileNameOriginal.FileNameFormat(fileExtension);

                //    //var fileExtension = Path.GetExtension(model.Image.FileName);
                //    //var fileName = titleNonAccent.FileNameFormat(fileExtension);

                //    _imageService.CropAndResizeImage(model.Image, $"{Contains.PaymentMethodFolder}", fileName, ImageSize.PaymentMethodWithMediumSize, ImageSize.PaymentMethodHeightMediumSize);

                //    model.ImageUrl = string.Concat(Contains.PaymentMethodFolder, fileName);
                //}

                var modelMap = Mapper.Map(model, byId);
                _paymentMethodService.Update(modelMap);

                //Update Localized
                foreach (var localized in model.Locales)
                {
                    _localizedPropertyService.SaveLocalizedValue(modelMap, x => x.PaymentMethodSystemName, localized.PaymentMethodSystemName, localized.LanguageId);
                    _localizedPropertyService.SaveLocalizedValue(modelMap, x => x.Description, localized.Description, localized.LanguageId);
                }


                Response.Cookies.Add(new HttpCookie("system_message", string.Format(MessageUI.UpdateSuccess, FormUI.PaymentMethod)));
                if (!Url.IsLocalUrl(returnUrl) || returnUrl.Length <= 1 || !returnUrl.StartsWith("/") || returnUrl.StartsWith("//") || returnUrl.StartsWith("/\\"))
                {
                    action = RedirectToAction("Index");
                }
                else
                {
                    action = Redirect(returnUrl);
                }
            }
            catch (Exception ex)
            {
                LogText.Log(string.Concat("PaymentMethod.Edit: ", ex.Message));
                return(View(model));
            }

            return(action);
        }
        public ActionResult GetDefaultPayment(string userId)
        {
            PaymentMethods paymentMethod = _paymentMethodService.GetUserDefaultPaymentMethod(userId);

            if (paymentMethod == null)
            {
                return(new JsonResult(null)
                {
                    StatusCode = StatusCodes.Status404NotFound
                });
            }
            PaymentMethodViewModel paymentMethodVM = new PaymentMethodViewModel()
            {
                Id          = paymentMethod.Id,
                CreatedTime = paymentMethod.CreatedTime,
                InUsed      = paymentMethod.InUsed,
                IsDefault   = paymentMethod.IsDefault,
                PaymentType = paymentMethod.PaymentType,
                UserId      = paymentMethod.UserId
            };

            if (paymentMethodVM.PaymentType == PaymentType.Wallet)
            {
                paymentMethodVM.Wallets = paymentMethod.Wallets;
            }


            return(new JsonResult(paymentMethodVM)
            {
                StatusCode = StatusCodes.Status200OK
            });
        }
        public static IPaymentMethodViewModel <IPaymentOption> Resolve(PaymentMethodViewModel <IPaymentOption> paymentMethod)
        {
            var paymentMethodName = paymentMethod.SystemName;

            switch (paymentMethodName)
            {
            case "CashOnDelivery":
                return(null);         //new CashOnDeliveryViewModel() { PaymentMethod = new CashOnDeliveryPaymentMethod() };

            case "DemoPaymentMethod": //DemoPaymentMethod
                var returnPayment = new DemoPaymentMethodViewModel();
                returnPayment.PaymentMethod = new DemoPaymentMethod();
                returnPayment.PaymentMethod.PaymentMethodId = paymentMethod.Id;
                return(returnPayment);

            case "GenericCreditCard":

                return(null);   //new GenericCreditCardViewModel() { PaymentMethod = new GenericCreditCardPaymentMethod() };

            default:
                return(new DemoPaymentMethodViewModel()
                {
                    PaymentMethod = new DemoPaymentMethod()
                });
            }

            throw new ArgumentException("No view model has been implemented for the method " + paymentMethodName, "paymentMethodName");
        }
        public async Task <IActionResult> AddEditPaymentMethod(int id, PaymentMethodViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View("_AddEditPaymentMethod", model));
            }

            if (id > 0)
            {
                PaymentMethod payment = await _unitOfWork.Repository <PaymentMethod>().GetByIdAsync(id);

                if (payment != null)
                {
                    payment.Name         = model.Name;
                    payment.ModifiedDate = DateTime.Now;
                    payment.Description  = model.Description;
                    payment.Processor    = model.Processor;
                    await _unitOfWork.Repository <PaymentMethod>().UpdateAsync(payment);
                }
            }
            else
            {
                PaymentMethod payment = new PaymentMethod
                {
                    Name         = model.Name,
                    ModifiedDate = DateTime.Now,
                    AddedDate    = DateTime.Now,
                    Description  = model.Description,
                    Processor    = model.Processor
                };
                await _unitOfWork.Repository <PaymentMethod>().InsertAsync(payment);
            }
            return(RedirectToAction(nameof(Index)));
        }
Beispiel #6
0
        //[ValidateAntiForgeryToken]
        public IActionResult AddPost(PaymentMethodViewModel paymentMethodViewModels)
        {
            var paymentMethodList = _payment.GetPaymentMethods();

            ViewBag.PaymentMethod = paymentMethodList;
            ViewBag.AccountTreeId = new SelectList(_Acctree.GetAccountTrees(), "Id", "DescriptionAr", paymentMethodViewModels.AccountTreeId);
            if (paymentMethodViewModels.AccountTreeId == null)
            {
                ModelState.AddModelError("", "الرجاء تحدد رقم الحساب");
            }
            if (paymentMethodViewModels.Id == 0)
            {
                ModelState.Remove("Id");
                ModelState.Remove("AccountTreeId");
                if (ModelState.IsValid)
                {
                    var paymentMethod = _mapper.Map <PaymentMethod>(paymentMethodViewModels);
                    _payment.AddPaymentMethod(paymentMethod);
                    _toastNotification.AddSuccessToastMessage("تم بيانات طرقة الدفع بنجاح");
                    return(RedirectToAction(nameof(Index)));
                }
                return(View(nameof(Index), paymentMethodViewModels));
            }
            else
            {
                if (ModelState.IsValid)
                {
                    var paymentMethod = _mapper.Map <PaymentMethod>(paymentMethodViewModels);
                    _payment.UpdatePaymentMethod(paymentMethodViewModels.Id, paymentMethod);
                    _toastNotification.AddSuccessToastMessage("تم تعديل طريقة الدفع بنجاح");
                    return(RedirectToAction(nameof(Index)));
                }
                return(View(nameof(Index), paymentMethodViewModels));
            }
        }
        public ActionResult GetAllUserPayment(string userId)
        {
            List <PaymentMethods> userPaymentMethods = _paymentMethodService.GetAllUserPaymentMethod(userId);

            List <PaymentMethodViewModel> paymentMethodVMs = new List <PaymentMethodViewModel>();
            PaymentMethodViewModel        paymentMethodVM;

            foreach (var upm in userPaymentMethods)
            {
                paymentMethodVM = new PaymentMethodViewModel()
                {
                    Id          = upm.Id,
                    CreatedTime = upm.CreatedTime,
                    InUsed      = upm.InUsed,
                    IsDefault   = upm.IsDefault,
                    PaymentType = upm.PaymentType,
                    UserId      = upm.UserId,
                };
                if (paymentMethodVM.PaymentType == PaymentType.Wallet)
                {
                    paymentMethodVM.Wallets = upm.Wallets;
                }

                paymentMethodVMs.Add(paymentMethodVM);
            }

            return(new JsonResult(paymentMethodVMs)
            {
                StatusCode = StatusCodes.Status200OK
            });
        }
Beispiel #8
0
        public UserOrderViewModel CheckForLoggedInUserForOrder()
        {
            try
            {
                var objComplex = HttpContext.Session.GetObjectFromJson <UserViewModel>("ComplexObject");

                //Set up automapping
                var mapper = mapextension.UserViewModelToUserOrderViewModel();
                UserOrderViewModel model = mapper.Map <UserOrderViewModel>(objComplex);
                model.PaymentMethods = new List <PaymentMethodViewModel>();

                foreach (Payment p in paymentRepo.RetrieveAllPayments())
                {
                    PaymentMethodViewModel pmodel = new PaymentMethodViewModel();
                    pmodel.PaymentMethodId   = p.RetrieveID();
                    pmodel.PaymentMethodName = p.RetrieveName();
                    model.PaymentMethods.Add(pmodel);
                }

                return(model);
            }
            catch (NullReferenceException e)
            {
                Console.WriteLine(e.Message);
                Console.WriteLine("No session set");
            }

            return(null);
        }
        public ActionResult Edit(PaymentMethodViewModel model)
        {
            model.Patients = PatientManager.GetAllPatient();
            model.Services = ServiceManager.GetAllService();

            if (model.PaymentMethodId > 0)
            {
                var paymentMethod = PaymentMethodManager.GetPaymentbyId(model.PaymentMethodId);

                model.PaymentMethodId = paymentMethod.PaymentMethodId;
                model.PatientId       = paymentMethod.PatientId;
                model.ServiceId       = paymentMethod.ServiceId;
                model.DiscountAmount  = paymentMethod.DiscountAmount;
                model.Charge          = paymentMethod.Charge;
                model.TotalCharge     = paymentMethod.TotalCharge;

                model.Paid         = paymentMethod.Paid;
                model.Due          = paymentMethod.Due;
                model.Date         = paymentMethod.Date;
                model.PaymentType  = paymentMethod.PaymentType;
                model.CreatedDate  = paymentMethod.CreatedDate;
                model.LastPaidDate = paymentMethod.LastPaidDate;
            }
            return(View(model));
        }
        public JsonResult Save(PaymentMethodViewModel model)
        {
            int saveIndex = 0;

            PaymentMethod paymentMethod = new PaymentMethod();

            paymentMethod.PaymentMethodId = model.PaymentMethodId;
            paymentMethod.ServiceId       = model.ServiceId;
            paymentMethod.PatientId       = model.PatientId;
            paymentMethod.Charge          = model.Charge;
            paymentMethod.DiscountAmount  = model.DiscountAmount;
            paymentMethod.Paid            = model.Paid;
            paymentMethod.Date            = model.Date;
            paymentMethod.PaymentType     = model.PaymentType;
            paymentMethod.CreatedDate     = model.CreatedDate;
            paymentMethod.LastPaidDate    = model.LastPaidDate;
            paymentMethod.TotalCharge     = paymentMethod.Charge - paymentMethod.DiscountAmount;
            paymentMethod.Due             = paymentMethod.TotalCharge - paymentMethod.Paid;

            saveIndex = model.PaymentMethodId == 0
                ? PaymentMethodManager.Save(paymentMethod)
                : PaymentMethodManager.Edit(paymentMethod);



            return(Reload(saveIndex));
        }
Beispiel #11
0
        /// <summary>
        /// Creates view model for checkout preview step.
        /// </summary>
        /// <param name="paymentMethod">Payment method selected on preview step</param>
        public PreviewViewModel PreparePreviewViewModel(PaymentMethodViewModel paymentMethod = null)
        {
            var cart           = mShoppingService.GetCurrentShoppingCart();
            var billingAddress = mShoppingService.GetBillingAddress();
            var shippingOption = cart.ShippingOption;
            var paymentMethods = CreatePaymentMethodList(cart);

            paymentMethod = paymentMethod ?? new PaymentMethodViewModel(cart.PaymentOption, paymentMethods);

            // PaymentMethods are excluded from automatic binding and must be recreated manually after post action
            paymentMethod.PaymentMethods = paymentMethod.PaymentMethods ?? paymentMethods;

            var deliveryDetailsModel = new DeliveryDetailsViewModel
            {
                Customer       = new CustomerViewModel(cart.Customer),
                BillingAddress = new BillingAddressViewModel(billingAddress, null, mCountryRepository),
                ShippingOption = new ShippingOptionViewModel(shippingOption, null, cart.IsShippingNeeded)
            };

            var cartModel = new CartViewModel(cart);

            var viewModel = new PreviewViewModel
            {
                CartModel       = cartModel,
                DeliveryDetails = deliveryDetailsModel,
                ShippingName    = shippingOption?.ShippingOptionDisplayName ?? "",
                PaymentMethod   = paymentMethod
            };

            return(viewModel);
        }
Beispiel #12
0
        private async void GoNext()
        {
            IsShippingAddressInvalid = ShippingAddressViewModel.ValidateForm() == false;
            IsBillingAddressInvalid  = !UseSameAddressAsShipping && BillingAddressViewModel.ValidateForm() == false;
            IsPaymentMethodInvalid   = PaymentMethodViewModel.ValidateForm() == false;

            if (IsShippingAddressInvalid || IsBillingAddressInvalid || IsPaymentMethodInvalid)
            {
                return;
            }

            string errorMessage = string.Empty;

            try
            {
                await _accountService.VerifyUserAuthenticationAsync();
                await ProcessFormAsync();
            }
            catch (Exception ex)
            {
                errorMessage = string.Format(CultureInfo.CurrentCulture, _resourceLoader.GetString("GeneralServiceErrorMessage"), Environment.NewLine, ex.Message);
            }

            if (!string.IsNullOrWhiteSpace(errorMessage))
            {
                await _alertMessageService.ShowAsync(errorMessage, _resourceLoader.GetString("ErrorServiceUnreachable"));
            }
        }
Beispiel #13
0
        public override void OnNavigatedTo(NavigatedToEventArgs e, Dictionary <string, object> viewModelState)
        {
            if (viewModelState == null)
            {
                return;
            }

            // Try to populate address and payment method controls with default data if available
            ShippingAddressViewModel.SetLoadDefault(true);
            BillingAddressViewModel.SetLoadDefault(true);
            PaymentMethodViewModel.SetLoadDefault(true);

            // This ViewModel is an example of composition. The CheckoutHubPageViewModel manages
            // three child view models (Shipping Address, Billing Address, and Payment Method).
            // Since the FrameNavigationService calls this OnNavigatedTo method, passing in
            // a viewModelState dictionary, it is the responsibility of the parent view model
            // to manage separate dictionaries for each of its children. If the parent view model
            // were to pass its viewModelState dictionary to each of its children, it would be very
            // easy for one child view model to write over a sibling view model's state.
            if (e.NavigationMode == NavigationMode.New)
            {
                viewModelState["ShippingViewModel"]      = new Dictionary <string, object>();
                viewModelState["BillingViewModel"]       = new Dictionary <string, object>();
                viewModelState["PaymentMethodViewModel"] = new Dictionary <string, object>();
            }

            ShippingAddressViewModel.OnNavigatedTo(e, viewModelState["ShippingViewModel"] as Dictionary <string, object>);
            BillingAddressViewModel.OnNavigatedTo(e, viewModelState["BillingViewModel"] as Dictionary <string, object>);
            PaymentMethodViewModel.OnNavigatedTo(e, viewModelState["PaymentMethodViewModel"] as Dictionary <string, object>);
            base.OnNavigatedTo(e, viewModelState);
        }
Beispiel #14
0
        public bool Update(PaymentMethodViewModel vm, Guid id)
        {
            var paymentMethod = Mapper.Map <PaymentMethod>(vm);

            var result = _paymentMethodRepository.Update(paymentMethod, id);

            return(result != null);
        }
Beispiel #15
0
        public PaymentMethodViewModel Create(PaymentMethodViewModel vm)
        {
            var paymentMethod = Mapper.Map <PaymentMethod>(vm);

            var result = _paymentMethodRepository.Add(paymentMethod);

            return(Mapper.Map <PaymentMethodViewModel>(result));
        }
        public static PaymentMethod ToEntity(this PaymentMethodViewModel source)
        {
            var destination = new PaymentMethod();

            destination.Name = source.Name;

            return(destination);
        }
Beispiel #17
0
        public ActionResult method_add()
        {
            var viewmodel = new PaymentMethodViewModel();

            viewmodel.methodList = typeof(PaymentMethod).ToSelectList(false, true);

            return(View(viewmodel));
        }
        public static PaymentMethodViewModel ToViewModel(this PaymentMethod source)
        {
            var destination = new PaymentMethodViewModel();

            destination.Id   = source.Id;
            destination.Name = source.Name;

            return(destination);
        }
Beispiel #19
0
        public async Task <IActionResult> AddPaymentMethodAsync(PaymentMethodViewModel model)
        {
            PaymentMethod p = new PaymentMethod(model.CardNum);

            _userClient.GetCurrentUser().addPaymentMethod(p);
            await _userClient.UpdateAsync(_userClient.GetCurrentUser());

            return(RedirectToAction("Index", "Wallet"));
        }
        public void Edit(PaymentMethodViewModel viewModel)
        {
            var paymentMethod = _paymentMethodRepository.Get(viewModel.Id);

            paymentMethod.Name = viewModel.Name;
            paymentMethod.Cost = viewModel.Cost;

            _paymentMethodRepository.SaveChanges();
        }
        private async Task SaveAsync()
        {
            if (PaymentMethodViewModel.ValidateForm())
            {
                await PaymentMethodViewModel.ProcessFormAsync();

                _navigationService.GoBack();
            }
        }
Beispiel #22
0
        public ActionResult Create()
        {
            var viewModel = new PaymentMethodViewModel
            {
                Heading = "Create",
            };

            return(View("PaymentMethodForm", viewModel));
        }
        /// <summary>
        /// Delete an entity.
        /// </summary>
        /// <param name="model"></param>
        public void Delete(PaymentMethodViewModel model)
        {
            var entity = model.ToEntity();

            this._PaymentMethodsRepository.Delete(entity);

            #region Commit Changes
            this._unitOfWork.Commit();
            #endregion
        }
Beispiel #24
0
        public ActionResult AddAccount()
        {
            //if user is not here then send back to login page
            var m = new PaymentMethodViewModel()
            {
                UserID = currentUser.UserId
            };

            return(View(m));
        }
Beispiel #25
0
        public ActionResult AddBankAccount()
        {
            var account     = createAnAccount();
            var accountLink = createAcountLink(account);
            var m           = new PaymentMethodViewModel()
            {
                UserID = currentUser.UserId
            };

            return(Redirect(accountLink));
        }
Beispiel #26
0
 public AddOrderCommand(int userId,
                        IEnumerable <OrderProductViewModel> products,
                        PaymentMethodViewModel payment,
                        string contactMail
                        )
 {
     UserId      = userId;
     Products    = products;
     Payment     = payment;
     ContactMail = contactMail;
 }
        public void AddPaymentMethod(PaymentMethodViewModel viewModel)
        {
            var paymentMethod = new PaymentMethod
            {
                Name = viewModel.Name,
                Cost = viewModel.Cost,
            };

            _paymentMethodRepository.Add(paymentMethod);
            _paymentMethodRepository.SaveChanges();
        }
 public ActionResult Edit(PaymentMethodViewModel model)
 {
     if (ModelState.IsValid)
     {
         paymentMethodService.Update(model);
         return RedirectToAction("Index")
             .WithSuccess(string.Format("Payment method has been updated".TA()));
     }
     ViewBag.Countries = countryService.FindAll().Where(c => c.IsActive).ToList();
     return View(model);
 }
Beispiel #29
0
 public ActionResult Edit(PaymentMethodViewModel model)
 {
     if (ModelState.IsValid)
     {
         paymentMethodService.Update(model);
         return(RedirectToAction("Index")
                .WithSuccess(string.Format("Payment method has been updated".TA())));
     }
     ViewBag.Countries = countryService.FindAll().Where(c => c.IsActive).ToList();
     return(View(model));
 }
        //
        // GET: /PaymentMethod/
        public ActionResult Index(PaymentMethodViewModel model)
        {
            model.Patients = PatientManager.GetAllPatient();
            model.Services = ServiceManager.GetAllService();
            var totalrecords = 0;

            model.PaymentMethods = PaymentMethodManager.GetAllPaymentbyPaging(out totalrecords, model).Where(x => (x.Date >= model.FromDate || model.FromDate == null) && (x.Date <= model.ToDate || model.ToDate == null)).ToList();
            model.TotalCharge    = model.Charge - model.DiscountAmount;
            model.TotalRecords   = totalrecords;

            return(View(model));
        }
Beispiel #31
0
        public override void OnNavigatingFrom(NavigatingFromEventArgs e, Dictionary <string, object> viewModelState, bool suspending)
        {
            if (viewModelState == null || viewModelState.Count == 0)
            {
                return;
            }

            ShippingAddressViewModel.OnNavigatingFrom(e, viewModelState["ShippingViewModel"] as Dictionary <string, object>, suspending);
            BillingAddressViewModel.OnNavigatingFrom(e, viewModelState["BillingViewModel"] as Dictionary <string, object>, suspending);
            PaymentMethodViewModel.OnNavigatingFrom(e, viewModelState["PaymentMethodViewModel"] as Dictionary <string, object>, suspending);
            base.OnNavigatingFrom(e, viewModelState, suspending);
        }
        public CheckoutViewModelFactoryTests()
        {
            _cart = new FakeCart(new MarketImpl(new MarketId(Currency.USD)), Currency.USD);
            _cart.Forms.Single().Shipments.Single().LineItems.Add(new InMemoryLineItem());
            _cart.Forms.Single().CouponCodes.Add("couponcode");

            _cashPayment = new PaymentMethodViewModel<PaymentMethodBase> { SystemName = cashPaymentName };
            _creditPayment = new PaymentMethodViewModel<PaymentMethodBase> { SystemName = creditPaymentName };
            var paymentServiceMock = new Mock<IPaymentService>();
            var marketMock = new Mock<IMarket>();
            var currentMarketMock = new Mock<ICurrentMarket>();
            var languageServiceMock = new Mock<LanguageService>(null, null, null, null);
            var paymentMethodViewModelFactory = new PaymentMethodViewModelFactory(currentMarketMock.Object, languageServiceMock.Object, paymentServiceMock.Object);

            currentMarketMock.Setup(x => x.GetCurrentMarket()).Returns(marketMock.Object);
            languageServiceMock.Setup(x => x.GetCurrentLanguage()).Returns(new CultureInfo("en-US"));
            paymentServiceMock.Setup(x => x.GetPaymentMethodsByMarketIdAndLanguageCode(It.IsAny<string>(), "en")).Returns(
               new[]
               {
                    new PaymentMethodModel { Description = "Lorem ipsum", FriendlyName = "payment method 1", LanguageId = "en", PaymentMethodId = Guid.NewGuid(), SystemName = cashPaymentName },
                    new PaymentMethodModel { Description = "Lorem ipsum", FriendlyName = "payment method 2", LanguageId = "en", PaymentMethodId = Guid.NewGuid(), SystemName = creditPaymentName }
               });

            var addressBookServiceMock = new Mock<IAddressBookService>();
            addressBookServiceMock.Setup(x => x.List()).Returns(() => new List<AddressModel> { new AddressModel { AddressId = "addressid" } });
            _preferredBillingAddress = CustomerAddress.CreateInstance();
            _preferredBillingAddress.Name = "preferredBillingAddress";
            addressBookServiceMock.Setup(x => x.GetPreferredBillingAddress()).Returns(_preferredBillingAddress);
            addressBookServiceMock.Setup(x => x.UseBillingAddressForShipment()).Returns(true);

            _startPage = new StartPage();
            var contentLoaderMock = new Mock<IContentLoader>();
            contentLoaderMock.Setup(x => x.Get<StartPage>(It.IsAny<PageReference>())).Returns(_startPage);

            var orderFactoryMock = new Mock<IOrderFactory>();
            var urlResolverMock = new Mock<UrlResolver>();
            var httpcontextMock = new Mock<HttpContextBase>();
            var requestMock = new Mock<HttpRequestBase>();

            requestMock.Setup(x => x.Url).Returns(new Uri("http://site.com"));
            requestMock.Setup(x => x.UrlReferrer).Returns(new Uri("http://site.com"));
            httpcontextMock.Setup(x => x.Request).Returns(requestMock.Object);

            Func<CultureInfo> func = () => CultureInfo.InvariantCulture;
            var shipmentViewModelFactoryMock = new Mock<ShipmentViewModelFactory>(null, null, null, null, null, null, func, null);
            shipmentViewModelFactoryMock.Setup(x => x.CreateShipmentsViewModel(It.IsAny<ICart>())).Returns(() => new[]
            {
                new ShipmentViewModel {
                    CartItems = new[]
                    {
                        new CartItemViewModel { Quantity = 1 }
                    }
                }
            });

            _subject = new CheckoutViewModelFactory(
                new MemoryLocalizationService(),
                paymentMethodViewModelFactory,
                addressBookServiceMock.Object,
                contentLoaderMock.Object,
                orderFactoryMock.Object,
                urlResolverMock.Object,
                (() => httpcontextMock.Object),
                shipmentViewModelFactoryMock.Object);
        }