Added required documents for blame, added 2 sms

This commit is contained in:
SepehrYahyaee
2026-04-25 15:14:44 +03:30
parent 5618d120e3
commit 9c87927e6c
6 changed files with 102 additions and 5 deletions

View File

@@ -1182,6 +1182,46 @@ export class RequestManagementService {
req.workflow.nextStep = undefined;
req.status = CaseStatus.WAITING_FOR_SIGNATURES;
closedByMutualAgreement = true;
if (
isSecondThirdParty &&
closedByMutualAgreement &&
req.status === CaseStatus.WAITING_FOR_SIGNATURES &&
req.blameStatus === BlameStatus.AGREED
) {
const firstIdx = this.getPartyIndex(req, PartyRole.FIRST);
const secondIdx = this.getPartyIndex(req, PartyRole.SECOND);
const firstPhone = (req.parties?.[firstIdx]?.person as any)?.phoneNumber;
const secondPhone = (req.parties?.[secondIdx]?.person as any)?.phoneNumber;
const baseUrl = process.env.URL;
const token = String(req._id);
const targets = [
firstPhone
? {
receptor: firstPhone,
link: `${baseUrl}/user?token=${token}`,
}
: null,
secondPhone
? {
receptor: secondPhone,
link: `${baseUrl}/user2?token=${token}`,
}
: null,
].filter(
(t): t is { receptor: string; link: string } => !!t?.receptor && !!t?.link,
);
for (const target of targets) {
await this.smsOrchestrationService.sendThirdPartyAgreementSignNotice(
{
receptor: target.receptor,
publicId: req.publicId,
link: target.link,
},
);
}
}
}
}