private void IncrementRuleAccumulatorForRule(PricingRule rule) { if (!_ruleAccumulator.ContainsKey(rule.Sku)) { _ruleAccumulator.Add(rule.Sku, 0); } _ruleAccumulator[rule.Sku]++; }
private void MonitorAndApplyRule(PricingRule rule, ReceiptItems receiptItems) { IncrementRuleAccumulatorForRule(rule); if (_ruleAccumulator[rule.Sku] < rule.QuailfyingQty) { return; } ApplyRule(rule, receiptItems); }
private void ResetRuleAccumulatorForRule(PricingRule rule) { _ruleAccumulator.Remove(rule.Sku); }
private void ApplyRule(PricingRule rule, ReceiptItems receiptItems) { receiptItems.AddReceiptDiscount(rule.Sku, rule.DiscountRule, rule.Price, rule.Rule); ResetRuleAccumulatorForRule(rule); }