CBE pay checks freshly quoted amount

This commit is contained in:
Marshal
2026-08-07 08:55:42 +00:00
parent eb9edcc3df
commit 2eb7110392

View File

@@ -272,10 +272,15 @@ export class CbeBillService {
);
}
// Validate against the freshly-quoted amount — the same figure bill-query
// just showed the payer — not the intent's amount asserted at creation,
// which can go stale when the domain re-prices the invoice. Fallback to
// the intent amount only for domain builds that return no current amount.
const expectedAmount = billQuery.currentAmountMinor ?? intent.amountMinor;
const amount = Number(dto.Amount);
if (
!Number.isFinite(amount) ||
!amountsMatchToTheCent(amount, intent.amountMinor)
!amountsMatchToTheCent(amount, expectedAmount)
) {
throw new CbeBillError("Amount mismatch", "BUSINESS");
}