feat(billing): enhance invoice payment processing and revert handling

feat(bookings): add event handlers for booking invoice payment processing
fix(bookings): include PAYMENT_VERIFICATION_IN_PROGRESS status in queries
fix(train-scheduling): update status checks to include PAYMENT_VERIFICATION_IN_PROGRESS
feat(notifier): notify customers when a train is cancelled
This commit is contained in:
Marshal
2026-08-05 20:46:44 +00:00
parent 1b5f364294
commit 8089e5cfd9
8 changed files with 102 additions and 24 deletions

View File

@@ -422,7 +422,9 @@ export class BookingBatchService implements OnModuleInit {
.getRepository(Booking)
.createQueryBuilder("b")
.select("DISTINCT b.train_schedule_id", "scheduleId")
.where(`b.status IN ('SELECTED_FOR_BATCH', 'AWAITING_PAYMENT')`)
.where(
`b.status IN ('SELECTED_FOR_BATCH', 'AWAITING_PAYMENT', 'PAYMENT_VERIFICATION_IN_PROGRESS')`,
)
.andWhere("b.train_schedule_id IS NOT NULL")
.getRawMany<{ scheduleId: string }>();
for (const { scheduleId } of reserved) this.armSettle(scheduleId);
@@ -2118,7 +2120,9 @@ export class BookingBatchService implements OnModuleInit {
if (linked) return "ALLOCATED";
if (
booking.status === "SELECTED_FOR_BATCH" ||
booking.status === "AWAITING_PAYMENT"
booking.status === "AWAITING_PAYMENT" ||
// Redirect-acked, webhook pending — still a reserved (unpaid) hold.
booking.status === "PAYMENT_VERIFICATION_IN_PROGRESS"
) {
return "SELECTED_FOR_BATCH";
}