Refactor notification system

Introduced `EnvelopeNotificationBase` as a new base class for notifications, providing a unified structure with an abstract `GetTemplateType` method and optional attachments. Added `DocumentReceivedNotification` and updated `DocumentSignedNotification` to inherit from this base class, streamlining attachment handling and template type determination.

Refactored `IEnvelopeNotificationService` to use a generic `Notify` method, allowing for flexibility with different notification types. Updated `FinalizeEnvelopeCommandHandler` to align with the new attachment handling.

Added `EnvelopeNotificationExtensions` for converting attachments to `EmailAttachmentDto` objects and introduced `ReplacePlaceholderExtensions` for dynamic placeholder replacement in email templates using reflection. Removed outdated placeholder logic from `EnvelopeNotificationService`.
This commit is contained in:
2026-10-28 16:25:19 +01:00
parent 8b7f99eb76
commit 8aabc3e233
8 changed files with 181 additions and 30 deletions

View File

@@ -0,0 +1,15 @@
using DigitalData.MessagingService.Application.Common.Dto;
namespace EnvelopeGenerator.Infrastructure.Notification;
public static class EnvelopeNotificationExtensions
{
public static EmailAttachmentDto ToEmailAttachmentDto(this (string FileName, byte[] Content) attachment) => new()
{
FileName = attachment.FileName,
Content = attachment.Content
};
public static IEnumerable<EmailAttachmentDto> ToEmailAttachmentDto(this IEnumerable<(string FileName, byte[] Content)> attachments)
=> attachments.Select(ToEmailAttachmentDto);
}