CaseCostService¶
Builds the combined cost-history view for a legal case by merging three sources — legal-case cost adjustments (via ILegalQueryProvider.GetCaseCost), subpoena recipient payments (via ILegalQueryProvider.GetSubpoenas and financial-transaction lookups), and legal-bill service-line payments (via ILegalQueryProvider.GetLegalBills and ICCClaimApiService.GetClaim) — into a single chronologically ordered CaseCost list, and reorganizes amended/adjusted entries into nested adjustment histories.
Purpose¶
- Populates each
CaseInfo's combined cost history (and optionally case notes) for display in the legal case list/detail UI. - Merges legal-case cost adjustments, subpoena recipient payments, and legal-bill service payments into one
CaseCosttimeline, ordered by service-from date descending. - Attributes each cost entry with authorized-by/requested-by employee names resolved from ADP employee data, and financial transaction payment ID/issue date where available.
- Reorganizes amended cost entries so each amendment nests its prior (parent) versions under
AdjustmentHistory, removing the parent entries from the flat list.
Context¶
- Namespace:
SAIF.Services.Legal - Assembly/package:
SAIF.Services(packaged inside theSAIF.SAIFCode.CoreNuGet package).
Public members¶
| Member | Signature | Purpose |
|---|---|---|
| CaseCostService (constructor) | public CaseCostService(IUserProfileService userProfileService, ILegalQueryProvider legalQueryProvider, IBillServiceHelper billServiceHelper, ICCClaimApiService ccclaimApiService) |
Wires the user-profile, legal-query, bill-service-helper, and claim-API collaborators, and registers the CaseCost AutoMapper mapping once via MapCaseCost. |
| PopulateAdditionalCaseListProperties | public void PopulateAdditionalCaseListProperties(IEnumerable<CaseInfo> caseList, bool includeSubpoenas, bool includeNotes) |
For each case in the list, sets CaseCost to the combined cost history (optionally including subpoenas) and, when requested, sets CaseNotes from IBillServiceHelper.GetBillNotes; does nothing if caseList is null. |
Behavioral notes¶
GetCombinedCaseCostHistoryalways includes legal-case cost adjustments and legal-bill payments, and includes subpoena payments only whenincludeSubpoenasistrue.MapRecipientsToCaseCostmarks a subpoena paymentIsPaidSubpoenaonly when its status code isPaidand the current user is authorized forLNBillUpdate(CanEnterBills).CreateHistoryRowconverts billed units to hours (rounded to 2 decimals, away-from-zero) for conference/deposition (and cancellation) service codes, and resolves the MCO plan description from the claim's MCO data (fetched per service line viaICCClaimApiService.GetClaim) when the rate type isMCO.MoveAmendedCaseCostsToAdjustedListswalks each amended entry'sParentCostIdchain, moving every ancestor entry into the amended entry'sAdjustmentHistorylist and removing it from the flatcostHistorycollection.- A static
MapCaseCostmethod registers theCaseCost→ContractData.CaseCostmapping, including provider names, authorized-by fields, service description, formatted quantity-paid text, and prepayment yes/no text; this is invoked once per instance construction rather than from a static constructor.*
Constraints and usage notes¶
userProfileService,legalQueryProvider, andbillServiceHelperare null-checked in the constructor viaEnforce.ArgumentNotNull;ccclaimApiServiceis not validated for null.*CreateHistoryRowcallsICCClaimApiService.GetClaimsynchronously (viaGetAwaiter().GetResult()) once per bill service line, which may be a per-row network/API cost for cases with many bill services.*
Note: Statements marked with * were inferred from code structure, naming conventions, or contextual evidence where direct confirmation was not available in source artifacts. Statements marked with ** could not be confirmed; treat as unknown until verified.
Sources¶
Services/SAIF.Services/Legal/CaseCostService.cs