forked from Yara724/api
Merge pull request 'Fix v2 flow sign of second party' (#206) from s.yahyaee/yara724-api:main into main
Reviewed-on: Yara724/api#206
This commit is contained in:
@@ -2119,7 +2119,7 @@ export class RequestManagementService {
|
|||||||
}
|
}
|
||||||
req.workflow.completedSteps = completed;
|
req.workflow.completedSteps = completed;
|
||||||
req.workflow.currentStep = WorkflowStep.WAITING_FOR_SIGNATURES;
|
req.workflow.currentStep = WorkflowStep.WAITING_FOR_SIGNATURES;
|
||||||
req.workflow.nextStep = undefined;
|
req.workflow.nextStep = WorkflowStep.WAITING_FOR_SIGNATURES;
|
||||||
req.status = CaseStatus.WAITING_FOR_SIGNATURES;
|
req.status = CaseStatus.WAITING_FOR_SIGNATURES;
|
||||||
closedByMutualAgreement = true;
|
closedByMutualAgreement = true;
|
||||||
|
|
||||||
@@ -2205,7 +2205,7 @@ export class RequestManagementService {
|
|||||||
}
|
}
|
||||||
req.workflow.completedSteps = completed;
|
req.workflow.completedSteps = completed;
|
||||||
req.workflow.currentStep = WorkflowStep.WAITING_FOR_SIGNATURES;
|
req.workflow.currentStep = WorkflowStep.WAITING_FOR_SIGNATURES;
|
||||||
req.workflow.nextStep = undefined;
|
req.workflow.nextStep = WorkflowStep.WAITING_FOR_SIGNATURES;
|
||||||
req.status = CaseStatus.WAITING_FOR_SIGNATURES;
|
req.status = CaseStatus.WAITING_FOR_SIGNATURES;
|
||||||
} else if (!closedByMutualAgreement) {
|
} else if (!closedByMutualAgreement) {
|
||||||
if (stepKey === WorkflowStep.SECOND_DESCRIPTION) {
|
if (stepKey === WorkflowStep.SECOND_DESCRIPTION) {
|
||||||
@@ -6796,17 +6796,16 @@ export class RequestManagementService {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
await this.verifyExpertAccessForBlameV2(req, expert);
|
await this.verifyExpertAccessForBlameV2(req, expert);
|
||||||
// In the V2 IN_PERSON mirror flow guilt is resolved automatically during
|
// In the V2 IN_PERSON mirror flow guilt is resolved automatically after both
|
||||||
// addDescriptionV2 — accident-fields must only be called once the file has
|
// parties complete their narrative steps (addDescriptionV2). The sign step for
|
||||||
// reached WAITING_FOR_SIGNATURES (both parties' narrative steps are done).
|
// both parties must happen BEFORE accident-fields is called — calling it earlier
|
||||||
// Calling it earlier would overwrite the workflow and skip the sign step.
|
// would overwrite the workflow and cause the frontend to skip the sign page.
|
||||||
if (
|
if (
|
||||||
req.creationMethod === CreationMethod.IN_PERSON &&
|
req.creationMethod === CreationMethod.IN_PERSON &&
|
||||||
req.status !== CaseStatus.WAITING_FOR_SIGNATURES &&
|
|
||||||
req.status !== CaseStatus.COMPLETED
|
req.status !== CaseStatus.COMPLETED
|
||||||
) {
|
) {
|
||||||
throw new BadRequestException(
|
throw new BadRequestException(
|
||||||
`accident-fields can only be submitted after both parties have completed their narrative steps (current status: ${req.status}). Make sure both parties have gone through location, voice, and description before calling this endpoint.`,
|
`accident-fields can only be submitted after both parties have signed (current status: ${req.status}). Complete both signatures first.`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -6837,9 +6836,14 @@ export class RequestManagementService {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
// For IN_PERSON expert files: after accident fields are filled, guilt is
|
// For IN_PERSON expert files that have not yet reached COMPLETED: after accident
|
||||||
// decided and we can go straight to signatures (no separate review needed).
|
// fields are filled, guilt is decided and we can go straight to signatures.
|
||||||
if (req.creationMethod === CreationMethod.IN_PERSON) {
|
// When the file is already COMPLETED (both parties signed) we only save the
|
||||||
|
// supplemental fields without touching the workflow or status.
|
||||||
|
if (
|
||||||
|
req.creationMethod === CreationMethod.IN_PERSON &&
|
||||||
|
req.status !== CaseStatus.COMPLETED
|
||||||
|
) {
|
||||||
const completed = Array.isArray(req.workflow?.completedSteps)
|
const completed = Array.isArray(req.workflow?.completedSteps)
|
||||||
? req.workflow.completedSteps
|
? req.workflow.completedSteps
|
||||||
: [];
|
: [];
|
||||||
|
|||||||
Reference in New Issue
Block a user