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);
            }
        }
예제 #2
0
        protected override void DispenseCallback(string sku)
        {
            var priceInCents = ProductInfoRepository.GetPrice(sku) ?? 0;

            Context.State = new PriceState(this, priceInCents);
        }