Fixed Captcha

This commit is contained in:
SepehrYahyaee
2026-05-31 14:01:04 +03:30
parent 389133e1c9
commit 2b7192151d
6 changed files with 225 additions and 137 deletions

View File

@@ -4565,7 +4565,9 @@ export class ClaimRequestManagementService {
// 3. Validate workflow step is correct (should be at SELECT_OTHER_PARTS)
if (
claimCase.workflow?.currentStep !== ClaimWorkflowStep.SELECT_OTHER_PARTS
claimCase.workflow?.currentStep !==
ClaimWorkflowStep.SELECT_OTHER_PARTS &&
claimCase.workflow?.currentStep !== ClaimWorkflowStep.USER_EXPERT_RESEND
) {
throw new BadRequestException(
`Invalid workflow step. Expected ${ClaimWorkflowStep.SELECT_OTHER_PARTS}, but current step is ${claimCase.workflow?.currentStep}`,
@@ -4573,7 +4575,11 @@ export class ClaimRequestManagementService {
}
// 4. Validate other parts and bank info haven't been submitted yet
if (claimCase.money?.sheba || claimCase.money?.nationalCodeOfInsurer) {
if (
claimCase.money?.sheba &&
claimCase.money?.nationalCodeOfInsurer &&
claimCase.workflow?.currentStep !== ClaimWorkflowStep.USER_EXPERT_RESEND
) {
throw new ConflictException(
"Bank information has already been submitted for this claim",
);
@@ -4635,6 +4641,8 @@ export class ClaimRequestManagementService {
);
}
let step = claimCase.workflow?.currentStep;
// External inquiry checks before moving workflow:
// 1) ownership check for nationalCode + plate
// await this.sandHubService.getCarOwnershipInfo(ownershipPlate, nationalCode);
@@ -4643,11 +4651,16 @@ export class ClaimRequestManagementService {
const updatePayload: any = {
"damage.otherParts": otherParts.length > 0 ? otherParts : undefined,
"money.sheba": shebaNumber,
"money.nationalCodeOfInsurer": nationalCode,
...(step !== ClaimWorkflowStep.USER_EXPERT_RESEND && {
"money.sheba": "",
"money.nationalCodeOfInsurer": nationalCode,
}),
status: ClaimWorkflowStep.CAPTURE_PART_DAMAGES,
"workflow.currentStep": ClaimWorkflowStep.CAPTURE_PART_DAMAGES,
"workflow.nextStep": ClaimWorkflowStep.UPLOAD_REQUIRED_DOCUMENTS,
$push: {
"workflow.completedSteps": ClaimWorkflowStep.SELECT_OTHER_PARTS,
history: {
@@ -4660,7 +4673,7 @@ export class ClaimRequestManagementService {
timestamp: new Date(),
metadata: {
stepKey: ClaimWorkflowStep.SELECT_OTHER_PARTS,
otherParts: otherParts,
otherParts,
otherPartsCount: otherParts.length,
hasBankInfo: true,
hasGreenCardUpload: !!file,