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); } }
protected override void DispenseCallback(string sku) { var priceInCents = ProductInfoRepository.GetPrice(sku) ?? 0; Context.State = new PriceState(this, priceInCents); }