All Docs
FeaturesDepositClearUpdated March 20, 2026

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:

EventDescription
deposit_releases.createdA new deposit release row is inserted
deposit_releases.totalDepositAmount updatedThe 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 release
  • tenancies.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_releases and tenancies records

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

EntityRole
deposit_releasesSource of the totalDepositAmount being checked; trigger point for the function
tenanciesProvides the reference depositAmount for comparison
compliance_checksReceives the new critical check record when a discrepancy is found
notificationsUsed to alert finance and admin users

Resolving a Discrepancy

When a deposit_amount_discrepancy compliance check is raised:

  1. Navigate to Compliance → Open Checks in the dashboard.
  2. Locate the check flagged as deposit_amount_discrepancy.
  3. Review the deposit_releases.totalDepositAmount against tenancies.depositAmount for the affected records.
  4. 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.depositAmount is 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.