public bool Pay(int paytmentMethod, ChoiceCustomer choice) { switch (paytmentMethod) { case 1: choice.SelectPaymentMethod(new DebitCard()); break; case 2: choice.SelectPaymentMethod(new BankTransfer()); break; case 3: choice.SelectPaymentMethod(new Cash()); break; default: choice.SelectPaymentMethod(new Cash()); break; } var success = choice.Pay(); return(success); }
public static void PayTShirt(TShirt shirt) { Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine($"Your tshirt cost: {shirt.Price}"); Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("-----------------------------------------------------------------------------------------------"); Console.Write("How would you like to pay? 1) Debit Cart , 2) Bank Transfer, 3) Cash: "); Console.ForegroundColor = ConsoleColor.White; var paytmentType = int.Parse(Console.ReadLine().Trim()); var choice = new ChoiceCustomer(); choice.SetDueAmount(shirt.Price); var simpleEshop = new SimpleEshop(); var success = simpleEshop.PayOrder(paytmentType, choice); Console.WriteLine(success); Console.Read(); }
public bool PayOrder(int paymentMethod, ChoiceCustomer choice) { var payments = new Payments(); bool success = payments.Pay(paymentMethod, choice); if (success) { Console.ForegroundColor = ConsoleColor.Blue; Console.WriteLine("Successful payment"); Console.ForegroundColor = ConsoleColor.White; } else { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("Try again..."); Console.ForegroundColor = ConsoleColor.White; } return(success); }