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

# BillAssignment

`BillAssignment` implements bill-responsibility assignment for a batch of e-bills (operation OP-DOM-01 in this library's operations catalog): for every non-assigned bill on a batch it records an audit note for each pended error, asks ClaimCenter for the claim, chooses an assignment rule based on whether the claim is confidential or has provider errors, applies the resulting responsible party and status to the bill, and marks the e-bill as Assigned. It is a static, stateless orchestrator — all collaborators (query providers, the repository factory, the user profile, and the ClaimCenter/Guidewire API clients) are passed in as parameters rather than held as fields.

## Purpose
- Assigns each non-assigned bill on a batch to its responsible party and status by evaluating the claim's conflict/error state, recording audit notes for pended errors, and updating the e-bill status to Assigned ([DOM-BR-001](../../business-rules.md#dom-br-001-bill-assignment), [DOM-BR-006](../../business-rules.md#dom-br-006-assignment-complete)).
- Chooses among confidential, claim-error, provider-error, and clean assignment rules based on whether the claim's worker is a conflict worker and whether pended errors are all provider errors ([DOM-BR-002](../../business-rules.md#dom-br-002-assignment), [DOM-BR-003](../../business-rules.md#dom-br-003-assignment), [DOM-BR-004](../../business-rules.md#dom-br-004-assignment), [DOM-BR-005](../../business-rules.md#dom-br-005-assignment)).
- Wraps any exception raised while assigning a bill with the e-bill's identifier so failures are traceable back to the specific bill ([DOM-BR-007](../../business-rules.md#dom-br-007-exception)).

## 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 |
| --- | --- | --- |
| AssignBillsResponsibily | `public static AssignResults AssignBillsResponsibily(long batchId, IEbillingQueryProvider queryProvider, IRepositoryFactory factory, IUserProfileService profile, IAuditNoteQueryProvider auditNoteQueryProvider, IBillQueryProvider billQueryProvider, IClaimQueryProvider claimQueryProvider, IWorkerQueryProvider workerQueryProvider, ICCClaimApiService claimApiService, IClaimDataApiClient gwClaimDataApiClient)` | Assigns responsibility for every non-assigned bill in the batch, tallies successes and failures into `AssignResults`, and rethrows any per-bill exception with the e-bill id attached ([DOM-BR-007](../../business-rules.md#dom-br-007-exception)). |
| AssignBillResponsibility | `public static bool AssignBillResponsibility(Ebill bill, IEbillingQueryProvider queryProvider, IRepositoryFactory factory, IUserProfileService profile, IAuditNoteQueryProvider auditNoteQueryProvider, IBillQueryProvider billQueryProvider, IClaimQueryProvider claimQueryProvider, IWorkerQueryProvider workerQueryProvider, ICCClaimApiService claimApiService, IClaimDataApiClient gwClaimDataApiClient)` | Assigns a single bill: records a "BE"/"B" audit note per pended error ([DOM-BR-001](../../business-rules.md#dom-br-001-bill-assignment)), applies the chosen assignment rule's status and responsible party to the bill, and updates the e-bill to Assigned ([DOM-BR-006](../../business-rules.md#dom-br-006-assignment-complete)). |
| GetBillAssignmentRule | `public static EbillAssignmentRule GetBillAssignmentRule(Ebill bill, IList<EbillErrorCondition> pendedErrors, IEbillingQueryProvider queryProvider, ICCClaimApiService ccclaimApiService)` | Selects the assignment rule for a bill: confidential when the claim's worker is a conflict worker, claim-error when not all pended errors are provider errors, provider-error when all are, otherwise clean ([DOM-BR-002](../../business-rules.md#dom-br-002-assignment), [DOM-BR-003](../../business-rules.md#dom-br-003-assignment), [DOM-BR-004](../../business-rules.md#dom-br-004-assignment), [DOM-BR-005](../../business-rules.md#dom-br-005-assignment)). |
| UpdateBillStatusToAssigned | `public static void UpdateBillStatusToAssigned(Ebill bill, IEbillingQueryProvider queryProvider, string updateUser)` | Sets the e-bill's status to Assigned and stamps the update user/date ([DOM-BR-006](../../business-rules.md#dom-br-006-assignment-complete)). |

## Behavioral notes
- Assignment delegates the actual status/responsible-party change to `Model.Claims.Bills.Bill.ModifyStatus`, which maps the target status to a status code and throws on an unrecognized status ([DOM-BR-030](../../business-rules.md#dom-br-030-status-change)).
- The claim lookup used to decide the assignment rule calls `ICCClaimApiService.GetClaim` synchronously via `GetAwaiter().GetResult()`, so a slow or failing ClaimCenter call blocks the assignment loop for that bill*.

> **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/BillAssignment.cs`
