Commit Graph

675 Commits

Author SHA1 Message Date
cb6dea319b rename Entities.Signature as DocReceiverElement 2026-06-09 22:52:41 +02:00
d59aa6157d Rename SignCommand to SigningCommand across codebase
Updated all references to `SignCommand` to use the new `SigningCommand` name for consistency and clarity. This includes changes to class definitions, method signatures, and pipeline behaviors in the following files:

- `DependencyInjection.cs`: Updated pipeline behaviors to use `SigningCommand`.
- `AnnotationBehavior.cs`: Updated class definition and methods to use `SigningCommand`. Marked `SignCommand` as `[Obsolete]`.
- `DocStatusBehavior.cs`, `EnvelopeReceiverResolutionBehavior.cs`, `HistoryBehavior.cs`, `SendSignedMailBehavior.cs`: Updated class definitions and methods to use `SigningCommand`.
- `SendSignedMailBehavior.cs`: Updated `CreatePlaceHolders` method to accept `SigningCommand`.
- `SigningCommand.cs`: Renamed `SignCommand` record to `SigningCommand` and updated internal methods and properties. Renamed `SignCommandHandler` to `SigningCommandHandler`.

Marked `SignCommand` as `[Obsolete]` where applicable to indicate deprecation. These changes improve code readability and align the command name with its purpose in the signing process.
2026-06-09 22:47:08 +02:00
1569647b60 Update pipeline behaviors for SignCommand in MediatR
Added EnvelopeReceiverResolutionBehavior as the first pipeline
behavior for SignCommand. Updated execution order of existing
behaviors: AnnotationBehavior (2nd), DocStatusBehavior (3rd),
and HistoryBehavior (4th). SendSignedMailBehavior remains last.
Updated comments to reflect the new execution order.
2026-06-09 22:43:37 +02:00
3bb2a013ab Add EnvelopeReceiverResolutionBehavior pipeline behavior
Introduced a new pipeline behavior class `EnvelopeReceiverResolutionBehavior` to resolve and validate the `EnvelopeReceiver` during the signing process.

- Added necessary `using` directives for dependencies such as `AutoMapper`, `MediatR`, and `IRepository`.
- Implemented the `Handle` method to query the database for `EnvelopeReceiver` if not provided in the `SignCommand` request.
- Throws a `NotFoundException` if the `EnvelopeReceiver` is not found.
- Maps the retrieved entity to a DTO and sets it in the request.
- Ensures the behavior executes before other signing process behaviors.
2026-06-09 22:43:19 +02:00
215b755f92 Refactor SignCommand and improve handler comments
Refactored the `SignCommand` class to inherit from `EnvelopeReceiverQueryBase` and introduced a private backing field `_envelopeReceiver` for better encapsulation. Added an internal method `SetEnvelopeReceiver` to manage the envelope receiver data. Updated the `EnvelopeReceiver` property to use the backing field and removed the `required` modifier for more controlled initialization.

Clarified comments in `SignCommandHandler` to emphasize that all processing is handled by pipeline behaviors, leaving the handler intentionally empty. Made minor adjustments to comments for improved clarity and consistency.
2026-06-09 22:42:50 +02:00
3a94733047 Refactor SignCommand and deprecate PsPdfKitAnnotation
Removed the `EmailAddress` property from the `SignCommand` class, which previously retrieved the receiver's email address and threw an exception if the receiver was null. This change eliminates reliance on `EnvelopeReceiver`.

Removed the `ToJson` extension method usage and the associated `using EnvelopeGenerator.Application.Common.Extensions;` directive, as well as the unused `using EnvelopeGenerator.Domain.Constants;` directive.

Marked the `PsPdfKitAnnotation` property as `[Obsolete]`, directing users to use `Signature.Commands.SignCommand` instead, signaling a transition to a newer implementation.
2026-06-09 19:11:55 +02:00
7793d3cbb9 Update EmailOut to use EnvelopeReceiver properties
Updated the `EmailAddress` and `ReferenceString` properties
of the `EmailOut` object in `SendSignedMailBehavior` to use
`request.EnvelopeReceiver.Receiver!.EmailAddress` instead of
`request.EmailAddress`. This ensures the values are derived
from the `EnvelopeReceiver.Receiver` object for improved
accuracy and consistency.
2026-06-09 19:11:44 +02:00
9174065365 Pass cancellationToken to next() in pipeline behaviors
Updated the `Handle` method in multiple classes implementing
`IPipelineBehavior<SignCommand, Unit>` to pass the `cancellationToken`
parameter to the `next()` method. This change ensures consistent
propagation of the `cancellationToken` through the pipeline, enabling
proper handling of cancellation requests during asynchronous operations.

Modified files:
- AnnotationBehavior.cs
- DocStatusBehavior.cs
- HistoryBehavior.cs
- SendSignedMailBehavior.cs
2026-06-09 19:07:38 +02:00
19824afc1c Mark PsPdfKitAnnotation as obsolete; remove TemplateType
The `PsPdfKitAnnotation` property in the `SignCommand` class has been marked as `[Obsolete]` with a deprecation message suggesting the use of `Signature.Commands.SignCommand` instead.

The `TemplateType` property, which returned the `EmailTemplateType.DocumentSigned` value, has been removed from the `SignCommand` class.
2026-06-09 19:07:26 +02:00
c7fe3f0b9c Mark PsPdfKitAnnotation as obsolete
Added an [Obsolete] attribute to the PsPdfKitAnnotation property
in the DocSignedNotification class, indicating that the PSPDFKit
library is deprecated.

Reorganized using directives in DocumentReceiverElementService.cs
to improve consistency and maintain code readability.
2026-06-09 19:04:55 +02:00
a98024063a Refactor namespaces for SignCommand and behaviors
Updated namespaces from `Signature` to `Signatures` for consistency and clarity across the application. Simplified pipeline behavior registrations in `DependencyInjection.cs` by using shorter references. Added `Microsoft.Extensions.Configuration` to `DependencyInjection.cs` to support configuration functionality. Ensured all references to `SignCommand` and related behaviors align with the new namespace structure.
2026-06-09 18:55:31 +02:00
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
e5347b063d Add pipeline behaviors for signing process
Introduced four new pipeline behaviors (`AnnotationBehavior`,
`DocStatusBehavior`, `HistoryBehavior`, and `SendSignedMailBehavior`)
to modularize the signing process. These behaviors handle annotation
persistence, document status creation, history recording, and signed
mail notifications, respectively.

- `AnnotationBehavior`: Saves annotations using `IRepository`.
- `DocStatusBehavior`: Creates document status via `ISender`.
- `HistoryBehavior`: Records signing history and validates receiver
  information.
- `SendSignedMailBehavior`: Sends signed mail notifications using
  email templates and dynamic placeholder replacement.

Added error handling for missing data in `HistoryBehavior` and
`SendSignedMailBehavior`. Updated the signing pipeline to execute
these behaviors sequentially, ensuring a structured and extensible
workflow.
2026-06-09 18:33:57 +02:00
ecd695ad37 Add MediatR pipeline behaviors for SignCommand
Introduced MediatR to the project by adding the `using MediatR;` directive in `DependencyInjection.cs`. Registered pipeline behaviors for the `Signature.Commands.SignCommand` to enforce a structured execution order:

1. AnnotationBehavior: Saves annotations.
2. DocStatusBehavior: Creates document status.
3. HistoryBehavior: Records history.
4. SendSignedMailBehavior: Sends notification email (executes last).

These changes improve the command handling pipeline by ensuring sequential and reliable execution of behaviors.
2026-06-09 18:33:27 +02:00
fceb266630 Deprecate DocSignedNotification and cleanup annotations
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.
2026-06-09 18:22:43 +02:00
87bdef9d5e Add SignCommand and handler for document signing
Introduce `SignCommand` and `SignCommandHandler` in the `EnvelopeGenerator.Application.Signature.Commands` namespace.

- `SignCommand` is a CQRS command that encapsulates the envelope receiver's information (`EnvelopeReceiverDto`) and optional PSPDFKit annotation data.
- Added computed properties for email template type (`TemplateType`) and receiver's email address (`EmailAddress`), with validation for null receivers.
- `SignCommandHandler` implements the `IRequestHandler<SignCommand>` interface, with a placeholder `Handle` method delegating processing to pipeline behaviors.
- Added necessary `using` directives for MediatR, DTOs, extensions, and constants.
2026-06-09 18:12:12 +02:00
2fb32fb982 Add PsPdfKitAnnotation record with deprecation notice
Introduced a new `PsPdfKitAnnotation` record in the namespace
`EnvelopeGenerator.Application.Common.Dto` to represent PSPDFKit
annotation data. The record includes two parameters: `Instant`
of type `ExpandoObject` and `Structured` of type
`IEnumerable<AnnotationCreateDto>`.

Marked the record with the `[Obsolete]` attribute to indicate
that the PSPDFKit library is deprecated. Added a summary XML
comment to describe the purpose of the record. Also added a
`using` directive for `System.Dynamic` to support `ExpandoObject`.
2026-06-09 18:07:27 +02:00
126a4acb12 Add new properties to SignatureDto for signature details
Added the `System.ComponentModel.DataAnnotations.Schema` namespace.
Introduced new properties to the `SignatureDto` class:
- `FullName` (string?) for the full name of the signature entity.
- `Position` (string?) for the position of the signature entity.
- `Place` (string?) for the place associated with the signature entity.
- `Ink` (byte[]?) for the ink data of the signature entity.
2026-06-09 17:05:23 +02:00
cd077aa1bd Refactor DocSignedNotification for better encapsulation
Refactored `DocSignedNotification` to remove inheritance from
`EnvelopeReceiverDto` and introduced a required `EnvelopeReceiver`
property. Updated all usages across the codebase to align with the
new structure, including controllers, handlers, and tests.

- Improved encapsulation and reduced coupling by making
  dependencies explicit.
- Updated `AnnotationController`, `DocStatusHandler`,
  `HistoryHandler`, and `SendSignedMailHandler` to use the
  `EnvelopeReceiver` property.
- Adjusted `DocSignedNotificationTests` to reflect the new
  instantiation pattern.
- Updated XML documentation and ensured consistent access to
  `EnvelopeReceiver` properties like `EnvelopeId`, `ReceiverId`,
  and `EmailAddress`.
2026-06-09 16:34:49 +02:00
49ac35153e Refactor AnnotationController and DocSignedNotification
Refactored `AnnotationController` to simplify `DocSignedNotification` creation and improve error handling. Replaced the `ToDocSignedNotification` extension method with direct instantiation of `DocSignedNotification`. Introduced a `try-catch` block to handle exceptions during notification publishing, ensuring a `RemoveSignatureNotification` is sent on failure.

Removed `ToDocSignedNotification` and `PublishSafely` extension methods, as their functionality was inlined into the controller. Updated tests to reflect these changes. Simplified the `DocSignedNotification` class by removing redundant methods.

Improved maintainability and clarity by reducing dependencies on extension methods and handling exceptions explicitly.
2026-06-09 15:39:41 +02:00
e6f12f0c68 Add SenderAppType property to SignatureDto
Updated the `using` directives in `SignatureDto.cs` to include the `EnvelopeGenerator.Domain.Constants` namespace and reordered the existing namespaces. Added a new `SenderAppType` property to the `SignatureDto` class, with a default value of `SenderAppType.LegacyFormApp`.
2026-06-06 21:23:06 +02:00
34f145305c Standardize coordinate system to use INCHES
Updated the digital document signing system to use INCHES as the standard unit for annotations and signatures, aligning with GdPicture14's native format. Previously used DevExpress units (1/100 inch) and other formats have been replaced.

- Updated `AnnotationDto` to reflect the new coordinate system.
- Introduced `SignatureDto` for signature positions, deprecating `AnnotationDto`.
- Added conversion formulas for transforming coordinates between INCHES and other systems (DevExpress, PDF Points, PDF.js, etc.).
- Added a unit comparison table and A4 page dimensions in various units.
- Introduced a new read-only PDF.js viewer for envelopes (`/envelope/{EnvelopeKey}`).

These changes improve consistency, simplify conversions, and align with modern tools like PSPDFKit and iText7.
2026-06-06 21:21:12 +02:00
b9efc75d4f Add nullable Annotations property to SignatureDto
A new property `Annotations` of type `IEnumerable<AnnotationDto>?`
was added to the `SignatureDto` class. This property includes a
getter and setter, allowing the class to manage a collection of
annotations. The property is nullable, enabling it to hold a
`null` value if no annotations are present.
2026-06-06 18:25:46 +02:00
8dc561cb8f Refactor query to include related document data
Refactored the `Handle` method in `ReadDocumentQueryHandler` to
eagerly load related data (`Elements` and `Annotations`) using
`Include` and `ThenInclude`. Introduced a reusable `docQuery`
variable to reduce code duplication and ensure consistency in
queries for both `query.Id` and `query.EnvelopeId`. No changes
were made to the mapping logic or exception handling.
2026-06-06 18:07:31 +02:00
dcb3e5d45d Mark Type obsolete; add X and Y properties
The `Type` property in `AnnotationCreateDto` was marked as obsolete with the note: "Not required for DevExpress."

Added `X` and `Y` properties to represent the horizontal and vertical positions of the signature field on the page. Both properties use DevExpress units (hundredths of an inch) with the origin at the top-left corner of the page.

Detailed documentation was added for `X` and `Y`, including differences in coordinate systems and unit conversions between DevExpress, PSPDFKit, and GDPicture.
2026-05-31 11:11:47 +02:00
d97268c18c Refactor AnnotationCreateDto and update appsettings.json
Refactored the `AnnotationCreateDto` class:
- Changed `ElementId` from `int` to `long` and made it mutable.
- Marked `Name`, `Value`, and `Type` as `[Obsolete]` with defaults.
- Added `[Obsolete]` attributes to `Width` and `Height`.
- Introduced a new `Page` property to replace `SignatureDto`.

Updated `appsettings.json`:
- Set `Api.BaseUrl` to an empty string.
2026-05-31 11:10:31 +02:00
9b2539e378 Refactor CreateEnvelopeCommand authorization method
Replaced the `Authorize` method with a new `WithAuth` method
in the `CreateEnvelopeCommand` class. The new method sets
the `UserId` property and returns the current instance,
enabling method chaining and improving usability.
2026-05-30 16:47:51 +02:00
bfae72529c Add query for sensitive envelope receiver data
Introduced `ReadEnvelopeReceiverSecretQuery` to fetch sensitive
fields (e.g., access code, phone number) for envelope receivers.
Added extension methods for dispatching the query via `IMediator`
and implemented `ReadEnvelopeReceiverSecretQueryHandler` to
process the query using repositories and AutoMapper.

Updated `EnvelopeController` with a new HTTP GET endpoint
`EnvelopeReceiverWithSecretByMediatr` to expose the query
functionality. This endpoint returns sensitive data as
`EnvelopeReceiverSecretDto` or a 404 response if no match is found.

These changes improve modularity, testability, and separation of
concerns by leveraging MediatR and CQRS patterns.
2026-05-28 23:46:31 +02:00
OlgunR
45377ea61c Merge branch 'master' of https://vcs.digitaldata.works/AppStd/EnvelopeGenerator 2026-03-13 10:44:39 +01:00
OlgunR
b5748550d1 Fix typo in document confirmation message
Corrected "red" to "read" in the DocumentSuccessfullyConfirmed resource string to ensure proper messaging.
2026-03-13 10:44:00 +01:00
06c2a07fbc Replace DateTime.UtcNow with DateTime.Now for timestamps
Switched all audit and creation timestamps from UTC to local time
by replacing DateTime.UtcNow with DateTime.Now across the codebase.
This affects audit fields, object creation, and default values for
date/time properties.
2026-03-11 14:11:23 +01:00
200258ff73 Update EnvelopeDto.ReadOnly to use IsReadAndConfirm()
Refactored the ReadOnly property in EnvelopeDto to use the IsReadAndConfirm() extension method instead of directly checking EnvelopeTypeId. Marked the property as [Obsolete] and advised using EnvelopeExtensions.IsReadAndConfirm.
2026-03-11 09:43:22 +01:00
0341505f8d Merge branch 'origin/bugfix/history-inconsistency' 2026-03-06 10:15:22 +01:00
9b042d8f45 Merge branch 'master' of http://git.dd:3000/AppStd/EnvelopeGenerator 2026-03-06 09:54:26 +01:00
OlgunR
ad0c847172 Add SigningProcessTitle resource; rename rejection key
Added localized SigningProcessTitle entry to de-DE, en-US, and fr-FR resource files. Renamed RejectionInfoConfirmation to RejectionInfo1Confirmation. Removed duplicate SigningProcessTitle entries. No changes to localized values.
2026-03-06 09:53:18 +01:00
OlgunR
f8c7f60cf9 Add resource strings for document confirmation workflows
Added new localized strings for document confirmation processes in de-DE, en-US, and fr-FR resource files, including confirmation messages, UI labels, and process titles. Fixed a typo in the German resource and ensured consistency for the "SigningProcessTitle" key across languages.
2026-03-06 09:50:21 +01:00
647c5d2353 Add localization extensions for confirmation resources
Added three new extension methods to the Extensions class in Resource.cs: ConfirmDoc, ConfirmAgree, and ConfirmationProcessTitle. Each method retrieves the localized value for its respective resource key and includes XML documentation, consistent with existing localization methods.
2026-03-06 09:31:19 +01:00
4ce1d2a370 Add RejectionInfo1ForConfirmation extension method
Introduced a new extension method, RejectionInfo1ForConfirmation, to the Extensions class in Resource.cs. This method retrieves the localized string for "RejectionInfo1ForConfirmation" from an IStringLocalizer instance, providing functionality similar to the existing RejectionInfo1 method.
2026-03-06 09:28:12 +01:00
3d43d1896d Add DocConfirmed extension method to Resource.cs
Added a new DocConfirmed extension method to the Extensions class in Resource.cs. This method enables retrieval of the "DocConfirmed" localized string via IStringLocalizer, similar to the existing DocSigned method.
2026-03-06 01:20:12 +01:00
8e3c334fa3 Update final status to 'Lesebestätigung' for read confirm
Changed the [FINAL_STATUS] placeholder value from "Bestätigung" to the more specific "Lesebestätigung" when an envelope is read and confirmed, improving clarity in status messaging.
2026-03-04 16:19:45 +01:00
08299451bb Customize email placeholders by envelope action type
Added logic to set email template placeholders based on whether the envelope requires "Read and Confirm" or "Sign" actions. Placeholders such as [SIGNATURE_TYPE], [DOCUMENT_PROCESS], [FINAL_STATUS], [FINAL_ACTION], [REJECTED_BY_OTHERS], and [RECEIVER_ACTION] are now dynamically set to reflect the correct process and status, improving the accuracy and clarity of notification emails.
2026-03-04 16:19:33 +01:00
9a516ab3c9 Update and align NuGet dependencies; drop net7.0 from Web
- Downgrade Microsoft.Data.SqlClient to 5.2.2 in Application and Infrastructure projects
- Downgrade Microsoft.Extensions.DependencyInjection to 8.0.1 for net8.0 in Application
- Remove net7.0 target and related packages from Web project
- Upgrade OpenApi and Caching.SqlServer to 8.0.17 (net8.0) and 9.0.6 (net9.0) in Web
- Ensures consistent, compatible package versions across solution
2026-03-04 16:09:40 +01:00
f44643aa3e Add dynamic email placeholders for confirm/sign workflows
Refactored CreatePlaceholders to set email template values based on whether the envelope requires "read and confirm" or signature. Renamed method parameter for clarity and updated usages. Added a TODO for future method unification. Improves email content accuracy for different envelope actions.
2026-03-04 15:02:04 +01:00
86c99596c4 Implement IEnvelope interface in EnvelopeDto
EnvelopeDto now implements the IEnvelope interface, enabling it to be used wherever IEnvelope is required. No other modifications were made to the class.
2026-03-04 14:19:11 +01:00
afa3694cd7 Add MapAddedWhen to History mapping in MappingProfile
Imported necessary namespaces and updated the CreateHistoryCommand-to-History mapping to include the MapAddedWhen extension method, likely to handle automatic setting of creation timestamps or similar metadata.
2026-02-27 11:34:17 +01:00
48f4ea0c50 Use UTC for AddedWhen timestamp in CreateHistoryCommand
Changed AddedWhen to use DateTime.UtcNow instead of DateTime.Now
to ensure timestamps are stored in UTC, improving consistency
across different time zones and deployment environments.
2026-02-27 11:33:53 +01:00
74c4ddda83 Remove ModifyDocStatusCommandBase and its properties
Deleted the entire ModifyDocStatusCommandBase.cs file, including the record definition, its properties (EnvelopeId, ReceiverId, Value), and the To<TDest>() mapping method. No code or class definitions remain in this file.
2026-02-27 11:32:45 +01:00
f9b1e583df Remove SaveDocStatusCommand and always create doc status
Removed SaveDocStatusCommand and its handler, eliminating logic for updating existing document statuses. DocStatusHandler now always sends CreateDocStatusCommand with simplified parameters when handling DocSignedNotification. This change ensures a new document status is always created instead of updating existing ones.
2026-02-27 11:31:41 +01:00
8258d9f43f Refactor UpdateDocStatusCommand to use generic base class
Refactored UpdateDocStatusCommand to inherit from a generic UpdateCommand base class with a new DocStatusUpdateDto record. Added explicit EnvelopeId, ReceiverId, and Value properties. Removed ChangedWhen property and implemented BuildQueryExpression for querying. Updated using directives and improved XML documentation.
2026-02-19 14:32:45 +01:00
01f3335238 Refactor ModifyDocStatusCommandBase properties
Replaced computed EnvelopeId and ReceiverId with virtual settable properties for greater flexibility. Removed Status, Receiver, and StatusChangedWhen properties. Made Value property virtual and cleaned up related code and comments.
2026-02-19 14:32:35 +01:00