{"action":"created","comment":{"url":"https://api.github.com/repos/Kurry/moneytransfer/pulls/comments/215788356","pull_request_review_id":153134309,"id":215788356,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxNTc4ODM1Ng==","diff_hunk":"@@ -25,53 +28,59 @@\n             asyncResponse.resume(Response.status(Response.Status.SERVICE_UNAVAILABLE)\n             .entity(\"Operation timed out.\").build());\n     private static final Logger log = LoggerFactory.getLogger(TransactionsResource.class);\n-    private final TransactionsDao transactionsDao;\n-    private final AccountDao accountDao;\n     private final Executor executor;\n     private final TransactionProcessingService processingService;\n     private final BlockingQueue<Transaction> queue;\n+    private final TransactionsService service;\n \n-    public TransactionsResource(TransactionsDao transactionsDao, AccountDao accountDao) {\n-        this(transactionsDao, accountDao, Executors.newSingleThreadExecutor());\n-    }\n-\n-    public TransactionsResource(TransactionsDao transactionsDao, AccountDao accountDao, Executor executor) {\n-        this.transactionsDao = transactionsDao;\n-        this.accountDao = accountDao;\n-        this.executor = executor;\n+    public TransactionsResource(TransactionsService transactionsService) {\n+        this.service = transactionsService;\n+        this.executor = Executors.newSingleThreadExecutor();\n         this.queue = new ArrayBlockingQueue<>(MAX_TRANSACTIONS);\n-        this.processingService = new TransactionProcessingService(queue, transactionsDao);\n+        this.processingService = new TransactionProcessingService(queue, transactionsService);\n+        this.processingService.startAsync();\n     }\n \n     @POST\n+    @NotNull\n     @Path(\"/accounts/{id}/transactions\")\n-    public Transaction sendMoney(@PathParam(\"id\") String id, @NotNull @Valid Transaction transaction) {\n-        validateRequest(id, transaction);\n-        Transaction response = transactionsDao.sendMoney(id, transaction);\n-        if (response == null || response.getStatus() == TransactionStatus.FAILED) {\n-            throw new WebApplicationException(\"transaction failed\", Response.Status.PAYMENT_REQUIRED);\n+    public Transaction sendMoney(@PathParam(\"id\") String id,\n+                                 @NotNull @Valid Transaction transaction) {\n+        Transaction response = null;\n+        try {\n+            response = service.sendMoney(id, transaction);\n+        } catch (PersistenceLayerException e) {\n+            e.printStackTrace();","path":"src/main/java/com/interview/TransactionsResource.java","position":60,"original_position":60,"commit_id":"4e084692985ccae1f7d765747e31a1a27a310d2e","original_commit_id":"4e084692985ccae1f7d765747e31a1a27a310d2e","user":{"login":"Kurry","id":857247,"node_id":"MDQ6VXNlcjg1NzI0Nw==","avatar_url":"https://avatars2.githubusercontent.com/u/857247?v=4","gravatar_id":"","url":"https://api.github.com/users/Kurry","html_url":"https://github.com/Kurry","followers_url":"https://api.github.com/users/Kurry/followers","following_url":"https://api.github.com/users/Kurry/following{/other_user}","gists_url":"https://api.github.com/users/Kurry/gists{/gist_id}","starred_url":"https://api.github.com/users/Kurry/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kurry/subscriptions","organizations_url":"https://api.github.com/users/Kurry/orgs","repos_url":"https://api.github.com/users/Kurry/repos","events_url":"https://api.github.com/users/Kurry/events{/privacy}","received_events_url":"https://api.github.com/users/Kurry/received_events","type":"User","site_admin":false},"body":"// this still needs to be thrown/handled","created_at":"2018-09-06T21:44:33Z","updated_at":"2018-09-06T21:44:34Z","html_url":"https://github.com/Kurry/moneytransfer/pull/1#discussion_r215788356","pull_request_url":"https://api.github.com/repos/Kurry/moneytransfer/pulls/1","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/Kurry/moneytransfer/pulls/comments/215788356"},"html":{"href":"https://github.com/Kurry/moneytransfer/pull/1#discussion_r215788356"},"pull_request":{"href":"https://api.github.com/repos/Kurry/moneytransfer/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/Kurry/moneytransfer/pulls/1","id":213758522,"node_id":"MDExOlB1bGxSZXF1ZXN0MjEzNzU4NTIy","html_url":"https://github.com/Kurry/moneytransfer/pull/1","diff_url":"https://github.com/Kurry/moneytransfer/pull/1.diff","patch_url":"https://github.com/Kurry/moneytransfer/pull/1.patch","issue_url":"https://api.github.com/repos/Kurry/moneytransfer/issues/1","number":1,"state":"open","locked":false,"title":"FOR REVIEW ONLY: Added Transaction Service Layer","user":{"login":"Kurry","id":857247,"node_id":"MDQ6VXNlcjg1NzI0Nw==","avatar_url":"https://avatars2.githubusercontent.com/u/857247?v=4","gravatar_id":"","url":"https://api.github.com/users/Kurry","html_url":"https://github.com/Kurry","followers_url":"https://api.github.com/users/Kurry/followers","following_url":"https://api.github.com/users/Kurry/following{/other_user}","gists_url":"https://api.github.com/users/Kurry/gists{/gist_id}","starred_url":"https://api.github.com/users/Kurry/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kurry/subscriptions","organizations_url":"https://api.github.com/users/Kurry/orgs","repos_url":"https://api.github.com/users/Kurry/repos","events_url":"https://api.github.com/users/Kurry/events{/privacy}","received_events_url":"https://api.github.com/users/Kurry/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-09-06T21:40:26Z","updated_at":"2018-09-06T21:44:34Z","closed_at":null,"merged_at":null,"merge_commit_sha":"18971defc903b5eb73f6daa7b72cfaf46ef978d0","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/Kurry/moneytransfer/pulls/1/commits","review_comments_url":"https://api.github.com/repos/Kurry/moneytransfer/pulls/1/comments","review_comment_url":"https://api.github.com/repos/Kurry/moneytransfer/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Kurry/moneytransfer/issues/1/comments","statuses_url":"https://api.github.com/repos/Kurry/moneytransfer/statuses/4e084692985ccae1f7d765747e31a1a27a310d2e","head":{"label":"Kurry:feature/refactor-transactions-api","ref":"feature/refactor-transactions-api","sha":"4e084692985ccae1f7d765747e31a1a27a310d2e","user":{"login":"Kurry","id":857247,"node_id":"MDQ6VXNlcjg1NzI0Nw==","avatar_url":"https://avatars2.githubusercontent.com/u/857247?v=4","gravatar_id":"","url":"https://api.github.com/users/Kurry","html_url":"https://github.com/Kurry","followers_url":"https://api.github.com/users/Kurry/followers","following_url":"https://api.github.com/users/Kurry/following{/other_user}","gists_url":"https://api.github.com/users/Kurry/gists{/gist_id}","starred_url":"https://api.github.com/users/Kurry/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kurry/subscriptions","organizations_url":"https://api.github.com/users/Kurry/orgs","repos_url":"https://api.github.com/users/Kurry/repos","events_url":"https://api.github.com/users/Kurry/events{/privacy}","received_events_url":"https://api.github.com/users/Kurry/received_events","type":"User","site_admin":false},"repo":{"id":147004474,"node_id":"MDEwOlJlcG9zaXRvcnkxNDcwMDQ0NzQ=","name":"moneytransfer","full_name":"Kurry/moneytransfer","owner":{"login":"Kurry","id":857247,"node_id":"MDQ6VXNlcjg1NzI0Nw==","avatar_url":"https://avatars2.githubusercontent.com/u/857247?v=4","gravatar_id":"","url":"https://api.github.com/users/Kurry","html_url":"https://github.com/Kurry","followers_url":"https://api.github.com/users/Kurry/followers","following_url":"https://api.github.com/users/Kurry/following{/other_user}","gists_url":"https://api.github.com/users/Kurry/gists{/gist_id}","starred_url":"https://api.github.com/users/Kurry/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kurry/subscriptions","organizations_url":"https://api.github.com/users/Kurry/orgs","repos_url":"https://api.github.com/users/Kurry/repos","events_url":"https://api.github.com/users/Kurry/events{/privacy}","received_events_url":"https://api.github.com/users/Kurry/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Kurry/moneytransfer","description":"Circle Take Home Test","fork":false,"url":"https://api.github.com/repos/Kurry/moneytransfer","forks_url":"https://api.github.com/repos/Kurry/moneytransfer/forks","keys_url":"https://api.github.com/repos/Kurry/moneytransfer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Kurry/moneytransfer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Kurry/moneytransfer/teams","hooks_url":"https://api.github.com/repos/Kurry/moneytransfer/hooks","issue_events_url":"https://api.github.com/repos/Kurry/moneytransfer/issues/events{/number}","events_url":"https://api.github.com/repos/Kurry/moneytransfer/events","assignees_url":"https://api.github.com/repos/Kurry/moneytransfer/assignees{/user}","branches_url":"https://api.github.com/repos/Kurry/moneytransfer/branches{/branch}","tags_url":"https://api.github.com/repos/Kurry/moneytransfer/tags","blobs_url":"https://api.github.com/repos/Kurry/moneytransfer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Kurry/moneytransfer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Kurry/moneytransfer/git/refs{/sha}","trees_url":"https://api.github.com/repos/Kurry/moneytransfer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Kurry/moneytransfer/statuses/{sha}","languages_url":"https://api.github.com/repos/Kurry/moneytransfer/languages","stargazers_url":"https://api.github.com/repos/Kurry/moneytransfer/stargazers","contributors_url":"https://api.github.com/repos/Kurry/moneytransfer/contributors","subscribers_url":"https://api.github.com/repos/Kurry/moneytransfer/subscribers","subscription_url":"https://api.github.com/repos/Kurry/moneytransfer/subscription","commits_url":"https://api.github.com/repos/Kurry/moneytransfer/commits{/sha}","git_commits_url":"https://api.github.com/repos/Kurry/moneytransfer/git/commits{/sha}","comments_url":"https://api.github.com/repos/Kurry/moneytransfer/comments{/number}","issue_comment_url":"https://api.github.com/repos/Kurry/moneytransfer/issues/comments{/number}","contents_url":"https://api.github.com/repos/Kurry/moneytransfer/contents/{+path}","compare_url":"https://api.github.com/repos/Kurry/moneytransfer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Kurry/moneytransfer/merges","archive_url":"https://api.github.com/repos/Kurry/moneytransfer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Kurry/moneytransfer/downloads","issues_url":"https://api.github.com/repos/Kurry/moneytransfer/issues{/number}","pulls_url":"https://api.github.com/repos/Kurry/moneytransfer/pulls{/number}","milestones_url":"https://api.github.com/repos/Kurry/moneytransfer/milestones{/number}","notifications_url":"https://api.github.com/repos/Kurry/moneytransfer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Kurry/moneytransfer/labels{/name}","releases_url":"https://api.github.com/repos/Kurry/moneytransfer/releases{/id}","deployments_url":"https://api.github.com/repos/Kurry/moneytransfer/deployments","created_at":"2018-09-01T14:19:23Z","updated_at":"2018-09-06T19:24:26Z","pushed_at":"2018-09-06T21:40:27Z","git_url":"git://github.com/Kurry/moneytransfer.git","ssh_url":"git@github.com:Kurry/moneytransfer.git","clone_url":"https://github.com/Kurry/moneytransfer.git","svn_url":"https://github.com/Kurry/moneytransfer","homepage":"","size":178,"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":1,"license":null,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"Kurry:master","ref":"master","sha":"f1ab5e1b0e4c835ee9123cf9cb6950eca5329671","user":{"login":"Kurry","id":857247,"node_id":"MDQ6VXNlcjg1NzI0Nw==","avatar_url":"https://avatars2.githubusercontent.com/u/857247?v=4","gravatar_id":"","url":"https://api.github.com/users/Kurry","html_url":"https://github.com/Kurry","followers_url":"https://api.github.com/users/Kurry/followers","following_url":"https://api.github.com/users/Kurry/following{/other_user}","gists_url":"https://api.github.com/users/Kurry/gists{/gist_id}","starred_url":"https://api.github.com/users/Kurry/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kurry/subscriptions","organizations_url":"https://api.github.com/users/Kurry/orgs","repos_url":"https://api.github.com/users/Kurry/repos","events_url":"https://api.github.com/users/Kurry/events{/privacy}","received_events_url":"https://api.github.com/users/Kurry/received_events","type":"User","site_admin":false},"repo":{"id":147004474,"node_id":"MDEwOlJlcG9zaXRvcnkxNDcwMDQ0NzQ=","name":"moneytransfer","full_name":"Kurry/moneytransfer","owner":{"login":"Kurry","id":857247,"node_id":"MDQ6VXNlcjg1NzI0Nw==","avatar_url":"https://avatars2.githubusercontent.com/u/857247?v=4","gravatar_id":"","url":"https://api.github.com/users/Kurry","html_url":"https://github.com/Kurry","followers_url":"https://api.github.com/users/Kurry/followers","following_url":"https://api.github.com/users/Kurry/following{/other_user}","gists_url":"https://api.github.com/users/Kurry/gists{/gist_id}","starred_url":"https://api.github.com/users/Kurry/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kurry/subscriptions","organizations_url":"https://api.github.com/users/Kurry/orgs","repos_url":"https://api.github.com/users/Kurry/repos","events_url":"https://api.github.com/users/Kurry/events{/privacy}","received_events_url":"https://api.github.com/users/Kurry/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Kurry/moneytransfer","description":"Circle Take Home Test","fork":false,"url":"https://api.github.com/repos/Kurry/moneytransfer","forks_url":"https://api.github.com/repos/Kurry/moneytransfer/forks","keys_url":"https://api.github.com/repos/Kurry/moneytransfer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Kurry/moneytransfer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Kurry/moneytransfer/teams","hooks_url":"https://api.github.com/repos/Kurry/moneytransfer/hooks","issue_events_url":"https://api.github.com/repos/Kurry/moneytransfer/issues/events{/number}","events_url":"https://api.github.com/repos/Kurry/moneytransfer/events","assignees_url":"https://api.github.com/repos/Kurry/moneytransfer/assignees{/user}","branches_url":"https://api.github.com/repos/Kurry/moneytransfer/branches{/branch}","tags_url":"https://api.github.com/repos/Kurry/moneytransfer/tags","blobs_url":"https://api.github.com/repos/Kurry/moneytransfer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Kurry/moneytransfer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Kurry/moneytransfer/git/refs{/sha}","trees_url":"https://api.github.com/repos/Kurry/moneytransfer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Kurry/moneytransfer/statuses/{sha}","languages_url":"https://api.github.com/repos/Kurry/moneytransfer/languages","stargazers_url":"https://api.github.com/repos/Kurry/moneytransfer/stargazers","contributors_url":"https://api.github.com/repos/Kurry/moneytransfer/contributors","subscribers_url":"https://api.github.com/repos/Kurry/moneytransfer/subscribers","subscription_url":"https://api.github.com/repos/Kurry/moneytransfer/subscription","commits_url":"https://api.github.com/repos/Kurry/moneytransfer/commits{/sha}","git_commits_url":"https://api.github.com/repos/Kurry/moneytransfer/git/commits{/sha}","comments_url":"https://api.github.com/repos/Kurry/moneytransfer/comments{/number}","issue_comment_url":"https://api.github.com/repos/Kurry/moneytransfer/issues/comments{/number}","contents_url":"https://api.github.com/repos/Kurry/moneytransfer/contents/{+path}","compare_url":"https://api.github.com/repos/Kurry/moneytransfer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Kurry/moneytransfer/merges","archive_url":"https://api.github.com/repos/Kurry/moneytransfer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Kurry/moneytransfer/downloads","issues_url":"https://api.github.com/repos/Kurry/moneytransfer/issues{/number}","pulls_url":"https://api.github.com/repos/Kurry/moneytransfer/pulls{/number}","milestones_url":"https://api.github.com/repos/Kurry/moneytransfer/milestones{/number}","notifications_url":"https://api.github.com/repos/Kurry/moneytransfer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Kurry/moneytransfer/labels{/name}","releases_url":"https://api.github.com/repos/Kurry/moneytransfer/releases{/id}","deployments_url":"https://api.github.com/repos/Kurry/moneytransfer/deployments","created_at":"2018-09-01T14:19:23Z","updated_at":"2018-09-06T19:24:26Z","pushed_at":"2018-09-06T21:40:27Z","git_url":"git://github.com/Kurry/moneytransfer.git","ssh_url":"git@github.com:Kurry/moneytransfer.git","clone_url":"https://github.com/Kurry/moneytransfer.git","svn_url":"https://github.com/Kurry/moneytransfer","homepage":"","size":178,"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":1,"license":null,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Kurry/moneytransfer/pulls/1"},"html":{"href":"https://github.com/Kurry/moneytransfer/pull/1"},"issue":{"href":"https://api.github.com/repos/Kurry/moneytransfer/issues/1"},"comments":{"href":"https://api.github.com/repos/Kurry/moneytransfer/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/Kurry/moneytransfer/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/Kurry/moneytransfer/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Kurry/moneytransfer/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/Kurry/moneytransfer/statuses/4e084692985ccae1f7d765747e31a1a27a310d2e"}},"author_association":"OWNER"}}
{"actor":{"display_login":"Kurry"}}