Skip to content

ApproveBillRequestValidator

Enforces the single precondition for bill approval requests: the target bill, looked up via IBillQueryProvider, must currently carry the "REV" (review) status code before an ApproveBillRequest is allowed to proceed. It queries IBillQueryProvider.GetBill at validation time rather than relying on any value already present on the request DTO, so the check reflects the bill's live status.

Purpose

  • Rejects approval requests for bills that are not in "REV" status by validating BillId against a live lookup via IBillQueryProvider.GetBill.
  • Prevents approving a bill more than once or out of its expected workflow stage.

Context

  • Namespace: SAIF.Services.Claims.Bills.Validators
  • Assembly/package: SAIF.Services (packaged inside the SAIF.SAIFCode.Core NuGet package)

Public members

Member Signature Purpose
ApproveBillRequestValidator ApproveBillRequestValidator(IBillQueryProvider queryProvider) Wires a rule requiring BillId to resolve, via queryProvider.GetBill, to a bill whose BillStatus.Code equals "REV".*

Behavioral notes

  • Validation is enforced via FluentValidation's AbstractValidator<T> base.*
  • The Must predicate performs a database-backed lookup (queryProvider.GetBill) as part of validation rather than checking a value on the request itself, so the rule's outcome depends on external state at validation time.*

Constraints and usage notes

  • Requires an IBillQueryProvider implementation to be supplied via constructor injection; the validator cannot function without a bill data source.

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/Claims/Bills/Validators/ApproveBillRequestValidator.cs