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

@@ -109,6 +109,7 @@ describe('BookingBatchService — PAID reconcile', () => {
windowDurationHours: 3,
docReviewMinutes: 30,
paymentWindowMinutes: 60,
exportPaymentWindowMinutes: 60,
}),
};
@@ -835,7 +836,8 @@ describe('BookingBatchService — PAID reconcile', () => {
// One reservation whose pay window lapsed, and one booking on the waiting list.
const lapsed = booking('lapsed', 50, {
status: 'SELECTED_FOR_BATCH',
paymentDeadline: new Date(Date.now() - 60_000),
// Past deadline + the 5-minute webhook grace, so the settle expires it.
paymentDeadline: new Date(Date.now() - 6 * 60_000),
});
const waiting = booking('waiting', 10, { trainScheduleId: null });
@@ -870,7 +872,8 @@ describe('BookingBatchService — PAID reconcile', () => {
it('serialises concurrent settles so the same reservation is not settled twice', async () => {
const lapsed = booking('lapsed', 50, {
status: 'SELECTED_FOR_BATCH',
paymentDeadline: new Date(Date.now() - 60_000),
// Past deadline + the 5-minute webhook grace, so the settle expires it.
paymentDeadline: new Date(Date.now() - 6 * 60_000),
});
// Both callers read the reservation; the lock must stop the second from
// acting on rows the first already expired. (The PAYMENT transition and the
@@ -901,7 +904,8 @@ describe('BookingBatchService — PAID reconcile', () => {
it('never expires a reservation whose payment landed — allocates it instead', async () => {
const latePaid = booking('late-paid', 50, {
status: 'SELECTED_FOR_BATCH',
paymentDeadline: new Date(Date.now() - 60_000),
// Past deadline + the 5-minute webhook grace, so the settle expires it.
paymentDeadline: new Date(Date.now() - 6 * 60_000),
});
bookingsRepository.findReservedForSchedule
.mockResolvedValueOnce([latePaid])
@@ -1015,7 +1019,8 @@ describe('BookingBatchService — PAID reconcile', () => {
...(waiting as unknown as Record<string, unknown>),
status: 'SELECTED_FOR_BATCH',
trainScheduleId: exportScheduleId,
paymentDeadline: new Date(Date.now() - 1_000),
// Past deadline + the 5-minute webhook grace, so the settle expires it.
paymentDeadline: new Date(Date.now() - 6 * 60_000),
originYardId: 'yard-a',
destinationYardId: 'yard-b',
priorityScore: 0,