Beispiel #1
0
        public void WHEN_imageUrls_is_null_SHOULD_throw_ArgumentException()
        {
            //Arrange
            UseCountryServiceMock();

            var p = new CreateCartViewModelParam()
            {
                Cart             = new Overture.ServiceModel.Orders.Cart(),
                CultureInfo      = CultureInfo.InvariantCulture,
                BaseUrl          = GetRandom.String(32),
                ProductImageInfo = new ProductImageInfo()
                {
                    ImageUrls = null
                }
            };

            var sut = Container.CreateInstance <CartViewModelFactory>();

            // Act and Assert
            Assert.Throws <ArgumentException>(() => sut.CreateCartViewModel(p));
        }
        public void WHEN_cart_has_invalid_coupons_and_IncludeInvalidCouponsMessages_is_true_SHOULD_include_message()
        {
            //Arrange
            UseCountryServiceMock();

            const int validCouponsCount   = 1;
            const int invalidCouponsCount = 2;

            var p = new CreateCartViewModelParam()
            {
                Cart = new Overture.ServiceModel.Orders.Cart()
                {
                    Coupons = new List <Coupon>()
                    {
                        FakeCartFactory.CreateInvalidCoupon(),
                FakeCartFactory.CreateInvalidCoupon(),
                FakeCartFactory.CreateValidCoupon()
                    }
                },
                CultureInfo      = CultureInfo.InvariantCulture,
                BaseUrl          = GetRandom.String(32),
                ProductImageInfo = new ProductImageInfo()
                {
                    ImageUrls = new List <ProductMainImage>()
                },
                IncludeInvalidCouponsMessages = true
            };

            var sut = Container.CreateInstance <CartViewModelFactory>();

            //Act
            var vm = sut.CreateCartViewModel(p);

            //Assert
            vm.Should().NotBeNull();
            vm.Coupons.Should().NotBeNull();
            vm.Coupons.ApplicableCoupons.Should().HaveCount(validCouponsCount);
            vm.Coupons.Messages.Should().HaveCount(invalidCouponsCount);
        }
Beispiel #3
0
        //TODO: Would it be possible to add cache here too without too much problem?
        //TODO: Because it is called 3 times when you retrieve the Cart
        public virtual async Task <CartViewModel> CreateCartViewModelAsync(CreateCartViewModelParam param)
        {
            if (param == null)
            {
                throw new ArgumentNullException(nameof(param));
            }
            if (param.Cart == null)
            {
                throw new ArgumentException(GetMessageOfNull(nameof(param.Cart)), nameof(param));
            }
            if (string.IsNullOrWhiteSpace(param.BaseUrl))
            {
                throw new ArgumentException(GetMessageOfNullWhiteSpace(nameof(param.BaseUrl)), nameof(param));
            }

            param.ProductImageInfo = new ProductImageInfo
            {
                ImageUrls = await ImageService.GetImageUrlsAsync(param.Cart.GetLineItems()).ConfigureAwait(false),
            };

            var methodDisplayNames = await LookupService.GetLookupDisplayNamesAsync(new GetLookupDisplayNamesParam
            {
                CultureInfo = param.CultureInfo,
                LookupType  = LookupType.Order,
                LookupName  = "PaymentMethodType",
            }).ConfigureAwait(false);

            param.PaymentMethodDisplayNames = methodDisplayNames;

            var vm = CartViewModelFactory.CreateCartViewModel(param);

            if (CartConfiguration.GroupCartItemsByPrimaryCategory)
            {
                vm.GroupedLineItemDetailViewModels = await GetGroupedLineItems(vm, param).ConfigureAwait(false);
            }

            return(vm);
        }
        public void WHEN_cart_has_shippingMethod_SHOULD_return_shippingMethod_with_calculated_delivery_days()
        {
            //Arrange
            UseCountryServiceMock();

            var p = new CreateCartViewModelParam()
            {
                Cart = new Overture.ServiceModel.Orders.Cart
                {
                    Shipments = new List <Shipment>
                    {
                        new Shipment
                        {
                            FulfillmentMethod = new FulfillmentMethod
                            {
                                ExpectedDeliveryDate = DateTime.UtcNow.AddDays(3)
                            }
                        }
                    }
                },
                CultureInfo      = CultureInfo.InvariantCulture,
                BaseUrl          = GetRandom.String(32),
                ProductImageInfo = new ProductImageInfo()
                {
                    ImageUrls = new List <ProductMainImage>()
                }
            };

            var sut = Container.CreateInstance <CartViewModelFactory>();

            //Act
            var vm = sut.CreateCartViewModel(p);

            //Assert
            vm.Should().NotBeNull();
            vm.ShippingMethod.ExpectedDaysBeforeDelivery.ShouldBeEquivalentTo(3);
        }
        public void WHEN_cart_is_null_SHOULD_return_null()
        {
            //Arrange
            UseCountryServiceMock();

            var p = new CreateCartViewModelParam()
            {
                Cart             = null,
                CultureInfo      = CultureInfo.InvariantCulture,
                BaseUrl          = GetRandom.String(32),
                ProductImageInfo = new ProductImageInfo()
                {
                    ImageUrls = new List <ProductMainImage>()
                }
            };

            var sut = Container.CreateInstance <CartViewModelFactory>();

            //Act
            var vm = sut.CreateCartViewModel(p);

            //Assert
            vm.Should().BeNull("param.Cart was null");
        }
        public void WHEN_cart_has_valid_parameters_SHOULD_return_shipmentId()
        {
            //Arrange
            UseCountryServiceMock();

            var shipmentId = Guid.NewGuid();

            var p = new CreateCartViewModelParam()
            {
                Cart = new Overture.ServiceModel.Orders.Cart
                {
                    Shipments = new List <Shipment>
                    {
                        new Shipment
                        {
                            Id = shipmentId
                        }
                    }
                },
                CultureInfo      = CultureInfo.InvariantCulture,
                BaseUrl          = GetRandom.String(32),
                ProductImageInfo = new ProductImageInfo()
                {
                    ImageUrls = new List <ProductMainImage>()
                }
            };

            var sut = Container.CreateInstance <CartViewModelFactory>();

            //Act
            var vm = sut.CreateCartViewModel(p);

            //Assert
            vm.Should().NotBeNull();
            vm.CurrentShipmentId.ShouldBeEquivalentTo(shipmentId);
        }
        protected virtual async Task <CartViewModel> CreateCartViewModelAsync(CreateCartViewModelParam param)
        {
            if (param == null)
            {
                throw new ArgumentNullException(nameof(param));
            }
            if (param.Cart == null)
            {
                throw new ArgumentException(GetMessageOfNull(nameof(param.Cart)), nameof(param));
            }
            if (param.BaseUrl == null)
            {
                throw new ArgumentException(GetMessageOfNull(nameof(param.BaseUrl)), nameof(param));
            }

            param.ProductImageInfo = new ProductImageInfo
            {
                ImageUrls = await ImageService.GetImageUrlsAsync(param.Cart.GetLineItems()).ConfigureAwait(false)
            };

            var vm = CartViewModelFactory.CreateCartViewModel(param);

            return(vm);
        }
Beispiel #8
0
        protected virtual async Task <CartViewModel> CreateCartViewModelAsync(CreateCartViewModelParam param)
        {
            if (param == null)
            {
                throw new ArgumentNullException("param");
            }
            if (param.Cart == null)
            {
                throw new ArgumentException(ArgumentNullMessageFormatter.FormatErrorMessage("Cart"), "param");
            }
            if (param.BaseUrl == null)
            {
                throw new ArgumentException(ArgumentNullMessageFormatter.FormatErrorMessage("BaseUrl"), "param");
            }

            param.ProductImageInfo = new ProductImageInfo
            {
                ImageUrls = await ImageService.GetImageUrlsAsync(param.Cart.GetLineItems()).ConfigureAwait(false)
            };

            var vm = CartViewModelFactory.CreateCartViewModel(param);

            return(vm);
        }
        public void WHEN_cart_has_Payment_SHOULD_return_payment_ViewModel()
        {
            // Arrange
            UseCountryServiceMock();

            var cultureName         = "en-US";
            var methodId            = Guid.NewGuid();
            var displayName         = GetRandom.String(10);
            var paymentProviderName = GetRandom.String(32);

            var p = new CreateCartViewModelParam()
            {
                Cart = new Overture.ServiceModel.Orders.Cart
                {
                    Shipments = new List <Shipment>
                    {
                        new Shipment
                        {
                        }
                    },
                    Payments = new List <Payment>
                    {
                        new Payment
                        {
                            PaymentMethod = new PaymentMethod
                            {
                                Id = methodId,
                                PaymentProviderName = paymentProviderName,
                                DisplayName         = new LocalizedString()
                                {
                                    { cultureName, displayName }
                                },
                                Type = PaymentMethodType.Cash
                            },
                            BillingAddress = new Address
                            {
                                City = "Paris"
                            }
                        }
                    }
                },
                CultureInfo      = new CultureInfo(cultureName),
                BaseUrl          = GetRandom.String(32),
                ProductImageInfo = new ProductImageInfo()
                {
                    ImageUrls = new List <ProductMainImage>()
                },
                PaymentMethodDisplayNames = new Dictionary <string, string> {
                    { "Cash", "TestDisplayName" }
                }
            };

            var sut = Container.CreateInstance <CartViewModelFactory>();

            //Act
            var vm = sut.CreateCartViewModel(p);

            //Assert
            vm.Should().NotBeNull();
            vm.Payment.Should().NotBeNull();
            vm.Payment.PaymentMethod.Should().NotBeNull();
            vm.Payment.PaymentMethod.Id.ShouldBeEquivalentTo(methodId);
            vm.Payment.PaymentMethod.DisplayName.ShouldBeEquivalentTo("TestDisplayName");
            vm.Payment.PaymentMethod.PaymentProviderName.ShouldBeEquivalentTo(paymentProviderName);

            vm.Payment.BillingAddress.Should().NotBeNull();
            vm.Payment.BillingAddress.City.ShouldBeEquivalentTo("Paris");
            vm.Payment.BillingAddress.UseShippingAddress.Should().BeFalse();
        }
Beispiel #10
0
        protected virtual async Task <List <GroupedLineItemDetailViewModel> > GetGroupedLineItems(CartViewModel vm, CreateCartViewModelParam param)
        {
            var categoryTree = await CategoryRepository.GetCategoriesTreeAsync(new GetCategoriesParam
            {
                Scope = param.Cart.ScopeId
            }).ConfigureAwait(false);

            return(vm.LineItemDetailViewModels?
                   .Select(li =>
            {
                Category topLevelCategory = null;
                if (!string.IsNullOrWhiteSpace(li.ProductSummary.CategoryId))
                {
                    var categories = categoryTree.BuildPathFromTree(li.ProductSummary.CategoryId);
                    topLevelCategory = categories?.LastOrDefault(c => c.Id != "Root");
                }

                li.ProductSummary.TopLevelCategoryId = topLevelCategory?.Id ?? "Root";
                li.ProductSummary.TopLevelCategoryName = topLevelCategory?.DisplayName?.GetLocalizedValue(param.CultureInfo.Name)
                                                         ?? LocalizationProvider.GetLocalizedString(new GetLocalizedParam
                {
                    Category = "CheckoutProcess",
                    Key = "L_UndefinedLineItemCategory",
                    CultureInfo = param.CultureInfo
                });

                return li;
            })
                   .GroupBy(li => li.ProductSummary.TopLevelCategoryId)
                   .Select(lineItemsGroup =>
            {
                var li = lineItemsGroup.First();
                return new GroupedLineItemDetailViewModel
                {
                    TopLevelCategoryId = lineItemsGroup.Key,
                    TopLevelCategoryName = li.ProductSummary.TopLevelCategoryName,
                    LineItemDetailViewModels = lineItemsGroup.ToList(),
                    Quantity = lineItemsGroup.Sum(l => l.Quantity)
                };
            }
                           ).OrderBy(c => c.TopLevelCategoryId == "Root").ThenBy(c => c.TopLevelCategoryName).ToList());
        }
Beispiel #11
0
        /// <summary>
        /// Update the Cart
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        public virtual async Task <CartViewModel> UpdateCartAsync(UpdateCartViewModelParam param)
        {
            if (param == null)
            {
                throw new ArgumentNullException(nameof(param));
            }
            if (param.Coupons == null)
            {
                throw new ArgumentException(GetMessageOfNull(nameof(param.Coupons)), nameof(param));
            }
            if (param.CultureInfo == null)
            {
                throw new ArgumentException(GetMessageOfNull(nameof(param.CultureInfo)), nameof(param));
            }
            if (param.Shipments == null)
            {
                throw new ArgumentException(GetMessageOfNull(nameof(param.Shipments)), nameof(param));
            }
            if (param.CustomerId == Guid.Empty)
            {
                throw new ArgumentException(GetMessageOfEmpty(nameof(param.CustomerId)), nameof(param));
            }
            if (string.IsNullOrWhiteSpace(param.BaseUrl))
            {
                throw new ArgumentException(GetMessageOfNullWhiteSpace(nameof(param.BaseUrl)), nameof(param));
            }
            if (string.IsNullOrWhiteSpace(param.BillingCurrency))
            {
                throw new ArgumentException(GetMessageOfNullWhiteSpace(nameof(param.BillingCurrency)), nameof(param));
            }
            if (string.IsNullOrWhiteSpace(param.CartName))
            {
                throw new ArgumentException(GetMessageOfNullWhiteSpace(nameof(param.CartName)), nameof(param));
            }
            if (string.IsNullOrWhiteSpace(param.CartType))
            {
                throw new ArgumentException(GetMessageOfNullWhiteSpace(nameof(param.CartType)), nameof(param));
            }
            if (string.IsNullOrWhiteSpace(param.Scope))
            {
                throw new ArgumentException(GetMessageOfNullWhiteSpace(nameof(param.Scope)), nameof(param));
            }
            if (string.IsNullOrWhiteSpace(param.Status))
            {
                throw new ArgumentException(GetMessageOfNullWhiteSpace(nameof(param.Status)), nameof(param));
            }

            var updatedCart = await CartRepository.UpdateCartAsync(param).ConfigureAwait(false);

            await CartRepository.RemoveCouponsAsync(new RemoveCouponsParam
            {
                CartName    = param.CartName,
                CouponCodes = CouponViewService.GetInvalidCouponsCode(param.Coupons).ToList(),
                CustomerId  = param.CustomerId,
                Scope       = param.Scope
            }).ConfigureAwait(false);

            var vmParam = new CreateCartViewModelParam
            {
                Cart        = updatedCart,
                CultureInfo = param.CultureInfo,
                IncludeInvalidCouponsMessages = true,
                BaseUrl = param.BaseUrl
            };

            var viewModel = await CreateCartViewModelAsync(vmParam).ConfigureAwait(false);

            return(viewModel);
        }
Beispiel #12
0
        /// <summary>
        /// Update a line item in the cart.
        /// </summary>
        /// <param name="param"></param>
        /// <returns>The Lightweight CartViewModel</returns>
        public async virtual Task <CartViewModel> UpdateLineItemAsync(UpdateLineItemParam param)
        {
            if (param == null)
            {
                throw new ArgumentNullException(nameof(param));
            }
            if (string.IsNullOrWhiteSpace(param.CartName))
            {
                throw new ArgumentException(GetMessageOfNullWhiteSpace(nameof(param.CartName)), nameof(param));
            }
            if (string.IsNullOrWhiteSpace(param.ScopeId))
            {
                throw new ArgumentException(GetMessageOfNullWhiteSpace(nameof(param.ScopeId)), nameof(param));
            }
            if (param.CultureInfo == null)
            {
                throw new ArgumentException(GetMessageOfNull(nameof(param.CultureInfo)), nameof(param));
            }
            if (string.IsNullOrWhiteSpace(param.CartName))
            {
                throw new ArgumentException(GetMessageOfNullWhiteSpace(nameof(param.CartName)), nameof(param));
            }
            if (param.LineItemId == Guid.Empty)
            {
                throw new ArgumentException(GetMessageOfEmpty(nameof(param.LineItemId)), nameof(param));
            }
            if (param.CustomerId == Guid.Empty)
            {
                throw new ArgumentException(GetMessageOfEmpty(nameof(param.CustomerId)), nameof(param));
            }
            if (param.Quantity < 1)
            {
                throw new ArgumentOutOfRangeException(nameof(param), param.Quantity, GetMessageOfZeroNegative(nameof(param.Quantity)));
            }
            if (string.IsNullOrWhiteSpace(param.BaseUrl))
            {
                throw new ArgumentException(GetMessageOfNullWhiteSpace(nameof(param.BaseUrl)), nameof(param));
            }

            ProcessedCart cart;

            try
            {
                cart = await CartRepository.UpdateLineItemAsync(param).ConfigureAwait(false);
            }
            catch (ComposerException ex)
            {
                ClearEditModeIfCartDraftDoesNotExist(param.CartType, ex);
                throw;
            }

            await CartRepository.RemoveCouponsAsync(new RemoveCouponsParam
            {
                CartName    = param.CartName,
                CartType    = param.CartType,
                CouponCodes = CouponViewService.GetInvalidCouponsCode(cart.Coupons).ToList(),
                CustomerId  = param.CustomerId,
                Scope       = param.ScopeId
            }).ConfigureAwait(false);

            var vmParam = new CreateCartViewModelParam
            {
                Cart        = cart,
                CultureInfo = param.CultureInfo,
                IncludeInvalidCouponsMessages = true,
                BaseUrl = param.BaseUrl
            };

            var viewModel = await CreateCartViewModelAsync(vmParam).ConfigureAwait(false);

            return(viewModel);
        }
Beispiel #13
0
        /// <summary>
        /// Add line item to the cart.
        ///
        /// CartName will be created if needed
        /// CustomerId (guest customers) will be created if needed
        /// If the (product,variant) is already in the cart, the quantity will be increased;
        /// otherwise a new line will be added
        ///
        /// param.VariantId is optional
        ///
        /// </summary>
        /// <param name="param"></param>
        /// <returns>The Lightweight CartViewModel</returns>
        public async virtual Task <CartViewModel> AddLineItemAsync(AddLineItemParam param)
        {
            if (param == null)
            {
                throw new ArgumentNullException(nameof(param));
            }
            if (string.IsNullOrWhiteSpace(param.Scope))
            {
                throw new ArgumentException(GetMessageOfNullWhiteSpace(nameof(param.Scope)), nameof(param));
            }
            if (param.CultureInfo == null)
            {
                throw new ArgumentException(GetMessageOfNull(nameof(param.CultureInfo)), nameof(param));
            }
            if (string.IsNullOrWhiteSpace(param.CartName))
            {
                throw new ArgumentException(GetMessageOfNullWhiteSpace(nameof(param.CartName)), nameof(param));
            }
            if (param.CustomerId == Guid.Empty)
            {
                throw new ArgumentException(GetMessageOfEmpty(nameof(param.CustomerId)), nameof(param));
            }
            if (string.IsNullOrWhiteSpace(param.ProductId))
            {
                throw new ArgumentException(GetMessageOfNullWhiteSpace(nameof(param.ProductId)), nameof(param));
            }
            if (param.Quantity < 1)
            {
                throw new ArgumentOutOfRangeException(nameof(param), param.Quantity, GetMessageOfZeroNegative(nameof(param.Quantity)));
            }
            if (string.IsNullOrWhiteSpace(param.BaseUrl))
            {
                throw new ArgumentException(GetMessageOfNullWhiteSpace(nameof(param.BaseUrl)), nameof(param));
            }
            ProcessedCart cart;

            try
            {
                //If editing order, and line item exists, updating it instead
                if (param.CartType == CartConfiguration.OrderDraftCartType)
                {
                    var existingLineItem = await GetExistingLineItem(param).ConfigureAwait(false);

                    if (existingLineItem != null)
                    {
                        var updateLineItemParam = new UpdateLineItemParam
                        {
                            BaseUrl     = param.BaseUrl,
                            CartName    = param.CartName,
                            CartType    = param.CartType,
                            ScopeId     = param.Scope,
                            CultureInfo = param.CultureInfo,
                            CustomerId  = param.CustomerId,
                            LineItemId  = existingLineItem.Id,
                            Quantity    = param.Quantity + existingLineItem.Quantity,
                            RecurringOrderFrequencyName = param.RecurringOrderFrequencyName,
                            RecurringOrderProgramName   = param.RecurringOrderProgramName
                        };
                        return(await UpdateLineItemAsync(updateLineItemParam).ConfigureAwait(false));
                    }
                }

                cart = await CartRepository.AddLineItemAsync(param).ConfigureAwait(false);
            }
            catch (ComposerException ex)
            {
                ClearEditModeIfCartDraftDoesNotExist(param.CartType, ex);
                throw;
            }

            if (cart.CartType != CartConfiguration.OrderDraftCartType)
            {
                cart = await FixCartService.FixCartAsync(new FixCartParam
                {
                    Cart    = cart,
                    ScopeId = param.Scope
                }).ConfigureAwait(false);
            }

            var vmParam = new CreateCartViewModelParam
            {
                Cart        = cart,
                CultureInfo = param.CultureInfo,
                IncludeInvalidCouponsMessages = false,
                BaseUrl = param.BaseUrl
            };

            var viewModel = await CreateCartViewModelAsync(vmParam).ConfigureAwait(false);

            return(viewModel);
        }
Beispiel #14
0
        /// <summary>
        /// Update a line item in the cart.
        /// </summary>
        /// <param name="param"></param>
        /// <returns>The Lightweight CartViewModel</returns>
        public async virtual Task <CartViewModel> UpdateLineItemAsync(UpdateLineItemParam param)
        {
            if (param == null)
            {
                throw new ArgumentNullException("param", "param is required");
            }
            if (string.IsNullOrWhiteSpace(param.CartName))
            {
                throw new ArgumentException("param.CartName is required", "param");
            }
            if (string.IsNullOrWhiteSpace(param.ScopeId))
            {
                throw new ArgumentException("param.ScopeId is required", "param");
            }
            if (param.CultureInfo == null)
            {
                throw new ArgumentException("param.CultureInfo is required", "param");
            }
            if (string.IsNullOrWhiteSpace(param.CartName))
            {
                throw new ArgumentException("param.CartName is required", "param");
            }
            if (param.LineItemId == Guid.Empty)
            {
                throw new ArgumentException("param.LineItemId is required", "param");
            }
            if (param.CustomerId == Guid.Empty)
            {
                throw new ArgumentException("param.CustomerId is required", "param");
            }
            if (param.Quantity < 1)
            {
                throw new ArgumentException("param.Quantity must be greater than 0", "param");
            }
            if (string.IsNullOrWhiteSpace(param.BaseUrl))
            {
                throw new ArgumentException("param.BaseUrl is required", "param");
            }

            var cart = await CartRepository.UpdateLineItemAsync(param).ConfigureAwait(false);

            await CartRepository.RemoveCouponsAsync(new RemoveCouponsParam
            {
                CartName    = param.CartName,
                CouponCodes = CouponViewService.GetInvalidCouponsCode(cart.Coupons).ToList(),
                CustomerId  = param.CustomerId,
                Scope       = param.ScopeId
            }).ConfigureAwait(false);

            var vmParam = new CreateCartViewModelParam
            {
                Cart        = cart,
                CultureInfo = param.CultureInfo,
                IncludeInvalidCouponsMessages = true,
                BaseUrl = param.BaseUrl
            };

            var viewModel = await CreateCartViewModelAsync(vmParam).ConfigureAwait(false);

            return(viewModel);
        }
Beispiel #15
0
        public virtual CartViewModel CreateCartViewModel(CreateCartViewModelParam param)
        {
            if (param == null)
            {
                throw new ArgumentNullException(nameof(param));
            }
            if (param.CultureInfo == null)
            {
                throw new ArgumentException(GetMessageOfNull(nameof(param.CultureInfo)), nameof(param));
            }
            if (param.ProductImageInfo == null)
            {
                throw new ArgumentException(GetMessageOfNull(nameof(param.ProductImageInfo)), nameof(param));
            }
            if (param.ProductImageInfo.ImageUrls == null)
            {
                throw new ArgumentException(GetMessageOfNull(nameof(param.ProductImageInfo.ImageUrls)), nameof(param));
            }
            if (string.IsNullOrWhiteSpace(param.BaseUrl))
            {
                throw new ArgumentException(GetMessageOfNullWhiteSpace(nameof(param.BaseUrl)), nameof(param));
            }

            Helper.LineItemsHelper.PrepareGiftLineItems(param.Cart);

            var vm = ViewModelMapper.MapTo <CartViewModel>(param.Cart, param.CultureInfo);

            if (vm == null)
            {
                return(null);
            }

            vm.OrderSummary = GetOrderSummaryViewModel(param.Cart, param.CultureInfo);
            MapShipmentsAndPayments(param.Cart, param.CultureInfo, param.ProductImageInfo, param.BaseUrl, param.PaymentMethodDisplayNames, vm, param.Cart.Payments);
            MapCustomer(param.Cart.Customer, param.CultureInfo, vm);
            vm.Coupons = GetCouponsViewModel(param.Cart, param.CultureInfo, param.IncludeInvalidCouponsMessages);
            vm.OrderSummary.AdditionalFeeSummaryList = GetAdditionalFeesSummary(vm.LineItemDetailViewModels, param.CultureInfo);

            SetDefaultCountryCode(vm);
            SetDefaultShippingAddressNames(vm);
            SetPostalCodeRegexPattern(vm);
            SetPhoneNumberRegexPattern(vm);

            var getUrlParam = new BaseUrlParameter
            {
                CultureInfo = ComposerContext.CultureInfo
            };

            SetHomepageUrl(vm, getUrlParam);
            SetEditCartUrl(vm, getUrlParam);
            SetCheckoutUrl(vm, getUrlParam);
            SetForgotPasswordPageUrl(vm, getUrlParam);

            // Reverse the items order in the Cart so the last added item will be the first in the list
            if (vm.LineItemDetailViewModels != null)
            {
                vm.LineItemDetailViewModels.Reverse();
            }

            vm.IsAuthenticated = ComposerContext.IsAuthenticated;

            return(vm);
        }