public void ApplyPromotions(List <PromoDefinition> activePromotions, List <OrderDetail> productCart) { foreach (var promo in activePromotions) { IPromotion promotion = PromotionFactory.GetFactory(promo); // no need to apply further promotions if a promotion is already applied //if (!this.IsPromoApplied) //{ this.DiscountedAmount += promotion.ApplyPromotion(productCart); // mark promotion applied if (!this.IsPromoApplied && this.DiscountedAmount > 0) { this.IsPromoApplied = true; } //} } }
public void ApplyPromotion(IPromotion promotion) { this.promotion = promotion; promotion.ApplyPromotion(this); }