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

Pods 9662 simpler opt srn #1260

Open
wants to merge 28 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
6cb566a
PODS-9662 simple change of making srn
srinivasulumunagalahmrc Sep 9, 2024
4beec5c
PODS-9662 simple change of making srn
srinivasulumunagalahmrc Sep 9, 2024
6045a35
PODS-9662 simple change of making srn
srinivasulumunagalahmrc Sep 10, 2024
969512d
PODS-9662 simple change of making srn
srinivasulumunagalahmrc Sep 11, 2024
6fd79cd
Revert "PODS-9662 simple change of making srn"
srinivasulumunagalahmrc Sep 11, 2024
f7dcbf7
PODS-9662 simple change of making srn
srinivasulumunagalahmrc Sep 11, 2024
9b35b44
PODS-9662 simple change of making srn
srinivasulumunagalahmrc Sep 11, 2024
8730704
Revert "PODS-9662 simple change of making srn"
srinivasulumunagalahmrc Sep 13, 2024
5f0e414
PODS-9662 simple change of making srn work
srinivasulumunagalahmrc Sep 13, 2024
c15d995
PODS-9662 simple change of making srn work
srinivasulumunagalahmrc Sep 13, 2024
0743535
PODS-9662 simple change of making srn work
srinivasulumunagalahmrc Sep 13, 2024
1e894a5
PODS-9662 simple change of making srn work
srinivasulumunagalahmrc Sep 15, 2024
eaedb24
PODS-9662 simple change of making srn work
srinivasulumunagalahmrc Sep 17, 2024
d3112b2
PODS-9662 simple change of making srn work
srinivasulumunagalahmrc Sep 17, 2024
01680a9
PODS-9662 simple change of making srn work
srinivasulumunagalahmrc Sep 17, 2024
a507e90
PODS-9662 simple change of making srn work
srinivasulumunagalahmrc Sep 17, 2024
94bdab4
PODS-9662 simple change of making srn work
srinivasulumunagalahmrc Sep 17, 2024
338111d
Revert "PODS-9662 simple change of making srn work"
srinivasulumunagalahmrc Sep 18, 2024
67f7f1f
PODS-9662 simple change of making srn work
srinivasulumunagalahmrc Sep 18, 2024
e0406c3
PODS-9662 simple change of making srn work
srinivasulumunagalahmrc Sep 18, 2024
6b7a016
Merge remote-tracking branch 'origin/main' into PODS-9662-simpler
srinivasulumunagalahmrc Sep 25, 2024
01b3471
PODS-9662 merge from main
srinivasulumunagalahmrc Sep 25, 2024
9a46e39
Added OptionalSchemeReferenceNumber case class
PavelVjalicin Oct 31, 2024
bb91eed
PODS-9662 fixed many compilation issues
srinivasulumunagalahmrc Nov 12, 2024
6a20488
PODS-9662 fixed many compilation issues in src
srinivasulumunagalahmrc Nov 12, 2024
488c917
PODS-9662 fixed some tests
srinivasulumunagalahmrc Nov 12, 2024
a877e96
PODS-9662 merge from main
srinivasulumunagalahmrc Nov 14, 2024
ac2dfee
PODS-9662 merge from main
srinivasulumunagalahmrc Nov 14, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
25 changes: 13 additions & 12 deletions app/connectors/PensionSchemeVarianceLockConnector.scala
Original file line number Diff line number Diff line change
Expand Up @@ -29,23 +29,24 @@ import uk.gov.hmrc.http.HttpClient

import scala.concurrent.{ExecutionContext, Future}
import scala.util.{Failure, Try}
import models.SchemeReferenceNumber

@ImplementedBy(classOf[PensionSchemeVarianceLockConnectorImpl])
trait PensionSchemeVarianceLockConnector {

def lock(psaId: String, srn: String)
def lock(psaId: String, srn: SchemeReferenceNumber)
(implicit hc: HeaderCarrier, ec: ExecutionContext): Future[Lock]

def getLock(psaId: String, srn: String)
def getLock(psaId: String, srn: SchemeReferenceNumber)
(implicit hc: HeaderCarrier, ec: ExecutionContext): Future[Option[SchemeVariance]]

def getLockByPsa(psaId: String)
(implicit hc: HeaderCarrier, ec: ExecutionContext): Future[Option[SchemeVariance]]

def isLockByPsaIdOrSchemeId(psaId: String, srn: String)
def isLockByPsaIdOrSchemeId(psaId: String, srn: SchemeReferenceNumber)
(implicit hc: HeaderCarrier, ec: ExecutionContext): Future[Option[Lock]]

def releaseLock(psaId: String, srn: String)
def releaseLock(psaId: String, srn: SchemeReferenceNumber)
(implicit hc: HeaderCarrier, ec: ExecutionContext): Future[Unit]

}
Expand All @@ -56,10 +57,10 @@ class PensionSchemeVarianceLockConnectorImpl @Inject()(http: HttpClient, config:

private val logger = Logger(classOf[PensionSchemeVarianceLockConnectorImpl])

override def lock(psaId: String, srn: String)
override def lock(psaId: String, srn: SchemeReferenceNumber)
(implicit hc: HeaderCarrier, ec: ExecutionContext): Future[Lock] = {

implicit val headerCarrier: HeaderCarrier = hc.withExtraHeaders("psaId" -> psaId, "srn" -> srn)
implicit val headerCarrier: HeaderCarrier = hc.withExtraHeaders("psaId" -> psaId, "srn" -> srn.id)

val url = s"${config.updateSchemeDetailsUrl}/lock"

Expand All @@ -77,10 +78,10 @@ class PensionSchemeVarianceLockConnectorImpl @Inject()(http: HttpClient, config:
} andThen logExceptions("Unable to get the lock")
}

override def getLock(psaId: String, srn: String)
override def getLock(psaId: String, srn: SchemeReferenceNumber)
(implicit hc: HeaderCarrier, ec: ExecutionContext): Future[Option[SchemeVariance]] = {

implicit val headerCarrier: HeaderCarrier = hc.withExtraHeaders("psaId" -> psaId, "srn" -> srn)
implicit val headerCarrier: HeaderCarrier = hc.withExtraHeaders("psaId" -> psaId, "srn" -> srn.id)

val url = s"${config.updateSchemeDetailsUrl}/getLock"

Expand Down Expand Up @@ -124,10 +125,10 @@ class PensionSchemeVarianceLockConnectorImpl @Inject()(http: HttpClient, config:
}


override def isLockByPsaIdOrSchemeId(psaId: String, srn: String)
override def isLockByPsaIdOrSchemeId(psaId: String, srn: SchemeReferenceNumber)
(implicit hc: HeaderCarrier, ec: ExecutionContext): Future[Option[Lock]] = {

implicit val headerCarrier: HeaderCarrier = hc.withExtraHeaders("psaId" -> psaId, "srn" -> srn)
implicit val headerCarrier: HeaderCarrier = hc.withExtraHeaders("psaId" -> psaId, "srn" -> srn.id)

val url = s"${config.updateSchemeDetailsUrl}/isLockByPsaOrScheme"

Expand All @@ -151,10 +152,10 @@ class PensionSchemeVarianceLockConnectorImpl @Inject()(http: HttpClient, config:
case Failure(t: Throwable) => logger.error(msg, t)
}

override def releaseLock(psaId: String, srn: String)
override def releaseLock(psaId: String, srn: SchemeReferenceNumber)
(implicit hc: HeaderCarrier, ec: ExecutionContext): Future[Unit] = {

implicit val headerCarrier: HeaderCarrier = hc.withExtraHeaders("psaId" -> psaId, "srn" -> srn)
implicit val headerCarrier: HeaderCarrier = hc.withExtraHeaders("psaId" -> psaId, "srn" -> srn.id)

val url = s"${config.updateSchemeDetailsUrl}/release-lock"

Expand Down
7 changes: 4 additions & 3 deletions app/connectors/PensionsSchemeConnector.scala
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import uk.gov.hmrc.http.{HttpClient, HttpResponse, HeaderCarrier}
import utils.{UserAnswers, HttpResponseHelper}

import scala.concurrent.{ExecutionContext, Future}
import models.SchemeReferenceNumber

@ImplementedBy(classOf[PensionsSchemeConnectorImpl])
trait PensionsSchemeConnector {
Expand All @@ -39,7 +40,7 @@ trait PensionsSchemeConnector {
def updateSchemeDetails(psaId: String, pstr: String, answers: UserAnswers)
(implicit hc: HeaderCarrier, ec: ExecutionContext): Future[Unit]

def checkForAssociation(userId: String, srn: String, isPsa: Boolean = true)
def checkForAssociation(userId: String, srn: SchemeReferenceNumber, isPsa: Boolean = true)
(implicit headerCarrier: HeaderCarrier,
ec: ExecutionContext, request: RequestHeader): Future[Either[HttpResponse, Boolean]]
}
Expand Down Expand Up @@ -84,11 +85,11 @@ class PensionsSchemeConnectorImpl @Inject()(http: HttpClient, config: FrontendAp
}
}

def checkForAssociation(userId: String, srn: String, isPsa: Boolean)
def checkForAssociation(userId: String, srn: SchemeReferenceNumber, isPsa: Boolean)
(implicit headerCarrier: HeaderCarrier,
ec: ExecutionContext, request: RequestHeader): Future[Either[HttpResponse, Boolean]] = {
val headers: Seq[(String, String)] =
Seq((if(isPsa) "psaId" else "pspId", userId), ("schemeReferenceNumber", srn), ("Content-Type", "application/json"))
Seq((if(isPsa) "psaId" else "pspId", userId), ("schemeReferenceNumber", srn.id), ("Content-Type", "application/json"))

implicit val hc: HeaderCarrier = headerCarrier.withExtraHeaders(headers: _*)

Expand Down
7 changes: 4 additions & 3 deletions app/connectors/SchemeDetailsConnector.scala
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,14 @@ import utils.{HttpResponseHelper, UserAnswers}

import scala.concurrent.{ExecutionContext, Future}
import scala.util.Failure
import models.SchemeReferenceNumber

@ImplementedBy(classOf[SchemeDetailsConnectorImpl])
trait SchemeDetailsConnector {
def getSchemeDetails(psaId: String, schemeIdType: String, idNumber: String, refreshData: Option[Boolean] = None)
(implicit hc: HeaderCarrier, ec: ExecutionContext): Future[UserAnswers]

def getPspSchemeDetails(pspId: String, srn: String, refreshData: Option[Boolean] = None)
def getPspSchemeDetails(pspId: String, srn: SchemeReferenceNumber, refreshData: Option[Boolean] = None)
(implicit hc: HeaderCarrier, ec: ExecutionContext): Future[UserAnswers]
}

Expand Down Expand Up @@ -65,11 +66,11 @@ class SchemeDetailsConnectorImpl @Inject()(http: HttpClient, config: FrontendApp
}
}

override def getPspSchemeDetails(pspId: String, srn: String, refreshData: Option[Boolean])
override def getPspSchemeDetails(pspId: String, srn: SchemeReferenceNumber, refreshData: Option[Boolean])
(implicit hc: HeaderCarrier, ec: ExecutionContext): Future[UserAnswers] = {

val url = config.pspSchemeDetailsUrl
val schemeHc = hc.withExtraHeaders("srn" -> srn,
val schemeHc = hc.withExtraHeaders("srn" -> srn.id,
"pspId" -> pspId,
"refreshData" -> refreshData.map(_.toString).getOrElse("false"))

Expand Down
7 changes: 4 additions & 3 deletions app/controllers/AdviserCheckYourAnswersController.scala
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ import config.FrontendAppConfig
import connectors._
import controllers.actions._
import identifiers._

import javax.inject.Inject
import models.{CheckMode, NormalMode}
import models.{CheckMode, EmptyOptionalSchemeReferenceNumber, NormalMode}
import navigators.Navigator
import play.api.i18n.{I18nSupport, MessagesApi}
import play.api.mvc.{Action, AnyContent, MessagesControllerComponents}
Expand Down Expand Up @@ -60,11 +61,11 @@ class AdviserCheckYourAnswersController @Inject()(appConfig: FrontendAppConfig,
}
val vm = CYAViewModel(
answerSections = seqAnswerSection,
href = controllers.routes.PsaSchemeTaskListController.onPageLoad(NormalMode, None),
href = controllers.routes.PsaSchemeTaskListController.onPageLoad(NormalMode, EmptyOptionalSchemeReferenceNumber),
schemeName = existingSchemeName,
returnOverview = false,
hideEditLinks = request.viewOnly,
srn = None,
srn = EmptyOptionalSchemeReferenceNumber,
hideSaveAndContinueButton = request.viewOnly,
title = Message("checkYourAnswers.hs.title"),
h1 = Message("checkYourAnswers.hs.title")
Expand Down
8 changes: 4 additions & 4 deletions app/controllers/AnyMoreChangesController.scala
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ package controllers

import java.time.LocalDate
import java.time.format.DateTimeFormatter

import config.FrontendAppConfig
import controllers.actions._
import forms.AnyMoreChangesFormProvider
import identifiers.AnyMoreChangesId

import javax.inject.Inject
import models.UpdateMode
import models.{OptionalSchemeReferenceNumber, SchemeReferenceNumber, UpdateMode}
import navigators.Navigator
import play.api.data.Form
import play.api.i18n.{I18nSupport, MessagesApi}
Expand All @@ -51,13 +51,13 @@ class AnyMoreChangesController @Inject()(appConfig: FrontendAppConfig,
private val form: Form[Boolean] = formProvider()
private val postCall = controllers.routes.AnyMoreChangesController.onSubmit _

def onPageLoad(srn: Option[String]): Action[AnyContent] = (authenticate() andThen getData(UpdateMode, srn) andThen
def onPageLoad(srn: OptionalSchemeReferenceNumber): Action[AnyContent] = (authenticate() andThen getData(UpdateMode, srn) andThen
allowAccess(srn) andThen requireData).async {
implicit request =>
Future.successful(Ok(view(form, existingSchemeName, dateToCompleteDeclaration, postCall(srn), srn)))
}

def onSubmit(srn: Option[String]): Action[AnyContent] = (authenticate() andThen getData(UpdateMode, srn) andThen
def onSubmit(srn: OptionalSchemeReferenceNumber): Action[AnyContent] = (authenticate() andThen getData(UpdateMode, srn) andThen
requireData).async {
implicit request =>
form.bindFromRequest().fold(
Expand Down
4 changes: 3 additions & 1 deletion app/controllers/BeforeYouStartController.scala
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ package controllers

import connectors.PensionAdministratorConnector
import controllers.actions._
import models.EmptyOptionalSchemeReferenceNumber

import javax.inject.Inject
import play.api.i18n.{I18nSupport, MessagesApi}
import play.api.mvc.{Action, AnyContent, MessagesControllerComponents}
Expand All @@ -36,7 +38,7 @@ class BeforeYouStartController @Inject()(override val messagesApi: MessagesApi,
)(implicit val executionContext: ExecutionContext) extends
FrontendBaseController with I18nSupport {

def onPageLoad(): Action[AnyContent] = (authenticate() andThen getData() andThen allowAccess(None)).async {
def onPageLoad(): Action[AnyContent] = (authenticate() andThen getData() andThen allowAccess(EmptyOptionalSchemeReferenceNumber)).async {
implicit request =>
pensionAdministratorConnector.getPSAName.flatMap { psaName =>
Future.successful(Ok(view(psaName)))
Expand Down
9 changes: 5 additions & 4 deletions app/controllers/BenefitsSecuredByInsuranceController.scala
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ import config.FrontendAppConfig
import controllers.actions._
import forms.BenefitsSecuredByInsuranceFormProvider
import identifiers.{BenefitsSecuredByInsuranceId, SchemeNameId}

import javax.inject.Inject
import models.Mode
import models.{Mode, OptionalSchemeReferenceNumber, SchemeReferenceNumber}
import navigators.Navigator
import play.api.data.Form
import play.api.i18n.{I18nSupport, Messages, MessagesApi}
Expand All @@ -48,9 +49,9 @@ class BenefitsSecuredByInsuranceController @Inject()(appConfig: FrontendAppConfi
)(implicit val executionContext: ExecutionContext) extends
FrontendBaseController with I18nSupport with Retrievals {

val postCall: (Mode, Option[String]) => Call = routes.BenefitsSecuredByInsuranceController.onSubmit
val postCall: (Mode, OptionalSchemeReferenceNumber) => Call = routes.BenefitsSecuredByInsuranceController.onSubmit

def onPageLoad(mode: Mode, srn: Option[String]): Action[AnyContent] =
def onPageLoad(mode: Mode, srn: OptionalSchemeReferenceNumber): Action[AnyContent] =
(authenticate() andThen getData(mode, srn) andThen allowAccess(srn) andThen requireData).async {
implicit request =>
SchemeNameId.retrieve.map { schemeName =>
Expand All @@ -64,7 +65,7 @@ class BenefitsSecuredByInsuranceController @Inject()(appConfig: FrontendAppConfi

private def form(schemeName: String)(implicit messages: Messages): Form[Boolean] = formProvider(schemeName)

def onSubmit(mode: Mode, srn: Option[String]): Action[AnyContent] = (authenticate() andThen getData(mode, srn)
def onSubmit(mode: Mode, srn: OptionalSchemeReferenceNumber): Action[AnyContent] = (authenticate() andThen getData(mode, srn)
andThen requireData).async {
implicit request =>
SchemeNameId.retrieve.map { schemeName =>
Expand Down
7 changes: 4 additions & 3 deletions app/controllers/CheckYourAnswersBankDetailsController.scala
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ package controllers
import config.FrontendAppConfig
import controllers.actions._
import identifiers._

import javax.inject.Inject
import models.{CheckMode, NormalMode}
import models.{CheckMode, EmptyOptionalSchemeReferenceNumber, NormalMode}
import play.api.i18n.{I18nSupport, MessagesApi}
import play.api.mvc.{Action, AnyContent, MessagesControllerComponents}
import uk.gov.hmrc.play.bootstrap.frontend.controller.FrontendBaseController
Expand Down Expand Up @@ -55,11 +56,11 @@ class CheckYourAnswersBankDetailsController @Inject()(appConfig: FrontendAppConf

val vm = CYAViewModel(
answerSections = Seq(bankAccountSection),
href = controllers.routes.PsaSchemeTaskListController.onPageLoad(NormalMode, None),
href = controllers.routes.PsaSchemeTaskListController.onPageLoad(NormalMode, EmptyOptionalSchemeReferenceNumber),
schemeName = existingSchemeName,
returnOverview = false,
hideEditLinks = request.viewOnly,
srn = None,
srn = EmptyOptionalSchemeReferenceNumber,
hideSaveAndContinueButton = request.viewOnly,
title = Message("checkYourAnswers.hs.title"),
h1 = Message("checkYourAnswers.hs.title")
Expand Down
13 changes: 7 additions & 6 deletions app/controllers/CheckYourAnswersBeforeYouStartController.scala
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import models.AdministratorOrPractitioner.Practitioner

import javax.inject.Inject
import models.AuthEntity.PSP
import models.OptionalSchemeReferenceNumber.toSrn
import models._
import models.requests.DataRequest
import play.api.i18n.{I18nSupport, MessagesApi}
Expand All @@ -48,20 +49,20 @@ class CheckYourAnswersBeforeYouStartController @Inject()(override val messagesAp
FrontendBaseController
with Enumerable.Implicits with I18nSupport with Retrievals {

def onPageLoad(mode: Mode, srn: Option[String]): Action[AnyContent] =
def onPageLoad(mode: Mode, srn: OptionalSchemeReferenceNumber): Action[AnyContent] =
(authenticate() andThen getData(mode, srn) andThen allowAccess(srn) andThen requireData).async {
implicit request =>

Future.successful(Ok(view(vm(mode, srn))))
}

def pspOnPageLoad(srn: String): Action[AnyContent] =
(authenticate(Some(PSP)) andThen getPspData(srn) andThen allowAccess(Some(srn), allowPsa = true, allowPsp = true) andThen requireData).async {
def pspOnPageLoad(srn: SchemeReferenceNumber): Action[AnyContent] =
(authenticate(Some(PSP)) andThen getPspData(srn) andThen allowAccess(OptionalSchemeReferenceNumber(Some(srn)), allowPsa = true, allowPsp = true) andThen requireData).async {
implicit request =>
Future.successful(Ok(view(vm(UpdateMode, Some(srn)))))
Future.successful(Ok(view(vm(UpdateMode, OptionalSchemeReferenceNumber(Some(srn))))))
}

private def vm(mode: Mode, srn: Option[String])(implicit request: DataRequest[AnyContent]): CYAViewModel = {
private def vm(mode: Mode, srn: OptionalSchemeReferenceNumber)(implicit request: DataRequest[AnyContent]): CYAViewModel = {
implicit val userAnswers: UserAnswers = request.userAnswers

val beforeYouStart = AnswerSection(
Expand All @@ -76,7 +77,7 @@ class CheckYourAnswersBeforeYouStartController @Inject()(override val messagesAp
val heading = (titleOrHeading: Message) =>
if (mode == NormalMode) Message("checkYourAnswers.hs.title") else titleOrHeading

val returnToTaskListCall:Option[Call] = (request.administratorOrPractitioner, srn) match {
val returnToTaskListCall:Option[Call] = (request.administratorOrPractitioner, toSrn(srn)) match {
case (Practitioner, Some(srn)) => Option(controllers.routes.PspSchemeTaskListController.onPageLoad(srn))
case _ => None
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ import identifiers._
import models.AdministratorOrPractitioner.Practitioner
import models.AuthEntity.PSP
import models.Mode._
import models.OptionalSchemeReferenceNumber.toSrn
import models.requests.DataRequest
import models.{CheckUpdateMode, Mode, NormalMode, UpdateMode}
import models.{CheckUpdateMode, Mode, NormalMode, OptionalSchemeReferenceNumber, SchemeReferenceNumber, UpdateMode}
import play.api.i18n.{I18nSupport, MessagesApi}
import play.api.mvc.{Action, AnyContent, Call, MessagesControllerComponents}
import uk.gov.hmrc.play.bootstrap.frontend.controller.FrontendBaseController
Expand All @@ -48,19 +49,19 @@ class CheckYourAnswersBenefitsAndInsuranceController @Inject()(override val mess
extends FrontendBaseController
with Enumerable.Implicits with I18nSupport with Retrievals {

def onPageLoad(mode: Mode, srn: Option[String]): Action[AnyContent] =
def onPageLoad(mode: Mode, srn: OptionalSchemeReferenceNumber): Action[AnyContent] =
(authenticate() andThen getData(mode, srn) andThen allowAccess(srn) andThen requireData) {
implicit request =>
Ok(view(vm(mode, srn)))
}

def pspOnPageLoad(srn: String): Action[AnyContent] =
(authenticate(Some(PSP)) andThen getPspData(srn) andThen allowAccess(Some(srn), allowPsa = true, allowPsp = true) andThen requireData) {
def pspOnPageLoad(srn: SchemeReferenceNumber): Action[AnyContent] =
(authenticate(Some(PSP)) andThen getPspData(srn) andThen allowAccess(OptionalSchemeReferenceNumber(Some(srn)), allowPsa = true, allowPsp = true) andThen requireData) {
implicit request =>
Ok(view(vm(UpdateMode, Some(srn))))
Ok(view(vm(UpdateMode, OptionalSchemeReferenceNumber(Some(srn)))))
}

private def vm(mode: Mode, srn: Option[String])(implicit request: DataRequest[AnyContent]): CYAViewModel = {
private def vm(mode: Mode, srn: OptionalSchemeReferenceNumber)(implicit request: DataRequest[AnyContent]): CYAViewModel = {

implicit val userAnswers: UserAnswers = request.userAnswers
val benefitsAndInsuranceSection = AnswerSection(
Expand All @@ -78,7 +79,7 @@ class CheckYourAnswersBenefitsAndInsuranceController @Inject()(override val mess
val heading = (name: String) => if (mode == NormalMode) Message("checkYourAnswers.hs.title") else
Message("messages__benefitsAndInsuranceDetailsFor", name)

val returnToTaskListCall:Option[Call] = (request.administratorOrPractitioner, srn) match {
val returnToTaskListCall:Option[Call] = (request.administratorOrPractitioner, toSrn(srn)) match {
case (Practitioner, Some(srn)) => Option(controllers.routes.PspSchemeTaskListController.onPageLoad(srn))
case _ => None
}
Expand Down
Loading