28 lines
988 B
C#
28 lines
988 B
C#
using DigitalData.Core.Abstractions.Client;
|
|
using EnvelopeGenerator.Application.Configurations.GtxMessaging;
|
|
using EnvelopeGenerator.Application.Contracts;
|
|
using Microsoft.Extensions.Options;
|
|
|
|
namespace EnvelopeGenerator.Application.Services
|
|
{
|
|
public class GtxMessagingService : IMessagingService
|
|
{
|
|
private readonly IHttpClientService<SmsParams> _smsClient;
|
|
|
|
private readonly SmsParams _smsParams;
|
|
|
|
public GtxMessagingService(IHttpClientService<SmsParams> smsClient, IOptions<SmsParams> smsParamsOptions)
|
|
{
|
|
_smsClient = smsClient;
|
|
_smsParams = smsParamsOptions.Value;
|
|
}
|
|
|
|
public async Task SendSmsAsync(string recipient, string message)
|
|
{
|
|
await _smsClient.FetchAsync(queryParams: new Dictionary<string, object?>() {
|
|
{ _smsParams.RecipientQueryParamName, recipient },
|
|
{ _smsParams.MessageQueryParamName, message }
|
|
});
|
|
}
|
|
}
|
|
} |