mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-09-08 03:05:42 +00:00
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:
@@ -513,6 +513,17 @@ export class BillingService {
|
|||||||
// MoR EIMS reference — only once actually registered, never a placeholder row.
|
// MoR EIMS reference — only once actually registered, never a placeholder row.
|
||||||
if (invoice.eimsIrn) summary.push({ label: "EIMS IRN", value: invoice.eimsIrn });
|
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 {
|
return {
|
||||||
kind,
|
kind,
|
||||||
title,
|
title,
|
||||||
|
|||||||
Reference in New Issue
Block a user