feat(billing): add PNR row to freight invoice from booking payment reference

PNR isn't a column on Invoice/Payment — it's written onto Booking.pnrCode
when a CBE_BILL payment initiates. toDocumentModel() now looks it up by
invoice.sourceId and adds it to the existing summary grid, shown only
when present.
This commit is contained in:
Hagernesh
2026-08-14 07:16:19 +00:00
parent e56e1c3009
commit 41f480554c

View File

@@ -513,6 +513,17 @@ export class BillingService {
// MoR EIMS reference — only once actually registered, never a placeholder row.
if (invoice.eimsIrn) summary.push({ label: "EIMS IRN", value: invoice.eimsIrn });
// PNR — the CBE_BILL reference the customer pays against, written onto the booking at
// payment-initiation time (see initiatePayment()). Not a column on Invoice/Payment, so
// look it up by source id; only shown once a payment actually generated one.
if (invoice.source === Freight.InvoiceSource.Booking) {
const booking = await this.dataSource.getRepository(Booking).findOne({
where: { id: invoice.sourceId },
select: ["id", "pnrCode"],
});
if (booking?.pnrCode) summary.push({ label: "PNR", value: booking.pnrCode });
}
return {
kind,
title,