mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-26 18:42:49 +00:00
CBE pay checks freshly quoted amount
This commit is contained in:
@@ -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");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user