---
title: Manage distributions and refunds
summary: Persists third-party settlement distribution checks, validating that check amounts reconcile against claim-cost, refund, and other-amount components.
status: draft
owner: SAIF
last_reviewed: 2026-07-30
library: SAIF.Business.Claim.ThirdParty
reference_type: package
operation_id: OP-TP-05
trigger: clsThirdpartyDistribution.NewThirdpartyDistribution / GetThirdpartyDistribution followed by property edits and Save()
---

# Manage distributions and refunds

`clsThirdpartyDistribution` records a disbursement check against a case's recovery settlement, split across claim-cost, ARA, refund, employer-credit, and up to two "other" amount components. The distribution-history (`clsThirdpartyDistHist`) and refundee (`clsThirdpartyRefundee`) classes are read-only projections that surface the resulting history and payee detail; only the distribution and distribution-refund objects carry business rules and write behavior.

| Field | Value |
| --- | --- |
| **Operation ID** | OP-TP-05 |
| **Trigger** | `clsThirdpartyDistribution.NewThirdpartyDistribution` / `GetThirdpartyDistribution` followed by property edits and `Save()` |
| **Inputs** | `CaseSeqNum`, `DistributionCode`, payee name, check number/date/amount, claim-cost/ARA/refund/employer-credit/other amounts, refund payee names |
| **Outputs** | Persisted `thrdparty_distribution` row and associated `thrdparty_distribution_refund` rows; read-only distribution-history and refundee collections for display |
| **Primary components** | `clsThirdpartyDistribution.AddBusinessRules`, `clsThirdpartyDistribution.ValidCheckAmount`, `clsThirdpartyDistribution.ValidRefundAmount` |
| **Entry point** | `Business\SAIF.Business.Claim.ThirdParty\clsThirdpartyDistribution.vb` |

## Steps

1. **Create or retrieve a distribution.** Retrieval reads a distribution by case ([SQL-051](../sql/sql-051-pk82033_thirdparty-thrdparty_distribution_select.md), [thrdparty_distribution](../database-tables.md#thrdparty_distribution)).
2. **Validate the distribution (`IsValid`), with most checks skipped when `DistributionCode` is `ARA` (excess-cash-refund-account distributions do not require a payee, check number, or check date):**
   - Payee name, check number, and check date are required unless the distribution is an ARA type ([BR-025](../business-rules.md#br-025-distribution-requires-payee-name-check-number-and-a-valid-check-date)).
   - Check date, when required, must be a reasonable date within the shared `CommonBusinessRules` window (`Now.AddYears(MIN_REASONABLE_DATE_OFFSET)` through today) ([BR-025](../business-rules.md#br-025-distribution-requires-payee-name-check-number-and-a-valid-check-date)).
   - Check amount is required unless the distribution is an ARA type ([BR-026](../business-rules.md#br-026-distribution-check-amount-is-required-and-must-equal-the-sum-of-refund-claim-cost-and-other-amounts-including-excess-cash-refund-total)).
   - Check amount, unless ARA, must equal the sum of claim-cost, ARA, refund, employer-credit, and both other amounts ([BR-026](../business-rules.md#br-026-distribution-check-amount-is-required-and-must-equal-the-sum-of-refund-claim-cost-and-other-amounts-including-excess-cash-refund-total)).
   - The excess-cash refund amount must equal the sum of the two individual refund-payee amounts (`refund1Amount + refund2Amount`), evaluated regardless of distribution type ([BR-026](../business-rules.md#br-026-distribution-check-amount-is-required-and-must-equal-the-sum-of-refund-claim-cost-and-other-amounts-including-excess-cash-refund-total)).
   - A refund payee name is required whenever the corresponding refund amount (`refund1Amount`/`refund2Amount`) is non-zero ([BR-027](../business-rules.md#br-027-distribution-refundother-amount-names-are-required-whenever-the-corresponding-amount-is-entered)).
   - An "other" amount description is required whenever the corresponding other amount (`OtherAmount1`/`OtherAmount2`) is non-zero ([BR-027](../business-rules.md#br-027-distribution-refundother-amount-names-are-required-whenever-the-corresponding-amount-is-entered)).
   - Create-user text is required, delegated to the shared `CommonBusinessRules.TextRequired` rule.
   - A claim-costs-amount-required rule exists in source but is fully commented out and is not registered.*
3. **Persist the distribution** via insert ([SQL-023](../sql/sql-023-pk82033_thirdparty-thrdparty_distribution_insert.md)) or update ([SQL-077](../sql/sql-077-pk82033_thirdparty-thrdparty_distribution_update.md)) against [thrdparty_distribution](../database-tables.md#thrdparty_distribution); insert also allocates a new refund sequence number and writes to `thrdparty_distribution_refund` when refund payees are populated ([thrdparty_distribution_refund](../database-tables.md#thrdparty_distribution_refund)).
   - On a rows-affected value other than `1`: an insert/update error message is added.
4. **Read distribution history for display.** `clsThirdpartyDistHist` and its collection retrieve a read-only history of prior distributions for the case; no rules or write paths exist on this class.*
5. **Read refundee detail for display.** `clsThirdpartyRefundee` and its collection retrieve a read-only projection of refund payees for a distribution ([SQL-050](../sql/sql-050-pk82033_thirdparty-thrdparty_dist_refundee_select.md)); no rules or write paths exist on this class.*

## Process flow

The following diagram visualizes distribution check validation, centered on the amount-reconciliation rules.

```mermaid
flowchart TD
	Start([Caller creates or edits distribution]) --> Type{DistributionCode = ARA?}
	Type -->|No| Required[Validate payee name,<br>check number, check date,<br>check amount]
	Type -->|Yes| SkipReq[Skip payee/check-identity checks]
	Required --> Amounts[Validate check amount = sum<br>of claim-cost, ARA, refund,<br>employer-credit, other amounts]
	SkipReq --> Amounts
	Amounts --> RefundTotal[Validate refund amount =<br>refund1Amount + refund2Amount]
	RefundTotal --> Names[Validate refund/other payee<br>names present when amounts entered]
	Names --> Ok{All rules pass?}
	Ok -->|No| Fail([Broken rules returned])
	Ok -->|Yes| Save[Insert or update<br>thrdparty_distribution]
	Save --> Rows{RowsAffected = 1?}
	Rows -->|No| Contention([Insert/Update error added])
	Rows -->|Yes| Done([Distribution persisted;<br>refund rows written if present])
```

## Failure and edge-case behavior

- ARA-type distributions bypass the payee, check-number, check-date, and check-amount-required checks entirely — only the refund-amount-reconciliation and refund/other-name rules still apply to them.
- The refund-amount-reconciliation rule (`ValidRefundAmount`) runs unconditionally, even for ARA distributions, unlike the other amount checks.*
- A claim-costs-amount-required rule is present in source as commented-out code and never registered — the corresponding validation does not run despite appearing in the class.*
- A rows-affected value other than `1` on insert or update is treated as a DB contention failure rather than an exception ([BR-005](../business-rules.md#br-005-recovery-save-operations-require-one-affected-row)).
- Distribution history and refundee reads have no corresponding write path in this library; any correction requires editing the originating distribution and re-saving.*

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

## Related documentation

- [Operations and processes](../operations-processes.md)
- [Business rules](../business-rules.md)
- [SQL catalog](../sql/index.md)
- [Database tables](../database-tables.md)

## Sources

- `Business\SAIF.Business.Claim.ThirdParty\clsThirdpartyDistribution.vb`
- `Business\SAIF.Business.Claim.ThirdParty\clsThirdpartyDistributionCollection.vb`
- `Business\SAIF.Business.Claim.ThirdParty\clsThirdpartyDistHist.vb`
- `Business\SAIF.Business.Claim.ThirdParty\clsThirdpartyDistHistCollection.vb`
- `Business\SAIF.Business.Claim.ThirdParty\clsThirdpartyDistributionRefund.vb`
- `Business\SAIF.Business.Claim.ThirdParty\clsThirdpartyRefundee.vb`
- `Business\SAIF.Business.Claim.ThirdParty\clsThirdpartyRefundeeCollection.vb`
