Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class OrderDiscountProcessor : IDiscountProcessor
- {
- private readonly Discount _discount;
- public OrderDiscountProcessor(Discount discount)
- {
- _discount = discount;
- }
- public double ProcessDiscount(OrderViewModel order)
- {
- double discount = 0.0;
- double totalBill = order.Quantity * order.Price;
- if (order.Quantity >= _discount.MinimumItemCount && totalBill >= _discount.MinimumBillAmount)
- {
- discount = (totalBill * _discount.Percentage) / 100.0;
- }
- return discount;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement