Skip to content

Commit

Permalink
fix(accident-notification): improve representative handling (#16669) (#…
Browse files Browse the repository at this point in the history
…16670)

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
  • Loading branch information
norda-gunni and kodiakhq[bot] authored Oct 31, 2024
1 parent 64a5649 commit 5d1f145
Showing 1 changed file with 22 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
InjuredPersonInformationV2,
RepresentativeInfoV2,
StudiesAccidentTypeEnum,
utils,
WhoIsTheNotificationForEnum,
WorkAccidentTypeEnum,
WorkMachineV2,
Expand Down Expand Up @@ -334,7 +335,27 @@ const getEmployer = (
'representative',
) as RepresentativeInfoV2

if (accidentType !== AccidentTypeEnum.WORK) return
if (
answers.juridicalPerson &&
answers.applicant &&
utils.isRepresentativeOfCompanyOrInstitute(answers)
) {
return {
companyName: answers.juridicalPerson.companyNationalId,
companyNationalId: answers.juridicalPerson.companyName,
representativeName: answers.applicant.name ?? '',
representativeEmail: answers.applicant.email ?? '',
representativePhone: answers.applicant.phoneNumber ?? '',
}
}

if (
accidentType === AccidentTypeEnum.HOMEACTIVITIES ||
!companyInfo ||
!representative
) {
return undefined
}

return {
companyName: companyInfo.name ?? '',
Expand Down

0 comments on commit 5d1f145

Please sign in to comment.