{"action":"created","comment":{"url":"https://api.github.com/repos/openenglish/pp-api-gateway/pulls/comments/40800870","id":40800870,"diff_hunk":"@@ -0,0 +1,67 @@\n+package com.openenglish.pp.service.validation;\n+\n+import org.springframework.stereotype.Component;\n+\n+import java.util.Arrays;\n+import java.util.InputMismatchException;\n+import java.util.List;\n+\n+@Component\n+public class CPFValidator {\n+\n+  /**\n+   * Invalid default cpfs\n+   */\n+  private static List<String> invalidCPF = Arrays.asList(\"00000000000\", \"11111111111\", \"22222222222\",\n+                                                         \"33333333333\", \"44444444444\", \"55555555555\", \"66666666666\",\n+                                                         \"77777777777\", \"888888888888\", \"99999999999\");\n+\n+  /**\n+   * @return false if its an invalid CPF number.\n+   */\n+  public boolean isCPF(String cpf) {\n+    if (invalidCPF.contains(cpf)) {\n+      return false;\n+    }\n+\n+    if (cpf.length() != 11) {\n+      return false;\n+    }\n+\n+    try {\n+      // Calculate first verified digit (10th position on CPF)\n+      int firstDigit = calculateDigit(9, cpf, 10);\n+      // Calculate second verified digit (11th position on CPF)\n+      int secondDigit = calculateDigit(10, cpf, 11);\n+\n+      // Verify if the two digits equals the two digits submitted by the user\n+      if ((firstDigit == cpf.charAt(9)) && (secondDigit == cpf.charAt(10))) {\n+        return (true);","path":"pp-api-gateway-service/src/main/java/com/openenglish/pp/service/validation/CPFValidator.java","position":39,"original_position":39,"commit_id":"3a00108f09fb3c943afccc88b59d25f7c7546468","original_commit_id":"3a00108f09fb3c943afccc88b59d25f7c7546468","user":{"login":"ecaravatti","id":1544920,"avatar_url":"https://avatars.githubusercontent.com/u/1544920?v=3","gravatar_id":"","url":"https://api.github.com/users/ecaravatti","html_url":"https://github.com/ecaravatti","followers_url":"https://api.github.com/users/ecaravatti/followers","following_url":"https://api.github.com/users/ecaravatti/following{/other_user}","gists_url":"https://api.github.com/users/ecaravatti/gists{/gist_id}","starred_url":"https://api.github.com/users/ecaravatti/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ecaravatti/subscriptions","organizations_url":"https://api.github.com/users/ecaravatti/orgs","repos_url":"https://api.github.com/users/ecaravatti/repos","events_url":"https://api.github.com/users/ecaravatti/events{/privacy}","received_events_url":"https://api.github.com/users/ecaravatti/received_events","type":"User","site_admin":false},"body":"why the parenthesis?","created_at":"2015-09-30T14:34:22Z","updated_at":"2015-09-30T14:34:22Z","html_url":"https://github.com/openenglish/pp-api-gateway/pull/18#discussion_r40800870","pull_request_url":"https://api.github.com/repos/openenglish/pp-api-gateway/pulls/18","_links":{"self":{"href":"https://api.github.com/repos/openenglish/pp-api-gateway/pulls/comments/40800870"},"html":{"href":"https://github.com/openenglish/pp-api-gateway/pull/18#discussion_r40800870"},"pull_request":{"href":"https://api.github.com/repos/openenglish/pp-api-gateway/pulls/18"}}},"pull_request":{"url":"https://api.github.com/repos/openenglish/pp-api-gateway/pulls/18","id":46407599,"html_url":"https://github.com/openenglish/pp-api-gateway/pull/18","diff_url":"https://github.com/openenglish/pp-api-gateway/pull/18.diff","patch_url":"https://github.com/openenglish/pp-api-gateway/pull/18.patch","issue_url":"https://api.github.com/repos/openenglish/pp-api-gateway/issues/18","number":18,"state":"open","locked":false,"title":"Validation","user":{"login":"johntran777","id":1626553,"avatar_url":"https://avatars.githubusercontent.com/u/1626553?v=3","gravatar_id":"","url":"https://api.github.com/users/johntran777","html_url":"https://github.com/johntran777","followers_url":"https://api.github.com/users/johntran777/followers","following_url":"https://api.github.com/users/johntran777/following{/other_user}","gists_url":"https://api.github.com/users/johntran777/gists{/gist_id}","starred_url":"https://api.github.com/users/johntran777/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/johntran777/subscriptions","organizations_url":"https://api.github.com/users/johntran777/orgs","repos_url":"https://api.github.com/users/johntran777/repos","events_url":"https://api.github.com/users/johntran777/events{/privacy}","received_events_url":"https://api.github.com/users/johntran777/received_events","type":"User","site_admin":false},"body":"Please review and merge.","created_at":"2015-09-30T14:19:47Z","updated_at":"2015-09-30T14:34:22Z","closed_at":null,"merged_at":null,"merge_commit_sha":"30306731b119289fb2f6b4c847aa34a144ff8cdd","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/openenglish/pp-api-gateway/pulls/18/commits","review_comments_url":"https://api.github.com/repos/openenglish/pp-api-gateway/pulls/18/comments","review_comment_url":"https://api.github.com/repos/openenglish/pp-api-gateway/pulls/comments{/number}","comments_url":"https://api.github.com/repos/openenglish/pp-api-gateway/issues/18/comments","statuses_url":"https://api.github.com/repos/openenglish/pp-api-gateway/statuses/3a00108f09fb3c943afccc88b59d25f7c7546468","head":{"label":"openenglish:validation","ref":"validation","sha":"3a00108f09fb3c943afccc88b59d25f7c7546468","user":{"login":"openenglish","id":2280802,"avatar_url":"https://avatars.githubusercontent.com/u/2280802?v=3","gravatar_id":"","url":"https://api.github.com/users/openenglish","html_url":"https://github.com/openenglish","followers_url":"https://api.github.com/users/openenglish/followers","following_url":"https://api.github.com/users/openenglish/following{/other_user}","gists_url":"https://api.github.com/users/openenglish/gists{/gist_id}","starred_url":"https://api.github.com/users/openenglish/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openenglish/subscriptions","organizations_url":"https://api.github.com/users/openenglish/orgs","repos_url":"https://api.github.com/users/openenglish/repos","events_url":"https://api.github.com/users/openenglish/events{/privacy}","received_events_url":"https://api.github.com/users/openenglish/received_events","type":"Organization","site_admin":false},"repo":{"id":41930885,"name":"pp-api-gateway","full_name":"openenglish/pp-api-gateway","owner":{"login":"openenglish","id":2280802,"avatar_url":"https://avatars.githubusercontent.com/u/2280802?v=3","gravatar_id":"","url":"https://api.github.com/users/openenglish","html_url":"https://github.com/openenglish","followers_url":"https://api.github.com/users/openenglish/followers","following_url":"https://api.github.com/users/openenglish/following{/other_user}","gists_url":"https://api.github.com/users/openenglish/gists{/gist_id}","starred_url":"https://api.github.com/users/openenglish/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openenglish/subscriptions","organizations_url":"https://api.github.com/users/openenglish/orgs","repos_url":"https://api.github.com/users/openenglish/repos","events_url":"https://api.github.com/users/openenglish/events{/privacy}","received_events_url":"https://api.github.com/users/openenglish/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/openenglish/pp-api-gateway","description":"","fork":false,"url":"https://api.github.com/repos/openenglish/pp-api-gateway","forks_url":"https://api.github.com/repos/openenglish/pp-api-gateway/forks","keys_url":"https://api.github.com/repos/openenglish/pp-api-gateway/keys{/key_id}","collaborators_url":"https://api.github.com/repos/openenglish/pp-api-gateway/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/openenglish/pp-api-gateway/teams","hooks_url":"https://api.github.com/repos/openenglish/pp-api-gateway/hooks","issue_events_url":"https://api.github.com/repos/openenglish/pp-api-gateway/issues/events{/number}","events_url":"https://api.github.com/repos/openenglish/pp-api-gateway/events","assignees_url":"https://api.github.com/repos/openenglish/pp-api-gateway/assignees{/user}","branches_url":"https://api.github.com/repos/openenglish/pp-api-gateway/branches{/branch}","tags_url":"https://api.github.com/repos/openenglish/pp-api-gateway/tags","blobs_url":"https://api.github.com/repos/openenglish/pp-api-gateway/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/openenglish/pp-api-gateway/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/openenglish/pp-api-gateway/git/refs{/sha}","trees_url":"https://api.github.com/repos/openenglish/pp-api-gateway/git/trees{/sha}","statuses_url":"https://api.github.com/repos/openenglish/pp-api-gateway/statuses/{sha}","languages_url":"https://api.github.com/repos/openenglish/pp-api-gateway/languages","stargazers_url":"https://api.github.com/repos/openenglish/pp-api-gateway/stargazers","contributors_url":"https://api.github.com/repos/openenglish/pp-api-gateway/contributors","subscribers_url":"https://api.github.com/repos/openenglish/pp-api-gateway/subscribers","subscription_url":"https://api.github.com/repos/openenglish/pp-api-gateway/subscription","commits_url":"https://api.github.com/repos/openenglish/pp-api-gateway/commits{/sha}","git_commits_url":"https://api.github.com/repos/openenglish/pp-api-gateway/git/commits{/sha}","comments_url":"https://api.github.com/repos/openenglish/pp-api-gateway/comments{/number}","issue_comment_url":"https://api.github.com/repos/openenglish/pp-api-gateway/issues/comments{/number}","contents_url":"https://api.github.com/repos/openenglish/pp-api-gateway/contents/{+path}","compare_url":"https://api.github.com/repos/openenglish/pp-api-gateway/compare/{base}...{head}","merges_url":"https://api.github.com/repos/openenglish/pp-api-gateway/merges","archive_url":"https://api.github.com/repos/openenglish/pp-api-gateway/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/openenglish/pp-api-gateway/downloads","issues_url":"https://api.github.com/repos/openenglish/pp-api-gateway/issues{/number}","pulls_url":"https://api.github.com/repos/openenglish/pp-api-gateway/pulls{/number}","milestones_url":"https://api.github.com/repos/openenglish/pp-api-gateway/milestones{/number}","notifications_url":"https://api.github.com/repos/openenglish/pp-api-gateway/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/openenglish/pp-api-gateway/labels{/name}","releases_url":"https://api.github.com/repos/openenglish/pp-api-gateway/releases{/id}","created_at":"2015-09-04T18:12:25Z","updated_at":"2015-09-04T18:27:13Z","pushed_at":"2015-09-30T14:24:09Z","git_url":"git://github.com/openenglish/pp-api-gateway.git","ssh_url":"git@github.com:openenglish/pp-api-gateway.git","clone_url":"https://github.com/openenglish/pp-api-gateway.git","svn_url":"https://github.com/openenglish/pp-api-gateway","homepage":null,"size":740,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"openenglish:master","ref":"master","sha":"aad7ec01532e3d9e1f33c042efcac00b857a05a3","user":{"login":"openenglish","id":2280802,"avatar_url":"https://avatars.githubusercontent.com/u/2280802?v=3","gravatar_id":"","url":"https://api.github.com/users/openenglish","html_url":"https://github.com/openenglish","followers_url":"https://api.github.com/users/openenglish/followers","following_url":"https://api.github.com/users/openenglish/following{/other_user}","gists_url":"https://api.github.com/users/openenglish/gists{/gist_id}","starred_url":"https://api.github.com/users/openenglish/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openenglish/subscriptions","organizations_url":"https://api.github.com/users/openenglish/orgs","repos_url":"https://api.github.com/users/openenglish/repos","events_url":"https://api.github.com/users/openenglish/events{/privacy}","received_events_url":"https://api.github.com/users/openenglish/received_events","type":"Organization","site_admin":false},"repo":{"id":41930885,"name":"pp-api-gateway","full_name":"openenglish/pp-api-gateway","owner":{"login":"openenglish","id":2280802,"avatar_url":"https://avatars.githubusercontent.com/u/2280802?v=3","gravatar_id":"","url":"https://api.github.com/users/openenglish","html_url":"https://github.com/openenglish","followers_url":"https://api.github.com/users/openenglish/followers","following_url":"https://api.github.com/users/openenglish/following{/other_user}","gists_url":"https://api.github.com/users/openenglish/gists{/gist_id}","starred_url":"https://api.github.com/users/openenglish/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openenglish/subscriptions","organizations_url":"https://api.github.com/users/openenglish/orgs","repos_url":"https://api.github.com/users/openenglish/repos","events_url":"https://api.github.com/users/openenglish/events{/privacy}","received_events_url":"https://api.github.com/users/openenglish/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/openenglish/pp-api-gateway","description":"","fork":false,"url":"https://api.github.com/repos/openenglish/pp-api-gateway","forks_url":"https://api.github.com/repos/openenglish/pp-api-gateway/forks","keys_url":"https://api.github.com/repos/openenglish/pp-api-gateway/keys{/key_id}","collaborators_url":"https://api.github.com/repos/openenglish/pp-api-gateway/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/openenglish/pp-api-gateway/teams","hooks_url":"https://api.github.com/repos/openenglish/pp-api-gateway/hooks","issue_events_url":"https://api.github.com/repos/openenglish/pp-api-gateway/issues/events{/number}","events_url":"https://api.github.com/repos/openenglish/pp-api-gateway/events","assignees_url":"https://api.github.com/repos/openenglish/pp-api-gateway/assignees{/user}","branches_url":"https://api.github.com/repos/openenglish/pp-api-gateway/branches{/branch}","tags_url":"https://api.github.com/repos/openenglish/pp-api-gateway/tags","blobs_url":"https://api.github.com/repos/openenglish/pp-api-gateway/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/openenglish/pp-api-gateway/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/openenglish/pp-api-gateway/git/refs{/sha}","trees_url":"https://api.github.com/repos/openenglish/pp-api-gateway/git/trees{/sha}","statuses_url":"https://api.github.com/repos/openenglish/pp-api-gateway/statuses/{sha}","languages_url":"https://api.github.com/repos/openenglish/pp-api-gateway/languages","stargazers_url":"https://api.github.com/repos/openenglish/pp-api-gateway/stargazers","contributors_url":"https://api.github.com/repos/openenglish/pp-api-gateway/contributors","subscribers_url":"https://api.github.com/repos/openenglish/pp-api-gateway/subscribers","subscription_url":"https://api.github.com/repos/openenglish/pp-api-gateway/subscription","commits_url":"https://api.github.com/repos/openenglish/pp-api-gateway/commits{/sha}","git_commits_url":"https://api.github.com/repos/openenglish/pp-api-gateway/git/commits{/sha}","comments_url":"https://api.github.com/repos/openenglish/pp-api-gateway/comments{/number}","issue_comment_url":"https://api.github.com/repos/openenglish/pp-api-gateway/issues/comments{/number}","contents_url":"https://api.github.com/repos/openenglish/pp-api-gateway/contents/{+path}","compare_url":"https://api.github.com/repos/openenglish/pp-api-gateway/compare/{base}...{head}","merges_url":"https://api.github.com/repos/openenglish/pp-api-gateway/merges","archive_url":"https://api.github.com/repos/openenglish/pp-api-gateway/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/openenglish/pp-api-gateway/downloads","issues_url":"https://api.github.com/repos/openenglish/pp-api-gateway/issues{/number}","pulls_url":"https://api.github.com/repos/openenglish/pp-api-gateway/pulls{/number}","milestones_url":"https://api.github.com/repos/openenglish/pp-api-gateway/milestones{/number}","notifications_url":"https://api.github.com/repos/openenglish/pp-api-gateway/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/openenglish/pp-api-gateway/labels{/name}","releases_url":"https://api.github.com/repos/openenglish/pp-api-gateway/releases{/id}","created_at":"2015-09-04T18:12:25Z","updated_at":"2015-09-04T18:27:13Z","pushed_at":"2015-09-30T14:24:09Z","git_url":"git://github.com/openenglish/pp-api-gateway.git","ssh_url":"git@github.com:openenglish/pp-api-gateway.git","clone_url":"https://github.com/openenglish/pp-api-gateway.git","svn_url":"https://github.com/openenglish/pp-api-gateway","homepage":null,"size":740,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/openenglish/pp-api-gateway/pulls/18"},"html":{"href":"https://github.com/openenglish/pp-api-gateway/pull/18"},"issue":{"href":"https://api.github.com/repos/openenglish/pp-api-gateway/issues/18"},"comments":{"href":"https://api.github.com/repos/openenglish/pp-api-gateway/issues/18/comments"},"review_comments":{"href":"https://api.github.com/repos/openenglish/pp-api-gateway/pulls/18/comments"},"review_comment":{"href":"https://api.github.com/repos/openenglish/pp-api-gateway/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/openenglish/pp-api-gateway/pulls/18/commits"},"statuses":{"href":"https://api.github.com/repos/openenglish/pp-api-gateway/statuses/3a00108f09fb3c943afccc88b59d25f7c7546468"}}}}