private Money GetDiscountPrice(EntryContentBase content, IPriceValue defaultPrice, IMarket market, Currency currency) { if (defaultPrice == null) { return(new Money(0, currency)); } if (_promotionHelper == null) { _promotionHelper = new PromotionHelperFacade(); } _promotionHelper.Reset(); return(_promotionEntryService.GetDiscountPrice(defaultPrice, content, currency, _promotionHelper).UnitPrice); }
private IList <IPriceValue> GetDiscountPrices(IList <IPriceValue> prices, MarketId marketId, Currency currency) { currency = GetCurrency(currency, marketId); var priceValues = new List <IPriceValue>(); foreach (var entry in GetEntries(prices)) { var price = prices .OrderBy(x => x.UnitPrice.Amount) .FirstOrDefault(x => x.CatalogKey.CatalogEntryCode.Equals(entry.Code) && x.UnitPrice.Currency.Equals(currency)); if (price == null) { continue; } priceValues.Add(_promotionEntryService.GetDiscountPrice( price, entry, currency, _promotionHelper)); } return(priceValues); }