示例#1
0
 public ShoppingService(int customerId, IStockService stockRepository, IDiscountService discountService,
                        IPaymentGatewayClient paymentGateWay, ILogger logger)
 {
     _customerId           = customerId;
     _stockService         = stockRepository;
     _discountService      = discountService;
     _logger               = logger;
     _paymentGatewayClient = paymentGateWay;
 }
 public CustomerController(IConfiguration configuration, IStockRepository stockRepository, IStockService stockService,
                           IDiscountService discountService, IPaymentGatewayClient paymentGatewayClient
                           , ILogger logger)
 {
     _configuration        = configuration;
     _stockRepository      = stockRepository;
     _stockService         = stockService;
     _discountService      = discountService;
     _paymentGatewayClient = paymentGatewayClient;
     _logger = logger;
 }
 public JsonResult Register(int customerId)
 {
     if (customerId.ToString() != null)
     {
         _paymentGatewayClient = new PaymentGatewayClient(new HttpClient());
         List <string> items = new List <string>()
         {
             "Breads", "Milk", "Biscuits", "Dryfruits"
         };
         ShoppingService shoppingService = new ShoppingService(customerId, _stockService, _discountService, _paymentGatewayClient, _logger);
         var             count           = shoppingService.BuyItems(items);
         var             result          = count > 0 ? $"Shopping done for {count} products" : $"Shopping done for { count} product";
         return(Json(result));
     }
     return(Json("Invalid Customer Id"));
 }
 public PaymentRepository(IPaymentGatewayClient paymentGatewayClient)
 {
     _paymentGatewayClient = paymentGatewayClient;
 }
示例#5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FeatureToggleServiceTest" /> class.
 /// </summary>
 public ClientTests()
 {
     this.paymentGatewayClient = this.GetService <IPaymentGatewayClient>();
 }
 public PaymentGatewayService(IPaymentGatewayClient paymentGatewayClient)
 {
     _paymentGatewayClient = paymentGatewayClient;
 }
示例#7
0
 public CreateAndReadPaymentTests(IPaymentGatewayClient paymentGatewayClient)
 {
     _paymentGatewayClient = paymentGatewayClient;
 }