diff --git a/app/uk/gov/hmrc/agentclientrelationships/config/AppConfig.scala b/app/uk/gov/hmrc/agentclientrelationships/config/AppConfig.scala index d9edf6f5..94a61864 100644 --- a/app/uk/gov/hmrc/agentclientrelationships/config/AppConfig.scala +++ b/app/uk/gov/hmrc/agentclientrelationships/config/AppConfig.scala @@ -114,10 +114,9 @@ class AppConfig @Inject() (config: Configuration, servicesConfig: ServicesConfig val altItsaEnabled = servicesConfig.getBoolean("alt-itsa.enabled") - // Note: Personal Income Record is not handled through agent-client-relationships + // Note: Personal Income Record is not handled through agent-client-relationships for many of the endpoints + val supportedServicesWithoutPir: Seq[Service] = Service.supportedServices.filterNot(_ == Service.PersonalIncomeRecord) val supportedServices: Seq[Service] = Service.supportedServices - // TODO: Keeping this list in appConfig to enable reading it from config in future if necessary - // If this is not needed, could be moved somewhere else where constants are kept val internalHostPatterns: Seq[Regex] = config.get[Seq[String]]("internalServiceHostPatterns").map(_.r) diff --git a/app/uk/gov/hmrc/agentclientrelationships/controllers/AgentDetailsController.scala b/app/uk/gov/hmrc/agentclientrelationships/controllers/AgentDetailsController.scala index aca5ae9c..4b54c22e 100644 --- a/app/uk/gov/hmrc/agentclientrelationships/controllers/AgentDetailsController.scala +++ b/app/uk/gov/hmrc/agentclientrelationships/controllers/AgentDetailsController.scala @@ -39,7 +39,7 @@ class AgentDetailsController @Inject() ( extends BackendController(cc) with AuthActions { - val supportedServices: Seq[Service] = appConfig.supportedServices + val supportedServices: Seq[Service] = appConfig.supportedServicesWithoutPir def getAgentDetails(arn: Arn): Action[AnyContent] = Action.async { implicit request => withAuthorisedAsAgent { _ => diff --git a/app/uk/gov/hmrc/agentclientrelationships/controllers/AuthorisationRequestInfoController.scala b/app/uk/gov/hmrc/agentclientrelationships/controllers/AuthorisationRequestInfoController.scala index d2a45dc3..f75e41ba 100644 --- a/app/uk/gov/hmrc/agentclientrelationships/controllers/AuthorisationRequestInfoController.scala +++ b/app/uk/gov/hmrc/agentclientrelationships/controllers/AuthorisationRequestInfoController.scala @@ -42,7 +42,7 @@ class AuthorisationRequestInfoController @Inject() ( extends BackendController(cc) with AuthActions { - val supportedServices: Seq[Service] = appConfig.supportedServices + val supportedServices: Seq[Service] = appConfig.supportedServicesWithoutPir def get(arn: Arn, invitationId: String): Action[AnyContent] = Action.async { implicit request => withAuthorisedAsAgent { _ => diff --git a/app/uk/gov/hmrc/agentclientrelationships/controllers/ClientDetailsController.scala b/app/uk/gov/hmrc/agentclientrelationships/controllers/ClientDetailsController.scala index c4ba9d50..09c16e89 100644 --- a/app/uk/gov/hmrc/agentclientrelationships/controllers/ClientDetailsController.scala +++ b/app/uk/gov/hmrc/agentclientrelationships/controllers/ClientDetailsController.scala @@ -45,7 +45,7 @@ class ClientDetailsController @Inject() ( extends BackendController(cc) with AuthActions { - val supportedServices: Seq[Service] = appConfig.supportedServices + val supportedServices: Seq[Service] = appConfig.supportedServicesWithoutPir private def expectedResults(results: Seq[Result]): Boolean = results.forall(result => result.header.status == 200 | result.header.status == 404) diff --git a/app/uk/gov/hmrc/agentclientrelationships/controllers/InvitationController.scala b/app/uk/gov/hmrc/agentclientrelationships/controllers/InvitationController.scala index eccce535..12a568c4 100644 --- a/app/uk/gov/hmrc/agentclientrelationships/controllers/InvitationController.scala +++ b/app/uk/gov/hmrc/agentclientrelationships/controllers/InvitationController.scala @@ -41,7 +41,7 @@ class InvitationController @Inject() ( extends BackendController(cc) with AuthActions { - val supportedServices: Seq[Service] = appConfig.supportedServices + val supportedServices: Seq[Service] = appConfig.supportedServicesWithoutPir def createInvitation(arn: Arn): Action[JsValue] = Action.async(parse.json) { implicit request => request.body diff --git a/app/uk/gov/hmrc/agentclientrelationships/controllers/InvitationLinkController.scala b/app/uk/gov/hmrc/agentclientrelationships/controllers/InvitationLinkController.scala index 60080c3c..9c20687a 100644 --- a/app/uk/gov/hmrc/agentclientrelationships/controllers/InvitationLinkController.scala +++ b/app/uk/gov/hmrc/agentclientrelationships/controllers/InvitationLinkController.scala @@ -45,7 +45,7 @@ class InvitationLinkController @Inject() ( extends BackendController(cc) with AuthActions { - val supportedServices: Seq[Service] = appConfig.supportedServices + val supportedServices: Seq[Service] = appConfig.supportedServicesWithoutPir def validateLink(uid: String, normalizedAgentName: String): Action[AnyContent] = Action.async { implicit request => agentReferenceService.validateLink(uid, normalizedAgentName).map { response => diff --git a/app/uk/gov/hmrc/agentclientrelationships/controllers/RelationshipsController.scala b/app/uk/gov/hmrc/agentclientrelationships/controllers/RelationshipsController.scala index 356c1483..253c586f 100644 --- a/app/uk/gov/hmrc/agentclientrelationships/controllers/RelationshipsController.scala +++ b/app/uk/gov/hmrc/agentclientrelationships/controllers/RelationshipsController.scala @@ -60,7 +60,7 @@ class RelationshipsController @Inject() ( private val strideRoles = Seq(appConfig.oldAuthStrideRole, appConfig.newAuthStrideRole) - val supportedServices: Seq[Service] = appConfig.supportedServices + val supportedServices: Seq[Service] = appConfig.supportedServicesWithoutPir def checkForRelationship( arn: Arn, diff --git a/app/uk/gov/hmrc/agentclientrelationships/controllers/RemoveAuthorisationController.scala b/app/uk/gov/hmrc/agentclientrelationships/controllers/RemoveAuthorisationController.scala index fa86c74e..3dce0ee4 100644 --- a/app/uk/gov/hmrc/agentclientrelationships/controllers/RemoveAuthorisationController.scala +++ b/app/uk/gov/hmrc/agentclientrelationships/controllers/RemoveAuthorisationController.scala @@ -49,7 +49,7 @@ class RemoveAuthorisationController @Inject() ( extends BackendController(cc) with AuthActions { - val supportedServices: Seq[Service] = appConfig.supportedServices + val supportedServices: Seq[Service] = appConfig.supportedServicesWithoutPir def removeAuthorisation(arn: Arn): Action[JsValue] = Action.async(parse.json) { implicit request => request.body diff --git a/app/uk/gov/hmrc/agentclientrelationships/services/DeleteRelationshipsService.scala b/app/uk/gov/hmrc/agentclientrelationships/services/DeleteRelationshipsService.scala index e093e3fa..4c8e7ee3 100644 --- a/app/uk/gov/hmrc/agentclientrelationships/services/DeleteRelationshipsService.scala +++ b/app/uk/gov/hmrc/agentclientrelationships/services/DeleteRelationshipsService.scala @@ -369,7 +369,7 @@ private[services] abstract class DeleteRelationshipsService( (for { clientIdTypeStr <- deleteRecord.clientIdentifierType clientIdStr <- deleteRecord.clientIdentifier - service <- appConfig.supportedServices.find(_.supportedClientIdType.enrolmentId == clientIdTypeStr) + service <- appConfig.supportedServicesWithoutPir.find(_.supportedClientIdType.enrolmentId == clientIdTypeStr) } yield EnrolmentKey( service.id, Seq(Identifier(clientIdTypeStr, clientIdStr)) diff --git a/app/uk/gov/hmrc/agentclientrelationships/services/FindRelationshipsService.scala b/app/uk/gov/hmrc/agentclientrelationships/services/FindRelationshipsService.scala index bc21a8c5..cebd1c64 100644 --- a/app/uk/gov/hmrc/agentclientrelationships/services/FindRelationshipsService.scala +++ b/app/uk/gov/hmrc/agentclientrelationships/services/FindRelationshipsService.scala @@ -52,7 +52,7 @@ class FindRelationshipsService @Inject() ( )(implicit hc: HeaderCarrier, ec: ExecutionContext): Future[Option[ActiveRelationship]] = // If the tax id type is among one of the supported ones... if ( - appConfig.supportedServices + appConfig.supportedServicesWithoutPir .map(_.supportedClientIdType.enrolmentId) .contains(ClientIdentifier(taxIdentifier).enrolmentId) ) @@ -71,7 +71,7 @@ class FindRelationshipsService @Inject() ( identifiers: Map[Service, TaxIdentifier] )(implicit hc: HeaderCarrier, ec: ExecutionContext): Future[Map[Service, Seq[Arn]]] = Future - .traverse(appConfig.supportedServices) { service => + .traverse(appConfig.supportedServicesWithoutPir) { service => identifiers.get(service).map(eiv => service.supportedClientIdType.createUnderlying(eiv.value)) match { case Some(taxId) => getActiveRelationshipsForClient(taxId).map(_.map(r => (service, r.arn))) @@ -84,7 +84,7 @@ class FindRelationshipsService @Inject() ( identifiers: Map[Service, TaxIdentifier] )(implicit hc: HeaderCarrier, ec: ExecutionContext): Future[Seq[InactiveRelationship]] = Future - .traverse(appConfig.supportedServices) { service => + .traverse(appConfig.supportedServicesWithoutPir) { service => identifiers.get(service) match { case Some(taxId) => getInactiveRelationshipsForClient(taxId) case None => Future.successful(Seq.empty) @@ -97,7 +97,7 @@ class FindRelationshipsService @Inject() ( )(implicit hc: HeaderCarrier, ec: ExecutionContext): Future[Seq[InactiveRelationship]] = // if it is one of the tax ids that we support... if ( - appConfig.supportedServices.exists( + appConfig.supportedServicesWithoutPir.exists( _.supportedClientIdType.enrolmentId == ClientIdentifier(taxIdentifier).enrolmentId ) ) { diff --git a/app/uk/gov/hmrc/agentclientrelationships/services/ValidationService.scala b/app/uk/gov/hmrc/agentclientrelationships/services/ValidationService.scala index 874fc3a8..9369f858 100644 --- a/app/uk/gov/hmrc/agentclientrelationships/services/ValidationService.scala +++ b/app/uk/gov/hmrc/agentclientrelationships/services/ValidationService.scala @@ -51,7 +51,7 @@ class ValidationService @Inject() ( makeSanitisedCbcEnrolmentKey(CbcId(clientId)) // "normal" cases case (serviceKey, _) => - if (appConfig.supportedServices.exists(_.id == serviceKey)) + if (appConfig.supportedServicesWithoutPir.exists(_.id == serviceKey)) validateSupportedServiceForEnrolmentKey(serviceKey, clientType, clientId) else Future.successful(Left(s"Unknown service $serviceKey"))