Skip to content

CertificateExtensions

Static extension-method helper class providing convenience accessors and type-conversion helpers used alongside CertificateService — a null-safe certificate-holder name accessor, a contract-to-data CertificateTypes converter, and a policy-period lookup keyed by a certificate's effective date, the latter supporting an OSC-versus-standard-policy branch used when computing a certificate's editable/cancellation state.

Purpose

  • Exposes Name1() as a null-safe way to read a certificate's certificate-holder primary name.
  • Converts the Certificate.CertificateTypes contract enum to the corresponding SAIF.Data.Model.Policies.Certificates.Certificate.CertificateTypes data-layer enum.
  • Resolves the PeriodBase (policy or OSC period) that corresponds to a given certificate's effective date, used to evaluate cancellation status.

Context

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

Public members

Member Signature Purpose
Name1 public static string Name1(this Certificate target) Returns the certificate holder's Name1 value, or an empty string if the certificate has no associated certificate holder.
ToDataType public static PolicyData.Certificates.Certificate.CertificateTypes ToDataType(this Certificate.CertificateTypes target) Maps Certificate.CertificateTypes.Bid and .OtherStates to their data-layer equivalents, defaulting to Standard for any other value.
Period public static PeriodBase Period(this Policy target, Certificate certificate) Returns the certificate's OscPeriod if it is an Other-States certificate, otherwise finds and returns the policy period matching the certificate's PolicyPeriodEffectiveDate from target.Periods.

Behavioral notes

  • Period throws if no policy period matches the certificate's effective date (via First), for non-OSC certificates.*
  • These extension methods are consumed by CertificateService.GetEditableCertificates and MapContractToDataObject to convert certificate types and resolve cancellation-relevant periods.*

Constraints and usage notes

  • None of the extension methods perform explicit null-argument validation on target; Name1 and Period carry CA1062 suppressions acknowledging this.*

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/CertificateService.cs