Merge pull request #1157 from Tria-plc/freight_feature/usermanagement

CBE pay checks freshly quoted amount
This commit is contained in:
marshal
2026-08-07 11:56:28 +03:00
committed by GitHub

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");
}