public ConfigurationProviderFactory(ILogger logger) { var config = ConfigurationManager.GetSection("commerceApp") as CommerceAppConfigurationSection; if (config?.PaymentProcessor.Type != null && config.CustomerNotifier.Type != null) { _paymentProcessor = Activator.CreateInstance(Type.GetType(config.PaymentProcessor.Type)) as IPaymentProcessor; _customerNotifier = Activator.CreateInstance(Type.GetType(config.CustomerNotifier.Type)) as ICustomerNotifier; if (_customerNotifier != null) { _customerNotifier.FromAddress = config.CustomerNotifier.FromAddress; _customerNotifier.SmtpServer = config.CustomerNotifier.SmtpServer; } _events = new CommerceAppExtensionPoints(); foreach (CommerceAppModuleElement element in config.Modules) { ICommerceModule module = Activator.CreateInstance(Type.GetType(element.Type)) as ICommerceModule; module.Initialize(_events); } } else { logger.Log("Incorrect configurations in App.config."); } }
public CommerceManager(IStoreRepository storeRepository, IConfigurationProviderFactory configFactory, ICustomerValidator customerValidator, ILogger logger) { _storeRepository = storeRepository; _paymentProcessor = configFactory.GetPaymentProcessor(); _customerNotifier = configFactory.GetCustomerNotifier(); _events = configFactory.GetEvents(); _customerValidator = customerValidator; _logger = logger; }
public void Initialize(ICommerceAppEvents extensions) { extensions.OrderItemProcessed += OnOrderItemProcessed; }