diff --git a/EnvelopeGenerator.Application/Configurations/GtxMessaging/SmsParams.cs b/EnvelopeGenerator.Application/Configurations/GtxMessaging/SmsParams.cs deleted file mode 100644 index eae4b63f..00000000 --- a/EnvelopeGenerator.Application/Configurations/GtxMessaging/SmsParams.cs +++ /dev/null @@ -1,21 +0,0 @@ -using DigitalData.Core.Abstractions.Client; -namespace EnvelopeGenerator.Application.Configurations.GtxMessaging -{ - /// - /// https://www.gtx-messaging.com/en/api-docs/sms-rest-api/ - /// - public class SmsParams : IHttpClientOptions - { - public required string Uri { get; init; } - - public string? Path { get; init; } - - public Dictionary? Headers { get; init; } - - public Dictionary? QueryParams { get; init; } - - public string RecipientQueryParamName { get; init; } = "to"; - - public string MessageQueryParamName { get; init; } = "text"; - } -} \ No newline at end of file diff --git a/EnvelopeGenerator.Application/Configurations/GtxMessagingParams.cs b/EnvelopeGenerator.Application/Configurations/GtxMessagingParams.cs new file mode 100644 index 00000000..837baf7d --- /dev/null +++ b/EnvelopeGenerator.Application/Configurations/GtxMessagingParams.cs @@ -0,0 +1,20 @@ +using DigitalData.Core.Abstractions.Client; +namespace EnvelopeGenerator.Application.Configurations; + +/// +/// https://www.gtx-messaging.com/en/api-docs/sms-rest-api/ +/// +public class GtxMessagingParams : IHttpClientOptions +{ + public required string Uri { get; init; } + + public string? Path { get; init; } + + public Dictionary? Headers { get; init; } + + public Dictionary? QueryParams { get; init; } + + public string RecipientQueryParamName { get; init; } = "to"; + + public string MessageQueryParamName { get; init; } = "text"; +} \ No newline at end of file diff --git a/EnvelopeGenerator.Application/Extensions/DIExtensions.cs b/EnvelopeGenerator.Application/Extensions/DIExtensions.cs index 3ad13d27..7ef576c0 100644 --- a/EnvelopeGenerator.Application/Extensions/DIExtensions.cs +++ b/EnvelopeGenerator.Application/Extensions/DIExtensions.cs @@ -9,7 +9,6 @@ using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; using DigitalData.Core.Client; -using EnvelopeGenerator.Application.Configurations.GtxMessaging; using QRCoder; namespace EnvelopeGenerator.Application.Extensions @@ -59,7 +58,7 @@ namespace EnvelopeGenerator.Application.Extensions services.ConfigureByTypeName(config); services.ConfigureByTypeName(config); - services.AddHttpClientService(config.GetSection(nameof(SmsParams))); + services.AddHttpClientService(config.GetSection(nameof(GtxMessagingParams))); services.TryAddSingleton(); services.TryAddSingleton(); services.TryAddSingleton(); diff --git a/EnvelopeGenerator.Application/Services/GTXSmsSender.cs b/EnvelopeGenerator.Application/Services/GTXSmsSender.cs index 319700fb..5841d5d8 100644 --- a/EnvelopeGenerator.Application/Services/GTXSmsSender.cs +++ b/EnvelopeGenerator.Application/Services/GTXSmsSender.cs @@ -1,7 +1,7 @@ using AutoMapper; using DigitalData.Core.Abstractions.Client; using DigitalData.Core.Client; -using EnvelopeGenerator.Application.Configurations.GtxMessaging; +using EnvelopeGenerator.Application.Configurations; using EnvelopeGenerator.Application.Contracts; using EnvelopeGenerator.Application.DTOs.Messaging; using Microsoft.Extensions.Options; @@ -11,15 +11,15 @@ namespace EnvelopeGenerator.Application.Services; //TODO: move to DigitalData.Core public class GTXSmsSender : ISmsSender { - private readonly IHttpClientService _smsClient; + private readonly IHttpClientService _smsClient; - private readonly SmsParams _smsParams; + private readonly GtxMessagingParams _smsParams; private readonly IMapper _mapper; public string ServiceProvider { get; } - public GTXSmsSender(IHttpClientService smsClient, IOptions smsParamsOptions, IMapper mapper) + public GTXSmsSender(IHttpClientService smsClient, IOptions smsParamsOptions, IMapper mapper) { _smsClient = smsClient; _smsParams = smsParamsOptions.Value; diff --git a/EnvelopeGenerator.Web/appsettings.json b/EnvelopeGenerator.Web/appsettings.json index 8d71fd3c..6b8481b9 100644 --- a/EnvelopeGenerator.Web/appsettings.json +++ b/EnvelopeGenerator.Web/appsettings.json @@ -121,10 +121,7 @@ "[REASON]": "" } }, - "GTXMessagingConfig": { - "AuthKey": "ep$?A!Gs" - }, - "SmsParams": { + "GtxMessagingParams": { "Uri": "https://rest.gtx-messaging.net", "Path": "smsc/sendsms/f566f7e5-bdf2-4a9a-bf52-ed88215a432e/json", "Headers": {},