using EnvelopeGenerator.Application.DocStatus.Commands; using EnvelopeGenerator.Domain.Constants; using MediatR; using System.Text.Json; namespace EnvelopeGenerator.Application.Common.Notifications.DocSigned.Handlers; /// /// /// public class DocStatusHandler : INotificationHandler { private readonly ISender _sender; /// /// /// /// public DocStatusHandler(ISender sender) { _sender = sender; } /// /// /// /// /// /// public async Task Handle(DocSignedNotification notification, CancellationToken cancel) { await _sender.Send(new SaveDocStatusCommand() { Envelope = new() { Id = notification.EnvelopeId }, Receiver = new() { Id = notification.ReceiverId}, Value = JsonSerializer.Serialize(notification.PsPdfKitAnnotation.Instant, Format.Json.ForAnnotations) }, cancel); } }