{"action":"created","comment":{"url":"https://api.github.com/repos/hmrc/amls-frontend/pulls/comments/222903641","pull_request_review_id":161903972,"id":222903641,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyMjkwMzY0MQ==","diff_hunk":"@@ -43,34 +46,82 @@ class FitAndProperController @Inject()(\n     implicit authContext => implicit request =>\n \n       getData[ResponsiblePerson](index) map {\n-        case Some(ResponsiblePerson(Some(personName),_,_,_,_,_,_,_,_,_,_,_,_,_,_,alreadyPassed,_,_,_,_,_,_)) if (alreadyPassed.hasAlreadyPassedFitAndProper.isDefined) =>\n-          Ok(views.html.responsiblepeople.fit_and_proper(Form2[Boolean](alreadyPassed.hasAlreadyPassedFitAndProper.get), edit, index, flow, personName.titleName, appConfig.showFeesToggle, appConfig.phase2ChangesToggle))\n+        case Some(ResponsiblePerson(Some(personName),_,_,_,_,_,_,_,_,_,_,_,_,_,_,alreadyPassed,_,_,_,_,_,_))\n+          if alreadyPassed.hasAlreadyPassedFitAndProper.isDefined =>\n+          Ok(views.html.responsiblepeople.fit_and_proper(Form2[Boolean](alreadyPassed.hasAlreadyPassedFitAndProper.get),\n+            edit, index, flow, personName.titleName, appConfig.showFeesToggle, appConfig.phase2ChangesToggle))\n         case Some(ResponsiblePerson(Some(personName),_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_)) => {\n-          Ok(views.html.responsiblepeople.fit_and_proper(EmptyForm, edit, index, flow, personName.titleName, appConfig.showFeesToggle, appConfig.phase2ChangesToggle))\n+          Ok(views.html.responsiblepeople.fit_and_proper(EmptyForm, edit, index, flow, personName.titleName,\n+            appConfig.showFeesToggle, appConfig.phase2ChangesToggle))\n         }\n         case _ => NotFound(notFoundView)\n       }\n   }\n \n-  def post(index: Int, edit: Boolean = false, flow: Option[String] = None) =\n+  def post(index: Int, edit: Boolean = false, flow: Option[String] = None) = {\n     Authorised.async {\n-      implicit authContext => implicit request =>\n-        Form2[Boolean](request.body) match {\n-          case f: InvalidForm =>\n-            getData[ResponsiblePerson](index) map { rp =>\n-              BadRequest(views.html.responsiblepeople.fit_and_proper(f, edit, index, flow, ControllerHelper.rpTitleName(rp), appConfig.showFeesToggle, appConfig.phase2ChangesToggle))\n-            }\n-          case ValidForm(_, data) => {\n-            for {\n-              _ <- updateDataStrict[ResponsiblePerson](index) { rp =>\n-                rp.approvalFlags(rp.approvalFlags.copy(hasAlreadyPassedFitAndProper = Some(data)))\n+      implicit authContext =>\n+        implicit request =>\n+          Form2[Boolean](request.body) match {\n+            case f: InvalidForm =>\n+              getData[ResponsiblePerson](index) map { rp =>\n+                BadRequest(views.html.responsiblepeople.fit_and_proper(f, edit, index, flow,\n+                  ControllerHelper.rpTitleName(rp), appConfig.showFeesToggle, appConfig.phase2ChangesToggle))\n               }\n-            } yield\n-              Redirect(routes.DetailedAnswersController.get(index, flow))\n-          } recoverWith {\n-            case _: IndexOutOfBoundsException => Future.successful(NotFound(notFoundView))\n+            case ValidForm(_, data) => {\n+              dataCacheConnector.fetchAll flatMap { maybeCache =>\n+\n+                val businessMatching = for {\n+                  cacheMap <- maybeCache\n+                  bm <- cacheMap.getEntry[BusinessMatching](BusinessMatching.key)\n+                } yield bm\n+\n+                val msbOrTcsp = ControllerHelper.isMSBSelected(Some(businessMatching)) ||\n+                  ControllerHelper.isTCSPSelected(Some(businessMatching))\n+\n+                for {\n+                  cacheMap <- fetchAllAndUpdateStrict[ResponsiblePerson](index) { (_, rp) =>\n+                    if (appConfig.phase2ChangesToggle) {","path":"app/controllers/responsiblepeople/FitAndProperController.scala","position":75,"original_position":75,"commit_id":"2222831a12edc13761367b177a23e006e5d35efe","original_commit_id":"2222831a12edc13761367b177a23e006e5d35efe","user":{"login":"JGRobinson","id":1327228,"node_id":"MDQ6VXNlcjEzMjcyMjg=","avatar_url":"https://avatars0.githubusercontent.com/u/1327228?v=4","gravatar_id":"","url":"https://api.github.com/users/JGRobinson","html_url":"https://github.com/JGRobinson","followers_url":"https://api.github.com/users/JGRobinson/followers","following_url":"https://api.github.com/users/JGRobinson/following{/other_user}","gists_url":"https://api.github.com/users/JGRobinson/gists{/gist_id}","starred_url":"https://api.github.com/users/JGRobinson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JGRobinson/subscriptions","organizations_url":"https://api.github.com/users/JGRobinson/orgs","repos_url":"https://api.github.com/users/JGRobinson/repos","events_url":"https://api.github.com/users/JGRobinson/events{/privacy}","received_events_url":"https://api.github.com/users/JGRobinson/received_events","type":"User","site_admin":false},"body":"sorry my bad - see it now","created_at":"2018-10-05T06:30:49Z","updated_at":"2018-10-05T06:30:49Z","html_url":"https://github.com/hmrc/amls-frontend/pull/813#discussion_r222903641","pull_request_url":"https://api.github.com/repos/hmrc/amls-frontend/pulls/813","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/hmrc/amls-frontend/pulls/comments/222903641"},"html":{"href":"https://github.com/hmrc/amls-frontend/pull/813#discussion_r222903641"},"pull_request":{"href":"https://api.github.com/repos/hmrc/amls-frontend/pulls/813"}},"in_reply_to_id":222903437},"pull_request":{"url":"https://api.github.com/repos/hmrc/amls-frontend/pulls/813","id":220037601,"node_id":"MDExOlB1bGxSZXF1ZXN0MjIwMDM3NjAx","html_url":"https://github.com/hmrc/amls-frontend/pull/813","diff_url":"https://github.com/hmrc/amls-frontend/pull/813.diff","patch_url":"https://github.com/hmrc/amls-frontend/pull/813.patch","issue_url":"https://api.github.com/repos/hmrc/amls-frontend/issues/813","number":813,"state":"open","locked":false,"title":"Amls 4335 implement flow","user":{"login":"ajchilts","id":40767309,"node_id":"MDQ6VXNlcjQwNzY3MzA5","avatar_url":"https://avatars1.githubusercontent.com/u/40767309?v=4","gravatar_id":"","url":"https://api.github.com/users/ajchilts","html_url":"https://github.com/ajchilts","followers_url":"https://api.github.com/users/ajchilts/followers","following_url":"https://api.github.com/users/ajchilts/following{/other_user}","gists_url":"https://api.github.com/users/ajchilts/gists{/gist_id}","starred_url":"https://api.github.com/users/ajchilts/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ajchilts/subscriptions","organizations_url":"https://api.github.com/users/ajchilts/orgs","repos_url":"https://api.github.com/users/ajchilts/repos","events_url":"https://api.github.com/users/ajchilts/events{/privacy}","received_events_url":"https://api.github.com/users/ajchilts/received_events","type":"User","site_admin":false},"body":"Implement flow for approval check and ensure both fit and proper and approval values get set correctly/ \r\n\r\n## Related / Dependant PRs?\r\n\r\nN/A\r\n\r\n## How Has This Been Tested?\r\n\r\nUnit tests and manual testing given the scenarios. Regression automation also run. \r\n\r\n## Checklist\r\n\r\n<!--- Go over all the following points, and put an `x` in all the boxes that apply. -->\r\n<!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->\r\n\r\n- [ ] Breaking change (fix or feature that would cause existing functionality to change).\r\n- [x] Build passing.\r\n- [x] Unit tests have full coverage.\r\n- [ ] Unit test approach and implementation has been reviewed with QA (testers).\r\n- [x] Requires acceptance test run.\r\n- [x] Appropriate labels added.\r\n","created_at":"2018-10-03T13:30:09Z","updated_at":"2018-10-05T06:30:49Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c2b30b471c367b76c84c5e0566b59817caf5c58d","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":990437723,"node_id":"MDU6TGFiZWw5OTA0Mzc3MjM=","url":"https://api.github.com/repos/hmrc/amls-frontend/labels/pending%20QA","name":"pending QA","color":"f9d0c4","default":false},{"id":990436942,"node_id":"MDU6TGFiZWw5OTA0MzY5NDI=","url":"https://api.github.com/repos/hmrc/amls-frontend/labels/pending%20review","name":"pending review","color":"fbca04","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/hmrc/amls-frontend/pulls/813/commits","review_comments_url":"https://api.github.com/repos/hmrc/amls-frontend/pulls/813/comments","review_comment_url":"https://api.github.com/repos/hmrc/amls-frontend/pulls/comments{/number}","comments_url":"https://api.github.com/repos/hmrc/amls-frontend/issues/813/comments","statuses_url":"https://api.github.com/repos/hmrc/amls-frontend/statuses/2222831a12edc13761367b177a23e006e5d35efe","head":{"label":"hmrc:AMLS-4335-implement-flow","ref":"AMLS-4335-implement-flow","sha":"2222831a12edc13761367b177a23e006e5d35efe","user":{"login":"hmrc","id":5755339,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU3NTUzMzk=","avatar_url":"https://avatars1.githubusercontent.com/u/5755339?v=4","gravatar_id":"","url":"https://api.github.com/users/hmrc","html_url":"https://github.com/hmrc","followers_url":"https://api.github.com/users/hmrc/followers","following_url":"https://api.github.com/users/hmrc/following{/other_user}","gists_url":"https://api.github.com/users/hmrc/gists{/gist_id}","starred_url":"https://api.github.com/users/hmrc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hmrc/subscriptions","organizations_url":"https://api.github.com/users/hmrc/orgs","repos_url":"https://api.github.com/users/hmrc/repos","events_url":"https://api.github.com/users/hmrc/events{/privacy}","received_events_url":"https://api.github.com/users/hmrc/received_events","type":"Organization","site_admin":false},"repo":{"id":91313425,"node_id":"MDEwOlJlcG9zaXRvcnk5MTMxMzQyNQ==","name":"amls-frontend","full_name":"hmrc/amls-frontend","private":false,"owner":{"login":"hmrc","id":5755339,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU3NTUzMzk=","avatar_url":"https://avatars1.githubusercontent.com/u/5755339?v=4","gravatar_id":"","url":"https://api.github.com/users/hmrc","html_url":"https://github.com/hmrc","followers_url":"https://api.github.com/users/hmrc/followers","following_url":"https://api.github.com/users/hmrc/following{/other_user}","gists_url":"https://api.github.com/users/hmrc/gists{/gist_id}","starred_url":"https://api.github.com/users/hmrc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hmrc/subscriptions","organizations_url":"https://api.github.com/users/hmrc/orgs","repos_url":"https://api.github.com/users/hmrc/repos","events_url":"https://api.github.com/users/hmrc/events{/privacy}","received_events_url":"https://api.github.com/users/hmrc/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/hmrc/amls-frontend","description":null,"fork":false,"url":"https://api.github.com/repos/hmrc/amls-frontend","forks_url":"https://api.github.com/repos/hmrc/amls-frontend/forks","keys_url":"https://api.github.com/repos/hmrc/amls-frontend/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hmrc/amls-frontend/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hmrc/amls-frontend/teams","hooks_url":"https://api.github.com/repos/hmrc/amls-frontend/hooks","issue_events_url":"https://api.github.com/repos/hmrc/amls-frontend/issues/events{/number}","events_url":"https://api.github.com/repos/hmrc/amls-frontend/events","assignees_url":"https://api.github.com/repos/hmrc/amls-frontend/assignees{/user}","branches_url":"https://api.github.com/repos/hmrc/amls-frontend/branches{/branch}","tags_url":"https://api.github.com/repos/hmrc/amls-frontend/tags","blobs_url":"https://api.github.com/repos/hmrc/amls-frontend/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hmrc/amls-frontend/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hmrc/amls-frontend/git/refs{/sha}","trees_url":"https://api.github.com/repos/hmrc/amls-frontend/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hmrc/amls-frontend/statuses/{sha}","languages_url":"https://api.github.com/repos/hmrc/amls-frontend/languages","stargazers_url":"https://api.github.com/repos/hmrc/amls-frontend/stargazers","contributors_url":"https://api.github.com/repos/hmrc/amls-frontend/contributors","subscribers_url":"https://api.github.com/repos/hmrc/amls-frontend/subscribers","subscription_url":"https://api.github.com/repos/hmrc/amls-frontend/subscription","commits_url":"https://api.github.com/repos/hmrc/amls-frontend/commits{/sha}","git_commits_url":"https://api.github.com/repos/hmrc/amls-frontend/git/commits{/sha}","comments_url":"https://api.github.com/repos/hmrc/amls-frontend/comments{/number}","issue_comment_url":"https://api.github.com/repos/hmrc/amls-frontend/issues/comments{/number}","contents_url":"https://api.github.com/repos/hmrc/amls-frontend/contents/{+path}","compare_url":"https://api.github.com/repos/hmrc/amls-frontend/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hmrc/amls-frontend/merges","archive_url":"https://api.github.com/repos/hmrc/amls-frontend/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hmrc/amls-frontend/downloads","issues_url":"https://api.github.com/repos/hmrc/amls-frontend/issues{/number}","pulls_url":"https://api.github.com/repos/hmrc/amls-frontend/pulls{/number}","milestones_url":"https://api.github.com/repos/hmrc/amls-frontend/milestones{/number}","notifications_url":"https://api.github.com/repos/hmrc/amls-frontend/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hmrc/amls-frontend/labels{/name}","releases_url":"https://api.github.com/repos/hmrc/amls-frontend/releases{/id}","deployments_url":"https://api.github.com/repos/hmrc/amls-frontend/deployments","created_at":"2017-05-15T08:28:34Z","updated_at":"2018-09-28T14:25:17Z","pushed_at":"2018-10-04T15:06:43Z","git_url":"git://github.com/hmrc/amls-frontend.git","ssh_url":"git@github.com:hmrc/amls-frontend.git","clone_url":"https://github.com/hmrc/amls-frontend.git","svn_url":"https://github.com/hmrc/amls-frontend","homepage":"","size":15341,"stargazers_count":1,"watchers_count":1,"language":"Scala","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"archived":false,"open_issues_count":3,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":2,"open_issues":3,"watchers":1,"default_branch":"master"}},"base":{"label":"hmrc:AMLS-3754-v2","ref":"AMLS-3754-v2","sha":"a7037cdc0b1b1d7e1ac94b20fd172616636dcfef","user":{"login":"hmrc","id":5755339,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU3NTUzMzk=","avatar_url":"https://avatars1.githubusercontent.com/u/5755339?v=4","gravatar_id":"","url":"https://api.github.com/users/hmrc","html_url":"https://github.com/hmrc","followers_url":"https://api.github.com/users/hmrc/followers","following_url":"https://api.github.com/users/hmrc/following{/other_user}","gists_url":"https://api.github.com/users/hmrc/gists{/gist_id}","starred_url":"https://api.github.com/users/hmrc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hmrc/subscriptions","organizations_url":"https://api.github.com/users/hmrc/orgs","repos_url":"https://api.github.com/users/hmrc/repos","events_url":"https://api.github.com/users/hmrc/events{/privacy}","received_events_url":"https://api.github.com/users/hmrc/received_events","type":"Organization","site_admin":false},"repo":{"id":91313425,"node_id":"MDEwOlJlcG9zaXRvcnk5MTMxMzQyNQ==","name":"amls-frontend","full_name":"hmrc/amls-frontend","private":false,"owner":{"login":"hmrc","id":5755339,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU3NTUzMzk=","avatar_url":"https://avatars1.githubusercontent.com/u/5755339?v=4","gravatar_id":"","url":"https://api.github.com/users/hmrc","html_url":"https://github.com/hmrc","followers_url":"https://api.github.com/users/hmrc/followers","following_url":"https://api.github.com/users/hmrc/following{/other_user}","gists_url":"https://api.github.com/users/hmrc/gists{/gist_id}","starred_url":"https://api.github.com/users/hmrc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hmrc/subscriptions","organizations_url":"https://api.github.com/users/hmrc/orgs","repos_url":"https://api.github.com/users/hmrc/repos","events_url":"https://api.github.com/users/hmrc/events{/privacy}","received_events_url":"https://api.github.com/users/hmrc/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/hmrc/amls-frontend","description":null,"fork":false,"url":"https://api.github.com/repos/hmrc/amls-frontend","forks_url":"https://api.github.com/repos/hmrc/amls-frontend/forks","keys_url":"https://api.github.com/repos/hmrc/amls-frontend/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hmrc/amls-frontend/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hmrc/amls-frontend/teams","hooks_url":"https://api.github.com/repos/hmrc/amls-frontend/hooks","issue_events_url":"https://api.github.com/repos/hmrc/amls-frontend/issues/events{/number}","events_url":"https://api.github.com/repos/hmrc/amls-frontend/events","assignees_url":"https://api.github.com/repos/hmrc/amls-frontend/assignees{/user}","branches_url":"https://api.github.com/repos/hmrc/amls-frontend/branches{/branch}","tags_url":"https://api.github.com/repos/hmrc/amls-frontend/tags","blobs_url":"https://api.github.com/repos/hmrc/amls-frontend/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hmrc/amls-frontend/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hmrc/amls-frontend/git/refs{/sha}","trees_url":"https://api.github.com/repos/hmrc/amls-frontend/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hmrc/amls-frontend/statuses/{sha}","languages_url":"https://api.github.com/repos/hmrc/amls-frontend/languages","stargazers_url":"https://api.github.com/repos/hmrc/amls-frontend/stargazers","contributors_url":"https://api.github.com/repos/hmrc/amls-frontend/contributors","subscribers_url":"https://api.github.com/repos/hmrc/amls-frontend/subscribers","subscription_url":"https://api.github.com/repos/hmrc/amls-frontend/subscription","commits_url":"https://api.github.com/repos/hmrc/amls-frontend/commits{/sha}","git_commits_url":"https://api.github.com/repos/hmrc/amls-frontend/git/commits{/sha}","comments_url":"https://api.github.com/repos/hmrc/amls-frontend/comments{/number}","issue_comment_url":"https://api.github.com/repos/hmrc/amls-frontend/issues/comments{/number}","contents_url":"https://api.github.com/repos/hmrc/amls-frontend/contents/{+path}","compare_url":"https://api.github.com/repos/hmrc/amls-frontend/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hmrc/amls-frontend/merges","archive_url":"https://api.github.com/repos/hmrc/amls-frontend/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hmrc/amls-frontend/downloads","issues_url":"https://api.github.com/repos/hmrc/amls-frontend/issues{/number}","pulls_url":"https://api.github.com/repos/hmrc/amls-frontend/pulls{/number}","milestones_url":"https://api.github.com/repos/hmrc/amls-frontend/milestones{/number}","notifications_url":"https://api.github.com/repos/hmrc/amls-frontend/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hmrc/amls-frontend/labels{/name}","releases_url":"https://api.github.com/repos/hmrc/amls-frontend/releases{/id}","deployments_url":"https://api.github.com/repos/hmrc/amls-frontend/deployments","created_at":"2017-05-15T08:28:34Z","updated_at":"2018-09-28T14:25:17Z","pushed_at":"2018-10-04T15:06:43Z","git_url":"git://github.com/hmrc/amls-frontend.git","ssh_url":"git@github.com:hmrc/amls-frontend.git","clone_url":"https://github.com/hmrc/amls-frontend.git","svn_url":"https://github.com/hmrc/amls-frontend","homepage":"","size":15341,"stargazers_count":1,"watchers_count":1,"language":"Scala","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"archived":false,"open_issues_count":3,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":2,"open_issues":3,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/hmrc/amls-frontend/pulls/813"},"html":{"href":"https://github.com/hmrc/amls-frontend/pull/813"},"issue":{"href":"https://api.github.com/repos/hmrc/amls-frontend/issues/813"},"comments":{"href":"https://api.github.com/repos/hmrc/amls-frontend/issues/813/comments"},"review_comments":{"href":"https://api.github.com/repos/hmrc/amls-frontend/pulls/813/comments"},"review_comment":{"href":"https://api.github.com/repos/hmrc/amls-frontend/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/hmrc/amls-frontend/pulls/813/commits"},"statuses":{"href":"https://api.github.com/repos/hmrc/amls-frontend/statuses/2222831a12edc13761367b177a23e006e5d35efe"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"JGRobinson"}}