Skip to content

VerifiedAddressProviderMatchService

Implements IVerifiedAddressProviderMatchService, providing the trimmed/whitespace-tolerant string comparison rules used by AddressVerificationService to decide whether a verified address field matches, closely matches, or represents an equivalent PO Box form of a provider address field. It has no injected collaborators and holds no state.

Purpose

  • Compares two address field values for exact equality after trimming, treating two nulls as equal.
  • Compares the first three trimmed characters of two values (padded to at least 3 characters), used to detect near-matches on address line 1.
  • Detects when one value is a "PO BOX" form and the other contains "BOX", to treat them as an equivalent address line 1.

Context

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

Public members

Member Signature Purpose
IsEqual public bool IsEqual(string leftValue, string rightValue) Returns true when both values are null, or when both are non-null and equal after trimming; otherwise returns false.
IsFirstThreeBytesEqual public bool IsFirstThreeBytesEqual(string leftValue, string rightValue) Returns true when both values are non-null and their trimmed, right-padded (to 3 characters) first three characters match; otherwise returns false.
IsPoBox public bool IsPoBox(string leftValue, string rightValue) Returns true when both values are non-null, leftValue contains "PO BOX ", and rightValue contains "BOX"; otherwise returns false.

Behavioral notes

  • IsPoBox's comparison is asymmetric and case-sensitive: it only checks for "PO BOX " in leftValue and the substring "BOX" in rightValue, so swapping the arguments or differing case can change the result*.
  • All three methods treat a null argument (when the other is also null, for IsEqual) or a null in either position (for the other two methods) explicitly, avoiding NullReferenceException on missing address data.

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/AddressVerificationService/VerifiedAddressProviderMatchService.cs