private void DoPayment(Payment pay, float price) { pay.Connect(); pay.StartPayment(price); pay.EndPayment(); pay.Disconnect(); }
public Ticket(string from, string to, UIClass cls, int way, float discount, Payment payment) { this.from = from; this.to = to; this.cls = cls; this.way = way; this.discount = discount; this.payment = payment; }
private void handlePayment(UIInfo info) { // ************************************* // This is the code you need to refactor // ************************************* StandardTicket ticket = new StandardTicket(info); Payment payment = new Payment(ticket, info); printer = new Printer(); printer.CreateTicket(info, ticket); }
public bool MakePayment(UIPayment uiPayment, float price) { switch (uiPayment) { case UIPayment.CreditCard: payment = new CreditCard(); break; case UIPayment.DebitCard: payment = new DebitCard(); break; case UIPayment.Chipknip: payment = new Chipknip(); break; case UIPayment.Cash: payment = new Cash(); break; } return payment.HandlePayment(price); }