From 89dead6f026ee9a63521c9324ec7fb487a141f32 Mon Sep 17 00:00:00 2001 From: Drew Miley Date: Mon, 16 Feb 2026 16:55:27 +0000 Subject: [PATCH 01/10] APB-10281: Tidies dependencies and plugins --- project/AppDependencies.scala | 33 ++++++++++++++++++--------------- project/plugins.sbt | 10 +++++----- 2 files changed, 23 insertions(+), 20 deletions(-) diff --git a/project/AppDependencies.scala b/project/AppDependencies.scala index 9c094fae..18bf1b5a 100644 --- a/project/AppDependencies.scala +++ b/project/AppDependencies.scala @@ -1,24 +1,27 @@ import sbt.* object AppDependencies { - private val mongoVer = "2.10.0" + private val bootstrapVer = "10.3.0" - private val pekkoVersion = "1.0.3" + private val mongoVer = "2.10.0" + private val playVer = "play-30" + private val pekkoVer = "1.0.3" + val compile: Seq[ModuleID] = Seq( - "uk.gov.hmrc" %% "bootstrap-backend-play-30" % bootstrapVer, - "uk.gov.hmrc.mongo" %% "hmrc-mongo-play-30" % mongoVer, - "org.typelevel" %% "cats-core" % "2.13.0", - "uk.gov.hmrc" %% "crypto-json-play-30" % "8.4.0", - "io.github.samueleresca" %% "pekko-quartz-scheduler" % "1.2.0-pekko-1.0.x", - "uk.gov.hmrc" %% "domain-play-30" % "11.0.0" + "uk.gov.hmrc" %% s"bootstrap-backend-$playVer" % bootstrapVer, + "uk.gov.hmrc.mongo" %% s"hmrc-mongo-$playVer" % mongoVer, + "uk.gov.hmrc" %% s"domain-$playVer" % "11.0.0", + "uk.gov.hmrc" %% s"crypto-json-$playVer" % "8.4.0", + "org.typelevel" %% "cats-core" % "2.13.0", + "io.github.samueleresca" %% "pekko-quartz-scheduler" % "1.2.0-pekko-1.0.x" ) val test: Seq[ModuleID] = Seq( - "uk.gov.hmrc" %% "bootstrap-test-play-30" % bootstrapVer % Test, - "org.scalatestplus.play" %% "scalatestplus-play" % "7.0.2" % Test, - "uk.gov.hmrc.mongo" %% "hmrc-mongo-test-play-30" % mongoVer % Test, - "org.apache.pekko" %% "pekko-testkit" % pekkoVersion % Test, - "org.apache.pekko" %% "pekko-actor-testkit-typed" % pekkoVersion % Test, - "org.scalacheck" %% "scalacheck" % "1.19.0" % Test - ) + "uk.gov.hmrc" %% s"bootstrap-test-$playVer" % bootstrapVer, + "uk.gov.hmrc.mongo" %% s"hmrc-mongo-test-$playVer" % mongoVer, + "org.apache.pekko" %% "pekko-testkit" % pekkoVer, + "org.apache.pekko" %% "pekko-actor-testkit-typed" % pekkoVer, + "org.scalatestplus.play" %% "scalatestplus-play" % "7.0.2", + "org.scalacheck" %% "scalacheck" % "1.19.0" + ).map(_ % Test) } diff --git a/project/plugins.sbt b/project/plugins.sbt index bc65aec6..966656b2 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -3,11 +3,11 @@ resolvers += Resolver.url("HMRC-open-artefacts-ivy", url("https://open.artefacts ThisBuild / libraryDependencySchemes += "org.scala-lang.modules" %% "scala-xml" % VersionScheme.Always -addSbtPlugin("org.playframework" % "sbt-plugin" % "3.0.9") -addSbtPlugin("uk.gov.hmrc" % "sbt-auto-build" % "3.24.0") -addSbtPlugin("uk.gov.hmrc" % "sbt-distributables" % "2.6.0") -addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.4") -addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.3.1") +addSbtPlugin("org.playframework" % "sbt-plugin" % "3.0.9") +addSbtPlugin("uk.gov.hmrc" % "sbt-auto-build" % "3.24.0") +addSbtPlugin("uk.gov.hmrc" % "sbt-distributables" % "2.6.0") +addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.4") +addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.3.1") addSbtPlugin("org.scalastyle" %% "scalastyle-sbt-plugin" % "1.0.0") addSbtPlugin("org.wartremover" % "sbt-wartremover" % "3.3.3") addSbtPlugin("com.timushev.sbt" % "sbt-updates" % "0.6.4") From 234eff9a6216a06414279743063947fffa57df7b Mon Sep 17 00:00:00 2001 From: Drew Miley Date: Tue, 17 Feb 2026 11:43:20 +0000 Subject: [PATCH 02/10] APB-10281: Removes not needed test dependency --- project/AppDependencies.scala | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/project/AppDependencies.scala b/project/AppDependencies.scala index 18bf1b5a..7c1e0306 100644 --- a/project/AppDependencies.scala +++ b/project/AppDependencies.scala @@ -17,11 +17,10 @@ object AppDependencies { ) val test: Seq[ModuleID] = Seq( - "uk.gov.hmrc" %% s"bootstrap-test-$playVer" % bootstrapVer, - "uk.gov.hmrc.mongo" %% s"hmrc-mongo-test-$playVer" % mongoVer, - "org.apache.pekko" %% "pekko-testkit" % pekkoVer, - "org.apache.pekko" %% "pekko-actor-testkit-typed" % pekkoVer, - "org.scalatestplus.play" %% "scalatestplus-play" % "7.0.2", - "org.scalacheck" %% "scalacheck" % "1.19.0" + "uk.gov.hmrc" %% s"bootstrap-test-$playVer" % bootstrapVer, + "uk.gov.hmrc.mongo" %% s"hmrc-mongo-test-$playVer" % mongoVer, + "org.apache.pekko" %% "pekko-testkit" % pekkoVer, + "org.apache.pekko" %% "pekko-actor-testkit-typed" % pekkoVer, + "org.scalacheck" %% "scalacheck" % "1.19.0" ).map(_ % Test) } From aad076785c7f4c6240a5a10a59a8f491fb31f5cf Mon Sep 17 00:00:00 2001 From: Drew Miley Date: Tue, 17 Feb 2026 17:08:53 +0000 Subject: [PATCH 03/10] APB-10281: Comments out variations --- .../model/identifiers/NinoWithoutSuffix.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/uk/gov/hmrc/agentclientrelationships/model/identifiers/NinoWithoutSuffix.scala b/app/uk/gov/hmrc/agentclientrelationships/model/identifiers/NinoWithoutSuffix.scala index d82bd888..c309a953 100644 --- a/app/uk/gov/hmrc/agentclientrelationships/model/identifiers/NinoWithoutSuffix.scala +++ b/app/uk/gov/hmrc/agentclientrelationships/model/identifiers/NinoWithoutSuffix.scala @@ -54,7 +54,7 @@ with SimpleName { case _ => false } - def variations: Seq[String] = value +: Nino.validSuffixes.map(value + _) +// def variations: Seq[String] = value +: Nino.validSuffixes.map(value + _) } From be6ae816f12c622dac348a4ab5d06ce43c87c96a Mon Sep 17 00:00:00 2001 From: Drew Miley Date: Wed, 18 Feb 2026 13:52:42 +0000 Subject: [PATCH 04/10] APB-10281: Replaces in match of variations with equal match of value for clientId for PartialAuthRepository --- .../repository/PartialAuthRepository.scala | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/app/uk/gov/hmrc/agentclientrelationships/repository/PartialAuthRepository.scala b/app/uk/gov/hmrc/agentclientrelationships/repository/PartialAuthRepository.scala index 57851cf5..4f595798 100644 --- a/app/uk/gov/hmrc/agentclientrelationships/repository/PartialAuthRepository.scala +++ b/app/uk/gov/hmrc/agentclientrelationships/repository/PartialAuthRepository.scala @@ -126,7 +126,7 @@ with RequestAwareLogging { HMRCMTDIT, HMRCMTDITSUPP ), - in("nino", nino.variations.map(encryptedString): _*), + equal("nino", nino.value.map(encryptedString)), equal("arn", arn.value), equal("active", true) ) @@ -136,7 +136,7 @@ with RequestAwareLogging { def findActiveForClient(nino: NinoWithoutSuffix): Future[Seq[PartialAuthRelationship]] = Mdc.preservingMdc { collection - .find(and(in("nino", nino.variations.map(encryptedString): _*), equal("active", true))) + .find(and(equal("nino", nino.value.map(encryptedString)), equal("active", true))) .toFuture() } @@ -149,7 +149,7 @@ with RequestAwareLogging { .find( and( equal("service", serviceId), - in("nino", nino.variations.map(encryptedString): _*), + equal("nino", nino.value.map(encryptedString)), equal("arn", arn.value), equal("active", true) ) @@ -159,7 +159,7 @@ with RequestAwareLogging { def findAllForClient(nino: NinoWithoutSuffix): Future[Seq[PartialAuthRelationship]] = Mdc.preservingMdc { collection - .find(in("nino", nino.variations.map(encryptedString): _*)) + .find(equal("nino", nino.value.map(encryptedString))) .toFuture() } @@ -169,7 +169,7 @@ with RequestAwareLogging { .find( and( equal("service", HMRCMTDIT), - in("nino", NinoWithoutSuffix(nino).variations.map(encryptedString): _*), + equal("nino", NinoWithoutSuffix(nino).value.map(encryptedString)), equal("active", true) ) ) @@ -186,7 +186,7 @@ with RequestAwareLogging { .updateOne( and( equal("service", serviceId), - in("nino", nino.variations.map(encryptedString): _*), + equal("nino", nino.value.map(encryptedString)), equal("arn", arn.value), equal("active", true) ), @@ -206,7 +206,7 @@ with RequestAwareLogging { .deleteOne( and( equal("service", serviceId), - in("nino", nino.variations.map(encryptedString): _*), + equal("nino", nino.value.map(encryptedString)), equal("arn", arn.value), equal("active", true) ) From f06f5cf3a2f8a8b7332289b808c256e95393e7c2 Mon Sep 17 00:00:00 2001 From: Drew Miley Date: Wed, 18 Feb 2026 13:55:02 +0000 Subject: [PATCH 05/10] APB-10281: expandNinoSuffixes in InvitationsRepository now returns Seq of 1 Nino value --- .../repository/InvitationsRepository.scala | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/uk/gov/hmrc/agentclientrelationships/repository/InvitationsRepository.scala b/app/uk/gov/hmrc/agentclientrelationships/repository/InvitationsRepository.scala index b0eed4fd..337fbe4d 100644 --- a/app/uk/gov/hmrc/agentclientrelationships/repository/InvitationsRepository.scala +++ b/app/uk/gov/hmrc/agentclientrelationships/repository/InvitationsRepository.scala @@ -484,9 +484,10 @@ with RequestAwareLogging { .map(_.getModifiedCount == 1L) } +// TODO: Can we now make this return a String rather than Seq[String] private def expandNinoSuffixes(clientId: String): Seq[String] = { clientId match { - case nino if NinoWithoutSuffix.isValid(nino) => NinoWithoutSuffix(nino).variations + case nino if NinoWithoutSuffix.isValid(nino) => Seq(NinoWithoutSuffix(nino).value) case clientId => Seq(clientId) } } From 3afe90d7552f3d05966c9672d490ec06414d6034 Mon Sep 17 00:00:00 2001 From: Drew Miley Date: Wed, 18 Feb 2026 14:07:55 +0000 Subject: [PATCH 06/10] APB-10281: Corrects syntax for call to encryptedString --- .../repository/PartialAuthRepository.scala | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/app/uk/gov/hmrc/agentclientrelationships/repository/PartialAuthRepository.scala b/app/uk/gov/hmrc/agentclientrelationships/repository/PartialAuthRepository.scala index 4f595798..aaf221a9 100644 --- a/app/uk/gov/hmrc/agentclientrelationships/repository/PartialAuthRepository.scala +++ b/app/uk/gov/hmrc/agentclientrelationships/repository/PartialAuthRepository.scala @@ -126,7 +126,7 @@ with RequestAwareLogging { HMRCMTDIT, HMRCMTDITSUPP ), - equal("nino", nino.value.map(encryptedString)), + equal("nino", encryptedString(nino.value)), equal("arn", arn.value), equal("active", true) ) @@ -136,7 +136,7 @@ with RequestAwareLogging { def findActiveForClient(nino: NinoWithoutSuffix): Future[Seq[PartialAuthRelationship]] = Mdc.preservingMdc { collection - .find(and(equal("nino", nino.value.map(encryptedString)), equal("active", true))) + .find(and(equal("nino", encryptedString(nino.value)), equal("active", true))) .toFuture() } @@ -149,7 +149,7 @@ with RequestAwareLogging { .find( and( equal("service", serviceId), - equal("nino", nino.value.map(encryptedString)), + equal("nino", encryptedString(nino.value)), equal("arn", arn.value), equal("active", true) ) @@ -159,7 +159,7 @@ with RequestAwareLogging { def findAllForClient(nino: NinoWithoutSuffix): Future[Seq[PartialAuthRelationship]] = Mdc.preservingMdc { collection - .find(equal("nino", nino.value.map(encryptedString))) + .find(equal("nino", encryptedString(nino.value))) .toFuture() } @@ -169,7 +169,7 @@ with RequestAwareLogging { .find( and( equal("service", HMRCMTDIT), - equal("nino", NinoWithoutSuffix(nino).value.map(encryptedString)), + equal("nino", encryptedString(NinoWithoutSuffix(nino).value)), equal("active", true) ) ) @@ -186,7 +186,7 @@ with RequestAwareLogging { .updateOne( and( equal("service", serviceId), - equal("nino", nino.value.map(encryptedString)), + equal("nino", encryptedString(nino.value)), equal("arn", arn.value), equal("active", true) ), @@ -206,7 +206,7 @@ with RequestAwareLogging { .deleteOne( and( equal("service", serviceId), - equal("nino", nino.value.map(encryptedString)), + equal("nino", encryptedString(nino.value)), equal("arn", arn.value), equal("active", true) ) From 01776cbf3e20d16fc65ac3023e13dd866aa3adc2 Mon Sep 17 00:00:00 2001 From: Drew Miley Date: Wed, 18 Feb 2026 14:32:00 +0000 Subject: [PATCH 07/10] APB-10281: Renames helper function to getValidNinoWithoutSuffixOrClientId --- .../repository/InvitationsRepository.scala | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/app/uk/gov/hmrc/agentclientrelationships/repository/InvitationsRepository.scala b/app/uk/gov/hmrc/agentclientrelationships/repository/InvitationsRepository.scala index 337fbe4d..4abd074b 100644 --- a/app/uk/gov/hmrc/agentclientrelationships/repository/InvitationsRepository.scala +++ b/app/uk/gov/hmrc/agentclientrelationships/repository/InvitationsRepository.scala @@ -220,7 +220,7 @@ with RequestAwareLogging { suppliedClientIdKey else clientIdKey - Some(in(key, clientIds.flatMap(expandNinoSuffixes).map(encryptedString): _*)) + Some(in(key, clientIds.map(getValidNinoWithoutSuffixOrClientId).map(encryptedString): _*)) } else None, @@ -265,7 +265,7 @@ with RequestAwareLogging { suppliedClientIdKey else clientIdKey, - clientIds.map(_.replaceAll(" ", "")).flatMap(expandNinoSuffixes).map(encryptedString): _* + clientIds.map(_.replaceAll(" ", "")).map(getValidNinoWithoutSuffixOrClientId).map(encryptedString): _* ) ) ) @@ -306,8 +306,8 @@ with RequestAwareLogging { )), Some(equal(serviceKey, service)), Some(or( - in(suppliedClientIdKey, expandNinoSuffixes(clientId).map(encryptedString): _*), - in(clientIdKey, expandNinoSuffixes(clientId).map(encryptedString): _*) // Some deauth requests target the MTDITID for ITSA + equal(suppliedClientIdKey, encryptedString(getValidNinoWithoutSuffixOrClientId(clientId))), + equal(clientIdKey, encryptedString(getValidNinoWithoutSuffixOrClientId(clientId))) // Some deauth requests target the MTDITID for ITSA )), optArn.map(a => equal(arnKey, a)), invitationIdToIgnore @@ -335,7 +335,7 @@ with RequestAwareLogging { .updateOne( and( equal(arnKey, arn.value), - in(clientIdKey, expandNinoSuffixes(nino.value).map(encryptedString): _*), + equal(clientIdKey, encryptedString(nino.value)), equal(serviceKey, service), equal(statusKey, Codecs.toBson[InvitationStatus](PartialAuth)) ), @@ -484,11 +484,10 @@ with RequestAwareLogging { .map(_.getModifiedCount == 1L) } -// TODO: Can we now make this return a String rather than Seq[String] - private def expandNinoSuffixes(clientId: String): Seq[String] = { + private def getValidNinoWithoutSuffixOrClientId(clientId: String): String = { clientId match { - case nino if NinoWithoutSuffix.isValid(nino) => Seq(NinoWithoutSuffix(nino).value) - case clientId => Seq(clientId) + case nino if NinoWithoutSuffix.isValid(nino) => NinoWithoutSuffix(nino).value + case clientId => clientId } } From e3b02dd36595c55f5d2ccc360e622d0c0a50b75b Mon Sep 17 00:00:00 2001 From: Drew Miley Date: Wed, 18 Feb 2026 14:47:44 +0000 Subject: [PATCH 08/10] APB-10281: Adds TODOs for specific failing ITs in PartialAuthRepositoryISpec --- .../repository/PartialAuthRepositoryISpec.scala | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/it/test/uk/gov/hmrc/agentclientrelationships/repository/PartialAuthRepositoryISpec.scala b/it/test/uk/gov/hmrc/agentclientrelationships/repository/PartialAuthRepositoryISpec.scala index 2248f5e3..2496df52 100644 --- a/it/test/uk/gov/hmrc/agentclientrelationships/repository/PartialAuthRepositoryISpec.scala +++ b/it/test/uk/gov/hmrc/agentclientrelationships/repository/PartialAuthRepositoryISpec.scala @@ -113,6 +113,7 @@ with RepositoryCleanupSupport { ) } +// TODO: FIX "throw an exception if duplicate active record is passed in" in { repository.create( Instant.parse("2020-01-01T00:00:00.000Z"), @@ -147,7 +148,7 @@ with RepositoryCleanupSupport { } "partialAuthRepository.findActive" should { - +// TODO: FIX "retrieve partial auth which matches service, nino and arn" in { val nonMatchingEvent1 = partialAuth.copy(arn = "ARN1234567") val nonMatchingEvent2 = partialAuth.copy(service = "HMRC-MTD-IT-SUPP", nino = "AB539803A") @@ -204,7 +205,7 @@ with RepositoryCleanupSupport { } ".findByNino" should { - +// TODO: FIX "retrieves records for a given nino" in { await(repository.collection.insertOne(partialAuth).toFuture()) await(repository.findAllForClient(NinoWithoutSuffix("SX579189D"))) shouldBe Seq(partialAuth) @@ -263,6 +264,7 @@ with RepositoryCleanupSupport { } "deleteActivePartialAuth" should { +// TODO: FIX "delete when active record exists" in { await(repository.collection.insertOne(partialAuth).toFuture()) From ac92293bce418dade0999dca4cf5c64a0168599f Mon Sep 17 00:00:00 2001 From: Drew Miley Date: Wed, 18 Feb 2026 14:58:25 +0000 Subject: [PATCH 09/10] APB-10281: Removes suffix from Nino in PartialAuthRepositoryISpec --- .../PartialAuthRepositoryISpec.scala | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/it/test/uk/gov/hmrc/agentclientrelationships/repository/PartialAuthRepositoryISpec.scala b/it/test/uk/gov/hmrc/agentclientrelationships/repository/PartialAuthRepositoryISpec.scala index 2496df52..ab3ae0ef 100644 --- a/it/test/uk/gov/hmrc/agentclientrelationships/repository/PartialAuthRepositoryISpec.scala +++ b/it/test/uk/gov/hmrc/agentclientrelationships/repository/PartialAuthRepositoryISpec.scala @@ -52,7 +52,7 @@ with RepositoryCleanupSupport { Instant.parse("2020-02-02T00:00:00.000Z"), "XARN1234567", "HMRC-MTD-IT", - "SX579189D", + "SX579189", active = true, Instant.parse("2020-02-02T00:00:00.000Z") ) @@ -119,7 +119,7 @@ with RepositoryCleanupSupport { Instant.parse("2020-01-01T00:00:00.000Z"), Arn("XARN1234567"), "HMRC-MTD-IT", - NinoWithoutSuffix("SX579189D") + NinoWithoutSuffix("SX579189") ).futureValue intercept[RuntimeException]( @@ -128,7 +128,7 @@ with RepositoryCleanupSupport { Instant.parse("2020-01-01T00:00:00.000Z"), Arn("XARN1234567"), "HMRC-MTD-IT", - NinoWithoutSuffix("SX579189D") + NinoWithoutSuffix("SX579189") )) ) } @@ -141,7 +141,7 @@ with RepositoryCleanupSupport { Instant.parse("2020-01-01T00:00:00.000Z"), Arn("XARN1234567"), "HMRC-MTD-IT", - NinoWithoutSuffix("SX579189D") + NinoWithoutSuffix("SX579189") )) ) } @@ -161,7 +161,7 @@ with RepositoryCleanupSupport { await( repository.findActive( "HMRC-MTD-IT", - NinoWithoutSuffix("SX579189D"), + NinoWithoutSuffix("SX579189"), Arn("XARN1234567") ) ) shouldBe Some(partialAuth) @@ -173,7 +173,7 @@ with RepositoryCleanupSupport { await( repository.findActive( "HMRC-MTD-IT", - NinoWithoutSuffix("SX579189D"), + NinoWithoutSuffix("SX579189"), Arn("XARN1234567") ) ) shouldBe None @@ -185,7 +185,7 @@ with RepositoryCleanupSupport { await( repository.findActive( "HMRC-MTD-IT", - NinoWithoutSuffix("SX579189D"), + NinoWithoutSuffix("SX579189"), Arn("XARN1234567") ) ) shouldBe None @@ -197,7 +197,7 @@ with RepositoryCleanupSupport { await( repository.findActive( "HMRC-MTD-IT", - NinoWithoutSuffix("SX579189D"), + NinoWithoutSuffix("SX579189"), Arn("XARN1234567") ) ) shouldBe None @@ -208,7 +208,7 @@ with RepositoryCleanupSupport { // TODO: FIX "retrieves records for a given nino" in { await(repository.collection.insertOne(partialAuth).toFuture()) - await(repository.findAllForClient(NinoWithoutSuffix("SX579189D"))) shouldBe Seq(partialAuth) + await(repository.findAllForClient(NinoWithoutSuffix("SX579189"))) shouldBe Seq(partialAuth) } "fail to retrieve records when none are found for the given nino" in { @@ -224,7 +224,7 @@ with RepositoryCleanupSupport { Instant.parse("2020-01-01T00:00:00.000Z"), Arn("XARN1234567"), "HMRC-MTD-IT", - NinoWithoutSuffix("SX579189D") + NinoWithoutSuffix("SX579189") ) ) await(repository.collection.countDocuments().toFuture()) shouldBe 1 @@ -232,7 +232,7 @@ with RepositoryCleanupSupport { repository .deauthorise( "HMRC-MTD-IT", - NinoWithoutSuffix("SX579189D"), + NinoWithoutSuffix("SX579189"), Arn("XARN1234567"), Instant.parse("2020-01-01T00:00:00.000Z") ) @@ -240,7 +240,7 @@ with RepositoryCleanupSupport { val result = await( repository.findActive( "HMRC-MTD-IT", - NinoWithoutSuffix("SX579189D"), + NinoWithoutSuffix("SX579189"), Arn("XARN1234567") ) ) @@ -254,7 +254,7 @@ with RepositoryCleanupSupport { repository .deauthorise( "HMRC-MTD-VAT", - NinoWithoutSuffix("SX579189D"), + NinoWithoutSuffix("SX579189"), Arn("XARN1234567"), Instant.parse("2020-01-01T00:00:00.000Z") ) @@ -271,7 +271,7 @@ with RepositoryCleanupSupport { val result = await( repository.deleteActivePartialAuth( "HMRC-MTD-IT", - NinoWithoutSuffix("SX579189D"), + NinoWithoutSuffix("SX579189"), Arn("XARN1234567") ) ) From a2c6020725093b2c021dc403b97fc98072d90d1b Mon Sep 17 00:00:00 2001 From: Drew Miley Date: Fri, 20 Feb 2026 10:24:18 +0000 Subject: [PATCH 10/10] APB-10281: Removes variations from NinoWithoutSuffix --- .../model/identifiers/NinoWithoutSuffix.scala | 2 -- .../repository/PartialAuthRepositoryISpec.scala | 7 +++---- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/app/uk/gov/hmrc/agentclientrelationships/model/identifiers/NinoWithoutSuffix.scala b/app/uk/gov/hmrc/agentclientrelationships/model/identifiers/NinoWithoutSuffix.scala index c309a953..7893901b 100644 --- a/app/uk/gov/hmrc/agentclientrelationships/model/identifiers/NinoWithoutSuffix.scala +++ b/app/uk/gov/hmrc/agentclientrelationships/model/identifiers/NinoWithoutSuffix.scala @@ -54,8 +54,6 @@ with SimpleName { case _ => false } -// def variations: Seq[String] = value +: Nino.validSuffixes.map(value + _) - } object NinoWithoutSuffix diff --git a/it/test/uk/gov/hmrc/agentclientrelationships/repository/PartialAuthRepositoryISpec.scala b/it/test/uk/gov/hmrc/agentclientrelationships/repository/PartialAuthRepositoryISpec.scala index ab3ae0ef..075ad6db 100644 --- a/it/test/uk/gov/hmrc/agentclientrelationships/repository/PartialAuthRepositoryISpec.scala +++ b/it/test/uk/gov/hmrc/agentclientrelationships/repository/PartialAuthRepositoryISpec.scala @@ -113,7 +113,6 @@ with RepositoryCleanupSupport { ) } -// TODO: FIX "throw an exception if duplicate active record is passed in" in { repository.create( Instant.parse("2020-01-01T00:00:00.000Z"), @@ -148,7 +147,7 @@ with RepositoryCleanupSupport { } "partialAuthRepository.findActive" should { -// TODO: FIX + "retrieve partial auth which matches service, nino and arn" in { val nonMatchingEvent1 = partialAuth.copy(arn = "ARN1234567") val nonMatchingEvent2 = partialAuth.copy(service = "HMRC-MTD-IT-SUPP", nino = "AB539803A") @@ -205,7 +204,7 @@ with RepositoryCleanupSupport { } ".findByNino" should { -// TODO: FIX + "retrieves records for a given nino" in { await(repository.collection.insertOne(partialAuth).toFuture()) await(repository.findAllForClient(NinoWithoutSuffix("SX579189"))) shouldBe Seq(partialAuth) @@ -264,7 +263,7 @@ with RepositoryCleanupSupport { } "deleteActivePartialAuth" should { -// TODO: FIX + "delete when active record exists" in { await(repository.collection.insertOne(partialAuth).toFuture())