{"action":"created","comment":{"url":"https://api.github.com/repos/companieshouse/company-accounts.api.ch.gov.uk/pulls/comments/240968310","pull_request_review_id":184119263,"id":240968310,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDI0MDk2ODMxMA==","diff_hunk":"@@ -38,23 +40,40 @@\n     private DebtorsTransformer transformer;\n     private SmallFullService smallFullService;\n     private KeyIdGenerator keyIdGenerator;\n+    private DebtorsValidator debtorsValidator;\n \n     @Autowired\n     public DebtorsService(DebtorsRepository repository,\n                           DebtorsTransformer transformer,\n                           SmallFullService smallFullService,\n-                          KeyIdGenerator keyIdGenerator) {\n+                          KeyIdGenerator keyIdGenerator, DebtorsValidator debtorsValidator) {\n \n         this.repository = repository;\n         this.transformer = transformer;\n         this.smallFullService = smallFullService;\n         this.keyIdGenerator = keyIdGenerator;\n+        this.debtorsValidator = debtorsValidator;\n     }\n \n     @Override\n     public ResponseObject<Debtors> create(Debtors rest, Transaction transaction,\n                                           String companyAccountsId, HttpServletRequest request)\n-        throws DataException {\n+        throws DataException, RestException {\n+\n+        Errors errors;\n+\n+        try {\n+            errors = debtorsValidator.validateDebtors(rest, transaction);\n+        } catch (RestException restException) {\n+            throw restException;\n+        }\n+\n+        if (errors.hasErrors()) {\n+            DataException dataException = new DataException(","path":"src/main/java/uk/gov/companieshouse/api/accounts/service/impl/DebtorsService.java","position":74,"original_position":74,"commit_id":"637957b7922a5f468c1e5e631decd6c5ff4bc7dd","original_commit_id":"637957b7922a5f468c1e5e631decd6c5ff4bc7dd","user":{"login":"sroberts2","id":33425071,"node_id":"MDQ6VXNlcjMzNDI1MDcx","avatar_url":"https://avatars1.githubusercontent.com/u/33425071?v=4","gravatar_id":"","url":"https://api.github.com/users/sroberts2","html_url":"https://github.com/sroberts2","followers_url":"https://api.github.com/users/sroberts2/followers","following_url":"https://api.github.com/users/sroberts2/following{/other_user}","gists_url":"https://api.github.com/users/sroberts2/gists{/gist_id}","starred_url":"https://api.github.com/users/sroberts2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sroberts2/subscriptions","organizations_url":"https://api.github.com/users/sroberts2/orgs","repos_url":"https://api.github.com/users/sroberts2/repos","events_url":"https://api.github.com/users/sroberts2/events{/privacy}","received_events_url":"https://api.github.com/users/sroberts2/received_events","type":"User","site_admin":false},"body":"Why create a `dataException` here if we don't use it?","created_at":"2018-12-12T10:58:37Z","updated_at":"2018-12-12T10:58:37Z","html_url":"https://github.com/companieshouse/company-accounts.api.ch.gov.uk/pull/159#discussion_r240968310","pull_request_url":"https://api.github.com/repos/companieshouse/company-accounts.api.ch.gov.uk/pulls/159","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/companieshouse/company-accounts.api.ch.gov.uk/pulls/comments/240968310"},"html":{"href":"https://github.com/companieshouse/company-accounts.api.ch.gov.uk/pull/159#discussion_r240968310"},"pull_request":{"href":"https://api.github.com/repos/companieshouse/company-accounts.api.ch.gov.uk/pulls/159"}}},"pull_request":{"url":"https://api.github.com/repos/companieshouse/company-accounts.api.ch.gov.uk/pulls/159","id":236880206,"node_id":"MDExOlB1bGxSZXF1ZXN0MjM2ODgwMjA2","html_url":"https://github.com/companieshouse/company-accounts.api.ch.gov.uk/pull/159","diff_url":"https://github.com/companieshouse/company-accounts.api.ch.gov.uk/pull/159.diff","patch_url":"https://github.com/companieshouse/company-accounts.api.ch.gov.uk/pull/159.patch","issue_url":"https://api.github.com/repos/companieshouse/company-accounts.api.ch.gov.uk/issues/159","number":159,"state":"open","locked":false,"title":"Validate debtors note","user":{"login":"leahtaylor","id":15984133,"node_id":"MDQ6VXNlcjE1OTg0MTMz","avatar_url":"https://avatars3.githubusercontent.com/u/15984133?v=4","gravatar_id":"","url":"https://api.github.com/users/leahtaylor","html_url":"https://github.com/leahtaylor","followers_url":"https://api.github.com/users/leahtaylor/followers","following_url":"https://api.github.com/users/leahtaylor/following{/other_user}","gists_url":"https://api.github.com/users/leahtaylor/gists{/gist_id}","starred_url":"https://api.github.com/users/leahtaylor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leahtaylor/subscriptions","organizations_url":"https://api.github.com/users/leahtaylor/orgs","repos_url":"https://api.github.com/users/leahtaylor/repos","events_url":"https://api.github.com/users/leahtaylor/events{/privacy}","received_events_url":"https://api.github.com/users/leahtaylor/received_events","type":"User","site_admin":false},"body":"Validate a debtors resource\r\n\r\nAdd @Range , @Valid and @Length annotations to debtors REST models\r\nCreate debtors validator to validate previous period allowance, mandatory fields and field calculations\r\nCreate new RestException for failures getting companyProfile via RestTemplate\r\nCreate CompanyProfile model for RestTemplate response\r\nAdd new validation error messages\r\nAdd unit tests\r\n\r\nSFA-364\r\n","created_at":"2018-12-07T14:11:52Z","updated_at":"2018-12-12T10:58:37Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9aa41839e5d6ec33ef0aaa32c0c0b2e53d65f039","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/companieshouse/company-accounts.api.ch.gov.uk/pulls/159/commits","review_comments_url":"https://api.github.com/repos/companieshouse/company-accounts.api.ch.gov.uk/pulls/159/comments","review_comment_url":"https://api.github.com/repos/companieshouse/company-accounts.api.ch.gov.uk/pulls/comments{/number}","comments_url":"https://api.github.com/repos/companieshouse/company-accounts.api.ch.gov.uk/issues/159/comments","statuses_url":"https://api.github.com/repos/companieshouse/company-accounts.api.ch.gov.uk/statuses/637957b7922a5f468c1e5e631decd6c5ff4bc7dd","head":{"label":"companieshouse:feature/debtors-validation","ref":"feature/debtors-validation","sha":"637957b7922a5f468c1e5e631decd6c5ff4bc7dd","user":{"login":"companieshouse","id":4947323,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ5NDczMjM=","avatar_url":"https://avatars0.githubusercontent.com/u/4947323?v=4","gravatar_id":"","url":"https://api.github.com/users/companieshouse","html_url":"https://github.com/companieshouse","followers_url":"https://api.github.com/users/companieshouse/followers","following_url":"https://api.github.com/users/companieshouse/following{/other_user}","gists_url":"https://api.github.com/users/companieshouse/gists{/gist_id}","starred_url":"https://api.github.com/users/companieshouse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/companieshouse/subscriptions","organizations_url":"https://api.github.com/users/companieshouse/orgs","repos_url":"https://api.github.com/users/companieshouse/repos","events_url":"https://api.github.com/users/companieshouse/events{/privacy}","received_events_url":"https://api.github.com/users/companieshouse/received_events","type":"Organization","site_admin":false},"repo":{"id":137176372,"node_id":"MDEwOlJlcG9zaXRvcnkxMzcxNzYzNzI=","name":"company-accounts.api.ch.gov.uk","full_name":"companieshouse/company-accounts.api.ch.gov.uk","private":false,"owner":{"login":"companieshouse","id":4947323,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ5NDczMjM=","avatar_url":"https://avatars0.githubusercontent.com/u/4947323?v=4","gravatar_id":"","url":"https://api.github.com/users/companieshouse","html_url":"https://github.com/companieshouse","followers_url":"https://api.github.com/users/companieshouse/followers","following_url":"https://api.github.com/users/companieshouse/following{/other_user}","gists_url":"https://api.github.com/users/companieshouse/gists{/gist_id}","starred_url":"https://api.github.com/users/companieshouse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/companieshouse/subscriptions","organizations_url":"https://api.github.com/users/companieshouse/orgs","repos_url":"https://api.github.com/users/companieshouse/repos","events_url":"https://api.github.com/users/companieshouse/events{/privacy}","received_events_url":"https://api.github.com/users/companieshouse/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/companieshouse/company-accounts.api.ch.gov.uk","description":"The Companies House API for handling company accounts","fork":false,"url":"https://api.github.com/repos/companieshouse/company-accounts.api.ch.gov.uk","forks_url":"https://api.github.com/repos/companieshouse/company-accounts.api.ch.gov.uk/forks","keys_url":"https://api.github.com/repos/companieshouse/company-accounts.api.ch.gov.uk/keys{/key_id}","collaborators_url":"https://api.github.com/repos/companieshouse/company-accounts.api.ch.gov.uk/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/companieshouse/company-accounts.api.ch.gov.uk/teams","hooks_url":"https://api.github.com/repos/companieshouse/company-accounts.api.ch.gov.uk/hooks","issue_events_url":"https://api.github.com/repos/companieshouse/company-accounts.api.ch.gov.uk/issues/events{/number}","events_url":"https://api.github.com/repos/companieshouse/company-accounts.api.ch.gov.uk/events","assignees_url":"https://api.github.com/repos/companieshouse/company-accounts.api.ch.gov.uk/assignees{/user}","branches_url":"https://api.github.com/repos/companieshouse/company-accounts.api.ch.gov.uk/branches{/branch}","tags_url":"https://api.github.com/repos/companieshouse/company-accounts.api.ch.gov.uk/tags","blobs_url":"https://api.github.com/repos/companieshouse/company-accounts.api.ch.gov.uk/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/companieshouse/company-accounts.api.ch.gov.uk/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/companieshouse/company-accounts.api.ch.gov.uk/git/refs{/sha}","trees_url":"https://api.github.com/repos/companieshouse/company-accounts.api.ch.gov.uk/git/trees{/sha}","statuses_url":"https://api.github.com/repos/companieshouse/company-accounts.api.ch.gov.uk/statuses/{sha}","languages_url":"https://api.github.com/repos/companieshouse/company-accounts.api.ch.gov.uk/languages","stargazers_url":"https://api.github.com/repos/companieshouse/company-accounts.api.ch.gov.uk/stargazers","contributors_url":"https://api.github.com/repos/companieshouse/company-accounts.api.ch.gov.uk/contributors","subscribers_url":"https://api.github.com/repos/companieshouse/company-accounts.api.ch.gov.uk/subscribers","subscription_url":"https://api.github.com/repos/companieshouse/company-accounts.api.ch.gov.uk/subscription","commits_url":"https://api.github.com/repos/companieshouse/company-accounts.api.ch.gov.uk/commits{/sha}","git_commits_url":"https://api.github.com/repos/companieshouse/company-accounts.api.ch.gov.uk/git/commits{/sha}","comments_url":"https://api.github.com/repos/companieshouse/company-accounts.api.ch.gov.uk/comments{/number}","issue_comment_url":"https://api.github.com/repos/companieshouse/company-accounts.api.ch.gov.uk/issues/comments{/number}","contents_url":"https://api.github.com/repos/companieshouse/company-accounts.api.ch.gov.uk/contents/{+path}","compare_url":"https://api.github.com/repos/companieshouse/company-accounts.api.ch.gov.uk/compare/{base}...{head}","merges_url":"https://api.github.com/repos/companieshouse/company-accounts.api.ch.gov.uk/merges","archive_url":"https://api.github.com/repos/companieshouse/company-accounts.api.ch.gov.uk/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/companieshouse/company-accounts.api.ch.gov.uk/downloads","issues_url":"https://api.github.com/repos/companieshouse/company-accounts.api.ch.gov.uk/issues{/number}","pulls_url":"https://api.github.com/repos/companieshouse/company-accounts.api.ch.gov.uk/pulls{/number}","milestones_url":"https://api.github.com/repos/companieshouse/company-accounts.api.ch.gov.uk/milestones{/number}","notifications_url":"https://api.github.com/repos/companieshouse/company-accounts.api.ch.gov.uk/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/companieshouse/company-accounts.api.ch.gov.uk/labels{/name}","releases_url":"https://api.github.com/repos/companieshouse/company-accounts.api.ch.gov.uk/releases{/id}","deployments_url":"https://api.github.com/repos/companieshouse/company-accounts.api.ch.gov.uk/deployments","created_at":"2018-06-13T07:06:55Z","updated_at":"2018-12-11T12:53:54Z","pushed_at":"2018-12-12T07:07:37Z","git_url":"git://github.com/companieshouse/company-accounts.api.ch.gov.uk.git","ssh_url":"git@github.com:companieshouse/company-accounts.api.ch.gov.uk.git","clone_url":"https://github.com/companieshouse/company-accounts.api.ch.gov.uk.git","svn_url":"https://github.com/companieshouse/company-accounts.api.ch.gov.uk","homepage":null,"size":1406,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":6,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":6,"watchers":0,"default_branch":"develop"}},"base":{"label":"companieshouse:develop","ref":"develop","sha":"cb59f639a6908e2144391fa9c47230ef0a7759e1","user":{"login":"companieshouse","id":4947323,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ5NDczMjM=","avatar_url":"https://avatars0.githubusercontent.com/u/4947323?v=4","gravatar_id":"","url":"https://api.github.com/users/companieshouse","html_url":"https://github.com/companieshouse","followers_url":"https://api.github.com/users/companieshouse/followers","following_url":"https://api.github.com/users/companieshouse/following{/other_user}","gists_url":"https://api.github.com/users/companieshouse/gists{/gist_id}","starred_url":"https://api.github.com/users/companieshouse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/companieshouse/subscriptions","organizations_url":"https://api.github.com/users/companieshouse/orgs","repos_url":"https://api.github.com/users/companieshouse/repos","events_url":"https://api.github.com/users/companieshouse/events{/privacy}","received_events_url":"https://api.github.com/users/companieshouse/received_events","type":"Organization","site_admin":false},"repo":{"id":137176372,"node_id":"MDEwOlJlcG9zaXRvcnkxMzcxNzYzNzI=","name":"company-accounts.api.ch.gov.uk","full_name":"companieshouse/company-accounts.api.ch.gov.uk","private":false,"owner":{"login":"companieshouse","id":4947323,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ5NDczMjM=","avatar_url":"https://avatars0.githubusercontent.com/u/4947323?v=4","gravatar_id":"","url":"https://api.github.com/users/companieshouse","html_url":"https://github.com/companieshouse","followers_url":"https://api.github.com/users/companieshouse/followers","following_url":"https://api.github.com/users/companieshouse/following{/other_user}","gists_url":"https://api.github.com/users/companieshouse/gists{/gist_id}","starred_url":"https://api.github.com/users/companieshouse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/companieshouse/subscriptions","organizations_url":"https://api.github.com/users/companieshouse/orgs","repos_url":"https://api.github.com/users/companieshouse/repos","events_url":"https://api.github.com/users/companieshouse/events{/privacy}","received_events_url":"https://api.github.com/users/companieshouse/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/companieshouse/company-accounts.api.ch.gov.uk","description":"The Companies House API for handling company accounts","fork":false,"url":"https://api.github.com/repos/companieshouse/company-accounts.api.ch.gov.uk","forks_url":"https://api.github.com/repos/companieshouse/company-accounts.api.ch.gov.uk/forks","keys_url":"https://api.github.com/repos/companieshouse/company-accounts.api.ch.gov.uk/keys{/key_id}","collaborators_url":"https://api.github.com/repos/companieshouse/company-accounts.api.ch.gov.uk/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/companieshouse/company-accounts.api.ch.gov.uk/teams","hooks_url":"https://api.github.com/repos/companieshouse/company-accounts.api.ch.gov.uk/hooks","issue_events_url":"https://api.github.com/repos/companieshouse/company-accounts.api.ch.gov.uk/issues/events{/number}","events_url":"https://api.github.com/repos/companieshouse/company-accounts.api.ch.gov.uk/events","assignees_url":"https://api.github.com/repos/companieshouse/company-accounts.api.ch.gov.uk/assignees{/user}","branches_url":"https://api.github.com/repos/companieshouse/company-accounts.api.ch.gov.uk/branches{/branch}","tags_url":"https://api.github.com/repos/companieshouse/company-accounts.api.ch.gov.uk/tags","blobs_url":"https://api.github.com/repos/companieshouse/company-accounts.api.ch.gov.uk/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/companieshouse/company-accounts.api.ch.gov.uk/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/companieshouse/company-accounts.api.ch.gov.uk/git/refs{/sha}","trees_url":"https://api.github.com/repos/companieshouse/company-accounts.api.ch.gov.uk/git/trees{/sha}","statuses_url":"https://api.github.com/repos/companieshouse/company-accounts.api.ch.gov.uk/statuses/{sha}","languages_url":"https://api.github.com/repos/companieshouse/company-accounts.api.ch.gov.uk/languages","stargazers_url":"https://api.github.com/repos/companieshouse/company-accounts.api.ch.gov.uk/stargazers","contributors_url":"https://api.github.com/repos/companieshouse/company-accounts.api.ch.gov.uk/contributors","subscribers_url":"https://api.github.com/repos/companieshouse/company-accounts.api.ch.gov.uk/subscribers","subscription_url":"https://api.github.com/repos/companieshouse/company-accounts.api.ch.gov.uk/subscription","commits_url":"https://api.github.com/repos/companieshouse/company-accounts.api.ch.gov.uk/commits{/sha}","git_commits_url":"https://api.github.com/repos/companieshouse/company-accounts.api.ch.gov.uk/git/commits{/sha}","comments_url":"https://api.github.com/repos/companieshouse/company-accounts.api.ch.gov.uk/comments{/number}","issue_comment_url":"https://api.github.com/repos/companieshouse/company-accounts.api.ch.gov.uk/issues/comments{/number}","contents_url":"https://api.github.com/repos/companieshouse/company-accounts.api.ch.gov.uk/contents/{+path}","compare_url":"https://api.github.com/repos/companieshouse/company-accounts.api.ch.gov.uk/compare/{base}...{head}","merges_url":"https://api.github.com/repos/companieshouse/company-accounts.api.ch.gov.uk/merges","archive_url":"https://api.github.com/repos/companieshouse/company-accounts.api.ch.gov.uk/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/companieshouse/company-accounts.api.ch.gov.uk/downloads","issues_url":"https://api.github.com/repos/companieshouse/company-accounts.api.ch.gov.uk/issues{/number}","pulls_url":"https://api.github.com/repos/companieshouse/company-accounts.api.ch.gov.uk/pulls{/number}","milestones_url":"https://api.github.com/repos/companieshouse/company-accounts.api.ch.gov.uk/milestones{/number}","notifications_url":"https://api.github.com/repos/companieshouse/company-accounts.api.ch.gov.uk/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/companieshouse/company-accounts.api.ch.gov.uk/labels{/name}","releases_url":"https://api.github.com/repos/companieshouse/company-accounts.api.ch.gov.uk/releases{/id}","deployments_url":"https://api.github.com/repos/companieshouse/company-accounts.api.ch.gov.uk/deployments","created_at":"2018-06-13T07:06:55Z","updated_at":"2018-12-11T12:53:54Z","pushed_at":"2018-12-12T07:07:37Z","git_url":"git://github.com/companieshouse/company-accounts.api.ch.gov.uk.git","ssh_url":"git@github.com:companieshouse/company-accounts.api.ch.gov.uk.git","clone_url":"https://github.com/companieshouse/company-accounts.api.ch.gov.uk.git","svn_url":"https://github.com/companieshouse/company-accounts.api.ch.gov.uk","homepage":null,"size":1406,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":6,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":6,"watchers":0,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/companieshouse/company-accounts.api.ch.gov.uk/pulls/159"},"html":{"href":"https://github.com/companieshouse/company-accounts.api.ch.gov.uk/pull/159"},"issue":{"href":"https://api.github.com/repos/companieshouse/company-accounts.api.ch.gov.uk/issues/159"},"comments":{"href":"https://api.github.com/repos/companieshouse/company-accounts.api.ch.gov.uk/issues/159/comments"},"review_comments":{"href":"https://api.github.com/repos/companieshouse/company-accounts.api.ch.gov.uk/pulls/159/comments"},"review_comment":{"href":"https://api.github.com/repos/companieshouse/company-accounts.api.ch.gov.uk/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/companieshouse/company-accounts.api.ch.gov.uk/pulls/159/commits"},"statuses":{"href":"https://api.github.com/repos/companieshouse/company-accounts.api.ch.gov.uk/statuses/637957b7922a5f468c1e5e631decd6c5ff4bc7dd"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"sroberts2"}}