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;
        }
        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);
        }
        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
            });
        }
Example #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);
        }