From 24872df0ba429d6c840e01cfd809aaaccde48ae8 Mon Sep 17 00:00:00 2001 From: Stephanos A Date: Mon, 20 Jul 2026 23:20:26 +0300 Subject: [PATCH] Payment discrepancy paid amount update --- .../src/modules/reports/reports.service.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/apps/edr-passenger-api/src/modules/reports/reports.service.ts b/apps/edr-passenger-api/src/modules/reports/reports.service.ts index 42b5865ba..9460aa5a9 100644 --- a/apps/edr-passenger-api/src/modules/reports/reports.service.ts +++ b/apps/edr-passenger-api/src/modules/reports/reports.service.ts @@ -956,13 +956,11 @@ export class ReportsService { let rows = bookings.map(b => { const pi = b.paymentIntent!; const actualMinor = b.seats.reduce((s, seat) => s + (seat.fareMinor ?? 0), 0); - const paidMinor = Math.round(pi.amountMinor); - const varianceMinor = actualMinor - paidMinor; + // pi.amountMinor is a Float in full currency units — convert to cents once + const paidMinorCents = Math.round(pi.amountMinor * 100); const isPackage = !!(b as any).package; const effectiveActualMinor = isPackage ? actualMinor * 2 : actualMinor; - // actualMinor is in cents; paidMinor (PaymentIntent.amountMinor) is a Float in full units — convert to cents before comparing - const paidMinorCents = Math.round(paidMinor * 100); const effectiveVarianceMinor = effectiveActualMinor - paidMinorCents; const breakdown = b.seats.map(s => ({ @@ -984,7 +982,7 @@ export class ReportsService { destination: b.schedule.destinationStation.name, phone: b.passenger?.user?.phone ?? (b as any).contactPhone ?? '—', actualMinor: effectiveActualMinor, - paidMinor, + paidMinor: paidMinorCents, varianceMinor: effectiveVarianceMinor, breakdown, };