/// <summary>
 /// Initializes a new instance of <see cref="CreateOrUpdateTemplateService"/> class.
 /// </summary>
 /// <param name="marainServicesTenancy">Marain tenancy services.</param>
 /// <param name="tenantedTemplateStoreFactory">Template store factory.</param>
 public CreateOrUpdateTemplateService(
     IMarainServicesTenancy marainServicesTenancy,
     ITenantedNotificationTemplateStoreFactory tenantedTemplateStoreFactory)
 {
     this.marainServicesTenancy = marainServicesTenancy
                                  ?? throw new ArgumentNullException(nameof(marainServicesTenancy));
     this.tenantedTemplateStoreFactory = tenantedTemplateStoreFactory
                                         ?? throw new ArgumentNullException(nameof(tenantedTemplateStoreFactory));
 }
 /// <summary>
 /// Initializes a new instance of <see cref="GenerateTemplateService"/> class.
 /// </summary>
 /// <param name="marainServicesTenancy">Marain tenancy services.</param>
 /// <param name="tenantedTemplateStoreFactory">Template store factory.</param>
 /// <param name="generateTemplateComposer">The composer to generate the templated notification per communication channel.</param>
 /// <param name="logger">The logger for GenerateTemplateService.</param>
 public GenerateTemplateService(
     IMarainServicesTenancy marainServicesTenancy,
     ITenantedNotificationTemplateStoreFactory tenantedTemplateStoreFactory,
     IGenerateTemplateComposer generateTemplateComposer,
     ILogger <GenerateTemplateService> logger)
 {
     this.marainServicesTenancy        = marainServicesTenancy;
     this.tenantedTemplateStoreFactory = tenantedTemplateStoreFactory;
     this.logger = logger;
     this.generateTemplateComposer = generateTemplateComposer;
 }
Beispiel #3
0
 /// <summary>
 /// Initializes a new instance of <see cref="GetTemplateService"/> class.
 /// </summary>
 /// <param name="marainServicesTenancy">Marain tenancy services.</param>
 /// <param name="tenantedTemplateStoreFactory">Template store factory.</param>
 /// <param name="webPushTemplateMapper">WebPush Template Mapper.</param>
 /// <param name="emailTemplateMapper">Email Template Mapper.</param>
 /// <param name="smsTemplateMapper"><see cref="SmsTemplateMapper"/>.</param>
 public GetTemplateService(
     IMarainServicesTenancy marainServicesTenancy,
     ITenantedNotificationTemplateStoreFactory tenantedTemplateStoreFactory,
     WebPushTemplateMapper webPushTemplateMapper,
     EmailTemplateMapper emailTemplateMapper,
     SmsTemplateMapper smsTemplateMapper)
 {
     this.marainServicesTenancy        = marainServicesTenancy;
     this.tenantedTemplateStoreFactory = tenantedTemplateStoreFactory;
     this.webPushTemplateMapper        = webPushTemplateMapper;
     this.emailTemplateMapper          = emailTemplateMapper;
     this.smsTemplateMapper            = smsTemplateMapper;
 }
Beispiel #4
0
        public async Task GivenIHaveCreatedAndStoredANotificationTemplate(Table table)
        {
            ITenantedNotificationTemplateStoreFactory storeFactory = this.serviceProvider.GetRequiredService <ITenantedNotificationTemplateStoreFactory>();
            IJsonSerializerSettingsProvider           serializerSettingsProvider = this.serviceProvider.GetRequiredService <IJsonSerializerSettingsProvider>();

            NotificationTemplate notificationTemplate = BuildNotificationTemplateFrom(table.Rows[0], serializerSettingsProvider.Instance);

            INotificationTemplateStore store = await storeFactory.GetTemplateStoreForTenantAsync(this.featureContext.GetTransientTenant()).ConfigureAwait(false);

            EmailTemplate?result = await store.CreateOrUpdate("testshouldbreak", CommunicationType.Email, null, notificationTemplate.EmailTemplate !).ConfigureAwait(false);

            this.scenarioContext.Set(result);
        }
Beispiel #5
0
        public async Task GivenIHaveCreatedAndStoredASmsNotificationTemplate(Table table)
        {
            ITenantedNotificationTemplateStoreFactory storeFactory = this.serviceProvider.GetRequiredService <ITenantedNotificationTemplateStoreFactory>();
            SmsTemplate notificationTemplate = BuildSmsNotificationTemplateFrom(table.Rows[0]);

            INotificationTemplateStore?store = await storeFactory.GetTemplateStoreForTenantAsync(this.featureContext.GetTransientTenant()).ConfigureAwait(false);

            await store.CreateOrUpdate(notificationTemplate.NotificationType !, CommunicationType.Sms, notificationTemplate.ETag, notificationTemplate).ConfigureAwait(false);

            (SmsTemplate, string?)smsTemplate = await store.GetAsync <SmsTemplate>(notificationTemplate.NotificationType !, CommunicationType.Sms).ConfigureAwait(false);

            smsTemplate.Item1.ETag = smsTemplate.Item2;
            this.scenarioContext.Set(smsTemplate.Item1);
        }
Beispiel #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DispatchNotificationActivity"/> class.
 /// </summary>
 /// <param name="tenantProvider">The tenant provider.</param>
 /// <param name="notificationStoreFactory">The factory for the notification store.</param>
 /// <param name="tenantedTemplateStoreFactory">The factory for the templated store.</param>
 /// <param name="generateTemplateComposer">The composer to generate the templated notification per communication channel.</param>
 /// <param name="airshipClientFactory">The Airship Factory.</param>
 /// <param name="configuration">IConfiguration.</param>
 public DispatchNotificationActivity(
     ITenantProvider tenantProvider,
     ITenantedUserNotificationStoreFactory notificationStoreFactory,
     ITenantedNotificationTemplateStoreFactory tenantedTemplateStoreFactory,
     IGenerateTemplateComposer generateTemplateComposer,
     IAirshipClientFactory airshipClientFactory,
     IConfiguration configuration)
 {
     this.tenantProvider = tenantProvider
                           ?? throw new ArgumentNullException(nameof(tenantProvider));
     this.notificationStoreFactory = notificationStoreFactory
                                     ?? throw new ArgumentNullException(nameof(notificationStoreFactory));
     this.tenantedTemplateStoreFactory = tenantedTemplateStoreFactory
                                         ?? throw new ArgumentNullException(nameof(tenantedTemplateStoreFactory));
     this.generateTemplateComposer = generateTemplateComposer
                                     ?? throw new ArgumentNullException(nameof(generateTemplateComposer));
     this.airshipClientFactory = airshipClientFactory
                                 ?? throw new ArgumentNullException(nameof(airshipClientFactory));
     this.configuration = configuration
                          ?? throw new ArgumentNullException(nameof(configuration));
 }