mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-09-08 19:28:17 +00:00
changes export flow
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user