From 2eb7110392d66ab3356e1e9813b28d1947f98037 Mon Sep 17 00:00:00 2001 From: Marshal Date: Fri, 7 Aug 2026 08:55:42 +0000 Subject: [PATCH] CBE pay checks freshly quoted amount --- .../src/modules/cbe-bill/cbe-bill.service.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/apps/edr-payment-api/src/modules/cbe-bill/cbe-bill.service.ts b/apps/edr-payment-api/src/modules/cbe-bill/cbe-bill.service.ts index 580e6283d..d7f9eb8d6 100644 --- a/apps/edr-payment-api/src/modules/cbe-bill/cbe-bill.service.ts +++ b/apps/edr-payment-api/src/modules/cbe-bill/cbe-bill.service.ts @@ -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"); }