public void payCredit(float price, UIPayment payMethod) { CreditCard c = new CreditCard (); c.Connect (); int ccid = c.BeginTransaction (price + 0.50f); c.EndTransaction (ccid); }
public void payCash(float price, UIPayment payMethod) { CoinMachineAdap coin = new CoinMachineAdap(); coin.start(); coin.pay(price); coin.stop(); }
public void payDebit(float price, UIPayment payMethod) { DebitCard d = new DebitCard(); d.Connect(); int dcid = d.BeginTransaction(price); d.EndTransaction(dcid); }
private void makePayment(UIPayment payment, float price) { // Select the correct method of payment PaymentStrategy payMethod; switch (payment) { case UIPayment.CreditCard: // Add 50 cents if paying by credit card price += 0.50f; payMethod = new CreditCard(); break; case UIPayment.DebitCard: payMethod = new DebitCard(); break; case UIPayment.Cash: payMethod = new CoinEater(); break; default: payMethod = null; throw new Exception("No payment found"); } // Pay payMethod.Pay(price); }
public static void startPayment(Ticket ticket, UIDiscount discount, UIPayment payment) { float price = Pricing.calcPrice(ticket, discount, payment); // Pay switch (payment) { case UIPayment.CreditCard: CreditCard c = new CreditCard(); c.Connect(); int ccid = c.BeginTransaction(price); c.EndTransaction(ccid); break; case UIPayment.DebitCard: DebitCard d = new DebitCard(); d.Connect(); int dcid = d.BeginTransaction(price); d.EndTransaction(dcid); break; case UIPayment.Cash: IKEAMyntAtare2000 coin = new IKEAMyntAtare2000(); coin.starta(); coin.betala((int)Math.Round(price * 100)); coin.stoppa(); break; } }
private bool betaal(UIPayment betaalmiddel, float prijs) { IBetaalmiddel fysiekBetaalmiddel = new CreditCard(); // Initialiseer betaalmiddel als CreditCard, anders mogen we geen methodes ervan aanroepen. switch (betaalmiddel) { case UIPayment.CreditCard: prijs += 0.50f; fysiekBetaalmiddel = new CreditCard(); break; case UIPayment.DebitCard: fysiekBetaalmiddel = new DebitCard(); break; case UIPayment.Chipknip: fysiekBetaalmiddel = new Chipknip(); break; case UIPayment.Cash: fysiekBetaalmiddel = new Cash(); break; } fysiekBetaalmiddel.Connect(); int id = fysiekBetaalmiddel.BeginTransaction(prijs); // Return True als de betaling succesvol is afgerond. return(fysiekBetaalmiddel.EndTransaction(id)); }
//This should be a hastable, but I couldn't get the import to work on the Mono framework so I used a switch public static float getFee(UIPayment payment) { if (payment == UIPayment.CreditCard) { return(0.50f); } return(0.00f); }
public Purchase(String arr, String dep, UIDiscount discountt, UIClass class_t, UIPayment paymenttype) { dep_station = dep; arr_station = arr; discounttype = discountt; classtype = class_t; paymentType = paymenttype; }
public void payCredit(float price, UIPayment payMethod) { CreditCard c = new CreditCard(); c.Connect(); int ccid = c.BeginTransaction(price + 0.50f); c.EndTransaction(ccid); }
public UIInfo(string from, string to, UIClass cls, UIWay way, UIDiscount discount, UIPayment payment) { this.from = from; this.to = to; this.cls = cls; this.way = way; this.discount = discount; this.payment = payment; }
public TicketautomaatInvoer(string from, string to, UIClass cls, UIWay way, UIDiscount discount, UIPayment payment) { this.from = from; this.to = to; this.cls = cls; this.way = way; this.discount = discount; this.payment = payment; }
public Bestelling(string from, string to, UIClass cls, UIWay way, UIDiscount discount, UIPayment payment, int aantalKaartjes) { this.from = from; this.to = to; this.cls = cls; this.way = way; this.discount = discount; this.payment = payment; this.aantalKaartjes = aantalKaartjes; }
public Sale(UIPayment paymentMethod) { switch (paymentMethod) { case UIPayment.CreditCard: payment = new PaymentCredit(); break; case UIPayment.DebitCard: payment = new PaymentDebit(); break; case UIPayment.Cash: payment = new PaymentCash(); break; } }
public static float calcPrice(Ticket ticket, UIDiscount discount, UIPayment payment) { float price = 0; int tariefeenheden = Tariefeenheden.getTariefeenheden(ticket.from, ticket.to); int tableColumn; // First based on class switch (ticket.cls) { case UIClass.FirstClass: tableColumn = 3; break; default: tableColumn = 0; break; } // Then, on the discount switch (discount) { case UIDiscount.TwentyDiscount: tableColumn += 1; break; case UIDiscount.FortyDiscount: tableColumn += 2; break; } // Get price price = PricingTable.getPrice(tariefeenheden, tableColumn); if (ticket.way == UIWay.Return) { price *= 2; } // Add 50 cent if paying with credit card if (payment == UIPayment.CreditCard) { price += 0.50f; } return(price); }
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); }
void paymethod(float price, UIPayment payMethod) { //Create a payInfo class PayInfo payInfo = new PayInfo(); //Select the paymethod and call upon the right method in PayInfo.cs switch (payMethod) { case UIPayment.CreditCard: payInfo.payCredit(price, payMethod); break; case UIPayment.DebitCard: payInfo.payDebit(price, payMethod); break; case UIPayment.Cash: payInfo.payCash(price, payMethod); break; } }
public void CreateReceipt(UIInfo infoo) { this.payment = infoo.Payment; PrintReceipt(); }
public Payment(UIPayment pt) { paymenttype = pt; }
// Calculates the total prices based on the type of payment public static float calculatePaymentPrice(float total, UIPayment payment) { return(total + getFee(payment)); }
public void PrintTicket(string from, string to, UIClass cls, UIWay way, UIDiscount discount, UIPayment payment) { MessageBox.Show("Uw ticket\nStart location: " + from + "\nDestination: " + to + "\nClass: " + cls + "\nWay: " + way + "\nDiscount: " + discount + "\nPayment method: " + payment); }