public void AcceptPayment(Customer customer, IEnumerable<Product> products, decimal payment) { decimal subTotal = CalculateSubtotal(); subTotal = SubtractDiscounts(subTotal); decimal grandTotal = AddTax(subTotal); SubtractFromCustomerBalance(customer, grandTotal); }
public decimal ProcessOrder(Customer customer, IEnumerable<Product> products) { // do some processing of order decimal orderTotal = products.Sum(p => p.Price); Type customerType = customer.GetType(); if (customerType == typeof(Employee)) { orderTotal -= orderTotal * 0.15m; } else if (customerType == typeof(NonEmployee)) { orderTotal -= orderTotal * 0.05m; } return orderTotal; }
private void SubtractFromCustomerBalance(Customer customer, decimal grandTotal) { customer.DeductFromAccountBalance(grandTotal); }