mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-29 21:08:12 +00:00
chore: fix the invoice event
This commit is contained in:
@@ -691,7 +691,13 @@ export class BillingService {
|
|||||||
status: invoice.status,
|
status: invoice.status,
|
||||||
paymentId: invoice.paymentId ?? null,
|
paymentId: invoice.paymentId ?? null,
|
||||||
};
|
};
|
||||||
this.events.emit(`${invoice.source}.invoice.${event}`, payload);
|
this.events
|
||||||
|
.emitAsync(`${invoice.source}.invoice.${event}`, payload)
|
||||||
|
.catch((err) =>
|
||||||
|
this.logger.error(
|
||||||
|
`Listener for ${invoice.source}.invoice.${event} (invoice ${invoice.id}) failed: ${err instanceof Error ? err.message : String(err)}`,
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ── Payment reconciliation (by source) ───────────────────────────────────────
|
// ── Payment reconciliation (by source) ───────────────────────────────────────
|
||||||
|
|||||||
@@ -143,9 +143,16 @@ export class BookingInvoiceService {
|
|||||||
{ id: bookingId },
|
{ id: bookingId },
|
||||||
{ paymentStatus: "PAID", status: "PAID" },
|
{ paymentStatus: "PAID", status: "PAID" },
|
||||||
);
|
);
|
||||||
await this.firstMile.acceptBooking(bookingId);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
try {
|
||||||
|
await this.firstMile.acceptBooking(bookingId);
|
||||||
|
} catch (err) {
|
||||||
|
this.logger.error(
|
||||||
|
`Error accepting first-mile after payment: ${err instanceof Error ? err.message : String(err)}`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await this.bookingBatch.ensurePaidBookingAllocated(bookingId);
|
await this.bookingBatch.ensurePaidBookingAllocated(bookingId);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|||||||
Reference in New Issue
Block a user