From 55140846ba3e5e2a87445cb7fa5a3524d0396e50 Mon Sep 17 00:00:00 2001 From: TekH Date: Mon, 16 Nov 2026 09:16:22 +0100 Subject: [PATCH] feat(notification): add typed payloads for non-link email templates Add strongly typed notification records for remaining email templates that do not require document URL composition. Each record maps template placeholders to explicit properties and returns the matching EmailTemplateType. Also includes XML documentation so placeholder-to-property mapping is self-describing. --- .../DocumentAccessCodeReceivedNotification.cs | 47 +++++++++++++++++++ .../DocumentCompletedNotification.cs | 27 +++++++++++ .../DocumentDeletedNotification.cs | 37 +++++++++++++++ .../DocumentRejectedAdmNotification.cs | 37 +++++++++++++++ .../DocumentRejectedRec2Notification.cs | 32 +++++++++++++ .../DocumentRejectedRecNotification.cs | 32 +++++++++++++ .../Notification/TotpSecretNotification.cs | 27 +++++++++++ 7 files changed, 239 insertions(+) create mode 100644 EnvelopeGenerator.Application/Common/Interfaces/Services/Notification/DocumentAccessCodeReceivedNotification.cs create mode 100644 EnvelopeGenerator.Application/Common/Interfaces/Services/Notification/DocumentCompletedNotification.cs create mode 100644 EnvelopeGenerator.Application/Common/Interfaces/Services/Notification/DocumentDeletedNotification.cs create mode 100644 EnvelopeGenerator.Application/Common/Interfaces/Services/Notification/DocumentRejectedAdmNotification.cs create mode 100644 EnvelopeGenerator.Application/Common/Interfaces/Services/Notification/DocumentRejectedRec2Notification.cs create mode 100644 EnvelopeGenerator.Application/Common/Interfaces/Services/Notification/DocumentRejectedRecNotification.cs create mode 100644 EnvelopeGenerator.Application/Common/Interfaces/Services/Notification/TotpSecretNotification.cs diff --git a/EnvelopeGenerator.Application/Common/Interfaces/Services/Notification/DocumentAccessCodeReceivedNotification.cs b/EnvelopeGenerator.Application/Common/Interfaces/Services/Notification/DocumentAccessCodeReceivedNotification.cs new file mode 100644 index 00000000..e15778f9 --- /dev/null +++ b/EnvelopeGenerator.Application/Common/Interfaces/Services/Notification/DocumentAccessCodeReceivedNotification.cs @@ -0,0 +1,47 @@ +using EnvelopeGenerator.Domain.Constants; + +namespace EnvelopeGenerator.Application.Common.Interfaces.Services.Notification; + +/// +/// Payload for template. +/// +public record DocumentAccessCodeReceivedNotification : EnvelopeNotificationBase +{ + /// + /// Replaces [DOCUMENT_TITLE] in mail subject/body. + /// + public required string DocumentTitle { get; init; } + + /// + /// Replaces [NAME_RECEIVER] in mail body. + /// + public required string NameReceiver { get; init; } + + /// + /// Replaces [NAME_SENDER] in mail body. + /// + public required string NameSender { get; init; } + + /// + /// Determines [SIGNATURE_TYPE] text in mail body. + /// + public required bool IsReadAndConfirm { private get; init; } + + /// + /// Replaces [SIGNATURE_TYPE] in mail body. + /// + public string SignatureType => IsReadAndConfirm ? "Signieren" : "Lesen und bestätigen"; + + /// + /// Replaces [DOCUMENT_ACCESS_CODE] in mail body. + /// + public required string DocumentAccessCode { get; init; } + + /// + /// Replaces [NAME_PORTAL] in mail body. + /// + public string NamePortal { get; init; } = "signFLOW Portal"; + + /// + public override EmailTemplateType GetTemplateType() => EmailTemplateType.DocumentAccessCodeReceived; +} diff --git a/EnvelopeGenerator.Application/Common/Interfaces/Services/Notification/DocumentCompletedNotification.cs b/EnvelopeGenerator.Application/Common/Interfaces/Services/Notification/DocumentCompletedNotification.cs new file mode 100644 index 00000000..1345ec5f --- /dev/null +++ b/EnvelopeGenerator.Application/Common/Interfaces/Services/Notification/DocumentCompletedNotification.cs @@ -0,0 +1,27 @@ +using EnvelopeGenerator.Domain.Constants; + +namespace EnvelopeGenerator.Application.Common.Interfaces.Services.Notification; + +/// +/// Payload for template. +/// +public record DocumentCompletedNotification : EnvelopeNotificationBase +{ + /// + /// Replaces [DOCUMENT_TITLE] in mail subject/body. + /// + public required string DocumentTitle { get; init; } + + /// + /// Replaces [NAME_RECEIVER] in mail body. + /// + public required string NameReceiver { get; init; } + + /// + /// Replaces [NAME_PORTAL] in mail body. + /// + public string NamePortal { get; init; } = "signFLOW Portal"; + + /// + public override EmailTemplateType GetTemplateType() => EmailTemplateType.DocumentCompleted; +} diff --git a/EnvelopeGenerator.Application/Common/Interfaces/Services/Notification/DocumentDeletedNotification.cs b/EnvelopeGenerator.Application/Common/Interfaces/Services/Notification/DocumentDeletedNotification.cs new file mode 100644 index 00000000..dca00acf --- /dev/null +++ b/EnvelopeGenerator.Application/Common/Interfaces/Services/Notification/DocumentDeletedNotification.cs @@ -0,0 +1,37 @@ +using EnvelopeGenerator.Domain.Constants; + +namespace EnvelopeGenerator.Application.Common.Interfaces.Services.Notification; + +/// +/// Payload for template. +/// +public record DocumentDeletedNotification : EnvelopeNotificationBase +{ + /// + /// Replaces [DOCUMENT_TITLE] in mail subject/body. + /// + public required string DocumentTitle { get; init; } + + /// + /// Replaces [NAME_RECEIVER] in mail body. + /// + public required string NameReceiver { get; init; } + + /// + /// Replaces [NAME_SENDER] in mail body. + /// + public required string NameSender { get; init; } + + /// + /// Replaces [REASON] in mail body. + /// + public required string Reason { get; init; } + + /// + /// Replaces [NAME_PORTAL] in mail body. + /// + public string NamePortal { get; init; } = "signFLOW Portal"; + + /// + public override EmailTemplateType GetTemplateType() => EmailTemplateType.DocumentDeleted; +} diff --git a/EnvelopeGenerator.Application/Common/Interfaces/Services/Notification/DocumentRejectedAdmNotification.cs b/EnvelopeGenerator.Application/Common/Interfaces/Services/Notification/DocumentRejectedAdmNotification.cs new file mode 100644 index 00000000..2b5ce019 --- /dev/null +++ b/EnvelopeGenerator.Application/Common/Interfaces/Services/Notification/DocumentRejectedAdmNotification.cs @@ -0,0 +1,37 @@ +using EnvelopeGenerator.Domain.Constants; + +namespace EnvelopeGenerator.Application.Common.Interfaces.Services.Notification; + +/// +/// Payload for template. +/// +public record DocumentRejectedAdmNotification : EnvelopeNotificationBase +{ + /// + /// Replaces [DOCUMENT_TITLE] in mail subject/body. + /// + public required string DocumentTitle { get; init; } + + /// + /// Replaces [NAME_SENDER] in mail body. + /// + public required string NameSender { get; init; } + + /// + /// Replaces [NAME_RECEIVER] in mail body. + /// + public required string NameReceiver { get; init; } + + /// + /// Replaces [REASON] in mail body. + /// + public required string Reason { get; init; } + + /// + /// Replaces [NAME_PORTAL] in mail body. + /// + public string NamePortal { get; init; } = "signFLOW Portal"; + + /// + public override EmailTemplateType GetTemplateType() => EmailTemplateType.DocumentRejected_ADM; +} diff --git a/EnvelopeGenerator.Application/Common/Interfaces/Services/Notification/DocumentRejectedRec2Notification.cs b/EnvelopeGenerator.Application/Common/Interfaces/Services/Notification/DocumentRejectedRec2Notification.cs new file mode 100644 index 00000000..17eb0290 --- /dev/null +++ b/EnvelopeGenerator.Application/Common/Interfaces/Services/Notification/DocumentRejectedRec2Notification.cs @@ -0,0 +1,32 @@ +using EnvelopeGenerator.Domain.Constants; + +namespace EnvelopeGenerator.Application.Common.Interfaces.Services.Notification; + +/// +/// Payload for template. +/// +public record DocumentRejectedRec2Notification : EnvelopeNotificationBase +{ + /// + /// Replaces [DOCUMENT_TITLE] in mail subject/body. + /// + public required string DocumentTitle { get; init; } + + /// + /// Replaces [NAME_RECEIVER] in mail body. + /// + public required string NameReceiver { get; init; } + + /// + /// Replaces [NAME_SENDER] in mail body. + /// + public required string NameSender { get; init; } + + /// + /// Replaces [NAME_PORTAL] in mail body. + /// + public string NamePortal { get; init; } = "signFLOW Portal"; + + /// + public override EmailTemplateType GetTemplateType() => EmailTemplateType.DocumentRejected_REC_2; +} diff --git a/EnvelopeGenerator.Application/Common/Interfaces/Services/Notification/DocumentRejectedRecNotification.cs b/EnvelopeGenerator.Application/Common/Interfaces/Services/Notification/DocumentRejectedRecNotification.cs new file mode 100644 index 00000000..0eae5f33 --- /dev/null +++ b/EnvelopeGenerator.Application/Common/Interfaces/Services/Notification/DocumentRejectedRecNotification.cs @@ -0,0 +1,32 @@ +using EnvelopeGenerator.Domain.Constants; + +namespace EnvelopeGenerator.Application.Common.Interfaces.Services.Notification; + +/// +/// Payload for template. +/// +public record DocumentRejectedRecNotification : EnvelopeNotificationBase +{ + /// + /// Replaces [DOCUMENT_TITLE] in mail subject/body. + /// + public required string DocumentTitle { get; init; } + + /// + /// Replaces [NAME_RECEIVER] in mail body. + /// + public required string NameReceiver { get; init; } + + /// + /// Replaces [NAME_SENDER] in mail body. + /// + public required string NameSender { get; init; } + + /// + /// Replaces [NAME_PORTAL] in mail body. + /// + public string NamePortal { get; init; } = "signFLOW Portal"; + + /// + public override EmailTemplateType GetTemplateType() => EmailTemplateType.DocumentRejected_REC; +} diff --git a/EnvelopeGenerator.Application/Common/Interfaces/Services/Notification/TotpSecretNotification.cs b/EnvelopeGenerator.Application/Common/Interfaces/Services/Notification/TotpSecretNotification.cs new file mode 100644 index 00000000..e6baad6c --- /dev/null +++ b/EnvelopeGenerator.Application/Common/Interfaces/Services/Notification/TotpSecretNotification.cs @@ -0,0 +1,27 @@ +using EnvelopeGenerator.Domain.Constants; + +namespace EnvelopeGenerator.Application.Common.Interfaces.Services.Notification; + +/// +/// Payload for template. +/// +public record TotpSecretNotification : EnvelopeNotificationBase +{ + /// + /// Replaces [TFA_EXPIRATION] in mail body. + /// + public required string TfaExpiration { get; init; } + + /// + /// Replaces [TFA_QR_CODE] in mail body. + /// + public required string TfaQrCode { get; init; } + + /// + /// Replaces [NAME_PORTAL] in mail body. + /// + public string NamePortal { get; init; } = "signFLOW Portal"; + + /// + public override EmailTemplateType GetTemplateType() => EmailTemplateType.TotpSecret; +}