protected override void DispenseCallback(string sku) { var priceInCents = ProductInfoRepository.GetPrice(sku); var currentTotal = CurrentTotal(); if (currentTotal < priceInCents) { Context.State = new PriceState(this, priceInCents.Value); } else { Output.Add(sku); ProductInfoRepository.DecrementProductCount(sku); Vault.AddRange(CoinSlot); CoinSlot.Clear(); Refund(currentTotal, priceInCents); Context.State = new ThankYouState(this); } }
public void ReturnCoins() { ReturnTray.AddRange(CoinSlot); CoinSlot.Clear(); Context.State = new NoMoneyState(this); }