mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-29 17:38:12 +00:00
auto allocation and batch managemnt, tracking the train
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user