Skip to content

AuthorityMappingHelper

Registers the AutoMapper type-conversion maps used by the payment-authority feature, translating between SAIF.Data.Model.Claims.Authority/SAIF.Data.Model.Claims.CodeTables persistence entities and the SAIF.Core.Contracts.Claims.Authority contract types (PaymentAuthorityLimit, PaymentAuthorityLimitHistory, AuthorityBusinessProcessCode, FunctionTypeCode, ApprovalTypeCode). It is invoked once from ClaimAuthorityService's constructor* to ensure the global AutoMapper.Mapper static registry has these maps configured before any mapping calls occur.

Purpose

  • Establishes bidirectional AutoMapper configuration between authority-limit data entities and their contract representations.
  • Renames and reshapes fields during mapping (for example MaximumPaymentAmount → MaximumAmount, AuthorizedByEmplid → AuthorizedByEmployeeId, PurposeType → ApprovalType).
  • Populates the nested BusinessProcess code/description on PaymentAuthorityLimit via BeforeMap/AfterMap callbacks when mapping from EmployeeAuthorityLimit.
  • Normalizes UpdateUser to uppercase when mapping payment limit history records.

Context

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

Public members

Member Signature Purpose
MapTables public static void MapTables() Registers all AutoMapper CreateMap configurations for authority limits, authority limit history, and the related authority/payment-type/approval-type code tables; safe to call repeatedly since it only adds map configuration to the static Mapper registry.

Behavioral notes

  • Uses the static (non-instance) AutoMapper.Mapper API, so registrations are global and shared across all consumers of the process*.
  • The EmployeeAuthorityLimit → PaymentAuthorityLimit map sets BusinessProcess to a new AuthorityBusinessProcessCode before copying its Code and Description fields, ensuring the nested object is never left null.
  • Reverse maps (ReverseMap()) are registered for the code-table pairs, allowing mapping in both directions between data and contract code tables.

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/Authority/AuthorityMappingHelper.cs