public CheckoutTill(PricingRules rules, IReceiptPrinter receiptPrinter)
 {
     _rules = rules;
     _specialRuleEngine = new SpecialRuleEngine(_rules);
     _receiptItems = new ReceiptItems();
     _receiptPrinter = receiptPrinter;
 }
 private void MonitorAndApplyRule(PricingRule rule, ReceiptItems receiptItems)
 {
     IncrementRuleAccumulatorForRule(rule);
     if (_ruleAccumulator[rule.Sku] < rule.QuailfyingQty)
     {
         return;
     }
     ApplyRule(rule, receiptItems);
 }
 private void ApplyRule(PricingRule rule, ReceiptItems receiptItems)
 {
     receiptItems.AddReceiptDiscount(rule.Sku, rule.DiscountRule, rule.Price, rule.Rule);
     ResetRuleAccumulatorForRule(rule);
 }
 public void MonitorandApplyDiscountForSku(string sku, ReceiptItems receiptItems)
 {
     var rule = _rules.GetRuleBySku(sku);
     if (!rule.HasSpecialRuleForSku()) return;
     MonitorAndApplyRule(rule, receiptItems);
 }