renamed(SmsParams): umbenannt in GtxMessagingParams

This commit is contained in:
Developer 02
2025-01-31 13:06:11 +01:00
parent 120c8623dd
commit 28fdf0a115
5 changed files with 26 additions and 31 deletions

View File

@@ -1,21 +0,0 @@
using DigitalData.Core.Abstractions.Client;
namespace EnvelopeGenerator.Application.Configurations.GtxMessaging
{
/// <summary>
/// https://www.gtx-messaging.com/en/api-docs/sms-rest-api/
/// </summary>
public class SmsParams : IHttpClientOptions
{
public required string Uri { get; init; }
public string? Path { get; init; }
public Dictionary<string, object>? Headers { get; init; }
public Dictionary<string, object?>? QueryParams { get; init; }
public string RecipientQueryParamName { get; init; } = "to";
public string MessageQueryParamName { get; init; } = "text";
}
}

View File

@@ -0,0 +1,20 @@
using DigitalData.Core.Abstractions.Client;
namespace EnvelopeGenerator.Application.Configurations;
/// <summary>
/// https://www.gtx-messaging.com/en/api-docs/sms-rest-api/
/// </summary>
public class GtxMessagingParams : IHttpClientOptions
{
public required string Uri { get; init; }
public string? Path { get; init; }
public Dictionary<string, object>? Headers { get; init; }
public Dictionary<string, object?>? QueryParams { get; init; }
public string RecipientQueryParamName { get; init; } = "to";
public string MessageQueryParamName { get; init; } = "text";
}

View File

@@ -9,7 +9,6 @@ using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions; using Microsoft.Extensions.DependencyInjection.Extensions;
using DigitalData.Core.Client; using DigitalData.Core.Client;
using EnvelopeGenerator.Application.Configurations.GtxMessaging;
using QRCoder; using QRCoder;
namespace EnvelopeGenerator.Application.Extensions namespace EnvelopeGenerator.Application.Extensions
@@ -59,7 +58,7 @@ namespace EnvelopeGenerator.Application.Extensions
services.ConfigureByTypeName<CodeGeneratorParams>(config); services.ConfigureByTypeName<CodeGeneratorParams>(config);
services.ConfigureByTypeName<TotpSmsParams>(config); services.ConfigureByTypeName<TotpSmsParams>(config);
services.AddHttpClientService<SmsParams>(config.GetSection(nameof(SmsParams))); services.AddHttpClientService<GtxMessagingParams>(config.GetSection(nameof(GtxMessagingParams)));
services.TryAddSingleton<ISmsSender, GTXSmsSender>(); services.TryAddSingleton<ISmsSender, GTXSmsSender>();
services.TryAddSingleton<IEnvelopeSmsService, EnvelopeSmsService>(); services.TryAddSingleton<IEnvelopeSmsService, EnvelopeSmsService>();
services.TryAddSingleton<ICodeGenerator, CodeGenerator>(); services.TryAddSingleton<ICodeGenerator, CodeGenerator>();

View File

@@ -1,7 +1,7 @@
using AutoMapper; using AutoMapper;
using DigitalData.Core.Abstractions.Client; using DigitalData.Core.Abstractions.Client;
using DigitalData.Core.Client; using DigitalData.Core.Client;
using EnvelopeGenerator.Application.Configurations.GtxMessaging; using EnvelopeGenerator.Application.Configurations;
using EnvelopeGenerator.Application.Contracts; using EnvelopeGenerator.Application.Contracts;
using EnvelopeGenerator.Application.DTOs.Messaging; using EnvelopeGenerator.Application.DTOs.Messaging;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
@@ -11,15 +11,15 @@ namespace EnvelopeGenerator.Application.Services;
//TODO: move to DigitalData.Core //TODO: move to DigitalData.Core
public class GTXSmsSender : ISmsSender public class GTXSmsSender : ISmsSender
{ {
private readonly IHttpClientService<SmsParams> _smsClient; private readonly IHttpClientService<GtxMessagingParams> _smsClient;
private readonly SmsParams _smsParams; private readonly GtxMessagingParams _smsParams;
private readonly IMapper _mapper; private readonly IMapper _mapper;
public string ServiceProvider { get; } public string ServiceProvider { get; }
public GTXSmsSender(IHttpClientService<SmsParams> smsClient, IOptions<SmsParams> smsParamsOptions, IMapper mapper) public GTXSmsSender(IHttpClientService<GtxMessagingParams> smsClient, IOptions<GtxMessagingParams> smsParamsOptions, IMapper mapper)
{ {
_smsClient = smsClient; _smsClient = smsClient;
_smsParams = smsParamsOptions.Value; _smsParams = smsParamsOptions.Value;

View File

@@ -121,10 +121,7 @@
"[REASON]": "" "[REASON]": ""
} }
}, },
"GTXMessagingConfig": { "GtxMessagingParams": {
"AuthKey": "ep$?A!Gs"
},
"SmsParams": {
"Uri": "https://rest.gtx-messaging.net", "Uri": "https://rest.gtx-messaging.net",
"Path": "smsc/sendsms/f566f7e5-bdf2-4a9a-bf52-ed88215a432e/json", "Path": "smsc/sendsms/f566f7e5-bdf2-4a9a-bf52-ed88215a432e/json",
"Headers": {}, "Headers": {},