Exemplo n.º 1
0
 public Receipt(Cart OrderedProducts, PaymentAbstract PaymentDetails)
 {
     this.ProductsCart   = OrderedProducts;
     this.PaymentDetails = PaymentDetails;
     this.Subtotal       = 0;
     this.SalesTax       = 0;
     this.GrandTotal     = 0;
 }
Exemplo n.º 2
0
        public void ProductAction(Product choice)
        {
            if (InputUtil.GetYesNo("Would you like to order this item? (y/n)") == false)
            {
                return;
            }

            int qty = InputUtil.ReadInteger("\nHow many would you like?", 0, 25);

            if (qty > 0 && InputUtil.GetYesNo("Add purchase? (y/n)"))
            {
                this.SelectedProducts.AddProduct(choice, qty);
            }

            if (InputUtil.GetYesNo("\nWould you like to check out? (y/n)"))
            {
                int method = InputUtil.ReadInteger(
                    "How are you paying today?\n\t1 = cash\n\t2 = check\n\t3 = charge\n\t4 = cancel", 1, 4);
                PaymentAbstract paymentDetails = null;
                switch (method)
                {
                case 1: paymentDetails = new CashPayment(); break;

                case 2: paymentDetails = new CheckPayment(); break;

                case 3: paymentDetails = new CreditPayment(); break;

                case 4: break;
                }
                if (paymentDetails is null)
                {
                    // user cancelled payment - abort order
                }
                else
                {
                    paymentDetails.GetPayment(SelectedProducts.GetGrandTotal());
                    Console.WriteLine();
                    Console.WriteLine("Receipt:");
                    Receipt rcpt = new Receipt(SelectedProducts, paymentDetails);
                    rcpt.Display();

                    SelectedProducts.Clear();
                }
            }
        }
Exemplo n.º 3
0
 public PaymentView(PaymentAbstract pa) //double Subtotal, double Taxes, double GrandTotal)
 {
     this.pa = pa;
 }