Exemplo n.º 1
0
        public void OverrideUserInfoIntoOrder(Order original, Order destination)
        {
            destination.City    = original.City;
            destination.Street  = original.Street;
            destination.State   = original.State;
            destination.Country = original.Country;
            destination.ZipCode = original.ZipCode;

            destination.CardNumber         = original.CardNumber;
            destination.CardHolderName     = original.CardHolderName;
            destination.CardExpiration     = original.CardExpiration;
            destination.CardSecurityNumber = original.CardSecurityNumber;
        }
Exemplo n.º 2
0
        public Order MapUserInfoIntoOrder(UserData user, Order order)
        {
            order.City    = user.City;
            order.Street  = user.Street;
            order.State   = user.State;
            order.Country = user.Country;
            order.ZipCode = user.ZipCode;

            order.CardNumber         = user.CardNumber;
            order.CardHolderName     = user.CardHolderName;
            order.CardExpiration     = new DateTime(int.Parse("20" + user.Expiration.Split('/')[1]), int.Parse(user.Expiration.Split('/')[0]), 1);
            order.CardSecurityNumber = user.SecurityNumber;

            return(order);
        }
Exemplo n.º 3
0
        public BasketDTO MapOrderToBasket(Order order)
        {
            order.CardExpirationApiFormat();

            return(new BasketDTO()
            {
                City = order.City,
                Street = order.Street,
                State = order.State,
                Country = order.Country,
                ZipCode = order.ZipCode,
                CardNumber = order.CardNumber,
                CardHolderName = order.CardHolderName,
                CardExpiration = order.CardExpiration,
                CardSecurityNumber = order.CardSecurityNumber,
                CardTypeId = 1,
                Buyer = order.Buyer,
                RequestId = order.RequestId
            });
        }
Exemplo n.º 4
0
        public Order MapBasketToOrder(Basket basket)
        {
            var order = new Order();

            order.Total = 0;

            basket.Items.ForEach(x =>
            {
                order.OrderItems.Add(new OrderItem()
                {
                    ProductId = int.Parse(x.ProductId),

                    PictureUrl  = x.PictureUrl,
                    ProductName = x.ProductName,
                    Units       = x.Quantity,
                    UnitPrice   = x.UnitPrice
                });
                order.Total += (x.Quantity * x.UnitPrice);
            });

            return(order);
        }