public OrderConfirmationEmailTemplateViewModel Build()
        {
            var emailTemplate = new OrderConfirmationEmailTemplateViewModel()
            {
                Email       = model.Email,
                OrderNumber = orderNumber,
                Name        = model.FirstName + " " + model.LastName
            };

            emailTemplate.Items         = cartItemBuilder.Build(shoppingCart.Items);
            emailTemplate.PaymentMethod = model.PaymentMethod;

            if (emailTemplate.PaymentMethod == PaymentMethod.CraditCard)
            {
                emailTemplate.CCType = model.CreditCardViewModel.CreditCart;

                var length        = model.CreditCardViewModel.CreditCardsNumber.Length;
                var zeroBaseIndex = length - 4;

                emailTemplate.CCLast4Digits = model.CreditCardViewModel.CreditCardsNumber.Substring(zeroBaseIndex, 4);
            }

            return(emailTemplate);
        }
Ejemplo n.º 2
0
 protected override List <ICartItemViewModel> ResolveCore(List <ICartItem> source)
 {
     return(cartItemViewModelBuilder.Build(source));
 }