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 }); }
protected virtual IEnumerable <DiscountedEntry> GetDiscountedPrices(ContentReference contentLink, IMarket market, Currency currency) { return(_promotionEngine.GetDiscountPrices(new[] { contentLink }, market, currency, _referenceConverter, _lineItemCalculator)); }
public IEnumerable <DiscountedEntry> GetDiscountPrices(ContentReference contentReference) { var rewards = _promotionEngine.GetDiscountPrices(contentReference, _currentMarket.GetCurrentMarket(), _currentCurrency.GetCurrentCurrency()).ToList(); return(rewards); }