auto allocation and batch managemnt, tracking the train

This commit is contained in:
marshal
2026-06-12 11:42:46 +03:00
parent 8618ea2aa8
commit ef0abf1c41
61 changed files with 3541 additions and 378 deletions

View File

@@ -1,9 +1,10 @@
import { Injectable, Logger } from '@nestjs/common';
import { forwardRef, Inject, Injectable, Logger } from '@nestjs/common';
import { TelebirrDto } from '../dto/telebirr.dto';
import { PaymentRepository } from '../../payment.repository';
import { DataSource } from 'typeorm';
import { Booking } from '../../../bookings/entities/booking.entity';
import { TelebirrProvider, ProviderPaymentStatus } from '@edr/payment-providers';
import { BookingBatchService } from '../../../train-scheduling/booking-batch.service';
@Injectable()
export class TelebirrWebhookService {
@@ -13,6 +14,8 @@ export class TelebirrWebhookService {
private readonly datasource: DataSource,
private readonly paymentRepo: PaymentRepository,
private readonly telebirrProvider: TelebirrProvider,
@Inject(forwardRef(() => BookingBatchService))
private readonly bookingBatchService: BookingBatchService,
) { }
verifyTelebirrNotification(payload: TelebirrDto) {
@@ -40,6 +43,7 @@ export class TelebirrWebhookService {
{ id: payment.refId },
{ paymentStatus: "PAID" },
);
await this.bookingBatchService.ensurePaidBookingAllocated(payment.refId);
}
break;
case ProviderPaymentStatus.FAILED:
@@ -50,4 +54,4 @@ export class TelebirrWebhookService {
break;
}
}
}
}