Skip to content

Get policy header

PolicyHeaderService is the facade over the Policy Header API client. It returns the header for a policy and trims the associations list for external users.

Field Value
Operation ID OP-12
Trigger IPolicyHeaderService.GetHeader call
Inputs Policy number, optional customer id, optional user type code
Outputs PolicyHeader
Primary components PolicyHeaderService.GetHeader, PolicyHeaderService.GetRelationships
Entry point src/BolMiddleware/Services/Headers/Policy/PolicyHeaderService.cs

Steps

  1. Call the Policy Header API client with the policy number and an external-user flag that is true when the customer id is greater than zero.
  2. When the flag is true and a header came back, switch on the user type code (BR-BOLMIDDLEWARE-013):
  3. POLCY: replace the associations with those from a second header lookup for the customer id.
  4. AGNCY: keep only associations that contain a policy whose AgencyId equals the customer id.
  5. Any other code: leave the associations unchanged.
  6. Return the header.
  7. On exception: log the error through ISaifLogService and return a default PolicyHeader (BR-BOLMIDDLEWARE-021).
  8. GetRelationships(policyNumber) returns the list of policy associations from the same API and follows the same logging behavior.

Process flow

The following diagram visualizes this operation's control flow.

flowchart TD
    Start([GetHeader]) --> S1[Call Policy Header API with external flag]
    S1 --> D1{Customer id above zero?}
    D1 -->|No| EndOk([Return header])
    D1 -->|Yes| D2{User type code?}
    D2 -->|POLCY| S2[Replace associations from customer id lookup]
    D2 -->|AGNCY| S3[Keep associations with matching AgencyId]
    D2 -->|Other| EndOk
    S2 --> EndOk
    S3 --> EndOk
    S1 -->|Exception| EndErr([Log and return default])

Failure and edge-case behavior

  • A failed API call yields an empty header rather than an error, so the page cannot distinguish an outage from a missing policy.
  • The POLCY branch makes a second API call; the customer id and type code come from the web context, not the identity.

Sources

  • src/BolMiddleware/Services/Headers/Policy/PolicyHeaderService.cs
  • src/BolMiddleware/Services/Headers/Policy/IPolicyHeaderService.cs