forked from Yara724/api
Added required documents for blame, added 2 sms
This commit is contained in:
@@ -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,
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user