The `PsPdfKitAnnotation` property in the `SignCommand` class has been marked as `[Obsolete]` with a deprecation message suggesting the use of `Signature.Commands.SignCommand` instead. The `TemplateType` property, which returned the `EmailTemplateType.DocumentSigned` value, has been removed from the `SignCommand` class.
48 lines
1.6 KiB
C#
48 lines
1.6 KiB
C#
using MediatR;
|
|
using EnvelopeGenerator.Application.Common.Dto;
|
|
using EnvelopeGenerator.Application.Common.Dto.EnvelopeReceiver;
|
|
using EnvelopeGenerator.Application.Common.Extensions;
|
|
using EnvelopeGenerator.Domain.Constants;
|
|
|
|
namespace EnvelopeGenerator.Application.Signatures.Commands;
|
|
|
|
/// <summary>
|
|
/// Command to sign a document by a receiver.
|
|
/// </summary>
|
|
public record SignCommand : IRequest
|
|
{
|
|
/// <summary>
|
|
/// The envelope receiver information.
|
|
/// </summary>
|
|
public required EnvelopeReceiverDto EnvelopeReceiver { get; init; }
|
|
|
|
/// <summary>
|
|
/// The PSPDFKit annotation data.
|
|
/// </summary>
|
|
[Obsolete("This notification is deprecated. Use Signature.Commands.SignCommand instead.")]
|
|
public PsPdfKitAnnotation? PsPdfKitAnnotation { get; init; }
|
|
|
|
/// <summary>
|
|
/// Gets the email address of the receiver.
|
|
/// </summary>
|
|
public string EmailAddress => EnvelopeReceiver.Receiver?.EmailAddress
|
|
?? throw new InvalidOperationException($"Receiver is null." +
|
|
$"DocSignedNotification:\n{this.ToJson(Format.Json.ForDiagnostics)}");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Handles the sign command. The actual work is done by SignCommandBehavior pipeline.
|
|
/// </summary>
|
|
public class SignCommandHandler : IRequestHandler<SignCommand>
|
|
{
|
|
/// <summary>
|
|
/// Executes the signing command. Pipeline behaviors handle the actual processing.
|
|
/// </summary>
|
|
/// <param name="request"></param>
|
|
/// <param name="cancellationToken"></param>
|
|
/// <returns></returns>
|
|
public Task Handle(SignCommand request, CancellationToken cancellationToken = default)
|
|
{
|
|
return Task.CompletedTask;
|
|
}
|
|
} |