mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-28 03:10:54 +00:00
allow the custoemr to book while the payment window time
This commit is contained in:
@@ -109,23 +109,6 @@ export class ContractBookingService {
|
||||
private readonly bookingTransitionService: BookingTransitionService,
|
||||
) {}
|
||||
|
||||
/**
|
||||
* Mirrors BookingsService.assertNoUnpaidHold for the contract booking paths:
|
||||
* a company sitting on an unpaid hold (SELECTED_FOR_BATCH) books nothing new
|
||||
* until it pays or the hold dies.
|
||||
*/
|
||||
private async assertNoUnpaidHold(companyId?: string | null): Promise<void> {
|
||||
if (!companyId) return;
|
||||
const holds =
|
||||
await this.bookingsRepository.countUnpaidHoldsForCompany(companyId);
|
||||
if (holds > 0) {
|
||||
throw new ConflictException(
|
||||
'You already have a booking waiting for payment. Pay it or cancel it ' +
|
||||
'before making a new booking.',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
async createUnderContract(
|
||||
contractId: string,
|
||||
dto: CreateBookingUnderContractDto,
|
||||
@@ -186,8 +169,6 @@ export class ContractBookingService {
|
||||
// remainder; the customer cannot start any other booking on the contract.
|
||||
// If the remainder splits again the same rule repeats until the cap is
|
||||
// exhausted and the contract completes.
|
||||
await this.assertNoUnpaidHold(contract.companyId);
|
||||
|
||||
if (contract.contractKind === 'ONE_TIME') {
|
||||
if (await this.hasSplitBooking(contractId)) {
|
||||
await this.assertExactRemainder(contract, dto);
|
||||
@@ -475,7 +456,6 @@ export class ContractBookingService {
|
||||
);
|
||||
}
|
||||
}
|
||||
await this.assertNoUnpaidHold(contract.companyId);
|
||||
|
||||
const route = await this.resolveRoute(contract, dto.contractRouteId);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user