{"action":"created","comment":{"url":"https://api.github.com/repos/commercetools/commercetools-sync-java/pulls/comments/305284924","pull_request_review_id":264118795,"id":305284924,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDMwNTI4NDkyNA==","diff_hunk":"@@ -0,0 +1,212 @@\n+package com.commercetools.sync.taxcategories.utils;\n+\n+import com.commercetools.sync.commons.exceptions.BuildUpdateActionException;\n+import com.commercetools.sync.commons.exceptions.DuplicateNameException;\n+import io.sphere.sdk.commands.UpdateAction;\n+import io.sphere.sdk.taxcategories.SubRate;\n+import io.sphere.sdk.taxcategories.TaxCategory;\n+import io.sphere.sdk.taxcategories.TaxRate;\n+import io.sphere.sdk.taxcategories.TaxRateDraft;\n+import io.sphere.sdk.taxcategories.commands.updateactions.AddTaxRate;\n+import io.sphere.sdk.taxcategories.commands.updateactions.RemoveTaxRate;\n+import io.sphere.sdk.taxcategories.commands.updateactions.ReplaceTaxRate;\n+\n+import javax.annotation.Nonnull;\n+import javax.annotation.Nullable;\n+import java.util.ArrayList;\n+import java.util.Collection;\n+import java.util.List;\n+import java.util.Map;\n+import java.util.Objects;\n+import java.util.stream.Collectors;\n+\n+import static java.lang.String.format;\n+import static java.util.Collections.singletonList;\n+import static java.util.Optional.ofNullable;\n+import static java.util.stream.Collectors.toList;\n+import static java.util.stream.Collectors.toMap;\n+\n+final class TaxRatesUpdateActionUtils {\n+\n+    /**\n+     * Compares a list of {@link TaxRate}s with a list of {@link TaxRateDraft}s to\n+     * returns a {@link List} of {@link UpdateAction}&lt;{@link TaxCategory}&gt;. If both lists have identical\n+     * TaxRates, then no update actions are needed and hence an empty {@link List} is returned.\n+     *\n+     * <p>If the list of new {@link TaxRateDraft}s is {@code null}, then remove actions are built for\n+     * every existing tax rate in the {@code oldTaxRates} list.\n+     *\n+     * <p>Note: The method will ignore/filter out {@code null} tax rates drafts from the passed\n+     * {@code newTaxRateDrafts}.</p>\n+     *\n+     * @param oldTaxRates       the old list of tax rates.\n+     * @param newTaxRatesDrafts the new list of tax rates drafts.\n+     * @return a list of tax rates update actions if the list of tax rates are not identical.\n+     *         Otherwise, if the tax rates are identical, an empty list is returned.\n+     * @throws BuildUpdateActionException in case there are tax rates drafts with duplicate names or enums\n+     *                                    duplicate keys.\n+     */\n+    @Nonnull\n+    static List<UpdateAction<TaxCategory>> buildTaxRatesUpdateActions(\n+        @Nonnull final List<TaxRate> oldTaxRates,\n+        @Nullable final List<TaxRateDraft> newTaxRatesDrafts)\n+        throws BuildUpdateActionException {\n+        if (newTaxRatesDrafts != null) {","path":"src/main/java/com/commercetools/sync/taxcategories/utils/TaxRatesUpdateActionUtils.java","position":null,"original_position":54,"commit_id":"eeda9192baacc7f75bc7eb9bfe9fe455f20583d3","original_commit_id":"504a7ac7b29f40e222cee89d7652e76d66b50251","user":{"login":"jarzynp","id":13828559,"node_id":"MDQ6VXNlcjEzODI4NTU5","avatar_url":"https://avatars0.githubusercontent.com/u/13828559?v=4","gravatar_id":"","url":"https://api.github.com/users/jarzynp","html_url":"https://github.com/jarzynp","followers_url":"https://api.github.com/users/jarzynp/followers","following_url":"https://api.github.com/users/jarzynp/following{/other_user}","gists_url":"https://api.github.com/users/jarzynp/gists{/gist_id}","starred_url":"https://api.github.com/users/jarzynp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jarzynp/subscriptions","organizations_url":"https://api.github.com/users/jarzynp/orgs","repos_url":"https://api.github.com/users/jarzynp/repos","events_url":"https://api.github.com/users/jarzynp/events{/privacy}","received_events_url":"https://api.github.com/users/jarzynp/received_events","type":"User","site_admin":false},"body":"Fixed: [eeda919](https://github.com/commercetools/commercetools-sync-java/pull/421/commits/eeda9192baacc7f75bc7eb9bfe9fe455f20583d3)","created_at":"2019-07-19T09:52:32Z","updated_at":"2019-07-19T09:52:32Z","html_url":"https://github.com/commercetools/commercetools-sync-java/pull/421#discussion_r305284924","pull_request_url":"https://api.github.com/repos/commercetools/commercetools-sync-java/pulls/421","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/commercetools/commercetools-sync-java/pulls/comments/305284924"},"html":{"href":"https://github.com/commercetools/commercetools-sync-java/pull/421#discussion_r305284924"},"pull_request":{"href":"https://api.github.com/repos/commercetools/commercetools-sync-java/pulls/421"}},"in_reply_to_id":304927718},"pull_request":{"url":"https://api.github.com/repos/commercetools/commercetools-sync-java/pulls/421","id":298903926,"node_id":"MDExOlB1bGxSZXF1ZXN0Mjk4OTAzOTI2","html_url":"https://github.com/commercetools/commercetools-sync-java/pull/421","diff_url":"https://github.com/commercetools/commercetools-sync-java/pull/421.diff","patch_url":"https://github.com/commercetools/commercetools-sync-java/pull/421.patch","issue_url":"https://api.github.com/repos/commercetools/commercetools-sync-java/issues/421","number":421,"state":"open","locked":false,"title":"417 sync tax categories","user":{"login":"jarzynp","id":13828559,"node_id":"MDQ6VXNlcjEzODI4NTU5","avatar_url":"https://avatars0.githubusercontent.com/u/13828559?v=4","gravatar_id":"","url":"https://api.github.com/users/jarzynp","html_url":"https://github.com/jarzynp","followers_url":"https://api.github.com/users/jarzynp/followers","following_url":"https://api.github.com/users/jarzynp/following{/other_user}","gists_url":"https://api.github.com/users/jarzynp/gists{/gist_id}","starred_url":"https://api.github.com/users/jarzynp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jarzynp/subscriptions","organizations_url":"https://api.github.com/users/jarzynp/orgs","repos_url":"https://api.github.com/users/jarzynp/repos","events_url":"https://api.github.com/users/jarzynp/events{/privacy}","received_events_url":"https://api.github.com/users/jarzynp/received_events","type":"User","site_admin":false},"body":"#### Summary\r\nSynchronization of tax categories\r\n\r\n#### Description\r\nAdded modules for tax category synchronization, contains breaking changes.\r\nPR source code originates from [BaseService improvement](https://github.com/commercetools/commercetools-sync-java/pull/419)\r\n\r\n#### Relevant Issues\r\n[#417](https://github.com/commercetools/commercetools-sync-java/issues/417)\r\n\r\n#### Hints for Review\r\nAs was decided in [discussion](https://github.com/commercetools/commercetools-sync-java/pull/415#issuecomment-511797104) - old PR splitted; I hope I addressed all requested changes 😄 ","created_at":"2019-07-18T13:03:42Z","updated_at":"2019-07-19T09:52:32Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8c861227e6e3a8764497e44a8c515fa14442ef3f","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/commercetools/commercetools-sync-java/pulls/421/commits","review_comments_url":"https://api.github.com/repos/commercetools/commercetools-sync-java/pulls/421/comments","review_comment_url":"https://api.github.com/repos/commercetools/commercetools-sync-java/pulls/comments{/number}","comments_url":"https://api.github.com/repos/commercetools/commercetools-sync-java/issues/421/comments","statuses_url":"https://api.github.com/repos/commercetools/commercetools-sync-java/statuses/eeda9192baacc7f75bc7eb9bfe9fe455f20583d3","head":{"label":"ambsoft:417-sync-tax-categories","ref":"417-sync-tax-categories","sha":"eeda9192baacc7f75bc7eb9bfe9fe455f20583d3","user":{"login":"ambsoft","id":16029979,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE2MDI5OTc5","avatar_url":"https://avatars3.githubusercontent.com/u/16029979?v=4","gravatar_id":"","url":"https://api.github.com/users/ambsoft","html_url":"https://github.com/ambsoft","followers_url":"https://api.github.com/users/ambsoft/followers","following_url":"https://api.github.com/users/ambsoft/following{/other_user}","gists_url":"https://api.github.com/users/ambsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/ambsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ambsoft/subscriptions","organizations_url":"https://api.github.com/users/ambsoft/orgs","repos_url":"https://api.github.com/users/ambsoft/repos","events_url":"https://api.github.com/users/ambsoft/events{/privacy}","received_events_url":"https://api.github.com/users/ambsoft/received_events","type":"Organization","site_admin":false},"repo":{"id":157365745,"node_id":"MDEwOlJlcG9zaXRvcnkxNTczNjU3NDU=","name":"commercetools-sync-java","full_name":"ambsoft/commercetools-sync-java","private":false,"owner":{"login":"ambsoft","id":16029979,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE2MDI5OTc5","avatar_url":"https://avatars3.githubusercontent.com/u/16029979?v=4","gravatar_id":"","url":"https://api.github.com/users/ambsoft","html_url":"https://github.com/ambsoft","followers_url":"https://api.github.com/users/ambsoft/followers","following_url":"https://api.github.com/users/ambsoft/following{/other_user}","gists_url":"https://api.github.com/users/ambsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/ambsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ambsoft/subscriptions","organizations_url":"https://api.github.com/users/ambsoft/orgs","repos_url":"https://api.github.com/users/ambsoft/repos","events_url":"https://api.github.com/users/ambsoft/events{/privacy}","received_events_url":"https://api.github.com/users/ambsoft/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/ambsoft/commercetools-sync-java","description":"Java library used to import and/or sync (taking care of changes) data into one or more commercetools projects from external sources such as CSV, XML, JSON, etc.. or even from an already existing commercetools project.","fork":true,"url":"https://api.github.com/repos/ambsoft/commercetools-sync-java","forks_url":"https://api.github.com/repos/ambsoft/commercetools-sync-java/forks","keys_url":"https://api.github.com/repos/ambsoft/commercetools-sync-java/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ambsoft/commercetools-sync-java/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ambsoft/commercetools-sync-java/teams","hooks_url":"https://api.github.com/repos/ambsoft/commercetools-sync-java/hooks","issue_events_url":"https://api.github.com/repos/ambsoft/commercetools-sync-java/issues/events{/number}","events_url":"https://api.github.com/repos/ambsoft/commercetools-sync-java/events","assignees_url":"https://api.github.com/repos/ambsoft/commercetools-sync-java/assignees{/user}","branches_url":"https://api.github.com/repos/ambsoft/commercetools-sync-java/branches{/branch}","tags_url":"https://api.github.com/repos/ambsoft/commercetools-sync-java/tags","blobs_url":"https://api.github.com/repos/ambsoft/commercetools-sync-java/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ambsoft/commercetools-sync-java/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ambsoft/commercetools-sync-java/git/refs{/sha}","trees_url":"https://api.github.com/repos/ambsoft/commercetools-sync-java/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ambsoft/commercetools-sync-java/statuses/{sha}","languages_url":"https://api.github.com/repos/ambsoft/commercetools-sync-java/languages","stargazers_url":"https://api.github.com/repos/ambsoft/commercetools-sync-java/stargazers","contributors_url":"https://api.github.com/repos/ambsoft/commercetools-sync-java/contributors","subscribers_url":"https://api.github.com/repos/ambsoft/commercetools-sync-java/subscribers","subscription_url":"https://api.github.com/repos/ambsoft/commercetools-sync-java/subscription","commits_url":"https://api.github.com/repos/ambsoft/commercetools-sync-java/commits{/sha}","git_commits_url":"https://api.github.com/repos/ambsoft/commercetools-sync-java/git/commits{/sha}","comments_url":"https://api.github.com/repos/ambsoft/commercetools-sync-java/comments{/number}","issue_comment_url":"https://api.github.com/repos/ambsoft/commercetools-sync-java/issues/comments{/number}","contents_url":"https://api.github.com/repos/ambsoft/commercetools-sync-java/contents/{+path}","compare_url":"https://api.github.com/repos/ambsoft/commercetools-sync-java/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ambsoft/commercetools-sync-java/merges","archive_url":"https://api.github.com/repos/ambsoft/commercetools-sync-java/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ambsoft/commercetools-sync-java/downloads","issues_url":"https://api.github.com/repos/ambsoft/commercetools-sync-java/issues{/number}","pulls_url":"https://api.github.com/repos/ambsoft/commercetools-sync-java/pulls{/number}","milestones_url":"https://api.github.com/repos/ambsoft/commercetools-sync-java/milestones{/number}","notifications_url":"https://api.github.com/repos/ambsoft/commercetools-sync-java/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ambsoft/commercetools-sync-java/labels{/name}","releases_url":"https://api.github.com/repos/ambsoft/commercetools-sync-java/releases{/id}","deployments_url":"https://api.github.com/repos/ambsoft/commercetools-sync-java/deployments","created_at":"2018-11-13T10:57:33Z","updated_at":"2019-05-27T07:58:02Z","pushed_at":"2019-07-19T09:49:06Z","git_url":"git://github.com/ambsoft/commercetools-sync-java.git","ssh_url":"git@github.com:ambsoft/commercetools-sync-java.git","clone_url":"https://github.com/ambsoft/commercetools-sync-java.git","svn_url":"https://github.com/ambsoft/commercetools-sync-java","homepage":"","size":9597,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"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":0,"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":0,"watchers":0,"default_branch":"master"}},"base":{"label":"commercetools:master","ref":"master","sha":"81972655209d30aae9c77fe43a60a9b8eb7a8231","user":{"login":"commercetools","id":1084585,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEwODQ1ODU=","avatar_url":"https://avatars3.githubusercontent.com/u/1084585?v=4","gravatar_id":"","url":"https://api.github.com/users/commercetools","html_url":"https://github.com/commercetools","followers_url":"https://api.github.com/users/commercetools/followers","following_url":"https://api.github.com/users/commercetools/following{/other_user}","gists_url":"https://api.github.com/users/commercetools/gists{/gist_id}","starred_url":"https://api.github.com/users/commercetools/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/commercetools/subscriptions","organizations_url":"https://api.github.com/users/commercetools/orgs","repos_url":"https://api.github.com/users/commercetools/repos","events_url":"https://api.github.com/users/commercetools/events{/privacy}","received_events_url":"https://api.github.com/users/commercetools/received_events","type":"Organization","site_admin":false},"repo":{"id":84962876,"node_id":"MDEwOlJlcG9zaXRvcnk4NDk2Mjg3Ng==","name":"commercetools-sync-java","full_name":"commercetools/commercetools-sync-java","private":false,"owner":{"login":"commercetools","id":1084585,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEwODQ1ODU=","avatar_url":"https://avatars3.githubusercontent.com/u/1084585?v=4","gravatar_id":"","url":"https://api.github.com/users/commercetools","html_url":"https://github.com/commercetools","followers_url":"https://api.github.com/users/commercetools/followers","following_url":"https://api.github.com/users/commercetools/following{/other_user}","gists_url":"https://api.github.com/users/commercetools/gists{/gist_id}","starred_url":"https://api.github.com/users/commercetools/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/commercetools/subscriptions","organizations_url":"https://api.github.com/users/commercetools/orgs","repos_url":"https://api.github.com/users/commercetools/repos","events_url":"https://api.github.com/users/commercetools/events{/privacy}","received_events_url":"https://api.github.com/users/commercetools/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/commercetools/commercetools-sync-java","description":"Java library for importing and syncing (taking care of changes) data into one or more commercetools projects from external data files or from another commercetools project.","fork":false,"url":"https://api.github.com/repos/commercetools/commercetools-sync-java","forks_url":"https://api.github.com/repos/commercetools/commercetools-sync-java/forks","keys_url":"https://api.github.com/repos/commercetools/commercetools-sync-java/keys{/key_id}","collaborators_url":"https://api.github.com/repos/commercetools/commercetools-sync-java/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/commercetools/commercetools-sync-java/teams","hooks_url":"https://api.github.com/repos/commercetools/commercetools-sync-java/hooks","issue_events_url":"https://api.github.com/repos/commercetools/commercetools-sync-java/issues/events{/number}","events_url":"https://api.github.com/repos/commercetools/commercetools-sync-java/events","assignees_url":"https://api.github.com/repos/commercetools/commercetools-sync-java/assignees{/user}","branches_url":"https://api.github.com/repos/commercetools/commercetools-sync-java/branches{/branch}","tags_url":"https://api.github.com/repos/commercetools/commercetools-sync-java/tags","blobs_url":"https://api.github.com/repos/commercetools/commercetools-sync-java/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/commercetools/commercetools-sync-java/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/commercetools/commercetools-sync-java/git/refs{/sha}","trees_url":"https://api.github.com/repos/commercetools/commercetools-sync-java/git/trees{/sha}","statuses_url":"https://api.github.com/repos/commercetools/commercetools-sync-java/statuses/{sha}","languages_url":"https://api.github.com/repos/commercetools/commercetools-sync-java/languages","stargazers_url":"https://api.github.com/repos/commercetools/commercetools-sync-java/stargazers","contributors_url":"https://api.github.com/repos/commercetools/commercetools-sync-java/contributors","subscribers_url":"https://api.github.com/repos/commercetools/commercetools-sync-java/subscribers","subscription_url":"https://api.github.com/repos/commercetools/commercetools-sync-java/subscription","commits_url":"https://api.github.com/repos/commercetools/commercetools-sync-java/commits{/sha}","git_commits_url":"https://api.github.com/repos/commercetools/commercetools-sync-java/git/commits{/sha}","comments_url":"https://api.github.com/repos/commercetools/commercetools-sync-java/comments{/number}","issue_comment_url":"https://api.github.com/repos/commercetools/commercetools-sync-java/issues/comments{/number}","contents_url":"https://api.github.com/repos/commercetools/commercetools-sync-java/contents/{+path}","compare_url":"https://api.github.com/repos/commercetools/commercetools-sync-java/compare/{base}...{head}","merges_url":"https://api.github.com/repos/commercetools/commercetools-sync-java/merges","archive_url":"https://api.github.com/repos/commercetools/commercetools-sync-java/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/commercetools/commercetools-sync-java/downloads","issues_url":"https://api.github.com/repos/commercetools/commercetools-sync-java/issues{/number}","pulls_url":"https://api.github.com/repos/commercetools/commercetools-sync-java/pulls{/number}","milestones_url":"https://api.github.com/repos/commercetools/commercetools-sync-java/milestones{/number}","notifications_url":"https://api.github.com/repos/commercetools/commercetools-sync-java/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/commercetools/commercetools-sync-java/labels{/name}","releases_url":"https://api.github.com/repos/commercetools/commercetools-sync-java/releases{/id}","deployments_url":"https://api.github.com/repos/commercetools/commercetools-sync-java/deployments","created_at":"2017-03-14T15:06:58Z","updated_at":"2019-07-03T12:50:41Z","pushed_at":"2019-07-19T09:49:08Z","git_url":"git://github.com/commercetools/commercetools-sync-java.git","ssh_url":"git@github.com:commercetools/commercetools-sync-java.git","clone_url":"https://github.com/commercetools/commercetools-sync-java.git","svn_url":"https://github.com/commercetools/commercetools-sync-java","homepage":"https://commercetools.github.io/commercetools-sync-java","size":14043,"stargazers_count":18,"watchers_count":18,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":11,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":114,"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":11,"open_issues":114,"watchers":18,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/commercetools/commercetools-sync-java/pulls/421"},"html":{"href":"https://github.com/commercetools/commercetools-sync-java/pull/421"},"issue":{"href":"https://api.github.com/repos/commercetools/commercetools-sync-java/issues/421"},"comments":{"href":"https://api.github.com/repos/commercetools/commercetools-sync-java/issues/421/comments"},"review_comments":{"href":"https://api.github.com/repos/commercetools/commercetools-sync-java/pulls/421/comments"},"review_comment":{"href":"https://api.github.com/repos/commercetools/commercetools-sync-java/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/commercetools/commercetools-sync-java/pulls/421/commits"},"statuses":{"href":"https://api.github.com/repos/commercetools/commercetools-sync-java/statuses/eeda9192baacc7f75bc7eb9bfe9fe455f20583d3"}},"author_association":"NONE"}}
{"actor":{"display_login":"jarzynp"}}