using DigitalData.Core.Abstraction.Application.Repository; using DigitalData.EmailProfilerDispatcher.Abstraction.Entities; using EnvelopeGenerator.Application.Common.Configurations; using EnvelopeGenerator.Domain.Constants; using EnvelopeGenerator.Domain.Entities; using Microsoft.Extensions.Options; namespace EnvelopeGenerator.Application.Common.Notifications.EnvelopeDeleted.Handlers; public class SendDeletedMailHandler : SendMailHandler { public SendDeletedMailHandler( IRepository tempRepo, IRepository emailOutRepo, IOptions mailParamsOptions, IOptions dispatcherParamsOptions) : base(tempRepo, emailOutRepo, mailParamsOptions, dispatcherParamsOptions) { } protected override void ConfigureEmailOut(EnvelopeDeletedNotification notification, EmailOut emailOut) { emailOut.ReferenceString = notification.EmailAddress; emailOut.ReferenceId = notification.EnvelopeReceiver.ReceiverId; emailOut.WfId = (int)EnvelopeStatus.MessageDeletionSent; } protected override Dictionary CreatePlaceHolders(EnvelopeDeletedNotification notification) { var senderName = notification.Envelope.User?.Email; if (string.IsNullOrWhiteSpace(senderName)) senderName = notification.SenderReference; return new Dictionary { ["[NAME_RECEIVER]"] = notification.EnvelopeReceiver.Name ?? string.Empty, ["[NAME_SENDER]"] = senderName ?? string.Empty, ["[DOCUMENT_TITLE]"] = notification.Envelope.Title ?? string.Empty, ["[REASON]"] = notification.Reason }; } }