Enforced phone number validation for `AdvancedSignature` envelopes: - Introduced `CreateEnvelopeCommandValidator` to ensure receivers have non-empty phone numbers for advanced signatures. - Updated `CreateEnvelopeWizardPopup.razor` to dynamically adjust phone number placeholder text and validate input. - Added `ValidatePhoneNumber` method and integrated validation into the wizard's state management. - Introduced `IsAdvancedSignatureSelected` helper property for conditional logic. - Enhanced UI to reflect phone number requirements for advanced signatures. Added a test case in `CreateEnvelopeCommandTests.cs` to verify that creating an advanced signature envelope without a phone number throws a `BadRequestException`.
20 lines
632 B
C#
20 lines
632 B
C#
using EnvelopeGenerator.Domain.Constants;
|
|
using FluentValidation;
|
|
|
|
namespace EnvelopeGenerator.Application.Envelopes.Commands;
|
|
|
|
public sealed class CreateEnvelopeCommandValidator : AbstractValidator<CreateEnvelopeCommand>
|
|
{
|
|
public CreateEnvelopeCommandValidator()
|
|
{
|
|
When(
|
|
x => x.Type == EnvelopeType.AdvancedSignature,
|
|
() =>
|
|
{
|
|
RuleForEach(x => x.Receivers)
|
|
.Must(receiver => !string.IsNullOrWhiteSpace(receiver.PhoneNumber))
|
|
.WithMessage("PhoneNumber is required for advanced signature envelopes.");
|
|
});
|
|
}
|
|
}
|