Skip to content

CertificateInformationService

Implements ICertificateInformationService, loading and enriching policy data needed to build certificates of insurance: it retrieves a Policy via IUnitOfWork, maps it through AutoMapper into the certificate contracts namespace, and layers on derived fields the raw domain model doesn't carry directly — period status groupings, coverage-bind status, pending-cancellation dates, renewal/certificate-renewal period selection, DBA (doing-business-as) name resolution, employer-liability limit resolution (including a hardcoded OSC limits table), agency/employee marketing contact resolution, and policy-association lookups delegated to IPolicyAssociationService. It collaborates with IUnitOfWork, IUserProfileService, IPolicyAssociationService, a CertificateInformationDataHelper (constructed internally), and a LocationQueryProvider (constructed internally).

Purpose

  • Resolves a policy number into a fully composed Policy contract, including period status classification, active/renewal period selection, coverage-bound flags, DBA names, mailing address, and marketing contact.
  • Determines whether a submission-originated policy is owned by "saifQuote" for secondary-status display.
  • Resolves DBA names active as of a given policy period's effective date.
  • Resolves OSC (other-states-coverage) policies for a policy number, filtered to active/quoted/cancelled statuses.
  • Resolves employer liability limits for a policy period, falling back to standard limits by effective/expiration date when no period-specific limit exists, and exposes a hardcoded table of OSC limit options.
  • Resolves state codes eligible for OSC certificates.
  • Resolves the issuer contact (cached per user ID) for a given create-user ID.
  • Delegates policy-association lookups (all, filtered by type) to IPolicyAssociationService.

Context

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

Public members

Member Signature Purpose
CertificateInformationService (constructor) public CertificateInformationService(IUnitOfWork uow, IUserProfileService profileService, IPolicyAssociationService associationService) Wires the unit of work and user-profile service (both null-checked), constructs an internal CertificateInformationDataHelper and LocationQueryProvider from uow, and stores the policy-association service used for association lookups.
DetermineOwnedBySaifQuote public Boolean DetermineOwnedBySaifQuote(Policy policy) Returns true if the policy has at least one submission policy whose submission status code is none of "B", "T", "U", or "S" — used to flag policies still owned by the saifQuote submission process.
GetDbaNames public IEnumerable<DbaName> GetDbaNames(long policyNumber, DateTime effectiveDate) Returns the policy's DBA names active as of the matching period's end date (or now, capped at the current date), based on effective/cancel date ranges.
GetOtherStatesPolicies public IEnumerable<certInfoContract.OtherStatesPolicy> GetOtherStatesPolicies(long policyNumber) Returns the policy's OSC policies restricted to "ACTIVE", "QUOTED", or "CANCELLED" status and having a non-null OSC policy number, mapped into the information contract.
GetLimits public certInfoContract.EmployerLiabilityLimit GetLimits(long policyNumber, DateTime effectiveDate) Resolves the employer liability limit for a matching policy period; uses the period's most recent limit if it is still in effect as of the evaluation end date, otherwise falls back to the standard limit for that date range. Returns null if no matching period exists.
GetOscLimits public certInfoContract.EmployerLiabilityLimit GetOscLimits(string code) Returns the single hardcoded OSC limit option matching the given code.
GetOscLimits public IEnumerable<certInfoContract.EmployerLiabilityLimit> GetOscLimits() Returns the full hardcoded, lazily-built list of OSC limit options (accident/incident-disease/policy-disease limit combinations).
GetPolicy public certInfoContract.Policy GetPolicy(long policyNumber) Loads and fully composes the policy contract: classifies each period's status group and coverage-bind state, computes pending-cancellation dates for cancelling policies, selects the active/renewal periods and certificate renewal source/target periods, flags a fully flat-cancelled first period, computes an "OSC message" display flag for internal users, classifies relationship-code flags (leasing company, wrap-up, sub-account, State of Oregon) and parent/leasing-client/wrap-up-member flags, determines certificate-creation eligibility from status/period/relationship conditions, sets a secondary status ("Coverage Bound" or "saifQuote"), flags the primary DBA name, and resolves mailing address and marketing contact (agency or, absent an agent, the SAIF employee marketing contact).
GetPendingCancelDateForPolicy public DateTime? GetPendingCancelDateForPolicy(long policyNumber, DateTime expirationDate) Returns the cancel date of the policy's most recent cancellation record if the given expiration date falls on or after it, otherwise null.
GetStateCodes public IEnumerable<StateCode> GetStateCodes() Returns state codes flagged as "other states" or matching Oregon's code, ordered by description.
GetSaifContactData public PolicyTeamFunction GetSaifContactData(long policyNumber, string teamFunctionCode) Returns the policy team-function record matching the given policy number and team-function code (e.g. "MKTRP" for marketing rep), or null if none exists.
GetIssuerContactInfo public Contact GetIssuerContactInfo(string createUserUserid) Returns the certificate issuer's contact information for the given user ID, caching the lookup per user ID for the lifetime of this service instance.
GetPolicyAssociations public IEnumerable<policyAssociationContract.PolicyAssociation> GetPolicyAssociations(long policyNumber) Delegates to IPolicyAssociationService.GetPolicyAssociations(policyNumber) to return the policy's associations.
GetAllPolicyAssociations public IEnumerable<policyAssociationContract.PolicyAssociation> GetAllPolicyAssociations(long policyNumber) Delegates to IPolicyAssociationService.GetAllPolicyAssociations(policyNumber) to return all of the policy's associations, unfiltered.
GetPolicyAssociations (overload) public IEnumerable<policyAssociationContract.PolicyAssociation> GetPolicyAssociations(long policyNumber, AssociationTypes policyAssociationType) Delegates to IPolicyAssociationService.GetPolicyAssociations(policyNumber, policyAssociationType) to return the policy's associations filtered by association type.

Behavioral notes

  • A static constructor registers a large set of AutoMapper Mapper.CreateMap configurations (Policy, Period, PolicyStatus, PolicyPeriodStatus, TradingAs→DbaName, OtherStatesPolicy/Period, Location→Address, Agent/PolicyTeamFunction→IMarketingContact, and more) once per process; these mappings drive nearly every read operation on this type.
  • GetPolicy throws implicitly (via unguarded member access such as contractPolicy.ActivePeriod.EffectiveDate) if a policy has no current period when the policy is pending cancellation.*
  • Certificate-creation eligibility in GetPolicy is denied for status codes "P0", "P1", "P9", "PC", "PP", "PA", for status "P2" when no period has coverage bound, and for policies that are leasing clients, wrap-up members, or whose first (and only) period is flat-cancelled.
  • GetOscLimits() lazily builds and caches a static hardcoded list of 14 employer-liability limit combinations the first time it is accessed, reflecting that OSC limits are not currently stored in the database (per an inline comment).
  • IsCoverageBound (private) checks PolicyPeriodCoverageBind records; a period is treated as "coverage bound" only if a bind record exists with no BindCancelDate.
  • The class carries a CA1506:AvoidExcessiveClassCoupling suppression, reflecting its dependency on a large number of query providers, mappers, and repositories.*

Constraints and usage notes

  • Only uow and profileService are null-checked in the constructor via Enforce.ArgumentNotNull; associationService is not validated for null.*
  • CertificateInformationDataHelper and LocationQueryProvider are constructed directly inside the constructor rather than injected, coupling this service to those concrete types.*
  • ParsePolicyStatusGroups and ParsePeriodStatusGroup perform case-insensitive string matching against fixed description values (e.g. "ACTIVE", "APP", "CANCEL", "PENDCA" / "APP", "CLOSED", "OPEN", "NO COV", "RENEW"), so status text changes in the source data could silently fall through to an "Unknown" classification.*

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/Information/CertificateInformationService.cs