refactor(payment): centralize invoice processing with detailed tracking and configurable logging

This commit is contained in:
ghost2023
2026-07-02 11:47:35 +03:00
parent 118ba46930
commit 1c012ce1e2
11 changed files with 107 additions and 248 deletions

View File

@@ -1069,6 +1069,7 @@ export class BookingBatchService implements OnModuleInit {
Freight.InvoiceSource.Booking,
booking.id,
deadline,
"PREPAID",
);
await this.notifier.payNow(booking, deadline);
}
@@ -1120,7 +1121,7 @@ export class BookingBatchService implements OnModuleInit {
// Pay window closed before settlement → expire the booking's open invoice too
// (emits `booking.invoice.expired`). Domain owns the reaction; billing stays
// source-agnostic.
await this.billing.expirePayable(Freight.InvoiceSource.Booking, booking.id);
await this.billing.expirePayable(Freight.InvoiceSource.Booking, booking.id, "PREPAID");
this.notifier.expired(booking);
}
@@ -1167,6 +1168,7 @@ export class BookingBatchService implements OnModuleInit {
await this.billing.expirePayable(
Freight.InvoiceSource.Booking,
victim.id,
"PREPAID",
manager,
);
});