From f6ffea2b87021226b7e0a01a4a1010eeb7bf07d4 Mon Sep 17 00:00:00 2001 From: natib21 Date: Wed, 24 Jun 2026 06:38:03 +0000 Subject: [PATCH] fix return value --- .../src/modules/first-mile/first-mile.service.ts | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/apps/edr-freight-api/src/modules/first-mile/first-mile.service.ts b/apps/edr-freight-api/src/modules/first-mile/first-mile.service.ts index 16337230e..a4ead8c2a 100644 --- a/apps/edr-freight-api/src/modules/first-mile/first-mile.service.ts +++ b/apps/edr-freight-api/src/modules/first-mile/first-mile.service.ts @@ -1,4 +1,4 @@ -import { BadRequestException, Injectable, NotFoundException } from '@nestjs/common'; +import { Injectable, NotFoundException } from '@nestjs/common'; import { FindOptionsWhere } from 'typeorm'; import { BookingsRepository } from '../bookings/bookings.repository'; @@ -36,22 +36,20 @@ export class FirstMileService { * paid before any first-mile work proceeds. Throws if the reference is * unknown or the booking has not reached PAID status. */ - async acceptBooking(bookingReference: string): Promise { + async acceptBooking(bookingReference: string): Promise { const booking = await this.bookingsRepository.findByReference(bookingReference); if (!booking) { - throw new NotFoundException(`Booking ${bookingReference} not found`); + return null; } if (booking.paymentStatus !== 'PAID') { - throw new BadRequestException( - `Booking ${bookingReference} is not paid (payment status: ${booking.paymentStatus})`, - ); + return null; } return this.create({ bookingId: booking.id, - advancedPayment: booking.totalAmount, + advancedPayment: 0, }); }