Updated all references to `SignCommand` to use the new `SigningCommand` name for consistency and clarity. This includes changes to class definitions, method signatures, and pipeline behaviors in the following files: - `DependencyInjection.cs`: Updated pipeline behaviors to use `SigningCommand`. - `AnnotationBehavior.cs`: Updated class definition and methods to use `SigningCommand`. Marked `SignCommand` as `[Obsolete]`. - `DocStatusBehavior.cs`, `EnvelopeReceiverResolutionBehavior.cs`, `HistoryBehavior.cs`, `SendSignedMailBehavior.cs`: Updated class definitions and methods to use `SigningCommand`. - `SendSignedMailBehavior.cs`: Updated `CreatePlaceHolders` method to accept `SigningCommand`. - `SigningCommand.cs`: Renamed `SignCommand` record to `SigningCommand` and updated internal methods and properties. Renamed `SignCommandHandler` to `SigningCommandHandler`. Marked `SignCommand` as `[Obsolete]` where applicable to indicate deprecation. These changes improve code readability and align the command name with its purpose in the signing process.
51 lines
1.6 KiB
C#
51 lines
1.6 KiB
C#
using EnvelopeGenerator.Application.Common.Dto;
|
|
using EnvelopeGenerator.Application.DocStatus.Commands;
|
|
using EnvelopeGenerator.Application.Signatures.Commands;
|
|
using EnvelopeGenerator.Domain.Constants;
|
|
using MediatR;
|
|
using System.Text.Json;
|
|
|
|
namespace EnvelopeGenerator.Application.Signatures.Behaviors;
|
|
|
|
/// <summary>
|
|
/// Pipeline behavior that creates document status.
|
|
/// Executes second in the signing process.
|
|
/// </summary>
|
|
public class DocStatusBehavior : IPipelineBehavior<SigningCommand, Unit>
|
|
{
|
|
private const string BlankAnnotationJson = "{}";
|
|
|
|
private readonly ISender _sender;
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
public DocStatusBehavior(ISender sender)
|
|
{
|
|
_sender = sender;
|
|
}
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="request"></param>
|
|
/// <param name="next"></param>
|
|
/// <param name="cancellationToken"></param>
|
|
/// <returns></returns>
|
|
[Obsolete("This notification is deprecated. Use Signature.Commands.SignCommand instead.")]
|
|
public async Task<Unit> Handle(SigningCommand request, RequestHandlerDelegate<Unit> next, CancellationToken cancellationToken)
|
|
{
|
|
await _sender.Send(new CreateDocStatusCommand()
|
|
{
|
|
EnvelopeId = request.EnvelopeReceiver.EnvelopeId,
|
|
ReceiverId = request.EnvelopeReceiver.ReceiverId,
|
|
Value = request.PsPdfKitAnnotation is PsPdfKitAnnotation annot
|
|
? JsonSerializer.Serialize(annot.Instant, Format.Json.ForAnnotations)
|
|
: BlankAnnotationJson
|
|
}, cancellationToken);
|
|
|
|
return await next(cancellationToken);
|
|
}
|
|
}
|