Files
EnvelopeGenerator/EnvelopeGenerator.Application/Common/Notifications/DocSigned/Handlers/DocStatusHandler.cs
TekH e0cab3f965 Mark PSPDFKit-related code as obsolete
Added `[Obsolete]` attributes to classes, methods, and properties related to the deprecated PSPDFKit library and notifications.

- Marked `AnnotationHandler`, `DocStatusHandler`, `AnnotationBehavior`, and `DocStatusBehavior` as obsolete.
- Marked `Handle` methods in `DocStatusHandler` and `DocStatusBehavior` as obsolete.
- Marked `PsPdfKitAnnotation` property in `SignCommand` as obsolete.
- Marked `CreateOrUpdate` method in `AnnotationController` as obsolete.
- Added `Handle` methods in `DocStatusHandler` and `DocStatusBehavior` to send `CreateDocStatusCommand`.
- Updated `AnnotationController` dependencies to include `EnvelopeGenerator.Application.Common.Dto`.

These changes indicate a transition to `Signature.Commands.SignCommand` and deprecate PSPDFKit-related functionality.
2026-06-09 18:45:51 +02:00

43 lines
1.4 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>
[Obsolete("This notification is deprecated. Use Signature.Commands.SignCommand instead.")]
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>
[Obsolete("This notification is deprecated. Use Signature.Commands.SignCommand instead.")]
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);
}