{"action":"created","comment":{"url":"https://api.github.com/repos/hmrc/customs-declare-exports/pulls/comments/333049152","pull_request_review_id":299458478,"id":333049152,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDMzMzA0OTE1Mg==","diff_hunk":"@@ -0,0 +1,55 @@\n+/*\n+ * Copyright 2019 HM Revenue & Customs\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ *     http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+\n+package uk.gov.hmrc.exports.models\n+\n+case class PointerMapping(wcoPattern: PointerPattern, exportsPattern: PointerPattern) {\n+\n+  def applyToWCOPointer(pointer: Pointer): Pointer = {\n+    if (!wcoPattern.matches(pointer.pattern))","path":"app/uk/gov/hmrc/exports/models/PointerMapping.scala","position":22,"original_position":22,"commit_id":"ffa9b7a969682121c746a567931c5453f1e8ebf4","original_commit_id":"a4802d9f4f6b3a7383bc92fc2f50a5a2128fe0e6","user":{"login":"ed0906","id":4864094,"node_id":"MDQ6VXNlcjQ4NjQwOTQ=","avatar_url":"https://avatars1.githubusercontent.com/u/4864094?v=4","gravatar_id":"","url":"https://api.github.com/users/ed0906","html_url":"https://github.com/ed0906","followers_url":"https://api.github.com/users/ed0906/followers","following_url":"https://api.github.com/users/ed0906/following{/other_user}","gists_url":"https://api.github.com/users/ed0906/gists{/gist_id}","starred_url":"https://api.github.com/users/ed0906/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ed0906/subscriptions","organizations_url":"https://api.github.com/users/ed0906/orgs","repos_url":"https://api.github.com/users/ed0906/repos","events_url":"https://api.github.com/users/ed0906/events{/privacy}","received_events_url":"https://api.github.com/users/ed0906/received_events","type":"User","site_admin":false},"body":"Steve G has a mapping file, perhaps we can use the work you did in the wco-dec eventually to at least generate the left hand side of the mapping (`42A.26B.123.ABC` bit)\r\nThat way we'd know if we need to be handling it based on the schema","created_at":"2019-10-09T14:33:07Z","updated_at":"2019-10-09T14:33:07Z","html_url":"https://github.com/hmrc/customs-declare-exports/pull/111#discussion_r333049152","pull_request_url":"https://api.github.com/repos/hmrc/customs-declare-exports/pulls/111","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/hmrc/customs-declare-exports/pulls/comments/333049152"},"html":{"href":"https://github.com/hmrc/customs-declare-exports/pull/111#discussion_r333049152"},"pull_request":{"href":"https://api.github.com/repos/hmrc/customs-declare-exports/pulls/111"}},"in_reply_to_id":333031055},"pull_request":{"url":"https://api.github.com/repos/hmrc/customs-declare-exports/pulls/111","id":326115944,"node_id":"MDExOlB1bGxSZXF1ZXN0MzI2MTE1OTQ0","html_url":"https://github.com/hmrc/customs-declare-exports/pull/111","diff_url":"https://github.com/hmrc/customs-declare-exports/pull/111.diff","patch_url":"https://github.com/hmrc/customs-declare-exports/pull/111.patch","issue_url":"https://api.github.com/repos/hmrc/customs-declare-exports/issues/111","number":111,"state":"open","locked":false,"title":"CEDS-1695 WCO to Exports Pointer Mapping","user":{"login":"ed0906","id":4864094,"node_id":"MDQ6VXNlcjQ4NjQwOTQ=","avatar_url":"https://avatars1.githubusercontent.com/u/4864094?v=4","gravatar_id":"","url":"https://api.github.com/users/ed0906","html_url":"https://github.com/ed0906","followers_url":"https://api.github.com/users/ed0906/followers","following_url":"https://api.github.com/users/ed0906/following{/other_user}","gists_url":"https://api.github.com/users/ed0906/gists{/gist_id}","starred_url":"https://api.github.com/users/ed0906/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ed0906/subscriptions","organizations_url":"https://api.github.com/users/ed0906/orgs","repos_url":"https://api.github.com/users/ed0906/repos","events_url":"https://api.github.com/users/ed0906/events{/privacy}","received_events_url":"https://api.github.com/users/ed0906/received_events","type":"User","site_admin":false},"body":"This maps notifications with error blocks e.g.\r\n```\r\n<_2_1:Error>\r\n        <_2_1:ValidationCode>CDS10020</_2_1:ValidationCode>\r\n        <_2_1:Pointer>\r\n          <_2_1:DocumentSectionCode>42A</_2_1:DocumentSectionCode>\r\n          <_2_1:TagID>D026</_2_1:TagID> FunctionalReferenceID\r\n        </_2_1:Pointer>\r\n</_2_1:Error>\r\n```\r\nTo our notification model with a \"pointer\" field which corresponds to what that field is in our model\r\n\r\n```\r\n\"actionId\": \"...\",\r\n// .... other Notification fields...\r\n\"errors\" : [\r\n        {\r\n            \"validationCode\" : \"CDS10020\",\r\n            \"pointer\" : \"declaration.consignmentReferences.lrn\"\r\n        }\r\n    ]\r\n```\r\n\r\nThis also works when the xml `Pointer` refers to a Sequence\r\nIn this case our Notification model will look like:\r\n```\r\n\"actionId\": \"...\",\r\n// .... other Notification fields...\r\n\"errors\" : [\r\n        {\r\n            \"validationCode\" : \"CDS10020\",\r\n            \"pointer\" : \"declaration.consignmentReferences.0.lrn\"\r\n        }\r\n    ]\r\n```\r\nWhere the 0 would be the index in the `ConsignmentReferences` sequence that the error applies to.\r\n\r\n### How this can be used in the front end to link to a field\r\nIn the front end we can then use the `\"declaration.consignmentReferences.0.lrn\"` by doing something along the lines of:\r\n- Swap out the numerical sections with a `$` or other symbol e.g. `\"declaration.consignmentReferences.$.lrn\"` \r\n- Have a Messages file entry for that which is the Field Name (Phase 1)","created_at":"2019-10-09T07:50:57Z","updated_at":"2019-10-09T14:33:07Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a881045ba0e9ffb11769fbfd3b8f5d88748c6a00","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/hmrc/customs-declare-exports/pulls/111/commits","review_comments_url":"https://api.github.com/repos/hmrc/customs-declare-exports/pulls/111/comments","review_comment_url":"https://api.github.com/repos/hmrc/customs-declare-exports/pulls/comments{/number}","comments_url":"https://api.github.com/repos/hmrc/customs-declare-exports/issues/111/comments","statuses_url":"https://api.github.com/repos/hmrc/customs-declare-exports/statuses/ffa9b7a969682121c746a567931c5453f1e8ebf4","head":{"label":"hmrc:CEDS-1695","ref":"CEDS-1695","sha":"ffa9b7a969682121c746a567931c5453f1e8ebf4","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":148610528,"node_id":"MDEwOlJlcG9zaXRvcnkxNDg2MTA1Mjg=","name":"customs-declare-exports","full_name":"hmrc/customs-declare-exports","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/customs-declare-exports","description":null,"fork":false,"url":"https://api.github.com/repos/hmrc/customs-declare-exports","forks_url":"https://api.github.com/repos/hmrc/customs-declare-exports/forks","keys_url":"https://api.github.com/repos/hmrc/customs-declare-exports/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hmrc/customs-declare-exports/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hmrc/customs-declare-exports/teams","hooks_url":"https://api.github.com/repos/hmrc/customs-declare-exports/hooks","issue_events_url":"https://api.github.com/repos/hmrc/customs-declare-exports/issues/events{/number}","events_url":"https://api.github.com/repos/hmrc/customs-declare-exports/events","assignees_url":"https://api.github.com/repos/hmrc/customs-declare-exports/assignees{/user}","branches_url":"https://api.github.com/repos/hmrc/customs-declare-exports/branches{/branch}","tags_url":"https://api.github.com/repos/hmrc/customs-declare-exports/tags","blobs_url":"https://api.github.com/repos/hmrc/customs-declare-exports/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hmrc/customs-declare-exports/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hmrc/customs-declare-exports/git/refs{/sha}","trees_url":"https://api.github.com/repos/hmrc/customs-declare-exports/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hmrc/customs-declare-exports/statuses/{sha}","languages_url":"https://api.github.com/repos/hmrc/customs-declare-exports/languages","stargazers_url":"https://api.github.com/repos/hmrc/customs-declare-exports/stargazers","contributors_url":"https://api.github.com/repos/hmrc/customs-declare-exports/contributors","subscribers_url":"https://api.github.com/repos/hmrc/customs-declare-exports/subscribers","subscription_url":"https://api.github.com/repos/hmrc/customs-declare-exports/subscription","commits_url":"https://api.github.com/repos/hmrc/customs-declare-exports/commits{/sha}","git_commits_url":"https://api.github.com/repos/hmrc/customs-declare-exports/git/commits{/sha}","comments_url":"https://api.github.com/repos/hmrc/customs-declare-exports/comments{/number}","issue_comment_url":"https://api.github.com/repos/hmrc/customs-declare-exports/issues/comments{/number}","contents_url":"https://api.github.com/repos/hmrc/customs-declare-exports/contents/{+path}","compare_url":"https://api.github.com/repos/hmrc/customs-declare-exports/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hmrc/customs-declare-exports/merges","archive_url":"https://api.github.com/repos/hmrc/customs-declare-exports/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hmrc/customs-declare-exports/downloads","issues_url":"https://api.github.com/repos/hmrc/customs-declare-exports/issues{/number}","pulls_url":"https://api.github.com/repos/hmrc/customs-declare-exports/pulls{/number}","milestones_url":"https://api.github.com/repos/hmrc/customs-declare-exports/milestones{/number}","notifications_url":"https://api.github.com/repos/hmrc/customs-declare-exports/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hmrc/customs-declare-exports/labels{/name}","releases_url":"https://api.github.com/repos/hmrc/customs-declare-exports/releases{/id}","deployments_url":"https://api.github.com/repos/hmrc/customs-declare-exports/deployments","created_at":"2018-09-13T08:55:42Z","updated_at":"2019-10-09T08:10:31Z","pushed_at":"2019-10-09T14:13:05Z","git_url":"git://github.com/hmrc/customs-declare-exports.git","ssh_url":"git@github.com:hmrc/customs-declare-exports.git","clone_url":"https://github.com/hmrc/customs-declare-exports.git","svn_url":"https://github.com/hmrc/customs-declare-exports","homepage":"","size":785,"stargazers_count":2,"watchers_count":2,"language":"Scala","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"disabled":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":0,"open_issues":3,"watchers":2,"default_branch":"master"}},"base":{"label":"hmrc:master","ref":"master","sha":"86bbd011e8b976862f8771d67a9852158e00cded","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":148610528,"node_id":"MDEwOlJlcG9zaXRvcnkxNDg2MTA1Mjg=","name":"customs-declare-exports","full_name":"hmrc/customs-declare-exports","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/customs-declare-exports","description":null,"fork":false,"url":"https://api.github.com/repos/hmrc/customs-declare-exports","forks_url":"https://api.github.com/repos/hmrc/customs-declare-exports/forks","keys_url":"https://api.github.com/repos/hmrc/customs-declare-exports/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hmrc/customs-declare-exports/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hmrc/customs-declare-exports/teams","hooks_url":"https://api.github.com/repos/hmrc/customs-declare-exports/hooks","issue_events_url":"https://api.github.com/repos/hmrc/customs-declare-exports/issues/events{/number}","events_url":"https://api.github.com/repos/hmrc/customs-declare-exports/events","assignees_url":"https://api.github.com/repos/hmrc/customs-declare-exports/assignees{/user}","branches_url":"https://api.github.com/repos/hmrc/customs-declare-exports/branches{/branch}","tags_url":"https://api.github.com/repos/hmrc/customs-declare-exports/tags","blobs_url":"https://api.github.com/repos/hmrc/customs-declare-exports/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hmrc/customs-declare-exports/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hmrc/customs-declare-exports/git/refs{/sha}","trees_url":"https://api.github.com/repos/hmrc/customs-declare-exports/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hmrc/customs-declare-exports/statuses/{sha}","languages_url":"https://api.github.com/repos/hmrc/customs-declare-exports/languages","stargazers_url":"https://api.github.com/repos/hmrc/customs-declare-exports/stargazers","contributors_url":"https://api.github.com/repos/hmrc/customs-declare-exports/contributors","subscribers_url":"https://api.github.com/repos/hmrc/customs-declare-exports/subscribers","subscription_url":"https://api.github.com/repos/hmrc/customs-declare-exports/subscription","commits_url":"https://api.github.com/repos/hmrc/customs-declare-exports/commits{/sha}","git_commits_url":"https://api.github.com/repos/hmrc/customs-declare-exports/git/commits{/sha}","comments_url":"https://api.github.com/repos/hmrc/customs-declare-exports/comments{/number}","issue_comment_url":"https://api.github.com/repos/hmrc/customs-declare-exports/issues/comments{/number}","contents_url":"https://api.github.com/repos/hmrc/customs-declare-exports/contents/{+path}","compare_url":"https://api.github.com/repos/hmrc/customs-declare-exports/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hmrc/customs-declare-exports/merges","archive_url":"https://api.github.com/repos/hmrc/customs-declare-exports/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hmrc/customs-declare-exports/downloads","issues_url":"https://api.github.com/repos/hmrc/customs-declare-exports/issues{/number}","pulls_url":"https://api.github.com/repos/hmrc/customs-declare-exports/pulls{/number}","milestones_url":"https://api.github.com/repos/hmrc/customs-declare-exports/milestones{/number}","notifications_url":"https://api.github.com/repos/hmrc/customs-declare-exports/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hmrc/customs-declare-exports/labels{/name}","releases_url":"https://api.github.com/repos/hmrc/customs-declare-exports/releases{/id}","deployments_url":"https://api.github.com/repos/hmrc/customs-declare-exports/deployments","created_at":"2018-09-13T08:55:42Z","updated_at":"2019-10-09T08:10:31Z","pushed_at":"2019-10-09T14:13:05Z","git_url":"git://github.com/hmrc/customs-declare-exports.git","ssh_url":"git@github.com:hmrc/customs-declare-exports.git","clone_url":"https://github.com/hmrc/customs-declare-exports.git","svn_url":"https://github.com/hmrc/customs-declare-exports","homepage":"","size":785,"stargazers_count":2,"watchers_count":2,"language":"Scala","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"disabled":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":0,"open_issues":3,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/hmrc/customs-declare-exports/pulls/111"},"html":{"href":"https://github.com/hmrc/customs-declare-exports/pull/111"},"issue":{"href":"https://api.github.com/repos/hmrc/customs-declare-exports/issues/111"},"comments":{"href":"https://api.github.com/repos/hmrc/customs-declare-exports/issues/111/comments"},"review_comments":{"href":"https://api.github.com/repos/hmrc/customs-declare-exports/pulls/111/comments"},"review_comment":{"href":"https://api.github.com/repos/hmrc/customs-declare-exports/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/hmrc/customs-declare-exports/pulls/111/commits"},"statuses":{"href":"https://api.github.com/repos/hmrc/customs-declare-exports/statuses/ffa9b7a969682121c746a567931c5453f1e8ebf4"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"ed0906"}}