changes export flow

This commit is contained in:
Marshal
2026-07-30 11:30:34 +00:00
parent b671f07ce6
commit 2ca04b8f98
47 changed files with 1195 additions and 74 deletions

View File

@@ -137,6 +137,25 @@ export class BookingNotifierService {
});
}
/** One warning shortly before the pay window closes (sent once per hold). */
async payDeadlineApproaching(b: Booking, deadline: Date): Promise<void> {
const minutesLeft = Math.max(
1,
Math.round((deadline.getTime() - Date.now()) / 60_000),
);
const eat = deadline.toLocaleString('en-GB', { timeZone: 'Africa/Addis_Ababa' });
const msg =
`Payment reminder: about ${minutesLeft} minute${minutesLeft === 1 ? '' : 's'} left ` +
`to pay for booking ${b.reference ?? b.id}. Deadline: ${eat} EAT — ` +
`unpaid reservations are released and the wagons go back on sale.`;
await this.notifyContact(b, msg, 'PAY REMINDER');
// HIGH: minutes from losing the reserved wagons — must reach SMS/email.
this.inApp(b, 'Payment deadline approaching', msg, {
type: NotificationType.INVOICE_ISSUED,
priority: NotificationPriority.HIGH,
});
}
/**
* Partial-capacity offer: only `offeredWagons` of the booking's `totalWagons` fit
* this train. Paying accepts the split; letting the deadline pass keeps the