Example #1
0
        public double CancelPurchase()
        {
            SelectedProduct = null;

            var change = CoinsEntered.Sum();

            CoinsEntered.Clear();

            TransactionState = TransactionState.StandBy;

            return(change);
        }
Example #2
0
        private PurchaseResult HandlePurchase()
        {
            TransactionState = TransactionState.InProgress;

            var result = ProcessPurchase(CoinsEntered.ToArray());

            if (result != null && result.AmountDue >= 0)
            {
                TransactionState = TransactionState.StandBy;
            }

            return(result);
        }
Example #3
0
        public PurchaseResult InsertCoin(double coin)
        {
            CoinsEntered.Add(coin);

            return(HandlePurchase());
        }