---
title: EobBuilder
summary: API reference for EobBuilder.
status: draft
owner: SAIF Doc Gen
last_reviewed: 2026-09-24
library: SAIF.Domain
reference_type: package
---

# EobBuilder

`EobBuilder` generates explanation-of-benefits (EOB) records for a batch's bills, driving operation OP-DOM-12: it creates zero-payment ("NON") EOBs for completed bills directly, pulls the payment extract from the Guidewire `IMedicalBillingApiService` for paid bills (loading e-bills in chunks of 900 to respect the Oracle 1000-item IN-list limit), builds MCO-fee and service adjustments plus remittance advices from each bill's audited services, and supports regenerating a rejected EOB by re-attaching its bills and marking them Completed.

## Purpose
- Builds non-payment EOB groups for bills with zero payment, grouped by billing provider and status-effective date, with payment method fixed to `"NON"` ([DOM-BR-120](../../business-rules.md#dom-br-120-eob-generation)).
- Builds payment EOBs from the medical-billing API's payment extract, loading the corresponding e-bills in chunks of 900 ([DOM-BR-121](../../business-rules.md#dom-br-121-eob-generation)) and skipping and logging any extract row with a null payment-method code ([DOM-BR-122](../../business-rules.md#dom-br-122-eob-generation)).
- Builds MCO-fee adjustments and remittance advices using the clearinghouse's configured MCO reason/group codes ([DOM-BR-123](../../business-rules.md#dom-br-123-eob-generation)) and per-service adjustments/remittance advices grouped by service and RARC, inverting the adjustment amount and mapping `MA`/`PR` group codes to `CO` ([DOM-BR-124](../../business-rules.md#dom-br-124-eob-generation), [DOM-BR-125](../../business-rules.md#dom-br-125-eob-generation)).
- Regenerates a previously rejected EOB by re-attaching its bills to a new EOB record and setting those bills to Completed ([DOM-BR-126](../../business-rules.md#dom-br-126-eob-regenerate)).

## Context
- Namespace: `SAIF.Domain.Claims.Ebilling`
- Assembly/package: `SAIF.Domain` (`Domain/SAIF.Domain/SAIF.Domain.csproj`, .NET Framework 4.6.2 class library)

## Public members
| Member | Signature | Purpose |
| --- | --- | --- |
| GenerateEobs | `public static EobResults GenerateEobs(EbillBatch ebillBatch, IEbillingQueryProvider queryProvider, IRepositoryFactory factory, IMedicalBillingApiService medicalBillingApiSerivce, string updateUser, EbillClearinghouse clearinghouse, long rowLimit, ILogWriter errorLogWriter)` | Runs the full EOB generation pass for the batch: builds non-payment EOBs, then builds payment EOBs from the medical-billing API extract, returning the combined `EobResults`. |
| GenerateEob | `public static EobResults GenerateEob(EbillBatch ebillBatch, EbillEob ebillEob, IEbillingQueryProvider queryProvider, string updateUser)` | Regenerates a single rejected EOB: creates a replacement `EbillEob` record and re-attaches its bills, setting them to Completed ([DOM-BR-126](../../business-rules.md#dom-br-126-eob-regenerate)). |
| GenerateNonPaymentEobs | `public static void GenerateNonPaymentEobs(EbillBatch ebillBatch, IRepositoryFactory factory, IEbillingQueryProvider queryProvider, string updateUser, EobResults results, EbillClearinghouse clearinghouse)` | Groups completed zero-payment bills by billing provider and status-effective date and creates one `"NON"`-payment-method EOB per group, generating adjustments and attaching each e-bill ([DOM-BR-120](../../business-rules.md#dom-br-120-eob-generation)). |
| GeneratePaymentEobs | `public static void GeneratePaymentEobs(EbillBatch ebillBatch, IRepositoryFactory factory, IEbillingQueryProvider queryProvider, IMedicalBillingApiService medicalBillingApiSerivce, string updateUser, EobResults results, EbillClearinghouse clearinghouse, long rowLimit, ILogWriter errorLogWriter)` | Retrieves the payment EOB extract from the medical-billing API, loads the referenced e-bills in chunks of 900 ([DOM-BR-121](../../business-rules.md#dom-br-121-eob-generation)), and creates an EOB per extract row, skipping and logging rows with a null payment-method code ([DOM-BR-122](../../business-rules.md#dom-br-122-eob-generation)). |
| GenerateAdjustments | `public static void GenerateAdjustments(EbillEob eob, Ebill ebill, IRepositoryFactory factory, IEbillingQueryProvider queryProvider, string updateUser, EobResults results)` | Builds the MCO-fee adjustment/remittance-advice pair when audited services have an MCO admin fee, and the per-service adjustments/remittance advices from the bill's audit adjustments. |
| CreateMcoFeeAdjustment | `public static void CreateMcoFeeAdjustment(Ebill ebill, IEnumerable<CbpAuditedService> auditedMcoServices, IEbillingQueryProvider queryProvider, IRepositoryFactory factory, EobResults results)` | Inserts an `EbillEobAdjustment` per audited service with an MCO admin fee, using the clearinghouse's configured MCO adjustment reason/group codes ([DOM-BR-123](../../business-rules.md#dom-br-123-eob-generation)). |
| CreateMcoFeeRemittenceAdvice | `public static void CreateMcoFeeRemittenceAdvice(Ebill ebill, IEnumerable<CbpAuditedService> auditedMcoServices, IEbillingQueryProvider queryProvider, IRepositoryFactory factory, EobResults results)` | Inserts an `EbillEobRemittanceAdvice` per audited MCO service using the clearinghouse's configured MCO remittance-advice code. |
| CreateServiceAdjustments | `public static void CreateServiceAdjustments(Ebill ebill, EbillEob eob, IEnumerable<CbpAuditedServiceAdjustment> auditedServiceAdjustments, IRepositoryFactory factory, string updateUser, EobResults results)` | Inserts an `EbillEobAdjustment` per non-zero audit adjustment, inverting the adjustment amount and remapping `MA`/`PR` group codes to `CO` ([DOM-BR-124](../../business-rules.md#dom-br-124-eob-generation)). |
| CreateRemittanceAdvices | `public static void CreateRemittanceAdvices(Ebill ebill, EbillEob eob, IEnumerable<CbpAuditedServiceAdjustment> auditedServiceAdjustments, IRepositoryFactory factory, string updateUser, EobResults results)` | Inserts one `EbillEobRemittanceAdvice` per distinct service/RARC group among the bill's audit adjustments, skipping groups with no remittance-advice code ([DOM-BR-125](../../business-rules.md#dom-br-125-eob-generation)). |
| AttachEbillToEob | `public static void AttachEbillToEob(EbillEob eob, Ebill ebill, string updateUser)` | Links the e-bill to the given EOB and stamps the update user/date, without changing the bill's status. |

## Behavioral notes
- `File835Builder` and `File837AckBuilder` render the actual EDI output from the EOB data this class builds; their per-segment content was not traced line by line in this analysis**.
- Regenerating a rejected EOB (`GenerateEob`) is the only path that also changes bill status, setting each re-attached bill to Completed ([DOM-BR-126](../../business-rules.md#dom-br-126-eob-regenerate)); `AttachEbillToEob` used during normal generation does not change status.

> **Note:** Statements marked with `**` could not be confirmed; treat as unknown until verified.

## Sources
- `Domain/SAIF.Domain/Claims/Ebilling/EobBuilder.cs`
