Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(id-card): updates to application #15870

Merged
merged 126 commits into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from 118 commits
Commits
Show all changes
126 commits
Select commit Hold shift + click to select a range
2f7808c
new application setup
berglindoma13 Apr 15, 2024
a98fadb
Merge branch 'main' into feature/new-nafnskirteini-application
berglindoma13 Apr 15, 2024
dc3f217
new application setup
berglindoma13 Apr 17, 2024
5aa31da
merge conflicts
berglindoma13 Apr 30, 2024
18cf785
continued work
berglindoma13 May 2, 2024
52dd0f6
stuff
berglindoma13 May 3, 2024
0bfe1b5
working
berglindoma13 May 6, 2024
c8f5fe5
State for parent B
May 6, 2024
93ca69f
adding overview section to review
May 7, 2024
ed2642d
confirmation, approved and rejected file
May 7, 2024
f812245
adding steps
berglindoma13 May 8, 2024
373d145
Merge branch 'feature/new-nafnskirteini-application' of https://githu…
berglindoma13 May 8, 2024
5203b33
AssignParentB api action
sigruntg May 8, 2024
8b62dba
reject application email
sigruntg May 14, 2024
6047c8e
adding submit application email
sigruntg May 14, 2024
1840bc6
commenting out fjs code in service
sigruntg May 14, 2024
945a80a
adding chargefjsv2clientmodule to id card module file
sigruntg May 14, 2024
be4eadf
adding rest of steps
berglindoma13 May 14, 2024
5df0f28
mergin main
berglindoma13 May 14, 2024
201583c
Merge branch 'feature/new-nafnskirteini-application' of https://githu…
berglindoma13 May 14, 2024
2b35beb
merge conflicst
berglindoma13 May 14, 2024
711d582
fixing merge issues
sigruntg May 14, 2024
5423000
changes to reject conclusion screen
sigruntg May 15, 2024
20a69f9
..
sigruntg May 15, 2024
19eb588
accept reject buttons and modal
sigruntg May 16, 2024
2056a67
fixing conclusion screen
sigruntg May 16, 2024
91c7704
added disability check
berglindoma13 May 16, 2024
99959b4
Merge branch 'feature/new-nafnskirteini-application' of https://githu…
berglindoma13 May 16, 2024
38c5745
dataschema update
berglindoma13 May 16, 2024
f7aea26
klaraði bakendaföll eins og hægt er í bili
berglindoma13 May 16, 2024
ab9ab23
changes in prerequisites
sigruntg May 16, 2024
bb97583
changes to typeofidsubsection
sigruntg May 16, 2024
00e0e65
Merge branch 'main' into feature/new-nafnskirteini-application
berglindoma13 May 16, 2024
67c8f78
chore: charts update dirty files
andes-it May 16, 2024
968ea40
Merge branch 'main' into feature/new-nafnskirteini-application
berglindoma13 May 16, 2024
23fd252
changes to condition description
sigruntg May 16, 2024
880ba29
Merge branch 'main' into feature/new-nafnskirteini-application
berglindoma13 May 16, 2024
045cc0e
finishing up
berglindoma13 May 17, 2024
c13e006
mergin
berglindoma13 May 17, 2024
94a0936
changing answers
sigruntg May 17, 2024
e7d5767
small changes
sigruntg May 17, 2024
002d6b2
stuff
berglindoma13 May 17, 2024
a7cba9b
Merge branch 'feature/new-nafnskirteini-application' of https://githu…
berglindoma13 May 17, 2024
ad0f7de
payment fix
berglindoma13 May 17, 2024
0029fee
Merge branch 'main' into feature/new-nafnskirteini-application
berglindoma13 May 21, 2024
2d76f4c
Merge branch 'main' into feature/new-nafnskirteini-application
berglindoma13 May 21, 2024
b9d28c1
Merge branch 'main' into feature/new-nafnskirteini-application
berglindoma13 May 21, 2024
bc82e3b
Merge branch 'main' into feature/new-nafnskirteini-application
berglindoma13 May 22, 2024
537e4df
Merge branch 'main' into feature/new-nafnskirteini-application
berglindoma13 May 22, 2024
797ffb7
Merge branch 'main' into feature/new-nafnskirteini-application
berglindoma13 May 22, 2024
d7c9d61
Merge branch 'main' into feature/new-nafnskirteini-application
berglindoma13 May 22, 2024
4b193f4
merging
sigruntg May 23, 2024
e05765b
Merge branch 'main' into feature/new-nafnskirteini-application
berglindoma13 May 23, 2024
0d6218a
finishing too many things for one commit
sigruntg May 27, 2024
6d6f7df
submit application
sigruntg May 27, 2024
377d693
config update
berglindoma13 May 29, 2024
9ee6d4f
updates
berglindoma13 May 30, 2024
14b9c41
trying stuff
berglindoma13 May 30, 2024
30eebd3
working on this
berglindoma13 Jun 3, 2024
ecdb7e8
connection type to id call
berglindoma13 Jun 4, 2024
e5d4b79
working on this
berglindoma13 Jun 4, 2024
0471475
rest of updates for applicatin
berglindoma13 Jun 6, 2024
d3e685e
removed disability from dataprovider, not only with permission
berglindoma13 Jun 6, 2024
57e5cc1
Merge branch 'main' into feature/new-nafnskirteini-application
berglindoma13 Jun 6, 2024
3779731
removed space
berglindoma13 Jun 7, 2024
469806b
payment codes
berglindoma13 Jun 7, 2024
0009d51
Merge branch 'main' into feature/new-nafnskirteini-application
berglindoma13 Jun 7, 2024
3e53334
Merge branch 'main' into feature/new-nafnskirteini-application
berglindoma13 Jun 7, 2024
51a4f10
Merge branch 'main' into feature/new-nafnskirteini-application
berglindoma13 Jun 12, 2024
6f1cdec
temp changes, todo finish
berglindoma13 Jun 12, 2024
5888f7d
Merge branch 'feature/new-nafnskirteini-application' of https://githu…
berglindoma13 Jun 13, 2024
a6fdd1e
changes to condition for applying to id cards
berglindoma13 Jun 13, 2024
bd500e7
Merge branch 'main' into feature/new-nafnskirteini-application
berglindoma13 Jun 13, 2024
fbfb379
Merge branch 'main' into feature/new-nafnskirteini-application
berglindoma13 Jun 14, 2024
1fb55e8
finishind touches
berglindoma13 Jun 14, 2024
7d21be0
Merge branch 'feature/new-nafnskirteini-application' of https://githu…
berglindoma13 Jun 14, 2024
9ffdf6c
small fix
berglindoma13 Jun 14, 2024
2c0c7e3
typing iddocumenttype
berglindoma13 Jun 14, 2024
af2e6bf
Merge branch 'main' into feature/new-nafnskirteini-application
berglindoma13 Jun 14, 2024
7c7b668
Merge branch 'main' into feature/new-nafnskirteini-application
berglindoma13 Jun 18, 2024
bdb4780
fixing comments
berglindoma13 Jun 18, 2024
f92e580
Merge branch 'feature/new-nafnskirteini-application' of https://githu…
berglindoma13 Jun 18, 2024
0b63040
Merge branch 'main' into feature/new-nafnskirteini-application
berglindoma13 Jun 18, 2024
86f146b
fixing comments
berglindoma13 Jun 18, 2024
c361633
Merge branch 'feature/new-nafnskirteini-application' of https://githu…
berglindoma13 Jun 18, 2024
462a05c
small updates
berglindoma13 Jun 20, 2024
9ae5305
Merge branch 'main' into feature/new-nafnskirteini-application
berglindoma13 Jun 20, 2024
5ca61b1
Merge branch 'main' into feature/new-nafnskirteini-application
berglindoma13 Jun 20, 2024
3dc6a64
Merge branch 'main' into feature/new-nafnskirteini-application
AndesKrrrrrrrrrrr Jun 21, 2024
a4b5652
Merge branch 'main' into feature/new-nafnskirteini-application
berglindoma13 Jun 21, 2024
1173653
fixes for build
berglindoma13 Jun 21, 2024
dc537c3
Merge branch 'feature/new-nafnskirteini-application' of https://githu…
berglindoma13 Jun 21, 2024
9bc2943
Merge branch 'main' into feature/new-nafnskirteini-application
berglindoma13 Jun 21, 2024
71206e5
fixes for build
berglindoma13 Jun 21, 2024
fe86e06
Merge branch 'feature/new-nafnskirteini-application' of https://githu…
berglindoma13 Jun 21, 2024
945b71a
Merge branch 'main' into feature/new-nafnskirteini-application
berglindoma13 Jun 21, 2024
9a9a190
small update to test
berglindoma13 Jun 21, 2024
107ca07
Merge branch 'feature/new-nafnskirteini-application' of https://githu…
berglindoma13 Jun 21, 2024
cdba6fe
small update to test
berglindoma13 Jun 21, 2024
79fe651
small update to test
berglindoma13 Jun 21, 2024
66c2fc5
small update to test
berglindoma13 Jun 21, 2024
7bd7604
small updates
berglindoma13 Jun 24, 2024
ecf04d8
merge conflicts
berglindoma13 Jun 24, 2024
71b7743
updates to formatText, applicationCard and types
berglindoma13 Jun 25, 2024
d416478
stuff
berglindoma13 Jun 27, 2024
e3e9ddc
Merge branch 'main' into feature/nafnskirteini-update
berglindoma13 Jun 27, 2024
9d44e1b
payment code changes
berglindoma13 Jul 3, 2024
253bc3b
Merge branch 'main' into feature/nafnskirteini-update
berglindoma13 Aug 20, 2024
63ea2cd
updates to aplication
berglindoma13 Aug 23, 2024
8e5e5df
updates to application
berglindoma13 Aug 28, 2024
8d5ca65
more updates
berglindoma13 Aug 29, 2024
f8fa3ee
more updates
berglindoma13 Aug 30, 2024
aee380e
more updates
berglindoma13 Aug 30, 2024
32447c7
Merge branch 'main' into feature/nafnskirteini-update
berglindoma13 Sep 2, 2024
cfc4ca6
lokapunktar
berglindoma13 Sep 3, 2024
c9f8209
cosnole log remove
berglindoma13 Sep 3, 2024
29d90c6
more updates
berglindoma13 Sep 3, 2024
90c4cfd
more updates
berglindoma13 Sep 4, 2024
765b1a8
Merge branch 'main' into feature/nafnskirteini-update
berglindoma13 Sep 4, 2024
8aafe39
updates after comment
berglindoma13 Sep 4, 2024
156e222
Merge branch 'main' into feature/nafnskirteini-update
berglindoma13 Sep 4, 2024
6bc2cd2
Merge branch 'main' into feature/nafnskirteini-update
berglindoma13 Sep 5, 2024
1f0fad0
Merge branch 'main' into feature/nafnskirteini-update
berglindoma13 Sep 6, 2024
7852d68
Merge branch 'main' into feature/nafnskirteini-update
berglindoma13 Sep 6, 2024
4690765
Merge branch 'main' into feature/nafnskirteini-update
berglindoma13 Sep 6, 2024
ad7ddda
Merge branch 'main' into feature/nafnskirteini-update
kodiakhq[bot] Sep 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,25 @@ export class NationalRegistryService extends BaseTemplateApiService {
await this.validateChildren(params, children)
}

//allow parents whose children are icelandic citizenships in, but if no children, then check citizenship
if (params?.allowIfChildHasCitizenship) {
const children = await this.nationalRegistryApi.getCustodyChildren(auth)
if (children.length > 0) {
let foundChildWithIcelandicCitizenship = false
for (const child of children) {
const individual = await this.getIndividual(child)
if (individual?.citizenship?.code === 'IS') {
foundChildWithIcelandicCitizenship = true
break
}
}
//if child validates with icelandic citizenship, then do not check parents citizenship
if (foundChildWithIcelandicCitizenship) {
params = { ...params, icelandicCitizenship: false }
}
}
}

// Validate individual
this.validateIndividual(individual, false, params)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,3 @@ export type DistrictCommissionerAgencies = {
address: string
key: string
}

export interface IdentityDocumentChild {
childNationalId: string
secondParent: string
secondParentName: string
childName: string
passports?: IdentityDocument[]
}

export type IdentityDocument = {
number: string
type: string
verboseType: string
subType: string
status: string
issuingDate: string
expirationDate: string
displayFirstName: string
displayLastName: string
mrzFirstName: string
mrzLastName: string
sex: string
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ import { LOGGER_PROVIDER } from '@island.is/logging'
import { SharedTemplateApiService } from '../../shared'
import { TemplateApiModuleActionProps } from '../../../types'
import { coreErrorMessages, getValueViaPath } from '@island.is/application/core'
import {
DistrictCommissionerAgencies,
IdentityDocumentChild,
} from './constants'
import { DistrictCommissionerAgencies } from './constants'
import {
ChargeFjsV2ClientService,
getPaymentIdFromExternalData,
} from '@island.is/clients/charge-fjs-v2'
import { generateAssignParentBApplicationEmail } from './emailGenerators/assignParentBEmail'
import { PassportsService } from '@island.is/clients/passports'
import {
IdentityDocumentChild,
PassportsService,
} from '@island.is/clients/passports'
import { BaseTemplateApiService } from '../../base-template-api.service'
import {
ApplicationTypes,
Expand All @@ -27,7 +27,7 @@ import {
} from '@island.is/application/templates/id-card'
import { generateApplicationRejectEmail } from './emailGenerators/rejectApplicationEmail'
import { generateApplicationSubmittedEmail } from './emailGenerators/applicationSubmittedEmail'

import { info } from 'kennitala'
@Injectable()
export class IdCardService extends BaseTemplateApiService {
constructor(
Expand Down Expand Up @@ -57,41 +57,56 @@ export class IdCardService extends BaseTemplateApiService {
)
}

const expDate = identityDocument.userPassport?.expirationDate?.toString()
// if applicant has valid id that is not withinExpirationDate, then not available for application,
// otherwise available, either with no id or id within expiration limit
// applicant can have a valid ID and apply for II
const applicantIdentityWithinLimits = expDate
? isAvailableForApplication(
expDate,
'ID',
`${identityDocument.userPassport?.type}${identityDocument.userPassport?.subType}`,
)
: true
const applicantAge = info(auth.nationalId).age
const applicantInformation = {
age: applicantAge,
nationalId: auth.nationalId,
passport: identityDocument.userPassport,
children: identityDocument.childPassports,
}
const applicantIDWithinLimits = isAvailableForApplication(
'ID',
applicantInformation,
)
const applicantIIWithinLimits = isAvailableForApplication(
'II',
applicantInformation,
)

let childIdentityWithinLimits = false
identityDocument.childPassports?.map((child) => {
if (child.passports && child.passports.length > 0) {
child.passports.map((id) => {
const withinLimits = id.expirationDate
? isAvailableForApplication(
id.expirationDate.toString(),
'ID',
`${id.type}${id.subType}`,
)
: true
if (child.childNationalId) {
const childInformation = {
age: info(child.childNationalId).age,
nationalId: child.childNationalId,
passport: child.passports?.[0],
}
const withinLimits = isAvailableForApplication(
'ID',
childInformation,
)

if (withinLimits) {
// if there is any id for any child that is within limits then user should be let through dataProvider
childIdentityWithinLimits = true
if (withinLimits) {
// if there is any id for any child that is within limits then user should be let through dataProvider
childIdentityWithinLimits = true
}
}
})
} else {
childIdentityWithinLimits = true // if child has no id, then let through for application of new id
}
})

if (!applicantIdentityWithinLimits && !childIdentityWithinLimits) {
if (
!applicantIDWithinLimits &&
!applicantIIWithinLimits &&
!childIdentityWithinLimits
) {
throw new TemplateApiError(
{
title: coreErrorMessages.idCardApplicationRequirementsNotMet,
Expand Down Expand Up @@ -278,7 +293,6 @@ export class IdCardService extends BaseTemplateApiService {
guid: application.id,
appliedForPersonId: auth.nationalId,
priority: answers.priceList.priceChoice === Services.EXPRESS ? 1 : 0,
deliveryName: answers.priceList.location,
contactInfo: {
phoneAtHome: applicantInformation.phoneNumber,
phoneAtWork: applicantInformation.phoneNumber,
Expand All @@ -298,7 +312,6 @@ export class IdCardService extends BaseTemplateApiService {
guid: application.id,
appliedForPersonId: applicantInformation.nationalId,
priority: answers.priceList.priceChoice === Services.EXPRESS ? 1 : 0,
deliveryName: answers.priceList.location,
approvalA: {
personId:
firstGuardianInformation?.nationalId?.replace('-', '') || '',
Expand Down
24 changes: 12 additions & 12 deletions libs/application/templates/id-card/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,18 @@
"options": {
"jestConfig": "libs/application/templates/id-card/jest.config.ts",
"passWithNoTests": true
},
"extract-strings": {
"executor": "nx:run-commands",
"options": {
"command": "yarn ts-node -P libs/localization/tsconfig.lib.json libs/localization/scripts/extract 'libs/application/templates/id-card/src/**/*.{js,ts,tsx}'"
}
},
"configurations": {
"ci": {
"ci": true,
"codeCoverage": true
}
}
},
"extract-strings": {
"executor": "nx:run-commands",
"options": {
"command": "yarn ts-node -P libs/localization/tsconfig.lib.json libs/localization/scripts/extract 'libs/application/templates/id-card/src/**/*.{js,ts,tsx}'"
}
},
"configurations": {
"ci": {
"ci": true,
"codeCoverage": true
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const defaultParams = {
summary: error.invalidAgeDescription,
},
icelandicCitizenship: true,
allowPassOnChild: true,
allowIfChildHasCitizenship: true,
}

export const NationalRegistryUser = NationalRegistryUserApi.configure({
Expand All @@ -45,6 +45,7 @@ export const NationalRegistryUserParentB = NationalRegistryUserApi.configure({
...defaultParams,
icelandicCitizenship: false,
},
externalDataId: 'nationalRegistryParentB',
})

export const SyslumadurPaymentCatalogApi = PaymentCatalogApi.configure({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ export const ClearAnswers: FC<React.PropsWithChildren<FieldBaseProps>> = ({
setBeforeSubmitCallback &&
setBeforeSubmitCallback(async () => {
const chosenApplicants = getValues(Routes.CHOSENAPPLICANTS)

const newAnswers = updateAnswers(application, chosenApplicants, setValue)
try {
await updateApplication({
variables: {
input: {
id: application.id,
answers: updateAnswers(application, chosenApplicants, setValue),
answers: newAnswers,
},
locale,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@ export const RejectApproveButtons: FC<
input: {
id: application.id,
event: DefaultEvents.SUBMIT,
answers: {},
answers: {
...application.answers,
'secondGuardianInformation.approved': true,
},
},
},
})
Expand Down
Loading
Loading