Skip to content

Commit

Permalink
refactir
Browse files Browse the repository at this point in the history
  • Loading branch information
juni-haukur committed Oct 11, 2024
1 parent 52b8ff5 commit 8eafc5b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { NO, YES } from '@island.is/application/core'
import { ApplicationWithAttachments } from '@island.is/application/types'
import { EstateInfo } from '@island.is/clients/syslumenn'

Expand Down Expand Up @@ -59,7 +60,7 @@ export const getFakeEstateInfo = (
share: 100,
},
],
knowledgeOfOtherWills: 'yes',
knowledgeOfOtherWills: YES,
ships: [],
flyers: [],
guns: [
Expand All @@ -81,20 +82,23 @@ export const getFakeEstateInfo = (
nationalId: '0101303019',
email: 'fake@email.com',
phone: '9999999',
foreignCitizenship: [NO],
},
{
name: 'Gervimaður Færeyjar',
relation: 'Maki',
nationalId: '0101302399',
email: 'fake2@email.com',
phone: '9999998',
foreignCitizenship: [NO],
},
{
name: 'Gervimaður Bretland',
relation: 'Faðir',
nationalId: '0101304929',
email: 'fake3@email.com',
phone: '9999997',
foreignCitizenship: [NO],
},
],
caseNumber: `2020-00012${nationalIdOfDeceased.slice(-4)}`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { estateSchema } from '@island.is/application/templates/estate'
import { infer as zinfer } from 'zod'
import { UploadData } from '../types'
import { filterEmptyObjects } from './filters'
import { info } from 'kennitala'
import { info, isPerson } from 'kennitala'
import { NO, YES } from '@island.is/application/core'

type EstateSchema = zinfer<typeof estateSchema>
Expand Down Expand Up @@ -41,11 +41,7 @@ const estateMemberMapper = (element: EstateMember) => {
: info(element?.nationalId).age < 18
? { nationalId: '', name: '', phone: '', email: '' }
: undefined,
foreignCitizenship:
element.foreignCitizenship ??
(!element.nationalId || element.nationalId.endsWith('0000')
? [YES]
: [NO]),
foreignCitizenship: isPerson(element.nationalId) ? [YES] : [NO],
}
}

Expand Down
5 changes: 0 additions & 5 deletions libs/clients/syslumenn/src/lib/syslumennClient.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -402,11 +402,6 @@ export const estateMemberMapper = (estateRaw: Erfingar): EstateMember => {
advocate: estateRaw.malsvari ? mapAdvocate(estateRaw.malsvari) : undefined,
email: estateRaw.netfang ?? '',
phone: estateRaw.simi ?? '',
// We can assume that heir is a foreign citizen if national id is missing or ends with '0000'
foreignCitizenship:
!estateRaw.kennitala || estateRaw.kennitala.endsWith('0000')
? ['yes']
: ['no'],
}
}

Expand Down

0 comments on commit 8eafc5b

Please sign in to comment.