HOTFIX: not allowing empty price when expert tries to submit

This commit is contained in:
SepehrYahyaee
2026-09-05 16:44:40 +03:30
parent 70fa49398d
commit feacad58ca
7 changed files with 200 additions and 1 deletions

View File

@@ -168,6 +168,7 @@ import {
} from "src/helpers/unified-file-status";
import { buildEnrichedDamagedParts } from "./dto/claim-damaged-part.enricher";
import { canonicalizeResendDocumentKey } from "src/helpers/claim-resend-document-keys";
import { getExpertReplyPricingValidationError } from "src/helpers/expert-reply-pricing";
@Injectable()
export class ExpertClaimService {
@@ -1658,6 +1659,13 @@ export class ExpertClaimService {
);
}
const pricingValidationError = getExpertReplyPricingValidationError(
reply.parts,
);
if (pricingValidationError) {
throw new BadRequestException(pricingValidationError);
}
// Validate total price cap (priced lines sum), when enabled.
const priceCap = getClaimV2TotalPaymentCapToman();
if (priceCap !== null && reply.parts && reply.parts.length > 0) {
@@ -3261,6 +3269,13 @@ export class ExpertClaimService {
throw new ForbiddenException("This claim is locked by another expert");
}
const pricingValidationError = getExpertReplyPricingValidationError(
reply.parts,
);
if (pricingValidationError) {
throw new BadRequestException(pricingValidationError);
}
// Price cap validation, when enabled.
const priceCap = getClaimV2TotalPaymentCapToman();
if (priceCap !== null) {