mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-29 12:58:13 +00:00
fix: premature payable invoice
This commit is contained in:
@@ -2317,9 +2317,13 @@ export class BookingBatchService implements OnModuleInit {
|
||||
paymentDeadline: deadline,
|
||||
} as never);
|
||||
booking.trainScheduleId = scheduleId;
|
||||
// The invoice was generated at booking creation/approval, before this pay
|
||||
// window opened — refresh its printed due date to the real deadline.
|
||||
await this.billing.syncPayableDueDate(
|
||||
// The invoice was generated DRAFT at booking creation / operation-accept,
|
||||
// before this pay window existed. Reserving is the moment the booking becomes
|
||||
// payable (SELECTED_FOR_BATCH + a real deadline), so issue the draft here and
|
||||
// print the deadline as its due date — never earlier, or the customer could
|
||||
// settle an invoice for a slot they have not been offered yet. Idempotent: a
|
||||
// re-reserve only refreshes `dueAt`.
|
||||
await this.billing.issuePayable(
|
||||
Freight.InvoiceSource.Booking,
|
||||
booking.id,
|
||||
deadline,
|
||||
|
||||
Reference in New Issue
Block a user