Skip to content

TransactionValidator

A FluentValidation AbstractValidator<Transaction> that enforces date, type, approval, reference-text length, and amount rules for a Collections case transaction. It has no external collaborators, relying only on the Transaction instance being validated.

Purpose

  • When the transaction is still editable, requires the transaction date to fall after the debtor's last statement date (or after 01/01/1980 if there is none) and no more than seven days in the future.
  • Requires a transaction type code.
  • Requires an approving user name when the transaction type requires approval.
  • Bounds reference text to 30 characters.
  • Requires the transaction amount to be strictly between zero and one million.

Context

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

Public members

Member Signature Purpose
TransactionValidator() public TransactionValidator() Registers the conditional transaction-date, required-type, conditional-approval, reference-text-length, and amount rules described above against a validated Transaction instance.

Behavioral notes

  • The transaction-date rule is only evaluated when CanEdit is true, so transactions that are no longer editable (e.g. already statemented or system-generated) skip date validation entirely.
  • IsValidTransactionDate compares against the maximum LastStatementDate across all of the case's debtors, falling back to a fixed 01/01/1980 floor when no debtor has a statement date.

Sources

  • Services/SAIF.Services/Collections/Validators/TransactionValidator.cs