diff --git a/.github/workflows/build-pr.yml b/.github/workflows/build-pr.yml index 4362004e1c..a6ba9ffa8a 100644 --- a/.github/workflows/build-pr.yml +++ b/.github/workflows/build-pr.yml @@ -44,7 +44,7 @@ jobs: - name: "Get current pull request" id: PR - uses: 8BitJonny/gh-get-current-pr@2.2.0 + uses: 8BitJonny/gh-get-current-pr@4.0.0 with: github-token: ${{secrets.GITHUB_TOKEN}} filterOutClosed: true @@ -91,7 +91,7 @@ jobs: password: ${{secrets.OPENSHIFT_TOOLS_SERVICE_ACCOUNT_PASSWORD}} - name: "Get current pull request" - uses: 8BitJonny/gh-get-current-pr@2.2.0 + uses: 8BitJonny/gh-get-current-pr@4.0.0 id: PR with: github-token: ${{secrets.GITHUB_TOKEN}} @@ -157,7 +157,7 @@ jobs: password: ${{secrets.OPENSHIFT_TOOLS_SERVICE_ACCOUNT_PASSWORD}} - name: "Get current pull request" - uses: 8BitJonny/gh-get-current-pr@2.2.0 + uses: 8BitJonny/gh-get-current-pr@4.0.0 id: PR with: github-token: ${{secrets.GITHUB_TOKEN}} @@ -215,7 +215,7 @@ jobs: namespace: ${{secrets.OPENSHIFT_LICENSE_PLATE}}-${{secrets.OPENSHIFT_ENVIRONMENT}} - name: "Get current pull request" - uses: 8BitJonny/gh-get-current-pr@2.2.0 + uses: 8BitJonny/gh-get-current-pr@4.0.0 id: PR with: github-token: ${{secrets.GITHUB_TOKEN}} diff --git a/prime-angular-frontend/src/app/app-routing.module.ts b/prime-angular-frontend/src/app/app-routing.module.ts index e2aaa27604..0a4e4ec29d 100644 --- a/prime-angular-frontend/src/app/app-routing.module.ts +++ b/prime-angular-frontend/src/app/app-routing.module.ts @@ -6,7 +6,6 @@ import { AccessDeniedComponent } from '@lib/modules/root-routes/components/acces import { MaintenanceComponent } from '@lib/modules/root-routes/components/maintenance/maintenance.component'; import { PageNotFoundComponent } from '@lib/modules/root-routes/components/page-not-found/page-not-found.component'; import { HelpComponent } from '@lib/modules/root-routes/components/help/help.component'; -import { UnderagedComponent } from '@lib/modules/root-routes/components/underaged/underaged.component'; import { AuthRoutes } from '@auth/auth.routes'; import { EnrolmentRoutes } from '@enrolment/enrolment.routes'; @@ -19,6 +18,7 @@ import { SatEformsRoutes } from '@sat/sat-eforms.routes'; import { GisEnrolmentRoutes } from '@gis/gis-enrolment.routes'; import { HealthAuthSiteRegRoutes } from '@health-auth/health-auth-site-reg.routes'; import { PaperEnrolmentRoutes } from '@paper-enrolment/paper-enrolment.routes'; +import { NotEligibleComponent } from '@lib/modules/root-routes/components/not-eligible/not-eligible.component'; const routes: Routes = [ { @@ -70,11 +70,18 @@ const routes: Routes = [ }, { path: AppRoutes.UNDERAGED, - component: UnderagedComponent, + component: NotEligibleComponent, data: { title: 'Underaged' } }, + { + path: AppRoutes.IDENTITY_INSURANCE_LEVEL, + component: NotEligibleComponent, + data: { + title: 'Identity Insurance Level Not Met' + } + }, { path: AppRoutes.MAINTENANCE, component: MaintenanceComponent, @@ -110,4 +117,4 @@ const routes: Routes = [ imports: [RouterModule.forRoot(routes, { enableTracing: false })], exports: [RouterModule] }) -export class AppRoutingModule {} +export class AppRoutingModule { } diff --git a/prime-angular-frontend/src/app/app.routes.ts b/prime-angular-frontend/src/app/app.routes.ts index f3e3a2931a..5f9c44d184 100644 --- a/prime-angular-frontend/src/app/app.routes.ts +++ b/prime-angular-frontend/src/app/app.routes.ts @@ -1,6 +1,7 @@ export class AppRoutes { public static DENIED = 'denied'; public static UNDERAGED = 'underaged'; + public static IDENTITY_INSURANCE_LEVEL = 'identity-insurance-level'; public static MAINTENANCE = 'maintenance'; public static PAGE_NOT_FOUND = 'page-not-found'; public static HELP = 'help'; diff --git a/prime-angular-frontend/src/app/core/guards/identity-insurance-level.guard.spec.ts b/prime-angular-frontend/src/app/core/guards/identity-insurance-level.guard.spec.ts new file mode 100644 index 0000000000..738bf0d138 --- /dev/null +++ b/prime-angular-frontend/src/app/core/guards/identity-insurance-level.guard.spec.ts @@ -0,0 +1,40 @@ +import { provideHttpClientTesting } from '@angular/common/http/testing'; +import { TestBed } from '@angular/core/testing'; +import { RouterTestingModule } from '@angular/router/testing'; +import { AuthService } from '@auth/shared/services/auth.service'; +import { AppRoutes } from 'app/app.routes'; +import { KeycloakService } from 'keycloak-angular'; +import { MockAuthService } from 'test/mocks/mock-auth.service'; + +import { IdentityInsuranceLevelGuard } from './identity-insurance-level.guard'; +import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http'; +import { NotEligibleComponent } from '@lib/modules/root-routes/components/not-eligible/not-eligible.component'; + +describe('IdentityInsuranceLevelGuard', () => { + let guard: IdentityInsuranceLevelGuard; + + beforeEach(() => { + TestBed.configureTestingModule({ + imports: [RouterTestingModule.withRoutes([ + { + path: AppRoutes.IDENTITY_INSURANCE_LEVEL, + component: NotEligibleComponent + } + ])], + providers: [ + { + provide: AuthService, + useClass: MockAuthService + }, + KeycloakService, + provideHttpClient(withInterceptorsFromDi()), + provideHttpClientTesting() + ] + }); + guard = TestBed.inject(IdentityInsuranceLevelGuard); + }); + + it('should be created', () => { + expect(guard).toBeTruthy(); + }); +}); diff --git a/prime-angular-frontend/src/app/core/guards/identity-insurance-level.guard.ts b/prime-angular-frontend/src/app/core/guards/identity-insurance-level.guard.ts new file mode 100644 index 0000000000..196771b679 --- /dev/null +++ b/prime-angular-frontend/src/app/core/guards/identity-insurance-level.guard.ts @@ -0,0 +1,52 @@ +import { Injectable } from '@angular/core'; +import { Route, UrlSegment, ActivatedRouteSnapshot, RouterStateSnapshot, UrlTree, Router } from '@angular/router'; + +import { Observable } from 'rxjs'; +import { map } from 'rxjs/operators'; +import { AppRoutes } from 'app/app.routes'; +import { AuthService } from '@auth/shared/services/auth.service'; +import { BcscUser } from '@auth/shared/models/bcsc-user.model'; + +@Injectable({ + providedIn: 'root' +}) +export class IdentityInsuranceLevelGuard { + constructor( + private router: Router, + private authService: AuthService + ) { } + + public canActivate( + next: ActivatedRouteSnapshot, + state: RouterStateSnapshot): Observable | Promise | boolean | UrlTree { + return this.checkIdentityInsuranceLevel(); + } + + public canActivateChild( + next: ActivatedRouteSnapshot, + state: RouterStateSnapshot): Observable | Promise | boolean | UrlTree { + return this.canActivate(next, state); + } + + public canLoad( + route: Route, + segments: UrlSegment[]): Observable | Promise | boolean { + return this.checkIdentityInsuranceLevel(); + } + + private checkIdentityInsuranceLevel(): Observable | Promise | boolean { + return this.authService.getUser$() + .pipe( + map((user: BcscUser) => user.identityInsuranceLevel), + map((identityInsuranceLevel: number) => identityInsuranceLevel < 3), + map((unauthorized: boolean) => { + if (unauthorized) { + this.router.navigate([AppRoutes.IDENTITY_INSURANCE_LEVEL]); + return false; + } + + return true; + }) + ); + } +} diff --git a/prime-angular-frontend/src/app/core/guards/underaged.guard.spec.ts b/prime-angular-frontend/src/app/core/guards/underaged.guard.spec.ts index 47c6e0e65d..c5600d01ac 100644 --- a/prime-angular-frontend/src/app/core/guards/underaged.guard.spec.ts +++ b/prime-angular-frontend/src/app/core/guards/underaged.guard.spec.ts @@ -3,40 +3,40 @@ import { TestBed } from '@angular/core/testing'; import { RouterTestingModule } from '@angular/router/testing'; import { AuthService } from '@auth/shared/services/auth.service'; import { AppRoutes } from 'app/app.routes'; -import { UnderagedComponent } from '@lib/modules/root-routes/components/underaged/underaged.component'; import { KeycloakService } from 'keycloak-angular'; import { MockAuthService } from 'test/mocks/mock-auth.service'; import { UnderagedGuard } from './underaged.guard'; import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http'; +import { NotEligibleComponent } from '@lib/modules/root-routes/components/not-eligible/not-eligible.component'; describe('UnderagedGuard', () => { - let guard: UnderagedGuard; + let guard: UnderagedGuard; - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [RouterTestingModule.withRoutes([ - { - path: AppRoutes.UNDERAGED, - component: UnderagedComponent - } - ])], - providers: [ - { - provide: AuthService, - useClass: MockAuthService - }, - KeycloakService, - provideHttpClient(withInterceptorsFromDi()), - provideHttpClientTesting() - ] -}); - guard = TestBed.inject(UnderagedGuard); - }); + beforeEach(() => { + TestBed.configureTestingModule({ + imports: [RouterTestingModule.withRoutes([ + { + path: AppRoutes.UNDERAGED, + component: NotEligibleComponent + } + ])], + providers: [ + { + provide: AuthService, + useClass: MockAuthService + }, + KeycloakService, + provideHttpClient(withInterceptorsFromDi()), + provideHttpClientTesting() + ] + }); + guard = TestBed.inject(UnderagedGuard); + }); - it('should be created', () => { - expect(guard).toBeTruthy(); - }); + it('should be created', () => { + expect(guard).toBeTruthy(); + }); }); diff --git a/prime-angular-frontend/src/app/lib/modules/root-routes/components/underaged/underaged.component.html b/prime-angular-frontend/src/app/lib/modules/root-routes/components/not-eligible/not-eligible.component.html similarity index 64% rename from prime-angular-frontend/src/app/lib/modules/root-routes/components/underaged/underaged.component.html rename to prime-angular-frontend/src/app/lib/modules/root-routes/components/not-eligible/not-eligible.component.html index 82f8b8c628..f784709254 100644 --- a/prime-angular-frontend/src/app/lib/modules/root-routes/components/underaged/underaged.component.html +++ b/prime-angular-frontend/src/app/lib/modules/root-routes/components/not-eligible/not-eligible.component.html @@ -2,8 +2,8 @@

- You are not eligible to enrol in PRIME. If you believe you have received this page in error, please call - or email + You are not eligible to enrol in PRIME. If you believe you have received this page in error, please + email

diff --git a/prime-angular-frontend/src/app/lib/modules/root-routes/components/underaged/underaged.component.scss b/prime-angular-frontend/src/app/lib/modules/root-routes/components/not-eligible/not-eligible.component.scss similarity index 100% rename from prime-angular-frontend/src/app/lib/modules/root-routes/components/underaged/underaged.component.scss rename to prime-angular-frontend/src/app/lib/modules/root-routes/components/not-eligible/not-eligible.component.scss diff --git a/prime-angular-frontend/src/app/lib/modules/root-routes/components/underaged/underaged.component.spec.ts b/prime-angular-frontend/src/app/lib/modules/root-routes/components/not-eligible/not-eligible.component.spec.ts similarity index 60% rename from prime-angular-frontend/src/app/lib/modules/root-routes/components/underaged/underaged.component.spec.ts rename to prime-angular-frontend/src/app/lib/modules/root-routes/components/not-eligible/not-eligible.component.spec.ts index f3a4f01983..651c6b70a7 100644 --- a/prime-angular-frontend/src/app/lib/modules/root-routes/components/underaged/underaged.component.spec.ts +++ b/prime-angular-frontend/src/app/lib/modules/root-routes/components/not-eligible/not-eligible.component.spec.ts @@ -1,22 +1,22 @@ import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing'; -import { UnderagedComponent } from './underaged.component'; +import { NotEligibleComponent } from './not-eligible.component'; -describe('UnderagedComponent', () => { - let component: UnderagedComponent; - let fixture: ComponentFixture; +describe('NotEligibleComponent', () => { + let component: NotEligibleComponent; + let fixture: ComponentFixture; beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - declarations: [UnderagedComponent], + declarations: [NotEligibleComponent], schemas: [CUSTOM_ELEMENTS_SCHEMA] }) .compileComponents(); })); beforeEach(() => { - fixture = TestBed.createComponent(UnderagedComponent); + fixture = TestBed.createComponent(NotEligibleComponent); component = fixture.componentInstance; fixture.detectChanges(); }); diff --git a/prime-angular-frontend/src/app/lib/modules/root-routes/components/not-eligible/not-eligible.component.ts b/prime-angular-frontend/src/app/lib/modules/root-routes/components/not-eligible/not-eligible.component.ts new file mode 100644 index 0000000000..d6c5176bc5 --- /dev/null +++ b/prime-angular-frontend/src/app/lib/modules/root-routes/components/not-eligible/not-eligible.component.ts @@ -0,0 +1,13 @@ +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'app-not-eligible', + templateUrl: './not-eligible.component.html', + styleUrls: ['./not-eligible.component.scss'], + standalone: false +}) +export class NotEligibleComponent implements OnInit { + constructor() { } + + public ngOnInit(): void { } +} diff --git a/prime-angular-frontend/src/app/lib/modules/root-routes/components/underaged/underaged.component.ts b/prime-angular-frontend/src/app/lib/modules/root-routes/components/underaged/underaged.component.ts deleted file mode 100644 index 33f7756fb8..0000000000 --- a/prime-angular-frontend/src/app/lib/modules/root-routes/components/underaged/underaged.component.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { Component, OnInit } from '@angular/core'; - -@Component({ - selector: 'app-underaged', - templateUrl: './underaged.component.html', - styleUrls: ['./underaged.component.scss'], - standalone: false -}) -export class UnderagedComponent implements OnInit { - constructor() { } - - public ngOnInit(): void { } -} diff --git a/prime-angular-frontend/src/app/lib/modules/root-routes/root-routes.module.ts b/prime-angular-frontend/src/app/lib/modules/root-routes/root-routes.module.ts index 5fea3f25b2..65707c6ee7 100644 --- a/prime-angular-frontend/src/app/lib/modules/root-routes/root-routes.module.ts +++ b/prime-angular-frontend/src/app/lib/modules/root-routes/root-routes.module.ts @@ -7,7 +7,7 @@ import { PageNotFoundComponent } from './components/page-not-found/page-not-foun import { MaintenanceComponent } from './components/maintenance/maintenance.component'; import { PageSimpleComponent } from './components/page-simple/page-simple.component'; import { HelpComponent } from './components/help/help.component'; -import { UnderagedComponent } from './components/underaged/underaged.component'; +import { NotEligibleComponent } from './components/not-eligible/not-eligible.component'; @NgModule({ imports: [ @@ -19,7 +19,7 @@ import { UnderagedComponent } from './components/underaged/underaged.component'; PageNotFoundComponent, MaintenanceComponent, HelpComponent, - UnderagedComponent + NotEligibleComponent, ], exports: [ PageSimpleComponent, @@ -27,7 +27,7 @@ import { UnderagedComponent } from './components/underaged/underaged.component'; PageNotFoundComponent, MaintenanceComponent, HelpComponent, - UnderagedComponent + NotEligibleComponent, ] }) export class RootRoutesModule { } diff --git a/prime-angular-frontend/src/app/modules/adjudication/pages/enrollee-access-term-enrolment/enrollee-access-term-enrolment.component.ts b/prime-angular-frontend/src/app/modules/adjudication/pages/enrollee-access-term-enrolment/enrollee-access-term-enrolment.component.ts index 9102002f7d..ec5bad2320 100644 --- a/prime-angular-frontend/src/app/modules/adjudication/pages/enrollee-access-term-enrolment/enrollee-access-term-enrolment.component.ts +++ b/prime-angular-frontend/src/app/modules/adjudication/pages/enrollee-access-term-enrolment/enrollee-access-term-enrolment.component.ts @@ -97,6 +97,7 @@ export class EnrolleeAccessTermEnrolmentComponent extends AbstractComponent impl phone, phoneExtension, enrolleeCareSettings, + identityInsuranceLevel, ...remainder } = enrollee; @@ -119,7 +120,8 @@ export class EnrolleeAccessTermEnrolmentComponent extends AbstractComponent impl email, smsPhone, phone, - phoneExtension + phoneExtension, + identityInsuranceLevel }, // Provide the default and allow it to be overridden collectionNoticeAccepted: false, diff --git a/prime-angular-frontend/src/app/modules/adjudication/pages/enrollee-overview/enrollee-overview.component.ts b/prime-angular-frontend/src/app/modules/adjudication/pages/enrollee-overview/enrollee-overview.component.ts index 4cc1803d6b..4d1c9d80eb 100644 --- a/prime-angular-frontend/src/app/modules/adjudication/pages/enrollee-overview/enrollee-overview.component.ts +++ b/prime-angular-frontend/src/app/modules/adjudication/pages/enrollee-overview/enrollee-overview.component.ts @@ -27,10 +27,10 @@ import { EnrolleeAbsence } from '@shared/models/enrollee-absence.model'; import { AdjudicationRoutes } from '@adjudication/adjudication.routes'; @Component({ - selector: 'app-enrollee-overview', - templateUrl: './enrollee-overview.component.html', - styleUrls: ['./enrollee-overview.component.scss'], - standalone: false + selector: 'app-enrollee-overview', + templateUrl: './enrollee-overview.component.html', + styleUrls: ['./enrollee-overview.component.scss'], + standalone: false }) export class EnrolleeOverviewComponent extends AdjudicationContainerComponent implements OnInit { public enrollee: HttpEnrollee; @@ -144,6 +144,7 @@ export class EnrolleeOverviewComponent extends AdjudicationContainerComponent im phone, phoneExtension, userProvidedGpid, + identityInsuranceLevel, ...remainder } = enrollee; @@ -168,7 +169,8 @@ export class EnrolleeOverviewComponent extends AdjudicationContainerComponent im smsPhone, phone, phoneExtension, - userProvidedGpid + userProvidedGpid, + identityInsuranceLevel }, // Provide the default and allow it to be overridden collectionNoticeAccepted: false, diff --git a/prime-angular-frontend/src/app/modules/adjudication/pages/enrolment/enrolment.component.ts b/prime-angular-frontend/src/app/modules/adjudication/pages/enrolment/enrolment.component.ts index 6b1c7b5a1d..592dd20109 100644 --- a/prime-angular-frontend/src/app/modules/adjudication/pages/enrolment/enrolment.component.ts +++ b/prime-angular-frontend/src/app/modules/adjudication/pages/enrolment/enrolment.component.ts @@ -12,10 +12,10 @@ import { HttpEnrollee, Enrolment } from '@shared/models/enrolment.model'; import { AdjudicationRoutes } from '@adjudication/adjudication.routes'; @Component({ - selector: 'app-enrolment', - templateUrl: './enrolment.component.html', - styleUrls: ['./enrolment.component.scss'], - standalone: false + selector: 'app-enrolment', + templateUrl: './enrolment.component.html', + styleUrls: ['./enrolment.component.scss'], + standalone: false }) export class EnrolmentComponent extends AbstractComponent implements OnInit { public busy: Subscription; @@ -76,6 +76,7 @@ export class EnrolmentComponent extends AbstractComponent implements OnInit { smsPhone, phone, phoneExtension, + identityInsuranceLevel, ...remainder } = enrollee; @@ -100,7 +101,8 @@ export class EnrolmentComponent extends AbstractComponent implements OnInit { email, smsPhone, phone, - phoneExtension + phoneExtension, + identityInsuranceLevel }, // Provide the default and allow it to be overridden collectionNoticeAccepted: false, diff --git a/prime-angular-frontend/src/app/modules/auth/shared/models/bcsc-user.model.ts b/prime-angular-frontend/src/app/modules/auth/shared/models/bcsc-user.model.ts index ca444db8e8..c9d5fdafdb 100644 --- a/prime-angular-frontend/src/app/modules/auth/shared/models/bcsc-user.model.ts +++ b/prime-angular-frontend/src/app/modules/auth/shared/models/bcsc-user.model.ts @@ -8,4 +8,5 @@ export interface BcscUser extends User { givenNames: string; dateOfBirth: string; verifiedAddress: Address; + identityInsuranceLevel: number; } diff --git a/prime-angular-frontend/src/app/modules/auth/shared/services/auth.service.ts b/prime-angular-frontend/src/app/modules/auth/shared/services/auth.service.ts index 314ee324a9..068ad94042 100644 --- a/prime-angular-frontend/src/app/modules/auth/shared/services/auth.service.ts +++ b/prime-angular-frontend/src/app/modules/auth/shared/services/auth.service.ts @@ -106,6 +106,7 @@ export class AuthService implements IAuthService { const city = token?.address?.locality; const postal = token?.address?.postal_code; const givenNames = token?.given_names; + const identityInsuranceLevel = token?.identity_assurance_level; const userId = token?.sub; const username = token?.preferred_username; // Expecting e.g. gtcochh2vajdtodkby27kspv554dn4is@bcsc @@ -133,6 +134,7 @@ export class AuthService implements IAuthService { dateOfBirth, verifiedAddress, email, + identityInsuranceLevel, ...claims } as BcscUser; } diff --git a/prime-angular-frontend/src/app/modules/enrolment/enrolment-routing.module.ts b/prime-angular-frontend/src/app/modules/enrolment/enrolment-routing.module.ts index 1dd894257a..fae75309d1 100644 --- a/prime-angular-frontend/src/app/modules/enrolment/enrolment-routing.module.ts +++ b/prime-angular-frontend/src/app/modules/enrolment/enrolment-routing.module.ts @@ -34,6 +34,7 @@ import { RemoteAccessComponent } from './pages/remote-access/remote-access.compo import { RemoteAccessAddressesComponent } from './pages/remote-access-addresses/remote-access-addresses.component'; import { PaperEnrolleeReturneesPageComponent } from './pages/paper-enrollee-returnees-page/paper-enrollee-returnees-page.component'; import { AbsenceManagementPageComponent } from './pages/absence-management-page/absence-management-page.component'; +import { IdentityInsuranceLevelGuard } from '@core/guards/identity-insurance-level.guard'; const routes: Routes = [ { @@ -41,7 +42,8 @@ const routes: Routes = [ component: DashboardV1Component, canActivate: [ AuthenticationGuard, - UnderagedGuard + UnderagedGuard, + IdentityInsuranceLevelGuard ], canActivateChild: [ AuthenticationGuard, diff --git a/prime-angular-frontend/src/app/modules/enrolment/pages/collection-notice/collection-notice.component.spec.ts b/prime-angular-frontend/src/app/modules/enrolment/pages/collection-notice/collection-notice.component.spec.ts index e8b09cb2ab..f963e0bbcc 100644 --- a/prime-angular-frontend/src/app/modules/enrolment/pages/collection-notice/collection-notice.component.spec.ts +++ b/prime-angular-frontend/src/app/modules/enrolment/pages/collection-notice/collection-notice.component.spec.ts @@ -20,62 +20,62 @@ import { EnrolmentRoutes } from '@enrolment/enrolment.routes'; import { OverviewComponent } from '@enrolment/pages/overview/overview.component'; import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; import { AppRoutes } from 'app/app.routes'; -import { UnderagedComponent } from '@lib/modules/root-routes/components/underaged/underaged.component'; import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http'; +import { NotEligibleComponent } from '@lib/modules/root-routes/components/not-eligible/not-eligible.component'; describe('CollectionNoticeComponent', () => { - let component: CollectionNoticeComponent; - let fixture: ComponentFixture; + let component: CollectionNoticeComponent; + let fixture: ComponentFixture; - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule( - { - schemas: [CUSTOM_ELEMENTS_SCHEMA], - imports: [RouterTestingModule.withRoutes([ + beforeEach(waitForAsync(() => { + TestBed.configureTestingModule( { - path: EnrolmentRoutes.OVERVIEW, - component: OverviewComponent - }, - { - path: AppRoutes.UNDERAGED, - component: UnderagedComponent + schemas: [CUSTOM_ELEMENTS_SCHEMA], + imports: [RouterTestingModule.withRoutes([ + { + path: EnrolmentRoutes.OVERVIEW, + component: OverviewComponent + }, + { + path: AppRoutes.UNDERAGED, + component: NotEligibleComponent + } + ]), + NgxMaterialModule, + NgxBusyModule, + EnrolmentModule, + SharedModule], + providers: [ + { + provide: APP_CONFIG, + useValue: APP_DI_CONFIG + }, + { + provide: ConfigService, + useClass: MockConfigService + }, + { + provide: EnrolmentService, + useClass: MockEnrolmentService + }, + { + provide: AuthService, + useClass: MockAuthService + }, + provideHttpClient(withInterceptorsFromDi()), + provideHttpClientTesting() + ] } - ]), - NgxMaterialModule, - NgxBusyModule, - EnrolmentModule, - SharedModule], - providers: [ - { - provide: APP_CONFIG, - useValue: APP_DI_CONFIG - }, - { - provide: ConfigService, - useClass: MockConfigService - }, - { - provide: EnrolmentService, - useClass: MockEnrolmentService - }, - { - provide: AuthService, - useClass: MockAuthService - }, - provideHttpClient(withInterceptorsFromDi()), - provideHttpClientTesting() - ] -} - ).compileComponents(); - })); + ).compileComponents(); + })); - beforeEach(() => { - fixture = TestBed.createComponent(CollectionNoticeComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); + beforeEach(() => { + fixture = TestBed.createComponent(CollectionNoticeComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); - it('should create', () => { - expect(component).toBeTruthy(); - }); + it('should create', () => { + expect(component).toBeTruthy(); + }); }); diff --git a/prime-angular-frontend/src/app/modules/enrolment/shared/services/enrolment-resource.service.ts b/prime-angular-frontend/src/app/modules/enrolment/shared/services/enrolment-resource.service.ts index 2498f4ddeb..7c151a9146 100644 --- a/prime-angular-frontend/src/app/modules/enrolment/shared/services/enrolment-resource.service.ts +++ b/prime-angular-frontend/src/app/modules/enrolment/shared/services/enrolment-resource.service.ts @@ -666,6 +666,7 @@ export class EnrolmentResource { smsPhone, phone, phoneExtension, + identityInsuranceLevel, ...remainder } = enrollee; @@ -689,6 +690,7 @@ export class EnrolmentResource { smsPhone, phone, phoneExtension, + identityInsuranceLevel, }, // Provide the default and allow it to be overridden collectionNoticeAccepted: false, diff --git a/prime-angular-frontend/src/app/modules/gis-enrolment/shared/models/gis-enrolment.model.ts b/prime-angular-frontend/src/app/modules/gis-enrolment/shared/models/gis-enrolment.model.ts index 9cfdfda6f3..fb744a82a6 100644 --- a/prime-angular-frontend/src/app/modules/gis-enrolment/shared/models/gis-enrolment.model.ts +++ b/prime-angular-frontend/src/app/modules/gis-enrolment/shared/models/gis-enrolment.model.ts @@ -16,7 +16,8 @@ export class GisEnrolment implements Omit { public organization: string = null, public role: string = null, public submittedDate: string = null, - public id: number = 0 + public id: number = 0, + public identityInsuranceLevel: number = null, ) { this.hpdid = hpdid; this.userId = userId; @@ -33,6 +34,7 @@ export class GisEnrolment implements Omit { this.role = role; this.submittedDate = submittedDate; this.id = id; + this.identityInsuranceLevel = identityInsuranceLevel; } public static fromBcscUser(bcscUser: BcscUser): GisEnrolment { @@ -48,7 +50,7 @@ export class GisEnrolment implements Omit { } public static toBcscUser(enrolment: GisEnrolment): Omit { - const { hpdid, userId, username, givenNames, dateOfBirth, email, firstName, lastName } = enrolment; - return { hpdid, userId, username, givenNames, dateOfBirth, email, firstName, lastName }; + const { hpdid, userId, username, givenNames, dateOfBirth, email, firstName, lastName, identityInsuranceLevel } = enrolment; + return { hpdid, userId, username, givenNames, dateOfBirth, email, firstName, lastName, identityInsuranceLevel }; } } diff --git a/prime-angular-frontend/src/app/modules/sat-eforms/test/mock-sat-enrollee.service.ts b/prime-angular-frontend/src/app/modules/sat-eforms/test/mock-sat-enrollee.service.ts index da5e9f1754..41bcbcf0a3 100644 --- a/prime-angular-frontend/src/app/modules/sat-eforms/test/mock-sat-enrollee.service.ts +++ b/prime-angular-frontend/src/app/modules/sat-eforms/test/mock-sat-enrollee.service.ts @@ -30,7 +30,8 @@ export class MockSatEnrolleeService implements ISatEnrolleeService { verifiedAddress: new Address('CA', 'BC', faker.address.streetAddress(), '', faker.address.city(), faker.address.zipCode()), partyCertifications: [], submittedDate: faker.date.past(1).toDateString(), - username: `${faker.random.uuid()}@bcsc` + username: `${faker.random.uuid()}@bcsc`, + identityInsuranceLevel: 3 }); } diff --git a/prime-angular-frontend/src/app/shared/components/prime-email/prime-email.component.ts b/prime-angular-frontend/src/app/shared/components/prime-email/prime-email.component.ts index 4368cf1710..48a71d9374 100644 --- a/prime-angular-frontend/src/app/shared/components/prime-email/prime-email.component.ts +++ b/prime-angular-frontend/src/app/shared/components/prime-email/prime-email.component.ts @@ -2,10 +2,10 @@ import { Component, Inject } from '@angular/core'; import { APP_CONFIG, AppConfig } from 'app/app-config.module'; @Component({ - selector: 'app-prime-email', - templateUrl: './prime-email.component.html', - styleUrls: ['./prime-email.component.scss'], - standalone: false + selector: 'app-prime-email', + templateUrl: './prime-email.component.html', + styleUrls: ['./prime-email.component.scss'], + standalone: false }) export class PrimeEmailComponent { constructor( @@ -13,7 +13,7 @@ export class PrimeEmailComponent { ) { } public get primeEmail() { - return this.config.prime.email; + return this.config.prime.supportEmail; } public get primeEmailHref() { diff --git a/prime-angular-frontend/src/test/mocks/mock-auth.service.ts b/prime-angular-frontend/src/test/mocks/mock-auth.service.ts index 9ee398dc0a..236bf28560 100644 --- a/prime-angular-frontend/src/test/mocks/mock-auth.service.ts +++ b/prime-angular-frontend/src/test/mocks/mock-auth.service.ts @@ -69,7 +69,8 @@ export class MockAuthService implements IAuthService { postal: faker.address.zipCode() }, email: faker.internet.email(), - username: `${faker.random.uuid()}@bcsc` + username: `${faker.random.uuid()}@bcsc`, + identityInsuranceLevel: 3 })); } diff --git a/prime-angular-frontend/src/test/mocks/mock-enrolment.service.ts b/prime-angular-frontend/src/test/mocks/mock-enrolment.service.ts index 6ce741ca80..d6837f270b 100644 --- a/prime-angular-frontend/src/test/mocks/mock-enrolment.service.ts +++ b/prime-angular-frontend/src/test/mocks/mock-enrolment.service.ts @@ -41,7 +41,8 @@ export class MockEnrolmentService implements IEnrolmentService { phoneExtension: null, gpid: null, hpdid: null, - username: `${faker.random.uuid()}@bcsc` + username: `${faker.random.uuid()}@bcsc`, + identityInsuranceLevel: 3 }, appliedDate: null, approvedDate: null,