forked from Yara724/api
YARA-836 + 2 more sms
This commit is contained in:
@@ -1122,7 +1122,31 @@ export class ExpertBlameService {
|
||||
requestId,
|
||||
);
|
||||
|
||||
// TODO: Send notifications to parties (SMS/Push) about required documents
|
||||
const requestIdToken = String(request._id);
|
||||
const partyPhoneByUserId = new Map<string, string>();
|
||||
for (const p of request.parties || []) {
|
||||
const uid = p?.person?.userId ? String(p.person.userId) : "";
|
||||
const phone = p?.person?.phoneNumber;
|
||||
if (uid && typeof phone === "string" && phone.length > 0) {
|
||||
partyPhoneByUserId.set(uid, phone);
|
||||
}
|
||||
}
|
||||
for (const p of partyResendRequests) {
|
||||
const uid = String((p as any).partyId);
|
||||
const phone = partyPhoneByUserId.get(uid);
|
||||
if (!phone) continue;
|
||||
const role =
|
||||
String(request.parties?.find((x: any) => String(x?.person?.userId) === uid)?.role) ===
|
||||
"SECOND"
|
||||
? "SECOND"
|
||||
: "FIRST";
|
||||
await this.smsOrchestrationService.sendResendDocumentsNotice({
|
||||
receptor: phone,
|
||||
fileKind: "blame",
|
||||
publicId: request.publicId,
|
||||
link: this.smsOrchestrationService.buildBlamePartyLink(requestIdToken, role),
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
requestId: String(request._id),
|
||||
@@ -1277,6 +1301,27 @@ export class ExpertBlameService {
|
||||
);
|
||||
}
|
||||
|
||||
if (request.type === BlameRequestType.THIRD_PARTY) {
|
||||
const requestIdToken = String(request._id);
|
||||
const expertLastName =
|
||||
actor?.fullName?.trim()?.split(/\s+/).pop() || "کارشناس";
|
||||
for (const p of request.parties || []) {
|
||||
const phone = p?.person?.phoneNumber;
|
||||
if (!phone || typeof phone !== "string") continue;
|
||||
const role = String(p?.role) === "SECOND" ? "SECOND" : "FIRST";
|
||||
await this.smsOrchestrationService.sendSignatureReviewNotice({
|
||||
receptor: phone,
|
||||
fileKind: "blame",
|
||||
publicId: request.publicId,
|
||||
expertLastName,
|
||||
link: this.smsOrchestrationService.buildBlamePartyLink(
|
||||
requestIdToken,
|
||||
role,
|
||||
),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
requestId: String(request._id),
|
||||
status: CaseStatus.WAITING_FOR_SIGNATURES,
|
||||
|
||||
Reference in New Issue
Block a user