1
0
forked from Yara724/api

Added factorLink and branchName support

This commit is contained in:
SepehrYahyaee
2026-04-28 13:31:02 +03:30
parent f456443342
commit 9296795166
3 changed files with 141 additions and 21 deletions

View File

@@ -6408,26 +6408,38 @@ export class RequestManagementService {
},
});
if (updatedRequest.type === BlameRequestType.THIRD_PARTY) {
const guiltyPartyId = updatedRequest.expert?.decision?.guiltyPartyId
? String(updatedRequest.expert.decision.guiltyPartyId)
: null;
if (guiltyPartyId) {
const damagedParty = updatedRequest.parties?.find(
(p) => p.person?.userId && String(p.person.userId) !== guiltyPartyId,
);
const phone = damagedParty?.person?.phoneNumber?.trim();
if (phone) {
const publicId = String(updatedRequest.publicId);
const link = this.smsOrchestrationService.buildClaimLink(requestId);
await this.smsOrchestrationService.sendThirdPartyDamagedPartyClaimLinkNotice(
{
receptor: phone,
publicId,
link,
},
if (
updatedRequest.type === BlameRequestType.THIRD_PARTY ||
updatedRequest.type === BlameRequestType.CAR_BODY
) {
let targetPhone: string | undefined;
if (updatedRequest.type === BlameRequestType.THIRD_PARTY) {
const guiltyPartyId = updatedRequest.expert?.decision?.guiltyPartyId
? String(updatedRequest.expert.decision.guiltyPartyId)
: null;
if (guiltyPartyId) {
const damagedParty = updatedRequest.parties?.find(
(p) => p.person?.userId && String(p.person.userId) !== guiltyPartyId,
);
targetPhone = damagedParty?.person?.phoneNumber?.trim();
}
} else {
// CAR_BODY has a single owner/damaged party: notify that user too.
const ownerParty = updatedRequest.parties?.[partyIndex] ?? updatedRequest.parties?.[0];
targetPhone = ownerParty?.person?.phoneNumber?.trim();
}
if (targetPhone) {
const publicId = String(updatedRequest.publicId);
const link = this.smsOrchestrationService.buildClaimLink(requestId);
await this.smsOrchestrationService.sendThirdPartyDamagedPartyClaimLinkNotice(
{
receptor: targetPhone,
publicId,
link,
},
);
}
}
} else {