예제 #1
0
        public IPriceValue GetDiscountPrice(Price price, ContentReference contentLink, Currency currency, IMarket market)
        {
            var discountedPrice = _promotionEngine.GetDiscountPrices(new[] { contentLink }, market, currency, _referenceConverter, _lineItemCalculator);

            if (discountedPrice.Any())
            {
                var highestDiscount = discountedPrice.SelectMany(x => x.DiscountPrices).OrderBy(x => x.Price).FirstOrDefault().Price;
                return(new PriceValue
                {
                    CatalogKey = new CatalogKey(_referenceConverter.GetCode(contentLink)),
                    CustomerPricing = CustomerPricing.AllCustomers,
                    MarketId = price.MarketId,
                    MinQuantity = price.MinQuantity,
                    UnitPrice = highestDiscount,
                    ValidFrom = DateTime.UtcNow,
                    ValidUntil = null
                });
            }

            return(new PriceValue
            {
                CatalogKey = new CatalogKey(_referenceConverter.GetCode(contentLink)),
                CustomerPricing = CustomerPricing.AllCustomers,
                MarketId = price.MarketId,
                MinQuantity = price.MinQuantity,
                UnitPrice = price.UnitPrice,
                ValidFrom = DateTime.UtcNow,
                ValidUntil = null
            });
        }
예제 #2
0
 protected virtual IEnumerable <DiscountedEntry> GetDiscountedPrices(ContentReference contentLink, IMarket market, Currency currency)
 {
     return(_promotionEngine.GetDiscountPrices(new[] { contentLink }, market, currency, _referenceConverter, _lineItemCalculator));
 }
예제 #3
0
        public IEnumerable <DiscountedEntry> GetDiscountPrices(ContentReference contentReference)
        {
            var rewards = _promotionEngine.GetDiscountPrices(contentReference, _currentMarket.GetCurrentMarket(), _currentCurrency.GetCurrentCurrency()).ToList();

            return(rewards);
        }