Marked `DocSignedNotification` as `[Obsolete]` with a note to use `Signature.Commands.SignCommand` instead. Removed the `PsPdfKitAnnotation` record and its associated `using` directives from `DocSignedNotification.cs`. Added missing `using EnvelopeGenerator.Application.Common.Dto;` to `AnnotationHandler.cs` and `DocStatusHandler.cs` to ensure proper DTO support.
41 lines
1.3 KiB
C#
41 lines
1.3 KiB
C#
using EnvelopeGenerator.Application.DocStatus.Commands;
|
|
using EnvelopeGenerator.Application.Common.Dto;
|
|
using EnvelopeGenerator.Domain.Constants;
|
|
using MediatR;
|
|
using System.Text.Json;
|
|
|
|
namespace EnvelopeGenerator.Application.Common.Notifications.DocSigned.Handlers;
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public class DocStatusHandler : INotificationHandler<DocSignedNotification>
|
|
{
|
|
private const string BlankAnnotationJson = "{}";
|
|
|
|
private readonly ISender _sender;
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
public DocStatusHandler(ISender sender)
|
|
{
|
|
_sender = sender;
|
|
}
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="notification"></param>
|
|
/// <param name="cancel"></param>
|
|
/// <returns></returns>
|
|
public Task Handle(DocSignedNotification notification, CancellationToken cancel) => _sender.Send(new CreateDocStatusCommand()
|
|
{
|
|
EnvelopeId = notification.EnvelopeReceiver.EnvelopeId,
|
|
ReceiverId = notification.EnvelopeReceiver.ReceiverId,
|
|
Value = notification.PsPdfKitAnnotation is PsPdfKitAnnotation annot
|
|
? JsonSerializer.Serialize(annot.Instant, Format.Json.ForAnnotations)
|
|
: BlankAnnotationJson
|
|
}, cancel);
|
|
} |