Skip to main content

Safeco Auto

Safeco Auto is the quote-to-bind flow for Safeco Auto insurance. Customers arrive from DA (Dealer Application) via a deep link and complete a multi-step flow: confirm drivers and vehicles, select coverages, apply discounts, and bind with payment via Hydra.

Integration

AspectTechnology
ProtocolACORD XML (JSON-represented, converted by SafecoV3XmlConverterService)
Transaction typesRC1 (initial), RC1+CC (CLUE), RC1+ADD (driver discovery), RC2 (final rate), RC3 (bind)
PaymentHydra iframe (Liberty Mutual) for credit card / ACH
Bind statusServer-Sent Events (SSE) for real-time status
AuthSwitchboard OAuth (bearer token) for Safeco API; Hydra OAuth for payment
SessionCarrierQuoteSession in Prisma + Redis session store

Architecture

NestJS Module

SafecoCarrierModule (libs/apis/carriers/safeco/src/lib/safeco-carrier.module.ts) exports:

ProviderTokenPurpose
SafecoV3RateServiceRC1/RC2 rate flows
SafecoV3BindServiceRC3 bind
SafecoV3ReportsServiceCC/ADD/MVR reports
SafecoV3FieldMapperServiceSession → ACORD XML mapping
SafecoV3ApiClientSAFECO_API_CLIENT (via proxy)HTTP client to Safeco
SafecoV3AuthServiceSwitchboard OAuth tokens
SafecoHydraServiceHydra iframe URL + validation
HydraOAuthTokenManagerServiceHydra OAuth tokens
SafecoCdmAdapterCDM integration

The API client uses a proxy patternSafecoV3ApiClientProxy wraps the real client and mock client, allowing test/dev switching.

API Endpoints

All under POST /api/v1/ghcms/safeco/ unless noted:

EndpointMethodPurpose
/initial-quotePOSTLoad existing CRN quote (no Safeco API call)
/update-quotePOSTUpdate pricing — plain RC1
/rate-with-reportsPOSTFull 4-step rate flow (RC1+CC, RC1+ADD, RC2)
/ratePOSTDirect RC2 rate call
/payment-plansPOSTRC3 payment plan retrieval
/hydra-urlPOSTGenerate Hydra iframe URL
/hydra-validatePOSTValidate Hydra payment instrument
/bindPOSTAsync bind — returns 202, streams status via SSE
/bind/status/streamGET (SSE)Real-time bind status stream
/documents/:sessionIdGETList policy documents
/documents/:sessionId/download/:documentTypeGETDownload a policy document

Domain Types

TypeLocationPurpose
QuoteStatusdomain/entities/quote.entity.tsDRAFT, RATED, SELECTED, EXPIRED
PolicyStatusdomain/entities/policy.entity.tsPENDING, BOUND, ACTIVE, CANCELLED
SafecoDriverDtov3/application/dtos/Driver data for rate requests
SafecoVehicleDtov3/application/dtos/Vehicle data for rate requests
SafecoCoverageDtov3/application/dtos/Coverage data
SafecoPaymentPlanDtov3/application/dtos/Payment plan details
BindSessionDatav3/application/services/Composite session for bind
HydraPaymentInstrumentv3/application/services/Tokenized payment
SafecoAutoQuoteDatav3/infrastructure/xml/ACORD XML JSON representation

Key Files

AreaLocation
Portal flowapps/fastlane-portal/src/app/pages/carriers/safeco/auto/
Flow configapps/fastlane-portal/src/app/pages/carriers/safeco/auto/flow-config.ts
API Gateway controllerapps/apis/fastlane-api-gateway/src/app/controllers/safeco.controller.ts
Gateway handlersapps/apis/fastlane-api-gateway/src/app/handlers/safeco-*.handler.ts
Safeco liblibs/apis/carriers/safeco/
Rate servicelibs/apis/carriers/safeco/src/v3/application/services/safeco-v3-rate.service.ts
Bind servicelibs/apis/carriers/safeco/src/v3/application/services/safeco-v3-bind.service.ts
Field mapperlibs/apis/carriers/safeco/src/v3/infrastructure/mapping/safeco-v3-field-mapper.service.ts
ACORD XML utilslibs/apis/carriers/safeco/src/v3/infrastructure/xml/
Hydra servicelibs/apis/carriers/safeco/src/v3_1/application/services/safeco-hydra.service.ts
Constantslibs/apis/carriers/safeco/src/v3/constants/safeco.constants.ts

Documentation

Environment Variables

VariablePurpose
SAFECO_RC1_RC2_URLSafeco ACORD API endpoint (RC1/RC2)
SAFECO_RC3_URLSafeco ACORD API endpoint (bind)
SAFECO_RC1_RC2_ATTRIBUTION_IDPartner attribution header
SAFECO_API_TIMEOUTAPI timeout (default 30s)
SAFECO_HYDRA_BASE_URLHydra payment API
SAFECO_HYDRA_CLIENT_IDHydra OAuth client ID
SAFECO_HYDRA_CLIENT_PROFILE_IDHydra client profile
SAFECO_HYDRA_CALLBACK_URLHydra iframe callback
SAFECO_HYDRA_CSS_URLHydra iframe custom CSS