1631786ce2
Add push contracts, provider delivery and channel diagnostics. Link email channels to services and document migration and validation. Ref: IT-1074
31 lines
938 B
C#
31 lines
938 B
C#
namespace HrynCo.NotificationService.Worker;
|
|
|
|
using HrynCo.NotificationService.Contracts.Messages;
|
|
using HrynCo.NotificationService.Worker.Services.EmailProcessing;
|
|
using Hrynco.RabbitMq;
|
|
|
|
internal static class SendEmailDeliveryValidator
|
|
{
|
|
public static string? GetValidationError(
|
|
SendEmailMessage message,
|
|
RabbitMqMessageContext context,
|
|
SupportedMessageType supportedMessageType)
|
|
{
|
|
if (string.IsNullOrWhiteSpace(context.MessageId))
|
|
return "AMQP MessageId is required.";
|
|
|
|
if (SupportedMessageTypeParser.Parse(context.MessageType) != supportedMessageType)
|
|
return $"Unsupported AMQP message type '{context.MessageType ?? "<missing>"}'.";
|
|
|
|
try
|
|
{
|
|
SendEmailMessageValidator.Validate(message);
|
|
return null;
|
|
}
|
|
catch (InvalidDataException exception)
|
|
{
|
|
return exception.Message;
|
|
}
|
|
}
|
|
}
|