Deposit Amount Discrepancy Detector
Deposit Amount Discrepancy Detector
Available from: v0.1.375
Overview
The Deposit Amount Discrepancy Detector is an event-driven compliance function that automatically compares the deposit amount on a deposit_releases record against the original deposit amount held on the associated tenancy. When a material discrepancy is detected, the system raises a critical compliance check and alerts the relevant finance and administrative users.
This feature helps organisations catch data inconsistencies, unauthorised adjustments, and clerical errors at the earliest possible point — before they escalate into disputes or regulatory breaches under the Renters' Rights Act.
Trigger Conditions
The function fires automatically on either of the following database events:
| Event | Description |
|---|---|
deposit_releases.created | A new deposit release row is inserted |
deposit_releases.totalDepositAmount updated | The totalDepositAmount field on an existing deposit release is modified |
No manual action is required to invoke this check — it runs as part of the deposit release lifecycle.
Discrepancy Detection Logic
The detector compares two values:
deposit_releases.totalDepositAmount— the amount recorded on the deposit releasetenancies.depositAmount— the original deposit amount from the associated tenancy
A discrepancy is flagged if:
|totalDepositAmount - depositAmount| / depositAmount > 0.01
The 1% tolerance threshold is intentional. It prevents false positives caused by floating-point arithmetic or minor rounding differences between systems, while still catching any material financial variance.
What Happens When a Discrepancy Is Detected
When the comparison exceeds the 1% threshold, the system takes two automatic actions:
1. Compliance Check Created
A new row is inserted into compliance_checks with:
- Severity:
critical - Rule:
deposit_amount_discrepancy - Linked entities: the affected
deposit_releasesandtenanciesrecords
This check appears in the compliance dashboard and remains open until reviewed and resolved by an authorised user.
2. Notifications Dispatched
Real-time notifications are sent to:
- All users with the finance role in the organisation
- All org admins for the relevant organisation
Notifications contain sufficient context to identify the affected tenancy and the magnitude of the discrepancy.
Entities Involved
| Entity | Role |
|---|---|
deposit_releases | Source of the totalDepositAmount being checked; trigger point for the function |
tenancies | Provides the reference depositAmount for comparison |
compliance_checks | Receives the new critical check record when a discrepancy is found |
notifications | Used to alert finance and admin users |
Resolving a Discrepancy
When a deposit_amount_discrepancy compliance check is raised:
- Navigate to Compliance → Open Checks in the dashboard.
- Locate the check flagged as
deposit_amount_discrepancy. - Review the
deposit_releases.totalDepositAmountagainsttenancies.depositAmountfor the affected records. - Either:
- Correct the deposit release if the amount was entered in error, or
- Document a justified reason for the variance and mark the check as resolved with an audit note.
All resolution actions are logged for audit trail purposes.
Notes
- This check is non-blocking — the deposit release row is created or updated regardless of whether a discrepancy is found. The compliance check is raised in parallel.
- The 1% tolerance applies to the relative difference, not an absolute monetary value. For a £1,000 deposit, variances up to £10 will not trigger a check.
- If
tenancies.depositAmountis null or zero for the associated tenancy, the function handles this gracefully to avoid division errors — no false-positive check is raised in those edge cases.