CertificateHolderValidator¶
FluentValidation validator for CertificateHolderEdit, the entity representing the party named on a certificate of insurance. It enforces required and length-limited holder names, optional-but-format-checked email address, a required policy number, fax number format (skipped for foreign addresses), a minimum-contact-information rule requiring at least an email, fax, or complete domestic address, and delegates full address validation to a nested CertificateHolderAddressValidator.
Purpose¶
- Requires
Name1(1–100 characters) and capsName2at 100 characters. - Validates
EmailAddressformat (when present) and caps it at 60 characters. - Requires
PolicyNumberto be non-empty. - Validates fax number format for domestic addresses, skipping the check when
Address.IsForeignis true. - Requires the certificate holder to have at least an email address, a fax number, or a complete domestic address (line 1, city, and zip code), via
HasMinimumAddress; foreign addresses are always accepted. - Delegates structural address validation (line lengths, zip/zip+4 format) to
CertificateHolderAddressValidator.
Context¶
- Namespace:
SAIF.Services.Policies.Certificates.Validators - Assembly/package:
SAIF.Services(packaged inside theSAIF.SAIFCode.CoreNuGet package).
Public members¶
| Member | Signature | Purpose |
|---|---|---|
| CertificateHolderValidator (constructor) | public CertificateHolderValidator() |
Registers all validation rules for CertificateHolderEdit: name requirements/lengths, email format/length, required policy number, conditional fax format check, minimum-contact-information check, and nested address validation via CertificateHolderAddressValidator. |
Behavioral notes¶
BeAvalidFaxNumber(private) rejects a fax whoseNumericValueis positive butFormattedValueis empty; it accepts any 12-character formatted value or an empty one, and falls through totrueotherwise, so its practical rejection case is narrow.*HasMinimumAddress(private) returnstrueimmediately ifcertEditoraddressis null, if an email address is present, if a fax number is present, or if the address is foreign — the domestic-completeness check (line 1, city, zip all present) only applies when none of those short-circuits fire.- A source comment ("todo: sync up messages with client") indicates the validation error messages have not yet been finalized against client requirements.*
- The fax-format rule is explicitly skipped
.When(n => !n.Address.IsForeign), so foreign-address certificate holders are never subject to domestic fax-format checks.
Constraints and usage notes¶
- A new
CertificateHolderAddressValidatorinstance is constructed per validation run rather than injected, coupling this validator directly to that concrete type.* - Callers must ensure
certEdit.Addressis non-null before validation, sinceHasMinimumAddressand the fax-format.Whenclause both dereferenceAddressmembers.
Note: Statements marked with * were inferred from code structure, naming conventions, or contextual evidence where direct confirmation was not available in source artifacts. Statements marked with ** could not be confirmed; treat as unknown until verified.
Sources¶
Services/SAIF.Services/Policies/Certificates/Validators/CertificateHolderValidator.cs