forked from Yara724/api
Added factorLink and branchName support
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user