MR check: finance-services !2762: fix(xero): handle head contract claims in the invoice webhook
- MR finance-services!2762, from
fix/xero-hc-paid-status-sync-autest-v2intoautest, by Lutfi, updated 2026-11-11, checked at commitda5e7609. - Verdict: Safe. Of 50 certified dashboards: Broken 0, Affected 0, Needs review 0, Safe 50.
- Post the comment? Not needed (Safe). Post only if the team wants a comment on every MR.
- Changed: 2 migration(s), 1 model file(s), 5 code file(s) naming report data, 4 other file(s).
Drafted comment (not posted)
The comment a developer would see, between the two lines. Nothing is posted by the tool; whether comments are ever posted, and by whom, is not decided.
Report impact check: Safe. No certified Superset dashboard is affected by this MR (50 checked).
Read and cleared: 5 files that name report data (they don't change what gets stored).
Checked at da5e7609 against the 50 published and certified Superset dashboards (map built 2026-11-16) by the Report Impact Checker AI Tool (read-only). Questions: Lucas (BI).
Details for Lucas
Migrations
20261012000000-alter-head-contract-claim-histories-add-paid-at.js: addColumnhead_contract_claim_histories.paid_at— reports read it20261109000000-alter-head-contract-claim-histories-add-paid-source.js: addColumnhead_contract_claim_histories.paid_source— reports read it
Reviewed: Safe
src/helpers/xero-head-contract-paid-status.ts: Helpers that map a Xero invoice status to a Head Contract claim's status_payment, paid_at and paid_source. Those columns are not read by certified dashboards (they read status, type, meta, save_as_draft, is_variation and ids); invoices.status_from_integrated_app is not touched here.src/head-contract.service.ts: Manual payment status changes on Head Contract claims now also set paid_at and paid_source, and a claim marked paid by Xero can't be changed without force_override. Only status_payment, paid_at and paid_source are affected, which reports don't read; save_as_draft is unchanged (trailing comma only).src/integration.service.ts: New Xero webhook and backfill handling for Head Contract claims: writes head_contract_claim_histories.status_payment, paid_at, paid_source and the claim's status_from_integrated_app badge. None of these are read by certified dashboards; AP invoices (invoices.status_from_integrated_app) are not written by the new code.src/xero-client.service.ts: The Xero invoice webhook now also recognises Head Contract claims (paid, voided, deleted, reopened) and a backfill job syncs their paid status, writing only claim payment fields reports don't read. The existing AP invoice branch is kept as before, so invoices.status_from_integrated_app (Invoice Report by Xero Entity) is written as today.src/xero-integration.controller.ts: Registers the sync_xero_head_contract_paid_status message that starts the backfill. The backfill only writes Head Contract claim payment fields that reports don't read; organization_uuid is a payload field.