mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-29 19:58:11 +00:00
feat: implement audit logs
This commit is contained in:
@@ -10,6 +10,7 @@ import {
|
||||
import { EventEmitter2 } from "@nestjs/event-emitter";
|
||||
import { DataSource, EntityManager, In } from "typeorm";
|
||||
|
||||
import { Booking } from "../bookings/entities/booking.entity";
|
||||
import { CompaniesService } from "../companies/companies.service";
|
||||
import { applyBookingRefDirectionScope } from "../user-trade-access/trade-scope.util";
|
||||
import { PaymentService } from "../payment/payment.service";
|
||||
@@ -1192,6 +1193,17 @@ export class BillingService {
|
||||
.getRepository(Invoice)
|
||||
.update({ id: invoice.id }, { paymentId: result.intentId });
|
||||
|
||||
// CBE_BILL: the bill reference IS the booking's PNR — the number the customer pays against
|
||||
// at any CBE channel. Persist it on the booking so it survives the initiate response and
|
||||
// shows on the booking/contract everywhere. The payment service reissues the same reference
|
||||
// while the bill stays open, so re-initiating overwrites with an identical value.
|
||||
const billReference = result.response.clientAction?.billReference;
|
||||
if (billReference && invoice.source === Freight.InvoiceSource.Booking) {
|
||||
await this.dataSource
|
||||
.getRepository(Booking)
|
||||
.update({ id: invoice.sourceId }, { pnrCode: billReference });
|
||||
}
|
||||
|
||||
// Settlement is driven by the payment API (webhook/outbox → payment.succeeded);
|
||||
// billing must not simulate it. Kept for local demos only.
|
||||
// An OTP intent (CAC Bank) is NOT paid yet — the payer still has to enter the
|
||||
|
||||
Reference in New Issue
Block a user