mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-26 18:42:49 +00:00
Merge pull request #856 from Tria-plc/alpha
Payment discrepancy paid amount update
This commit is contained in:
@@ -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,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user