public static void MakePayment(List <Product.Product> products, Customer.Customer customer) { Payment payment = new Payment(); payment.Customer = customer; payment.Products = products; int amount = 0; foreach (Product.Product product in products) { amount += product.ProductPrice; } if (customer.GetMoney() < amount) { payment.Status = PaymentStatus.Error; return; } customer.Withdraw(amount); payment.Status = PaymentStatus.Success; customer.Payments.Add(payment); }