diff --git a/EnvelopeGenerator.Web/Models/TotpSmsParams.cs b/EnvelopeGenerator.Application/Configurations/TotpSmsParams.cs similarity index 93% rename from EnvelopeGenerator.Web/Models/TotpSmsParams.cs rename to EnvelopeGenerator.Application/Configurations/TotpSmsParams.cs index d515da53..13501fe4 100644 --- a/EnvelopeGenerator.Web/Models/TotpSmsParams.cs +++ b/EnvelopeGenerator.Application/Configurations/TotpSmsParams.cs @@ -1,6 +1,6 @@ using System.Globalization; -namespace EnvelopeGenerator.Web.Models +namespace EnvelopeGenerator.Application.Configurations { public class TotpSmsParams { diff --git a/EnvelopeGenerator.Application/Contracts/IEnvelopeSmsService.cs b/EnvelopeGenerator.Application/Contracts/IEnvelopeSmsService.cs new file mode 100644 index 00000000..6efc6abf --- /dev/null +++ b/EnvelopeGenerator.Application/Contracts/IEnvelopeSmsService.cs @@ -0,0 +1,5 @@ +namespace EnvelopeGenerator.Application.Contracts; + +public interface IEnvelopeSmsService +{ +} \ No newline at end of file diff --git a/EnvelopeGenerator.Application/Extensions/DIExtensions.cs b/EnvelopeGenerator.Application/Extensions/DIExtensions.cs index ba72c561..2a81c47a 100644 --- a/EnvelopeGenerator.Application/Extensions/DIExtensions.cs +++ b/EnvelopeGenerator.Application/Extensions/DIExtensions.cs @@ -16,7 +16,7 @@ namespace EnvelopeGenerator.Application.Extensions { public static class DIExtensions { - public static IServiceCollection AddEnvelopeGenerator(this IServiceCollection services, IConfigurationSection dispatcherConfigSection, IConfigurationSection mailConfigSection, IConfigurationSection smsConfigSection, IConfigurationSection codeGeneratorConfigSection, IConfigurationSection envelopeReceiverCacheParamsSection) + public static IServiceCollection AddEnvelopeGenerator(this IServiceCollection services, IConfigurationSection dispatcherConfigSection, IConfigurationSection mailConfigSection, IConfigurationSection smsConfigSection, IConfigurationSection codeGeneratorConfigSection, IConfigurationSection envelopeReceiverCacheParamsSection, IConfigurationSection totpSmsParamsSection) { //Inject CRUD Service and repositoriesad services.TryAddScoped(); @@ -58,9 +58,11 @@ namespace EnvelopeGenerator.Application.Extensions services.Configure(mailConfigSection); services.Configure(codeGeneratorConfigSection); services.Configure(envelopeReceiverCacheParamsSection); + services.Configure(totpSmsParamsSection); services.AddHttpClientService(smsConfigSection); services.TryAddSingleton(); + services.TryAddSingleton(); services.TryAddSingleton(); services.TryAddSingleton(); @@ -72,6 +74,7 @@ namespace EnvelopeGenerator.Application.Extensions mailConfigSection: config.GetSection("MailConfig"), smsConfigSection: config.GetSection("SmsConfig"), codeGeneratorConfigSection: config.GetSection("CodeGeneratorParams"), - envelopeReceiverCacheParamsSection: config.GetSection("EnvelopeReceiverCacheParams")); + envelopeReceiverCacheParamsSection: config.GetSection("EnvelopeReceiverCacheParams"), + totpSmsParamsSection: config.GetSection("TotpSmsParams")); } } \ No newline at end of file diff --git a/EnvelopeGenerator.Application/Services/EnvelopeSmsService.cs b/EnvelopeGenerator.Application/Services/EnvelopeSmsService.cs new file mode 100644 index 00000000..075e0249 --- /dev/null +++ b/EnvelopeGenerator.Application/Services/EnvelopeSmsService.cs @@ -0,0 +1,18 @@ +using EnvelopeGenerator.Application.Configurations; +using EnvelopeGenerator.Application.Contracts; +using Microsoft.Extensions.Options; + +namespace EnvelopeGenerator.Application.Services; + +public class EnvelopeSmsService : IEnvelopeSmsService +{ + private readonly ISmsSender _sender; + + private readonly TotpSmsParams _totpSmsParams; + + public EnvelopeSmsService(ISmsSender sender, IOptions totpSmsParamsOptions) + { + _sender = sender; + _totpSmsParams = totpSmsParamsOptions.Value; + } +} \ No newline at end of file