Skip to content

Commit

Permalink
Include the TRN questions in registration journey for Strict lookups
Browse files Browse the repository at this point in the history
  • Loading branch information
gunndabad committed Oct 12, 2023
1 parent a2ec2dd commit 9355045
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ public AuthenticationState(
[JsonIgnore]
public bool HasTrnSet => HasTrn.HasValue;
[JsonIgnore]
public bool StatedTrnSet => StatedTrn is not null;
[JsonIgnore]
public bool NameSet => HasName.HasValue;
[JsonIgnore]
public bool DateOfBirthSet => DateOfBirth.HasValue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ public override bool IsCompleted()
Steps.NiNumber => AuthenticationState is { HasNationalInsuranceNumber: true, ContactDetailsVerified: true },
Steps.HasTrn => (AuthenticationState is ({ NationalInsuranceNumberSet: true } or { HasNationalInsuranceNumberSet: true, HasNationalInsuranceNumber: false }) and { ContactDetailsVerified: true }),
Steps.Trn => AuthenticationState is { HasTrn: true, ContactDetailsVerified: true },
Steps.HasQts => AuthenticationState is ({ StatedTrn: { }, OAuthState: { TrnMatchPolicy: Models.TrnMatchPolicy.Default } } or { OAuthState: { TrnMatchPolicy: Models.TrnMatchPolicy.Default }, HasTrnSet: true, HasTrn: false }) and { ContactDetailsVerified: true },
Steps.IttProvider => AuthenticationState is { OAuthState: { TrnMatchPolicy: Models.TrnMatchPolicy.Default }, AwardedQts: true, ContactDetailsVerified: true },
Steps.HasQts => AuthenticationState is ({ StatedTrn: { }, OAuthState: { TrnMatchPolicy: TrnMatchPolicy.Default } } or { OAuthState: { TrnMatchPolicy: TrnMatchPolicy.Default }, HasTrnSet: true, HasTrn: false }) and { ContactDetailsVerified: true },
Steps.IttProvider => AuthenticationState is { OAuthState: { TrnMatchPolicy: TrnMatchPolicy.Default }, AwardedQts: true, ContactDetailsVerified: true },
SignInJourney.Steps.TrnInUse => AuthenticationState.TrnLookup == AuthenticationState.TrnLookupState.ExistingTrnFound,
SignInJourney.Steps.TrnInUseResendTrnOwnerEmailConfirmation => AuthenticationState.TrnLookup == AuthenticationState.TrnLookupState.ExistingTrnFound,
SignInJourney.Steps.TrnInUseChooseEmail => AuthenticationState.TrnLookup == AuthenticationState.TrnLookupState.EmailOfExistingAccountForTrnVerified,
Expand Down Expand Up @@ -152,7 +152,7 @@ public override string GetNextStepUrl(string currentStep) =>
(Steps.HasNiNumber, { HasNationalInsuranceNumber: false }) => shouldCheckAnswers ? CoreSignInJourney.Steps.CheckAnswers : Steps.HasTrn,
(Steps.NiNumber, _) => shouldCheckAnswers ? CoreSignInJourney.Steps.CheckAnswers : Steps.HasTrn,
(Steps.HasTrn, { HasTrn: true }) => Steps.Trn,
(Steps.HasTrn, { HasTrn: false, OAuthState.TrnMatchPolicy: Models.TrnMatchPolicy.Strict }) => CoreSignInJourney.Steps.CheckAnswers,
(Steps.HasTrn, { HasTrn: false, OAuthState.TrnMatchPolicy: TrnMatchPolicy.Strict }) => CoreSignInJourney.Steps.CheckAnswers,
(Steps.HasTrn, { HasTrn: false }) => shouldCheckAnswers ? CoreSignInJourney.Steps.CheckAnswers : Steps.HasQts,
(Steps.Trn, _) => shouldCheckAnswers ? CoreSignInJourney.Steps.CheckAnswers : Steps.HasQts,
(Steps.HasQts, { AwardedQts: true }) => Steps.IttProvider,
Expand Down Expand Up @@ -229,8 +229,10 @@ protected override bool AreAllQuestionsAnswered() =>
AuthenticationState.DateOfBirthSet &&
AuthenticationState.HasNationalInsuranceNumberSet &&
(AuthenticationState.NationalInsuranceNumberSet || AuthenticationState.HasNationalInsuranceNumber == false) &&
((AuthenticationState.AwardedQtsSet &&
(AuthenticationState.HasIttProviderSet || AuthenticationState.AwardedQts == false) || (AuthenticationState.AwardedQtsSet == false && AuthenticationState?.OAuthState?.TrnMatchPolicy == Models.TrnMatchPolicy.Strict)));
AuthenticationState.HasTrnSet &&
(AuthenticationState.StatedTrnSet || AuthenticationState.HasTrn == false) &&
(AuthenticationState.AwardedQtsSet &&
(AuthenticationState.HasIttProviderSet || AuthenticationState.AwardedQts == false) || (AuthenticationState.AwardedQtsSet == false && AuthenticationState?.OAuthState?.TrnMatchPolicy == TrnMatchPolicy.Strict));

public new static class Steps
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@ public async Task NewUser_WithTrnLookup_TrnNotFound_CanRegister_StrictTrnMatchPo

await page.SubmitRegisterNiNumberPage(nino);

await page.SubmitRegisterHasTrnPage(hasTrn: true);

await page.SubmitRegisterTrnPage(trn);

await page.SubmitCheckAnswersPage();

await page.SubmitCompletePageForNewUser(email);
Expand Down

0 comments on commit 9355045

Please sign in to comment.