{"action":"created","comment":{"url":"https://api.github.com/repos/LysanderPL/city-parking-spaces/pulls/comments/141012168","pull_request_review_id":65147304,"id":141012168,"diff_hunk":"@@ -0,0 +1,38 @@\n+package pl.sunflux.parking;\n+\n+import org.springframework.beans.factory.annotation.Autowired;\n+import org.springframework.stereotype.Service;\n+import pl.sunflux.controllers.rest.containers.driver.ParkingFeeContainer;\n+import pl.sunflux.controllers.rest.responses.driver.ParkingFeeResponse;\n+import pl.sunflux.entity.ParkingMeterUsage;\n+import pl.sunflux.repository.ParkingMeterUsageRepository;\n+\n+import java.math.BigDecimal;\n+\n+@Service\n+public class ParkingFeeImpl implements ParkingFeeInterface {\n+\n+    private final ParkingMeterUsageRepository parkingMeterUsageRepository;\n+    private final ParkingRatesCalculationInterface parkingRatesCalculationInterface;\n+\n+    @Autowired\n+    public ParkingFeeImpl(ParkingMeterUsageRepository parkingMeterUsageRepository, ParkingRatesCalculationInterface parkingRatesCalculationInterface) {\n+        this.parkingMeterUsageRepository = parkingMeterUsageRepository;\n+        this.parkingRatesCalculationInterface = parkingRatesCalculationInterface;\n+    }\n+\n+    @Override\n+    public ParkingFeeResponse prepareResponse(ParkingFeeContainer parkingFeeContainer) {\n+        ParkingMeterUsage parkingMeterUsage = parkingMeterUsageRepository.findById(parkingFeeContainer.getParkingTicketId()).get();\n+        ParkingFeeResponse parkingFeeResponse = new ParkingFeeResponse();\n+\n+        try {\n+            BigDecimal parkingFee = parkingRatesCalculationInterface.calculateParkingFee(parkingMeterUsage);\n+            parkingFeeResponse.setParkingFee(parkingFee);\n+            parkingFeeResponse.setCurrency(parkingMeterUsage.getCurrency());\n+        } catch (NoCalculationException e) {\n+            parkingFeeResponse.setParkingFee(new BigDecimal(0));","path":"src/main/java/pl/sunflux/parking/ParkingFeeImpl.java","position":34,"original_position":34,"commit_id":"de7f7a9b256879fda5b5de2df6666834c5c0f833","original_commit_id":"de7f7a9b256879fda5b5de2df6666834c5c0f833","user":{"login":"arkadius","id":534341,"avatar_url":"https://avatars3.githubusercontent.com/u/534341?v=4","gravatar_id":"","url":"https://api.github.com/users/arkadius","html_url":"https://github.com/arkadius","followers_url":"https://api.github.com/users/arkadius/followers","following_url":"https://api.github.com/users/arkadius/following{/other_user}","gists_url":"https://api.github.com/users/arkadius/gists{/gist_id}","starred_url":"https://api.github.com/users/arkadius/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arkadius/subscriptions","organizations_url":"https://api.github.com/users/arkadius/orgs","repos_url":"https://api.github.com/users/arkadius/repos","events_url":"https://api.github.com/users/arkadius/events{/privacy}","received_events_url":"https://api.github.com/users/arkadius/received_events","type":"User","site_admin":false},"body":"Czy zwrócenie `fee = 0` jest dobrym rozwiązaniem dla tego wyjątku? A co jeśli ktoś pomylił się przy podawaniu ticket id, albo gdyby ktoś grzebiąc w bazie usunął jakieś wpisy? Czy zwracając '0'  ten ktoś zauważy problem?","created_at":"2017-09-26T10:03:28Z","updated_at":"2017-09-26T10:04:18Z","html_url":"https://github.com/LysanderPL/city-parking-spaces/pull/1#discussion_r141012168","pull_request_url":"https://api.github.com/repos/LysanderPL/city-parking-spaces/pulls/1","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/LysanderPL/city-parking-spaces/pulls/comments/141012168"},"html":{"href":"https://github.com/LysanderPL/city-parking-spaces/pull/1#discussion_r141012168"},"pull_request":{"href":"https://api.github.com/repos/LysanderPL/city-parking-spaces/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/LysanderPL/city-parking-spaces/pulls/1","id":141179465,"html_url":"https://github.com/LysanderPL/city-parking-spaces/pull/1","diff_url":"https://github.com/LysanderPL/city-parking-spaces/pull/1.diff","patch_url":"https://github.com/LysanderPL/city-parking-spaces/pull/1.patch","issue_url":"https://api.github.com/repos/LysanderPL/city-parking-spaces/issues/1","number":1,"state":"open","locked":false,"title":"Development","user":{"login":"LysanderPL","id":12052557,"avatar_url":"https://avatars0.githubusercontent.com/u/12052557?v=4","gravatar_id":"","url":"https://api.github.com/users/LysanderPL","html_url":"https://github.com/LysanderPL","followers_url":"https://api.github.com/users/LysanderPL/followers","following_url":"https://api.github.com/users/LysanderPL/following{/other_user}","gists_url":"https://api.github.com/users/LysanderPL/gists{/gist_id}","starred_url":"https://api.github.com/users/LysanderPL/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LysanderPL/subscriptions","organizations_url":"https://api.github.com/users/LysanderPL/orgs","repos_url":"https://api.github.com/users/LysanderPL/repos","events_url":"https://api.github.com/users/LysanderPL/events{/privacy}","received_events_url":"https://api.github.com/users/LysanderPL/received_events","type":"User","site_admin":false},"body":"","created_at":"2017-09-14T21:17:57Z","updated_at":"2017-09-26T10:04:18Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0507a140fe868cc5640d5db1264121e8015d6240","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/LysanderPL/city-parking-spaces/pulls/1/commits","review_comments_url":"https://api.github.com/repos/LysanderPL/city-parking-spaces/pulls/1/comments","review_comment_url":"https://api.github.com/repos/LysanderPL/city-parking-spaces/pulls/comments{/number}","comments_url":"https://api.github.com/repos/LysanderPL/city-parking-spaces/issues/1/comments","statuses_url":"https://api.github.com/repos/LysanderPL/city-parking-spaces/statuses/de7f7a9b256879fda5b5de2df6666834c5c0f833","head":{"label":"LysanderPL:development","ref":"development","sha":"de7f7a9b256879fda5b5de2df6666834c5c0f833","user":{"login":"LysanderPL","id":12052557,"avatar_url":"https://avatars0.githubusercontent.com/u/12052557?v=4","gravatar_id":"","url":"https://api.github.com/users/LysanderPL","html_url":"https://github.com/LysanderPL","followers_url":"https://api.github.com/users/LysanderPL/followers","following_url":"https://api.github.com/users/LysanderPL/following{/other_user}","gists_url":"https://api.github.com/users/LysanderPL/gists{/gist_id}","starred_url":"https://api.github.com/users/LysanderPL/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LysanderPL/subscriptions","organizations_url":"https://api.github.com/users/LysanderPL/orgs","repos_url":"https://api.github.com/users/LysanderPL/repos","events_url":"https://api.github.com/users/LysanderPL/events{/privacy}","received_events_url":"https://api.github.com/users/LysanderPL/received_events","type":"User","site_admin":false},"repo":{"id":103423746,"name":"city-parking-spaces","full_name":"LysanderPL/city-parking-spaces","owner":{"login":"LysanderPL","id":12052557,"avatar_url":"https://avatars0.githubusercontent.com/u/12052557?v=4","gravatar_id":"","url":"https://api.github.com/users/LysanderPL","html_url":"https://github.com/LysanderPL","followers_url":"https://api.github.com/users/LysanderPL/followers","following_url":"https://api.github.com/users/LysanderPL/following{/other_user}","gists_url":"https://api.github.com/users/LysanderPL/gists{/gist_id}","starred_url":"https://api.github.com/users/LysanderPL/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LysanderPL/subscriptions","organizations_url":"https://api.github.com/users/LysanderPL/orgs","repos_url":"https://api.github.com/users/LysanderPL/repos","events_url":"https://api.github.com/users/LysanderPL/events{/privacy}","received_events_url":"https://api.github.com/users/LysanderPL/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/LysanderPL/city-parking-spaces","description":null,"fork":false,"url":"https://api.github.com/repos/LysanderPL/city-parking-spaces","forks_url":"https://api.github.com/repos/LysanderPL/city-parking-spaces/forks","keys_url":"https://api.github.com/repos/LysanderPL/city-parking-spaces/keys{/key_id}","collaborators_url":"https://api.github.com/repos/LysanderPL/city-parking-spaces/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/LysanderPL/city-parking-spaces/teams","hooks_url":"https://api.github.com/repos/LysanderPL/city-parking-spaces/hooks","issue_events_url":"https://api.github.com/repos/LysanderPL/city-parking-spaces/issues/events{/number}","events_url":"https://api.github.com/repos/LysanderPL/city-parking-spaces/events","assignees_url":"https://api.github.com/repos/LysanderPL/city-parking-spaces/assignees{/user}","branches_url":"https://api.github.com/repos/LysanderPL/city-parking-spaces/branches{/branch}","tags_url":"https://api.github.com/repos/LysanderPL/city-parking-spaces/tags","blobs_url":"https://api.github.com/repos/LysanderPL/city-parking-spaces/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/LysanderPL/city-parking-spaces/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/LysanderPL/city-parking-spaces/git/refs{/sha}","trees_url":"https://api.github.com/repos/LysanderPL/city-parking-spaces/git/trees{/sha}","statuses_url":"https://api.github.com/repos/LysanderPL/city-parking-spaces/statuses/{sha}","languages_url":"https://api.github.com/repos/LysanderPL/city-parking-spaces/languages","stargazers_url":"https://api.github.com/repos/LysanderPL/city-parking-spaces/stargazers","contributors_url":"https://api.github.com/repos/LysanderPL/city-parking-spaces/contributors","subscribers_url":"https://api.github.com/repos/LysanderPL/city-parking-spaces/subscribers","subscription_url":"https://api.github.com/repos/LysanderPL/city-parking-spaces/subscription","commits_url":"https://api.github.com/repos/LysanderPL/city-parking-spaces/commits{/sha}","git_commits_url":"https://api.github.com/repos/LysanderPL/city-parking-spaces/git/commits{/sha}","comments_url":"https://api.github.com/repos/LysanderPL/city-parking-spaces/comments{/number}","issue_comment_url":"https://api.github.com/repos/LysanderPL/city-parking-spaces/issues/comments{/number}","contents_url":"https://api.github.com/repos/LysanderPL/city-parking-spaces/contents/{+path}","compare_url":"https://api.github.com/repos/LysanderPL/city-parking-spaces/compare/{base}...{head}","merges_url":"https://api.github.com/repos/LysanderPL/city-parking-spaces/merges","archive_url":"https://api.github.com/repos/LysanderPL/city-parking-spaces/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/LysanderPL/city-parking-spaces/downloads","issues_url":"https://api.github.com/repos/LysanderPL/city-parking-spaces/issues{/number}","pulls_url":"https://api.github.com/repos/LysanderPL/city-parking-spaces/pulls{/number}","milestones_url":"https://api.github.com/repos/LysanderPL/city-parking-spaces/milestones{/number}","notifications_url":"https://api.github.com/repos/LysanderPL/city-parking-spaces/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/LysanderPL/city-parking-spaces/labels{/name}","releases_url":"https://api.github.com/repos/LysanderPL/city-parking-spaces/releases{/id}","deployments_url":"https://api.github.com/repos/LysanderPL/city-parking-spaces/deployments","created_at":"2017-09-13T16:29:28Z","updated_at":"2017-09-13T16:29:28Z","pushed_at":"2017-09-15T09:24:33Z","git_url":"git://github.com/LysanderPL/city-parking-spaces.git","ssh_url":"git@github.com:LysanderPL/city-parking-spaces.git","clone_url":"https://github.com/LysanderPL/city-parking-spaces.git","svn_url":"https://github.com/LysanderPL/city-parking-spaces","homepage":null,"size":99,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_projects":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":"LysanderPL:master","ref":"master","sha":"f220fe7af895310d31dad0000fb5db77e7b3a8f5","user":{"login":"LysanderPL","id":12052557,"avatar_url":"https://avatars0.githubusercontent.com/u/12052557?v=4","gravatar_id":"","url":"https://api.github.com/users/LysanderPL","html_url":"https://github.com/LysanderPL","followers_url":"https://api.github.com/users/LysanderPL/followers","following_url":"https://api.github.com/users/LysanderPL/following{/other_user}","gists_url":"https://api.github.com/users/LysanderPL/gists{/gist_id}","starred_url":"https://api.github.com/users/LysanderPL/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LysanderPL/subscriptions","organizations_url":"https://api.github.com/users/LysanderPL/orgs","repos_url":"https://api.github.com/users/LysanderPL/repos","events_url":"https://api.github.com/users/LysanderPL/events{/privacy}","received_events_url":"https://api.github.com/users/LysanderPL/received_events","type":"User","site_admin":false},"repo":{"id":103423746,"name":"city-parking-spaces","full_name":"LysanderPL/city-parking-spaces","owner":{"login":"LysanderPL","id":12052557,"avatar_url":"https://avatars0.githubusercontent.com/u/12052557?v=4","gravatar_id":"","url":"https://api.github.com/users/LysanderPL","html_url":"https://github.com/LysanderPL","followers_url":"https://api.github.com/users/LysanderPL/followers","following_url":"https://api.github.com/users/LysanderPL/following{/other_user}","gists_url":"https://api.github.com/users/LysanderPL/gists{/gist_id}","starred_url":"https://api.github.com/users/LysanderPL/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LysanderPL/subscriptions","organizations_url":"https://api.github.com/users/LysanderPL/orgs","repos_url":"https://api.github.com/users/LysanderPL/repos","events_url":"https://api.github.com/users/LysanderPL/events{/privacy}","received_events_url":"https://api.github.com/users/LysanderPL/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/LysanderPL/city-parking-spaces","description":null,"fork":false,"url":"https://api.github.com/repos/LysanderPL/city-parking-spaces","forks_url":"https://api.github.com/repos/LysanderPL/city-parking-spaces/forks","keys_url":"https://api.github.com/repos/LysanderPL/city-parking-spaces/keys{/key_id}","collaborators_url":"https://api.github.com/repos/LysanderPL/city-parking-spaces/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/LysanderPL/city-parking-spaces/teams","hooks_url":"https://api.github.com/repos/LysanderPL/city-parking-spaces/hooks","issue_events_url":"https://api.github.com/repos/LysanderPL/city-parking-spaces/issues/events{/number}","events_url":"https://api.github.com/repos/LysanderPL/city-parking-spaces/events","assignees_url":"https://api.github.com/repos/LysanderPL/city-parking-spaces/assignees{/user}","branches_url":"https://api.github.com/repos/LysanderPL/city-parking-spaces/branches{/branch}","tags_url":"https://api.github.com/repos/LysanderPL/city-parking-spaces/tags","blobs_url":"https://api.github.com/repos/LysanderPL/city-parking-spaces/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/LysanderPL/city-parking-spaces/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/LysanderPL/city-parking-spaces/git/refs{/sha}","trees_url":"https://api.github.com/repos/LysanderPL/city-parking-spaces/git/trees{/sha}","statuses_url":"https://api.github.com/repos/LysanderPL/city-parking-spaces/statuses/{sha}","languages_url":"https://api.github.com/repos/LysanderPL/city-parking-spaces/languages","stargazers_url":"https://api.github.com/repos/LysanderPL/city-parking-spaces/stargazers","contributors_url":"https://api.github.com/repos/LysanderPL/city-parking-spaces/contributors","subscribers_url":"https://api.github.com/repos/LysanderPL/city-parking-spaces/subscribers","subscription_url":"https://api.github.com/repos/LysanderPL/city-parking-spaces/subscription","commits_url":"https://api.github.com/repos/LysanderPL/city-parking-spaces/commits{/sha}","git_commits_url":"https://api.github.com/repos/LysanderPL/city-parking-spaces/git/commits{/sha}","comments_url":"https://api.github.com/repos/LysanderPL/city-parking-spaces/comments{/number}","issue_comment_url":"https://api.github.com/repos/LysanderPL/city-parking-spaces/issues/comments{/number}","contents_url":"https://api.github.com/repos/LysanderPL/city-parking-spaces/contents/{+path}","compare_url":"https://api.github.com/repos/LysanderPL/city-parking-spaces/compare/{base}...{head}","merges_url":"https://api.github.com/repos/LysanderPL/city-parking-spaces/merges","archive_url":"https://api.github.com/repos/LysanderPL/city-parking-spaces/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/LysanderPL/city-parking-spaces/downloads","issues_url":"https://api.github.com/repos/LysanderPL/city-parking-spaces/issues{/number}","pulls_url":"https://api.github.com/repos/LysanderPL/city-parking-spaces/pulls{/number}","milestones_url":"https://api.github.com/repos/LysanderPL/city-parking-spaces/milestones{/number}","notifications_url":"https://api.github.com/repos/LysanderPL/city-parking-spaces/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/LysanderPL/city-parking-spaces/labels{/name}","releases_url":"https://api.github.com/repos/LysanderPL/city-parking-spaces/releases{/id}","deployments_url":"https://api.github.com/repos/LysanderPL/city-parking-spaces/deployments","created_at":"2017-09-13T16:29:28Z","updated_at":"2017-09-13T16:29:28Z","pushed_at":"2017-09-15T09:24:33Z","git_url":"git://github.com/LysanderPL/city-parking-spaces.git","ssh_url":"git@github.com:LysanderPL/city-parking-spaces.git","clone_url":"https://github.com/LysanderPL/city-parking-spaces.git","svn_url":"https://github.com/LysanderPL/city-parking-spaces","homepage":null,"size":99,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_projects":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/LysanderPL/city-parking-spaces/pulls/1"},"html":{"href":"https://github.com/LysanderPL/city-parking-spaces/pull/1"},"issue":{"href":"https://api.github.com/repos/LysanderPL/city-parking-spaces/issues/1"},"comments":{"href":"https://api.github.com/repos/LysanderPL/city-parking-spaces/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/LysanderPL/city-parking-spaces/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/LysanderPL/city-parking-spaces/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/LysanderPL/city-parking-spaces/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/LysanderPL/city-parking-spaces/statuses/de7f7a9b256879fda5b5de2df6666834c5c0f833"}},"author_association":"OWNER"}}
{"actor":{"display_login":"arkadius"}}