public static void Run() { var products = new List <Product> { new Product { Name = "Sneakers", Value = new Random().Next(299) }, new Product { Name = "Shirt", Value = new Random().Next(299) }, new Product { Name = "Tennis Racket", Value = new Random().Next(299) } }; var order = new Order { Id = Guid.NewGuid(), Products = products }; var payment = new Payment { CreditCard = "5555 2222 4444 8888" }; var paymentService = new PaymentCreditCardService(new PaymentCreditCardFacade(new PayPalGateway(), new ConfigurationManager())); var paymentResult = paymentService.PerformPayment(order, payment); Console.WriteLine(paymentResult.Status); }
public static void Run() { var products = new List <Product> { new Product { Name = "Spotify Signature", Value = new Random().Next(50) }, new Product { Name = "Airline ticket", Value = new Random().Next(3000) }, new Product { Name = "IPhone", Value = new Random().Next(8000) }, }; var order = new Order { ID = Guid.NewGuid(), Products = products }; var payment = new Payment { CreditCard = "3333 6666 9999 1111" }; // Solve this with DI var paymentService = new PaymentCreditCardService(new PaymentCreditCardFacade(new PaypalGateway(), new ConfigurationManager())); var paymentResult = paymentService.Pay(order, payment); Console.WriteLine(paymentResult.Status); }