- Introduced new record `PsPdfKitAnnotation` to encapsulate both Instant and Structured annotation data - Updated `DocSignedNotification` to use `PsPdfKitAnnotation` instead of `ExpandoObject Annotations` - Modified extension methods to accept and map `PsPdfKitAnnotation` - Added reference to `EnvelopeGenerator.Application.Annotations.Commands` for `CreateAnnotationCommand`
39 lines
1.1 KiB
C#
39 lines
1.1 KiB
C#
using EnvelopeGenerator.Application.DocStatus.Commands;
|
|
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 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 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);
|
|
}
|
|
} |