Beispiel #1
0
        public int BuyItems(List <string> items)
        {
            var    products = _stockRepository.CheckStockStatus(items);
            double price    = 0;

            foreach (var item in products)
            {
                price += item.Price;
            }
            OrderValue = _discountService.ApplyDiscount(price);

            var requestUri = "http://www.google.com/search?q=" + OrderValue;
            var result     = _paymentGateWay.GetAsync(requestUri).Result; //pseudo payment gateway call

            if (result.IsSuccessStatusCode)
            {
                Console.WriteLine("Payment processed successfully");
            }
            else
            {
                LogPaymentFailure(result);
            }
            return(products.Count());
        }