public TwitterNotificationServiceIntegrationTest() { var container = new ServiceCollection(); container.AddDbContext <TwitterNotificationDbContext>(options => options.UseSqlServer("Data Source=(local);Initial Catalog=VirtoCommerce3;Persist Security Info=True;User ID=virto;Password=virto;MultipleActiveResultSets=True;Connect Timeout=30")); container.AddScoped <INotificationRepository, TwitterNotificationRepository>(); container.AddScoped <INotificationService, NotificationService>(); container.AddScoped <Func <INotificationRepository> >(provider => () => provider.CreateScope().ServiceProvider.GetService <INotificationRepository>()); container.AddScoped <IEventPublisher, InProcessBus>(); container.AddScoped <INotificationRegistrar, NotificationService>(); container.AddScoped <INotificationSearchService, NotificationSearchService>(); var serviceProvider = container.BuildServiceProvider(); _notificationService = serviceProvider.GetService <INotificationService>(); _notificationSearchService = serviceProvider.GetService <INotificationSearchService>(); if (AbstractTypeFactory <NotificationEntity> .AllTypeInfos.All(t => t.Type != typeof(TwitterNotificationEntity))) { AbstractTypeFactory <NotificationEntity> .RegisterType <TwitterNotificationEntity>(); } var registrar = serviceProvider.GetService <INotificationRegistrar>(); registrar.RegisterNotification <TwitterNotification>(); registrar.RegisterNotification <TwitterNotification, NotificationEntity>(); registrar.RegisterNotification <PostTwitterNotification>(); }
public OrderModuleController( ICustomerOrderService customerOrderService , ICustomerOrderSearchService searchService , IStoreService storeService , IUniqueNumberGenerator numberGenerator , IPlatformMemoryCache platformMemoryCache , Func <IOrderRepository> repositoryFactory , ICustomerOrderBuilder customerOrderBuilder , IShoppingCartService cartService , IChangeLogSearchService changeLogSearchService , INotificationTemplateRenderer notificationTemplateRenderer , INotificationSearchService notificationSearchService , ICustomerOrderTotalsCalculator totalsCalculator) { _customerOrderService = customerOrderService; _searchService = searchService; _uniqueNumberGenerator = numberGenerator; _storeService = storeService; _platformMemoryCache = platformMemoryCache; _repositoryFactory = repositoryFactory; //_securityService = securityService; //_permissionScopeService = permissionScopeService; _customerOrderBuilder = customerOrderBuilder; _cartService = cartService; _changeLogSearchService = changeLogSearchService; _notificationTemplateRenderer = notificationTemplateRenderer; _notificationSearchService = notificationSearchService; _totalsCalculator = totalsCalculator; }
public OrderModuleController( ICustomerOrderService customerOrderService , ICustomerOrderSearchService searchService , IStoreService storeService , IUniqueNumberGenerator numberGenerator , IPlatformMemoryCache platformMemoryCache , Func <IOrderRepository> repositoryFactory , ICustomerOrderBuilder customerOrderBuilder , IShoppingCartService cartService , IChangeLogSearchService changeLogSearchService , INotificationTemplateRenderer notificationTemplateRenderer , INotificationSearchService notificationSearchService , ICustomerOrderTotalsCalculator totalsCalculator , IAuthorizationService authorizationService , IConverter converter , IOptions <HtmlToPdfOptions> htmlToPdfOptions , IOptions <MvcNewtonsoftJsonOptions> jsonOptionsAccessor) { _customerOrderService = customerOrderService; _searchService = searchService; _uniqueNumberGenerator = numberGenerator; _storeService = storeService; _platformMemoryCache = platformMemoryCache; _repositoryFactory = repositoryFactory; _customerOrderBuilder = customerOrderBuilder; _cartService = cartService; _changeLogSearchService = changeLogSearchService; _notificationTemplateRenderer = notificationTemplateRenderer; _notificationSearchService = notificationSearchService; _totalsCalculator = totalsCalculator; _authorizationService = authorizationService; _htmlToPdfOptions = htmlToPdfOptions.Value; _converter = converter; _jsonOptions = jsonOptionsAccessor.Value; }
public static async Task <Notification> GetNotificationAsync(this INotificationSearchService service, string notificationType, TenantIdentity tenant = null, string responseGroup = null) { if (service == null) { throw new ArgumentNullException(nameof(service)); } var criteria = AbstractTypeFactory <NotificationSearchCriteria> .TryCreateInstance(); criteria.NotificationType = notificationType; //try to get with the Tenant criteria.Take = 1; criteria.ResponseGroup = responseGroup; if (tenant != null && !tenant.IsEmpty) { criteria.TenantId = tenant.Id; criteria.TenantType = tenant.Type; } var searchResult = await service.SearchNotificationsAsync(criteria); var result = searchResult?.Results.FirstOrDefault(x => x.TenantIdentity == tenant); if (result == null) { //Find first global notification (without tenant) criteria.TenantId = null; criteria.TenantType = null; searchResult = await service.SearchNotificationsAsync(criteria); result = searchResult?.Results.FirstOrDefault(x => x.TenantIdentity.IsEmpty); } return(result); }
public SendNotificationsSubscriptionChangedEventHandler(INotificationSearchService notificationSearchService, INotificationSender notificationSender, IStoreService storeService, UserManager <ApplicationUser> userManager, IMemberService memberService) { _notificationSearchService = notificationSearchService; _notificationSender = notificationSender; _storeService = storeService; _userManager = userManager; _memberService = memberService; }
public NotificationsController(INotificationSearchService notificationSearchService , INotificationService notificationService , INotificationTemplateRenderer notificationTemplateRender ) { _notificationSearchService = notificationSearchService; _notificationService = notificationService; _notificationTemplateRender = notificationTemplateRender; }
public SendNotificationsOrderChangedEventHandler(INotificationSender notificationSender, IStoreService storeService, IMemberService memberService, ISettingsManager settingsManager, UserManager <ApplicationUser> userManager, INotificationSearchService notificationSearchService) { _notificationSender = notificationSender; _storeService = storeService; _memberService = memberService; _settingsManager = settingsManager; _notificationSearchService = notificationSearchService; _userManager = userManager; }
public static async Task <T> GetNotificationAsync <T>(this INotificationSearchService service, TenantIdentity tenant = null) where T : Notification { if (service == null) { throw new ArgumentNullException(nameof(service)); } var result = await service.GetNotificationAsync(typeof(T).Name, tenant); return(result as T); }
public RequestCustomerReviewJob(ISettingsManager settingsManager, IItemService pItemService, ICrudService <Store> pStoreService, ICrudService <CustomerOrder> pCustomerOrderService, Func <ICustomerReviewRepository> pCustomerReviewRepository, ILogger <RequestCustomerReviewJob> pLog, INotificationSearchService pNotificationSearchService, INotificationSender pNotificationSender, IMemberResolver pMemberResolver) { _settingsManager = settingsManager; _log = pLog; _notificationSearchService = pNotificationSearchService; _notificationSender = pNotificationSender; _memberResolver = pMemberResolver; _storeService = pStoreService; _customerOrderService = pCustomerOrderService; _customerReviewRepository = pCustomerReviewRepository; _itemService = pItemService; }
public NotificationsExportImportManager(INotificationSearchService notificationSearchService, INotificationService notificationService) { _notificationSearchService = notificationSearchService; _notificationService = notificationService; _serializer = new JsonSerializer { ReferenceLoopHandling = ReferenceLoopHandling.Ignore, Formatting = Formatting.Indented, NullValueHandling = NullValueHandling.Ignore }; }
public NotificationsExportImportManager(INotificationSearchService notificationSearchService, INotificationService notificationService) { _notificationSearchService = notificationSearchService; _notificationService = notificationService; _serializer = new JsonSerializer { ReferenceLoopHandling = ReferenceLoopHandling.Ignore, Formatting = Formatting.Indented, NullValueHandling = NullValueHandling.Ignore, Converters = { new PolymorphicJsonConverter() }, ContractResolver = new CamelCasePropertyNamesContractResolver() }; }
public static async Task <Notification> GetNotificationAsync(this INotificationSearchService service, string notificationType, TenantIdentity tenant = null) { if (service == null) { throw new ArgumentNullException(nameof(service)); } var criteria = AbstractTypeFactory <NotificationSearchCriteria> .TryCreateInstance(); criteria.NotificationType = notificationType; criteria.Take = int.MaxValue; var searchResult = await service.SearchNotificationsAsync(criteria); //Find first global notification (without tenant) var result = searchResult.Results.Where(x => x.TenantIdentity.IsEmpty).FirstOrDefault(); if (tenant != null) { //If tenant is specified try to find a notification belongs to concrete tenant or use default as fallback result = searchResult.Results.Where(x => x.TenantIdentity == tenant).FirstOrDefault() ?? result; } return(result); }
public NotificationsExportImport(INotificationSearchService notificationSearchService, INotificationService notificationService, JsonSerializer jsonSerializer) { _notificationSearchService = notificationSearchService; _notificationService = notificationService; _jsonSerializer = jsonSerializer; }
public NotificationsExportImportManager(INotificationSearchService notificationSearchService, INotificationService notificationService) { _notificationSearchService = notificationSearchService; _notificationService = notificationService; }
public SampleService(INotificationSender notificationSender, INotificationSearchService notificationSearchService) { _notificationSender = notificationSender; _notificationSearchService = notificationSearchService; }