Example #1
0
        public static LineItem AsWebModel(this Data.CartItem item)
        {
            var product = new Product
            {
                Title       = item.Name,
                Description = item.Name,
                Excerpt     = item.Name,
                Handle      = item.ProductId
            };

            var variant = new Variant();

            var ret = new LineItem
            {
                Id               = item.Id,
                Handle           = item.ProductId,
                ProductId        = item.ProductId,
                Title            = item.Name,
                Price            = item.PlacedPrice,
                Quantity         = item.Quantity,
                RequiresShipping = item.RequiredShipping,
                Sku              = item.ProductCode,
                VariantId        = item.ProductId,
                Image            = item.ImageUrl,
                Variant          = variant,
                Product          = product,
                Url              = String.Format("/products/{0}", item.ProductId),
                Taxable          = item.TaxIncluded,
                TaxAmount        = item.TaxTotal
            };

            return(ret);
        }
        private CartItem CreateItem(string name)
        {
            var item = new CartItem
            {
                CatalogId = "sample",
                ProductId = "asdasd",
                CategoryId = "category",
                ListPrice = 10,
                PlacedPrice = 20,
                Quantity = 2,
                Name = name,
                Currency = "USD"
            };

            return item;
        }
Example #3
0
        public static Data.CartItem AsServiceModel(this LineItem item)
        {
            var ret = new Data.CartItem
                      {
                          Id = item.Id,
                          ProductCode = item.Handle,
                          ProductId = item.ProductId,
                          Name = item.Title,
                          PlacedPrice = item.Price,
                          RequiredShipping = item.RequiresShipping,
                          ExtendedPrice = item.Price,
                          Quantity = item.Quantity,
                          ImageUrl = item.Image,
                          CategoryId = "fake",
                          CatalogId = "fake",
                          TaxIncluded = item.Taxable,
                          TaxTotal = item.TaxAmount
                      };

            return ret;
        }
Example #4
0
        public static Data.CartItem AsServiceModel(this LineItem item)
        {
            var ret = new Data.CartItem
            {
                Id               = item.Id,
                ProductCode      = item.Handle,
                ProductId        = item.ProductId,
                Name             = item.Title,
                PlacedPrice      = item.Price,
                RequiredShipping = item.RequiresShipping,
                ExtendedPrice    = item.Price,
                Quantity         = item.Quantity,
                ImageUrl         = item.Image,
                CategoryId       = "fake",
                CatalogId        = "fake",
                TaxIncluded      = item.Taxable,
                TaxTotal         = item.TaxAmount
            };

            return(ret);
        }