43 lines
1.7 KiB
C#
43 lines
1.7 KiB
C#
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<EnvelopeDeletedNotification>
|
|
{
|
|
public SendDeletedMailHandler(
|
|
IRepository<EmailTemplate> tempRepo,
|
|
IRepository<EmailOut> emailOutRepo,
|
|
IOptions<MailParams> mailParamsOptions,
|
|
IOptions<DispatcherParams> 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<string, string> CreatePlaceHolders(EnvelopeDeletedNotification notification)
|
|
{
|
|
var senderName = notification.Envelope.User?.Email;
|
|
if (string.IsNullOrWhiteSpace(senderName))
|
|
senderName = notification.SenderReference;
|
|
|
|
return new Dictionary<string, string>
|
|
{
|
|
["[NAME_RECEIVER]"] = notification.EnvelopeReceiver.Name ?? string.Empty,
|
|
["[NAME_SENDER]"] = senderName ?? string.Empty,
|
|
["[DOCUMENT_TITLE]"] = notification.Envelope.Title ?? string.Empty,
|
|
["[REASON]"] = notification.Reason
|
|
};
|
|
}
|
|
}
|