Exemple #1
0
        public void betaling(TicketautomaatInvoer info, float price)
        {
            // Pay
            switch (info.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(price);
                coin.stoppa();
                break;
            }
        }
        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;
            }
        }
Exemple #3
0
        void Pay()
        {
            Price = (float)Math.Round(Price, 2);
            switch (payment.SelectedIndex)
            {
            case 0:
                CreditCard c = new CreditCard();
                c.Connect();
                Price += 0.5f;
                int ccid = c.BeginTransaction(Price);
                PaymentSuccesful = c.EndTransaction(ccid);
                break;

            case 1:
                DebitCard d = new DebitCard();
                d.Connect();
                int dcid = d.BeginTransaction(Price);
                PaymentSuccesful = d.EndTransaction(dcid);
                break;

            case 2:
                IKEAMyntAtare2000 coin = new IKEAMyntAtare2000();
                coin.starta();
                coin.betala(Price);
                PaymentSuccesful = coin.stoppa(true);     //false
                break;
            }
            PaymentSucces(PaymentSuccesful, Price);
        }
Exemple #4
0
        public bool startPayment(float price)
        {
            switch (paymenttype)
            {
            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;
            }
            return(true);
            // This should return false upon failure, but that's not going to happen.
        }
Exemple #5
0
 public override bool HandlePayment(float price)
 {
     IKEAMyntAtare2000 c = new IKEAMyntAtare2000();
     c.starta();
     c.stoppa();
     c.betala((int)Math.Round(price * 100)+additionalCharge);
     return true;
 }
Exemple #6
0
        public override void Pay(float price)
        {
            IKEAMyntAtare2000 coin = new IKEAMyntAtare2000();

            coin.starta();
            coin.betala((int)Math.Round(price * 100));
            coin.stoppa();
        }
Exemple #7
0
        public override string[] Pay()
        {
            string[] log = new string[8];

            IKEAMyntAtare2000 coin = new IKEAMyntAtare2000();

            coin.starta();
            coin.betala((int)Math.Round(price * 100));
            coin.stoppa();
            log[0] = "success";

            return(log);
        }
 // Pay
 public Payment(Ticket standard, UIInfo info)
 {
     switch (info.Payment) //Changing this in any way whatsoever does get rid of the cases but would just replace it with a different system to determine which method of payyment is used.
     {                     // no other method would make it easier to add extra payment methods, so this might as well stay.
         case UIPayment.CreditCard:
             CreditCard c = new CreditCard();
             c.Connect();
             int ccid = c.BeginTransaction(standard.price);
             c.EndTransaction(ccid);
             break;
         case UIPayment.DebitCard:
             DebitCard d = new DebitCard();
             d.Connect();
             int dcid = d.BeginTransaction(standard.price);
             d.EndTransaction(dcid);
             break;
         case UIPayment.Cash:
             IKEAMyntAtare2000 coin = new IKEAMyntAtare2000();
             coin.starta();
             coin.betala((int)Math.Round(standard.price * 100));
             coin.stoppa();
             break;
     }
 }
Exemple #9
0
 public CashPayment()
 {
     coinmachine = new IKEAMyntAtare2000();
 }
Exemple #10
0
        private void handlePayment(UIInfo info)
        {
            // *************************************
            // This is the code you need to refactor
            // *************************************

            // Get number of tariefeenheden
            int tariefeenheden = Tariefeenheden.getTariefeenheden(info.From, info.To);

            // Compute the column in the table based on choices
            int tableColumn;

            // First based on class
            switch (info.Class)
            {
            case UIClass.FirstClass:
                tableColumn = 3;
                break;

            default:
                tableColumn = 0;
                break;
            }
            // Then, on the discount
            switch (info.Discount)
            {
            case UIDiscount.TwentyDiscount:
                tableColumn += 1;
                break;

            case UIDiscount.FortyDiscount:
                tableColumn += 2;
                break;
            }

            // Get price
            float price = PricingTable.getPrice(tariefeenheden, tableColumn);

            if (info.Way == UIWay.Return)
            {
                price *= 2;
            }
            // Add 50 cent if paying with credit card
            if (info.Payment == UIPayment.CreditCard)
            {
                price += 0.50f;
            }

            // Pay
            switch (info.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;
            }
        }
Exemple #11
0
 public CashPayment()
 {
     coin = new IKEAMyntAtare2000();
 }
Exemple #12
0
 public CoinEater()
 {
     eater = new IKEAMyntAtare2000();
 }
Exemple #13
0
 public AdapterCoin()
 {
     coinMachine = new IKEAMyntAtare2000();
 }