Ejemplo n.º 1
0
        public marketingDto.ProductPromoEntry ToProductPromoEntryDto(PromotionProductEntry promoProductEntry)
        {
            var serviceModel = new marketingDto.ProductPromoEntry();

            serviceModel.InjectFrom <NullableAndEnumValueInjecter>(promoProductEntry);

            serviceModel.Discount   = promoProductEntry.Discount != null ? (double?)promoProductEntry.Discount.Amount : null;
            serviceModel.Price      = promoProductEntry.Price != null ? (double?)promoProductEntry.Price.Amount : null;
            serviceModel.Variations = promoProductEntry.Variations != null?promoProductEntry.Variations.Select(ToProductPromoEntryDto).ToList() : null;

            return(serviceModel);
        }
Ejemplo n.º 2
0
        public virtual marketingDto.ProductPromoEntry ToProductPromoEntryDto(LineItem lineItem)
        {
            var result = new marketingDto.ProductPromoEntry();

            result.CatalogId  = lineItem.CatalogId;
            result.CategoryId = lineItem.CategoryId;
            result.Code       = lineItem.Sku;
            result.ProductId  = lineItem.ProductId;
            result.Discount   = (double)lineItem.DiscountTotal.Amount;
            result.Price      = (double)lineItem.PlacedPrice.Amount;
            result.Quantity   = lineItem.Quantity;
            result.Variations = null; // TODO

            return(result);
        }
Ejemplo n.º 3
0
        public virtual marketingDto.ProductPromoEntry ToProductPromoEntryDto(LineItem lineItem)
        {
            var result = new marketingDto.ProductPromoEntry();

            result.CatalogId  = lineItem.CatalogId;
            result.CategoryId = lineItem.CategoryId;
            result.Code       = lineItem.Sku;
            result.ProductId  = lineItem.ProductId;
            result.Discount   = (double)lineItem.DiscountTotal.Amount;
            //Use only base price for discount evaluation
            result.Price           = (double)lineItem.SalePrice.Amount;
            result.Quantity        = lineItem.Quantity;
            result.InStockQuantity = lineItem.InStockQuantity;
            result.Variations      = null; // TODO

            return(result);
        }
Ejemplo n.º 4
0
        public static marketingDto.ProductPromoEntry ToProductPromoEntryDto(this LineItem lineItem)
        {
            var result = new marketingDto.ProductPromoEntry
            {
                CatalogId  = lineItem.CatalogId,
                CategoryId = lineItem.CategoryId,
                Code       = lineItem.Sku,
                ProductId  = lineItem.ProductId,
                Discount   = (double)lineItem.DiscountTotal.Amount,
                //Use only base price for discount evaluation
                Price           = (double)lineItem.SalePrice.Amount,
                Quantity        = lineItem.Quantity,
                InStockQuantity = lineItem.InStockQuantity,
                Variations      = null // TODO
            };

            return(result);
        }
Ejemplo n.º 5
0
        public virtual marketingDto.ProductPromoEntry ToProductPromoEntryDto(Product product)
        {
            var result = new marketingDto.ProductPromoEntry
            {
                CatalogId  = product.CatalogId,
                CategoryId = product.CategoryId,
                Outline    = product.Outline,
                ProductId  = product.Id,
                Quantity   = 1,
                Variations = product.Variations?.Select(ToProductPromoEntryDto).ToList()
            };

            if (product.Price != null)
            {
                result.Discount = (double)product.Price.DiscountAmount.Amount;
                result.Price    = (double)product.Price.SalePrice.Amount;
            }

            return(result);
        }
Ejemplo n.º 6
0
        public virtual marketingDto.ProductPromoEntry ToProductPromoEntryDto(Product product)
        {
            var retVal = new marketingDto.ProductPromoEntry();

            retVal.CatalogId  = product.CatalogId;
            retVal.CategoryId = product.CategoryId;
            retVal.Outline    = product.Outline;

            if (product.Price != null)
            {
                retVal.Discount = (double)product.Price.DiscountAmount.Amount;
                retVal.Price    = (double)product.Price.SalePrice.Amount;
            }

            retVal.ProductId  = product.Id;
            retVal.Quantity   = 1;
            retVal.Variations = product.Variations != null?product.Variations.Select(ToProductPromoEntryDto).ToList() : null;

            return(retVal);
        }
Ejemplo n.º 7
0
        public static marketingDto.ProductPromoEntry ToProductPromoEntryDto(this Product product)
        {
            var result = new marketingDto.ProductPromoEntry
            {
                CatalogId       = product.CatalogId,
                CategoryId      = product.CategoryId,
                Outline         = product.Outline,
                ProductId       = product.Id,
                Quantity        = 1,
                InStockQuantity = product.Inventory != null && product.Inventory.InStockQuantity.HasValue ? (int)product.Inventory.InStockQuantity.Value : 0,
                Variations      = product.Variations?.Select(ToProductPromoEntryDto).ToList()
            };

            if (product.Price != null)
            {
                result.Discount = (double)product.Price.DiscountAmount.Amount;
                result.Price    = (double)product.Price.SalePrice.Amount;
            }

            return(result);
        }
Ejemplo n.º 8
0
        public static marketingDto.ProductPromoEntry ToProductPromoEntryDto(this LineItem lineItem)
        {
            var result = new marketingDto.ProductPromoEntry
            {
                CatalogId  = lineItem.CatalogId,
                CategoryId = lineItem.CategoryId,
                Code       = lineItem.Sku,
                ProductId  = lineItem.ProductId,
                Discount   = (double)lineItem.DiscountTotal.Amount,
                //Use only base price for discount evaluation
                Price           = (double)lineItem.SalePrice.Amount,
                ListPrice       = (double)lineItem.ListPrice.Amount,
                Quantity        = lineItem.Quantity,
                InStockQuantity = lineItem.InStockQuantity,
                // VP-3582: We need to pass all product outlines as 1 string to use them for promotion evaluation
                Outline    = lineItem.Product.Outlines,
                Variations = null // TODO
            };

            return(result);
        }
Ejemplo n.º 9
0
        public static marketingDto.ProductPromoEntry ToProductPromoEntryDto(this Product product)
        {
            var result = new marketingDto.ProductPromoEntry
            {
                CatalogId  = product.CatalogId,
                CategoryId = product.CategoryId,
                // VP-3582: We need to pass all product outlines as 1 string to use them for promotion evaluation
                Outline         = product.Outlines,
                Code            = product.Sku,
                ProductId       = product.Id,
                Quantity        = 1,
                InStockQuantity = product.Inventory != null && product.Inventory.InStockQuantity.HasValue ? (int)product.Inventory.InStockQuantity.Value : 0,
                Variations      = product.Variations?.Select(ToProductPromoEntryDto).ToList()
            };

            if (product.Price != null)
            {
                result.Discount  = (double)product.Price.DiscountAmount.Amount;
                result.Price     = (double)product.Price.SalePrice.Amount;
                result.ListPrice = (double)product.Price.ListPrice.Amount;
            }

            return(result);
        }