40 lines
1.2 KiB
C#
40 lines
1.2 KiB
C#
using EnvelopeGenerator.Application.Common.Notifications.DocSigned;
|
|
using EnvelopeGenerator.Application.DocStatus.Commands;
|
|
using EnvelopeGenerator.Domain.Constants;
|
|
using MediatR;
|
|
using Newtonsoft.Json;
|
|
|
|
namespace EnvelopeGenerator.Application.Common.Notifications.DocSigned.Handlers;
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public class AnnotationHandler : INotificationHandler<DocSignedNotification>
|
|
{
|
|
private readonly ISender _sender;
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
public AnnotationHandler(ISender sender)
|
|
{
|
|
_sender = sender;
|
|
}
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="notification"></param>
|
|
/// <param name="cancel"></param>
|
|
/// <returns></returns>
|
|
public async Task Handle(DocSignedNotification notification, CancellationToken cancel)
|
|
{
|
|
await _sender.Send(new SaveDocStatusCommand()
|
|
{
|
|
Envelope = new() { Id = notification.EnvelopeId },
|
|
Receiver = new() { Id = notification.ReceiverId},
|
|
Value = JsonConvert.SerializeObject(notification.Annotations, Format.Json.ForAnnotations)
|
|
}, cancel);
|
|
}
|
|
} |