diff --git a/apps/edr-passenger-web/portal/src/lib/generate-voucher.ts b/apps/edr-passenger-web/portal/src/lib/generate-voucher.ts index 4c8f25eec..306225a6c 100644 --- a/apps/edr-passenger-web/portal/src/lib/generate-voucher.ts +++ b/apps/edr-passenger-web/portal/src/lib/generate-voucher.ts @@ -437,8 +437,11 @@ interface VoucherData { } export const generateVoucherPDF = async (booking: VoucherData): Promise => { - // The settled payment amount, when available, is shown exactly as returned by the API - // (no /100, no per-passenger split) on every passenger's voucher — see fareIsMajorUnits. + // The amount shown is always a single raw field straight from the API — the settled + // payment amount when available, otherwise the booking total — never a derived value + // (previously this fell back to Math.round(totalMinor / passengers.length), which + // doesn't correspond to any real field and could disagree with what was actually + // charged). Same value on every passenger's voucher; no /100, no per-passenger split. const settledAmountMinor = booking.payment?.amountMinor; const settledCurrency = booking.payment?.currency; const useSettledAmount = settledAmountMinor != null && !!settledCurrency; @@ -465,7 +468,7 @@ export const generateVoucherPDF = async (booking: VoucherData): Promise => status: booking.status, outboundSchedule: { ...booking.schedule, seatClass: p.seat?.seatClass }, isRoundTrip: false, - fareMinor: useSettledAmount ? settledAmountMinor! : Math.round(booking.totalMinor / booking.passengers.length), + fareMinor: useSettledAmount ? settledAmountMinor! : booking.totalMinor, currency: voucherCurrency, fareIsMajorUnits: useSettledAmount, createdAt: booking.createdAt,