{"action":"created","comment":{"url":"https://api.github.com/repos/me-stevens/payroll/pulls/comments/49096101","id":49096101,"diff_hunk":"@@ -0,0 +1,39 @@\n+package com.mael.payroll.transactions;\n+\n+import com.mael.payroll.Employee;\n+import com.mael.payroll.Paycheck;\n+import com.mael.payroll.PayrollDBFacade;\n+\n+import java.time.LocalDate;\n+import java.util.HashMap;\n+import java.util.Map;\n+\n+public class PayDayTransaction {\n+\n+    private final PayrollDBFacade payrollDB;\n+    private final LocalDate payDay;\n+    private Map<Integer, Paycheck> payChecks;\n+\n+    public PayDayTransaction(PayrollDBFacade payrollDB, LocalDate payDay) {\n+        this.payrollDB = payrollDB;\n+        this.payDay    = payDay;\n+        this.payChecks = new HashMap<>();\n+    }\n+\n+    public void execute() {\n+        for (Map.Entry<Integer, Employee> entry : payrollDB.getAllEmployees().entrySet()) {","path":"src/main/java/com/mael/payroll/transactions/PayDayTransaction.java","position":24,"original_position":24,"commit_id":"a359c1f9ddd22be671854ddcf39c74eda0c95a6f","original_commit_id":"a359c1f9ddd22be671854ddcf39c74eda0c95a6f","user":{"login":"christophgockel","id":190137,"avatar_url":"https://avatars.githubusercontent.com/u/190137?v=3","gravatar_id":"","url":"https://api.github.com/users/christophgockel","html_url":"https://github.com/christophgockel","followers_url":"https://api.github.com/users/christophgockel/followers","following_url":"https://api.github.com/users/christophgockel/following{/other_user}","gists_url":"https://api.github.com/users/christophgockel/gists{/gist_id}","starred_url":"https://api.github.com/users/christophgockel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/christophgockel/subscriptions","organizations_url":"https://api.github.com/users/christophgockel/orgs","repos_url":"https://api.github.com/users/christophgockel/repos","events_url":"https://api.github.com/users/christophgockel/events{/privacy}","received_events_url":"https://api.github.com/users/christophgockel/received_events","type":"User","site_admin":false},"body":"`entry` provides too little information about the actual object it represents.","created_at":"2016-01-07T16:58:32Z","updated_at":"2016-01-07T16:58:32Z","html_url":"https://github.com/me-stevens/payroll/pull/7#discussion_r49096101","pull_request_url":"https://api.github.com/repos/me-stevens/payroll/pulls/7","_links":{"self":{"href":"https://api.github.com/repos/me-stevens/payroll/pulls/comments/49096101"},"html":{"href":"https://github.com/me-stevens/payroll/pull/7#discussion_r49096101"},"pull_request":{"href":"https://api.github.com/repos/me-stevens/payroll/pulls/7"}}},"pull_request":{"url":"https://api.github.com/repos/me-stevens/payroll/pulls/7","id":55358421,"html_url":"https://github.com/me-stevens/payroll/pull/7","diff_url":"https://github.com/me-stevens/payroll/pull/7.diff","patch_url":"https://github.com/me-stevens/payroll/pull/7.patch","issue_url":"https://api.github.com/repos/me-stevens/payroll/issues/7","number":7,"state":"open","locked":false,"title":"Payday for monthly emp","user":{"login":"me-stevens","id":2157089,"avatar_url":"https://avatars.githubusercontent.com/u/2157089?v=3","gravatar_id":"","url":"https://api.github.com/users/me-stevens","html_url":"https://github.com/me-stevens","followers_url":"https://api.github.com/users/me-stevens/followers","following_url":"https://api.github.com/users/me-stevens/following{/other_user}","gists_url":"https://api.github.com/users/me-stevens/gists{/gist_id}","starred_url":"https://api.github.com/users/me-stevens/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/me-stevens/subscriptions","organizations_url":"https://api.github.com/users/me-stevens/orgs","repos_url":"https://api.github.com/users/me-stevens/repos","events_url":"https://api.github.com/users/me-stevens/events{/privacy}","received_events_url":"https://api.github.com/users/me-stevens/received_events","type":"User","site_admin":false},"body":"The paying calculation is quite long so I decided to break it into little steps. Since there are a lot of new objects that I had to add, I started trying to pay a monthly employee first.\r\n\r\nFor that I had to create:\r\n\r\n* A `calculatePay()` method in the payment type interface. At this point it's only implemented for the monthly payment, in the sense that the other methods just return zero for the moment.\r\n* An `isPayDay()` method in the payment schedule interface. Again, it's only implemented for the monthly schedule, the others return a hardcoded false.\r\n* The payment method interface is still empty, but it will contain a `pay()` method that I didn't have to implement yet.\r\n\r\nAlso, introducing the possibility to pay employees has made me have to take care of the dates at this point, since they are needed for the `isPayDay()` check. Thanks god that @christophgockel [suggested to use `LocalDate`](https://github.com/me-stevens/payroll/pull/3#discussion_r49067127), which made things pretty easy (I was going to use `Calendar`):\r\n\r\n```java\r\n    private boolean isLastDayOfMonth(LocalDate date) {\r\n        Month month     = date.getMonth();\r\n        Month nextMonth = date.plusDays(1).getMonth();\r\n        return month != nextMonth;\r\n    }\r\n```\r\n\r\nI had to add a `Paycheck` class too. Also, the deductions due to affiliations of the employee are not taken into account yet in the `getPaid()` method of the `Employee` class, so I am just returning the net pay. This will change in the future and will affect the `Paycheck` class too.\r\n\r\nFinally, I also added methods in the employee class to calculate its pay (`getPaid()`) and to check if it is payday (`isPayDay()`), which are used in the `PayDayTransaction`.\r\n\r\n@ecomba","created_at":"2016-01-07T16:32:29Z","updated_at":"2016-01-07T16:58:32Z","closed_at":null,"merged_at":null,"merge_commit_sha":"67d543a4aaa2b0f78c0525ac56cd689380af5cfa","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/me-stevens/payroll/pulls/7/commits","review_comments_url":"https://api.github.com/repos/me-stevens/payroll/pulls/7/comments","review_comment_url":"https://api.github.com/repos/me-stevens/payroll/pulls/comments{/number}","comments_url":"https://api.github.com/repos/me-stevens/payroll/issues/7/comments","statuses_url":"https://api.github.com/repos/me-stevens/payroll/statuses/a359c1f9ddd22be671854ddcf39c74eda0c95a6f","head":{"label":"me-stevens:payday-for-monthly-emp","ref":"payday-for-monthly-emp","sha":"a359c1f9ddd22be671854ddcf39c74eda0c95a6f","user":{"login":"me-stevens","id":2157089,"avatar_url":"https://avatars.githubusercontent.com/u/2157089?v=3","gravatar_id":"","url":"https://api.github.com/users/me-stevens","html_url":"https://github.com/me-stevens","followers_url":"https://api.github.com/users/me-stevens/followers","following_url":"https://api.github.com/users/me-stevens/following{/other_user}","gists_url":"https://api.github.com/users/me-stevens/gists{/gist_id}","starred_url":"https://api.github.com/users/me-stevens/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/me-stevens/subscriptions","organizations_url":"https://api.github.com/users/me-stevens/orgs","repos_url":"https://api.github.com/users/me-stevens/repos","events_url":"https://api.github.com/users/me-stevens/events{/privacy}","received_events_url":"https://api.github.com/users/me-stevens/received_events","type":"User","site_admin":false},"repo":{"id":48845367,"name":"payroll","full_name":"me-stevens/payroll","owner":{"login":"me-stevens","id":2157089,"avatar_url":"https://avatars.githubusercontent.com/u/2157089?v=3","gravatar_id":"","url":"https://api.github.com/users/me-stevens","html_url":"https://github.com/me-stevens","followers_url":"https://api.github.com/users/me-stevens/followers","following_url":"https://api.github.com/users/me-stevens/following{/other_user}","gists_url":"https://api.github.com/users/me-stevens/gists{/gist_id}","starred_url":"https://api.github.com/users/me-stevens/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/me-stevens/subscriptions","organizations_url":"https://api.github.com/users/me-stevens/orgs","repos_url":"https://api.github.com/users/me-stevens/repos","events_url":"https://api.github.com/users/me-stevens/events{/privacy}","received_events_url":"https://api.github.com/users/me-stevens/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/me-stevens/payroll","description":"TDD Payroll app as seen in \"Principles, Patterns and Practices\"","fork":false,"url":"https://api.github.com/repos/me-stevens/payroll","forks_url":"https://api.github.com/repos/me-stevens/payroll/forks","keys_url":"https://api.github.com/repos/me-stevens/payroll/keys{/key_id}","collaborators_url":"https://api.github.com/repos/me-stevens/payroll/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/me-stevens/payroll/teams","hooks_url":"https://api.github.com/repos/me-stevens/payroll/hooks","issue_events_url":"https://api.github.com/repos/me-stevens/payroll/issues/events{/number}","events_url":"https://api.github.com/repos/me-stevens/payroll/events","assignees_url":"https://api.github.com/repos/me-stevens/payroll/assignees{/user}","branches_url":"https://api.github.com/repos/me-stevens/payroll/branches{/branch}","tags_url":"https://api.github.com/repos/me-stevens/payroll/tags","blobs_url":"https://api.github.com/repos/me-stevens/payroll/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/me-stevens/payroll/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/me-stevens/payroll/git/refs{/sha}","trees_url":"https://api.github.com/repos/me-stevens/payroll/git/trees{/sha}","statuses_url":"https://api.github.com/repos/me-stevens/payroll/statuses/{sha}","languages_url":"https://api.github.com/repos/me-stevens/payroll/languages","stargazers_url":"https://api.github.com/repos/me-stevens/payroll/stargazers","contributors_url":"https://api.github.com/repos/me-stevens/payroll/contributors","subscribers_url":"https://api.github.com/repos/me-stevens/payroll/subscribers","subscription_url":"https://api.github.com/repos/me-stevens/payroll/subscription","commits_url":"https://api.github.com/repos/me-stevens/payroll/commits{/sha}","git_commits_url":"https://api.github.com/repos/me-stevens/payroll/git/commits{/sha}","comments_url":"https://api.github.com/repos/me-stevens/payroll/comments{/number}","issue_comment_url":"https://api.github.com/repos/me-stevens/payroll/issues/comments{/number}","contents_url":"https://api.github.com/repos/me-stevens/payroll/contents/{+path}","compare_url":"https://api.github.com/repos/me-stevens/payroll/compare/{base}...{head}","merges_url":"https://api.github.com/repos/me-stevens/payroll/merges","archive_url":"https://api.github.com/repos/me-stevens/payroll/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/me-stevens/payroll/downloads","issues_url":"https://api.github.com/repos/me-stevens/payroll/issues{/number}","pulls_url":"https://api.github.com/repos/me-stevens/payroll/pulls{/number}","milestones_url":"https://api.github.com/repos/me-stevens/payroll/milestones{/number}","notifications_url":"https://api.github.com/repos/me-stevens/payroll/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/me-stevens/payroll/labels{/name}","releases_url":"https://api.github.com/repos/me-stevens/payroll/releases{/id}","created_at":"2015-12-31T10:11:13Z","updated_at":"2016-01-01T22:35:21Z","pushed_at":"2016-01-07T16:32:29Z","git_url":"git://github.com/me-stevens/payroll.git","ssh_url":"git@github.com:me-stevens/payroll.git","clone_url":"https://github.com/me-stevens/payroll.git","svn_url":"https://github.com/me-stevens/payroll","homepage":null,"size":83,"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":4,"forks":0,"open_issues":4,"watchers":0,"default_branch":"master"}},"base":{"label":"me-stevens:change-employees","ref":"change-employees","sha":"d71928914467d4a7155dbffd83fa8c25e2a8726e","user":{"login":"me-stevens","id":2157089,"avatar_url":"https://avatars.githubusercontent.com/u/2157089?v=3","gravatar_id":"","url":"https://api.github.com/users/me-stevens","html_url":"https://github.com/me-stevens","followers_url":"https://api.github.com/users/me-stevens/followers","following_url":"https://api.github.com/users/me-stevens/following{/other_user}","gists_url":"https://api.github.com/users/me-stevens/gists{/gist_id}","starred_url":"https://api.github.com/users/me-stevens/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/me-stevens/subscriptions","organizations_url":"https://api.github.com/users/me-stevens/orgs","repos_url":"https://api.github.com/users/me-stevens/repos","events_url":"https://api.github.com/users/me-stevens/events{/privacy}","received_events_url":"https://api.github.com/users/me-stevens/received_events","type":"User","site_admin":false},"repo":{"id":48845367,"name":"payroll","full_name":"me-stevens/payroll","owner":{"login":"me-stevens","id":2157089,"avatar_url":"https://avatars.githubusercontent.com/u/2157089?v=3","gravatar_id":"","url":"https://api.github.com/users/me-stevens","html_url":"https://github.com/me-stevens","followers_url":"https://api.github.com/users/me-stevens/followers","following_url":"https://api.github.com/users/me-stevens/following{/other_user}","gists_url":"https://api.github.com/users/me-stevens/gists{/gist_id}","starred_url":"https://api.github.com/users/me-stevens/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/me-stevens/subscriptions","organizations_url":"https://api.github.com/users/me-stevens/orgs","repos_url":"https://api.github.com/users/me-stevens/repos","events_url":"https://api.github.com/users/me-stevens/events{/privacy}","received_events_url":"https://api.github.com/users/me-stevens/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/me-stevens/payroll","description":"TDD Payroll app as seen in \"Principles, Patterns and Practices\"","fork":false,"url":"https://api.github.com/repos/me-stevens/payroll","forks_url":"https://api.github.com/repos/me-stevens/payroll/forks","keys_url":"https://api.github.com/repos/me-stevens/payroll/keys{/key_id}","collaborators_url":"https://api.github.com/repos/me-stevens/payroll/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/me-stevens/payroll/teams","hooks_url":"https://api.github.com/repos/me-stevens/payroll/hooks","issue_events_url":"https://api.github.com/repos/me-stevens/payroll/issues/events{/number}","events_url":"https://api.github.com/repos/me-stevens/payroll/events","assignees_url":"https://api.github.com/repos/me-stevens/payroll/assignees{/user}","branches_url":"https://api.github.com/repos/me-stevens/payroll/branches{/branch}","tags_url":"https://api.github.com/repos/me-stevens/payroll/tags","blobs_url":"https://api.github.com/repos/me-stevens/payroll/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/me-stevens/payroll/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/me-stevens/payroll/git/refs{/sha}","trees_url":"https://api.github.com/repos/me-stevens/payroll/git/trees{/sha}","statuses_url":"https://api.github.com/repos/me-stevens/payroll/statuses/{sha}","languages_url":"https://api.github.com/repos/me-stevens/payroll/languages","stargazers_url":"https://api.github.com/repos/me-stevens/payroll/stargazers","contributors_url":"https://api.github.com/repos/me-stevens/payroll/contributors","subscribers_url":"https://api.github.com/repos/me-stevens/payroll/subscribers","subscription_url":"https://api.github.com/repos/me-stevens/payroll/subscription","commits_url":"https://api.github.com/repos/me-stevens/payroll/commits{/sha}","git_commits_url":"https://api.github.com/repos/me-stevens/payroll/git/commits{/sha}","comments_url":"https://api.github.com/repos/me-stevens/payroll/comments{/number}","issue_comment_url":"https://api.github.com/repos/me-stevens/payroll/issues/comments{/number}","contents_url":"https://api.github.com/repos/me-stevens/payroll/contents/{+path}","compare_url":"https://api.github.com/repos/me-stevens/payroll/compare/{base}...{head}","merges_url":"https://api.github.com/repos/me-stevens/payroll/merges","archive_url":"https://api.github.com/repos/me-stevens/payroll/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/me-stevens/payroll/downloads","issues_url":"https://api.github.com/repos/me-stevens/payroll/issues{/number}","pulls_url":"https://api.github.com/repos/me-stevens/payroll/pulls{/number}","milestones_url":"https://api.github.com/repos/me-stevens/payroll/milestones{/number}","notifications_url":"https://api.github.com/repos/me-stevens/payroll/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/me-stevens/payroll/labels{/name}","releases_url":"https://api.github.com/repos/me-stevens/payroll/releases{/id}","created_at":"2015-12-31T10:11:13Z","updated_at":"2016-01-01T22:35:21Z","pushed_at":"2016-01-07T16:32:29Z","git_url":"git://github.com/me-stevens/payroll.git","ssh_url":"git@github.com:me-stevens/payroll.git","clone_url":"https://github.com/me-stevens/payroll.git","svn_url":"https://github.com/me-stevens/payroll","homepage":null,"size":83,"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":4,"forks":0,"open_issues":4,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/me-stevens/payroll/pulls/7"},"html":{"href":"https://github.com/me-stevens/payroll/pull/7"},"issue":{"href":"https://api.github.com/repos/me-stevens/payroll/issues/7"},"comments":{"href":"https://api.github.com/repos/me-stevens/payroll/issues/7/comments"},"review_comments":{"href":"https://api.github.com/repos/me-stevens/payroll/pulls/7/comments"},"review_comment":{"href":"https://api.github.com/repos/me-stevens/payroll/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/me-stevens/payroll/pulls/7/commits"},"statuses":{"href":"https://api.github.com/repos/me-stevens/payroll/statuses/a359c1f9ddd22be671854ddcf39c74eda0c95a6f"}}}}