Skip to content

File277CaBuilder

File277CaBuilder builds the outbound 277 claim-acknowledgement response file for a set of e-bills (operation OP-DOM-11): it assembles the ISA/GS/ST/BHT/HL segment structure through EdiBuildSegments, maps each bill's status to a 277 status category, and tracks the first and last response batch per bill so repeat acknowledgements can be distinguished from the initial one.

Purpose

  • Produces the complete outbound 277 response IEdiFile for a collection of response bills, mapping each bill's current status into the 277 status-category codes the clearinghouse expects (DOM-BR-110).
  • Tracks FirstResponseBatch/LastResponseBatch on each bill, setting LastResponseBatch only when the bill's status is not PEND so that only a bill's final acknowledgement is recorded as its last response (DOM-BR-111).
  • Provides the statement-date derivation (DetermineStatmentThruDate) and bill-lookup helper (GetBillForUpdating) that the main build method uses to prepare and update bills as it builds the response.

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
Build277ResponseFile public static IEdiFile Build277ResponseFile(IEnumerable<Ebill> responsebills, IEbillingQueryProvider ebillingQueryProvider, IUserProfileService userProfileService, EbillBatch batch277, bool isProductionRun, EbillClearinghouse clearinghouse, ILogWriter controlReport, StatusResponseResults statusResponseResults) Builds the ISA/GS/ST/BHT/HL header segments via EdiBuildSegments, then evaluates and writes a status entry for each response bill, updating the aggregate StatusResponseResults as it goes.
EvaluateCbpBillStatus public static int EvaluateCbpBillStatus(Ebill bill, StatusResponseResults results) Maps a bill's current status to its 277 status category: PEN maps to 2 (no matching claim) or 3, DIS maps to 4, and every other status maps to 1 (DOM-BR-110).
DetermineStatmentThruDate public static DateTime? DetermineStatmentThruDate(Ebill bill, DateTime statementFromDate) Derives the statement-through date to report for a bill given its statement-from date, used when writing the bill's status segment.
GetBillForUpdating public static Ebill GetBillForUpdating(IEbillingQueryProvider ebillingQueryProvider, long billId, EbillBatch batch277, StatusResponseResults statusResponseResults, IUserProfileService userProfileService) Retrieves the bill to update by id and stamps its FirstResponseBatch/LastResponseBatch for this 277 run, setting LastResponseBatch only when the bill's status is not PEND (DOM-BR-111).

Behavioral notes

  • GetBillForUpdating is the single place FirstResponseBatch and LastResponseBatch are stamped, so any caller building a 277 response outside Build277ResponseFile must still route bill lookups through it to keep those fields correct*.

Note: Statements marked with * were inferred from code structure, naming conventions, or contextual evidence where direct confirmation was not available in source artifacts.

Sources

  • Domain/SAIF.Domain/Claims/Ebilling/File277CaBuilder.cs