{"action":"created","comment":{"url":"https://api.github.com/repos/Sylius/Sylius-Docs/pulls/comments/45141096","id":45141096,"diff_hunk":"@@ -0,0 +1,179 @@\n+Basic Usage\n+===========\n+\n+Tax Rate\n+--------\n+\n+Every tax rate has two identifiers, an ID and name. You can access those by calling ``->getId()`` and ``getName()``\n+respectively. The name is mutable, so you can change it by calling ``->setName('EU VAT')`` on the tax rate instance.\n+\n+Setting Tax Amount\n+~~~~~~~~~~~~~~~~~~\n+\n+A tax rate has two basic amounts - the *amount* and the *amount as percentage* (by default equal 0).\n+\n+.. code-block:: php\n+\n+    <?php\n+\n+    use Sylius\\Component\\Taxation\\Model\\TaxRate;\n+    use Sylius\\Component\\Taxation\\Model\\TaxCategory;\n+\n+    $taxRate = new TaxRate();\n+    $taxCategory = new TaxCategory();\n+\n+    $taxRate->setAmount(0.5);\n+    $taxRate->getAmount(); // Output will be 0.5\n+    $taxRate->getAmountAsPercentage(); // Output will be 50\n+\n+\n+Setting Tax Category\n+~~~~~~~~~~~~~~~~~~~~\n+\n+Every tax rate can have a tax category. You can simply set or unset it by calling ``->setCategory()``.\n+\n+.. code-block:: php\n+\n+    <?php\n+\n+    $taxRate->setCategory($taxCategory);\n+    $taxRate->getCategory(); // Output will be  $taxCategory object\n+    $taxRate->setCategory();\n+    $taxRate->getCategory(); // Output will be null\n+\n+\n+Including tax rate in price\n+~~~~~~~~~~~~~~~~~~~~~~~~~~~\n+\n+You can also included a tax rate in price by calling ``setIncludedInPrice(true)`` (false by default).\n+To check if tax rate is included in price call ``isIncludedInPrice()``.\n+\n+.. hint::\n+    You can read how this property influences on price in chapter :ref:`default-calculator`.\n+\n+\n+Setting calculator\n+~~~~~~~~~~~~~~~~~~\n+\n+To set type of calculator for your tax rate object call ``setCalculator('nameOfCalculator')``. Notice that nameOfCalculator\n+should be the same as name of your calculator object.\n+\n+.. hint::\n+    To understand meaning of this property go to :ref:`delegating-calculator`.\n+\n+\n+Tax Category\n+------------\n+\n+Every tax category  has two identifiers, an ID and name. You can access those by calling ``->getId()`` and ``getName()``\n+respectively. The name is mutable, so you can change it by calling ``->setName('Clothing')`` on the tax category instance.\n+\n+Tax Rate Management\n+~~~~~~~~~~~~~~~~~~~\n+The collection of tax rates (Implementing the ``Doctrine\\Common\\Collections\\Collection`` interface) can be obtained using\n+the ``getRates()`` method. To add or remove tax rates, you can use the ``addRate()`` and ``removeRate()`` methods.\n+\n+.. code-block:: php\n+\n+    <?php\n+\n+    use Sylius\\Component\\Taxation\\Model\\TaxRate;\n+    use Sylius\\Component\\Taxation\\Model\\TaxCategory;\n+\n+    $taxCategory = new TaxCategory();\n+\n+    $taxRate1 = new TaxRate();\n+    $taxRate1->setName('taxRate1');\n+\n+    $taxRate2 = new TaxRate();\n+    $taxRate2->setName('taxRate2');\n+\n+    $taxCategory->addRate($taxRate1);\n+    $taxCategory->addRate($taxRate2);\n+    $taxCategory->getRates();\n+    //returns a collection of objects that implement the TaxRateInterface\n+    $taxCategory->removeRate($taxRate1);\n+    $taxCategory->hasRate($taxRate2); // returns true\n+    $taxCategory->getRates(); // returns collection with one element\n+\n+Calculators\n+-----------\n+\n+.. _default-calculator:\n+\n+Default Calculator\n+~~~~~~~~~~~~~~~~~~\n+\n+**Default Calculator** gives you the ability to calculate the tax amount for given base amount and tax rate.\n+\n+.. code-block:: php\n+\n+    <?php\n+\n+    use Sylius\\Component\\Taxation\\Model\\TaxRate;\n+    use Sylius\\Component\\Taxation\\Calculator\\DefaultCalculator;\n+\n+    $taxRate = new TaxRate();\n+    $taxRate->setAmount(2);\n+    $basicPrice = 10;\n+    $defaultCalculator = new DefaultCalculator();\n+    $defaultCalculator->calculate($basicPrice, $taxRate); //return 20\n+    $taxRate->setIncludedInPrice(true);\n+    $defaultCalculator->calculate($basicPrice, $taxRate);\n+    // return 7, because the tax is now included in price\n+\n+.. _delegating-calculator:\n+\n+Delegating Calculator\n+~~~~~~~~~~~~~~~~~~~~~\n+\n+**Delegating Calculator** gives you the ability to delegate the calculation of amount of tax to a correct calculator\n+instance based on a type defined in an instance of **TaxRate** class.\n+\n+.. code-block:: php\n+\n+    <?php\n+\n+    use Sylius\\Component\\Taxation\\Model\\TaxRate;\n+    use Sylius\\Component\\Taxation\\Calculator\\DefaultCalculator;\n+    use Sylius\\Component\\Registry\\ServiceRegistry;\n+    use Sylius\\Component\\Taxation\\Calculator\\DelegatingCalculator;\n+\n+    $taxRate = new TaxRate();\n+    $taxRate->setAmount(2);\n+    $base = 3; //set base price to 3\n+    $defaultCalculator = new DefaultCalculator();\n+\n+    $serviceRegistry =\n+    new ServiceRegistry('Sylius\\Component\\Taxation\\Calculator\\CalculatorInterface');","path":"components/Taxation/basic_usage.rst","position":148,"original_position":148,"commit_id":"96ed49e6f94df78640a66eb9ade6b1ab6b00bad4","original_commit_id":"96ed49e6f94df78640a66eb9ade6b1ab6b00bad4","user":{"login":"pjedrzejewski","id":614970,"avatar_url":"https://avatars.githubusercontent.com/u/614970?v=3","gravatar_id":"","url":"https://api.github.com/users/pjedrzejewski","html_url":"https://github.com/pjedrzejewski","followers_url":"https://api.github.com/users/pjedrzejewski/followers","following_url":"https://api.github.com/users/pjedrzejewski/following{/other_user}","gists_url":"https://api.github.com/users/pjedrzejewski/gists{/gist_id}","starred_url":"https://api.github.com/users/pjedrzejewski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pjedrzejewski/subscriptions","organizations_url":"https://api.github.com/users/pjedrzejewski/orgs","repos_url":"https://api.github.com/users/pjedrzejewski/repos","events_url":"https://api.github.com/users/pjedrzejewski/events{/privacy}","received_events_url":"https://api.github.com/users/pjedrzejewski/received_events","type":"User","site_admin":false},"body":"``CalculatorInterface::class``, we are on PHP 5.5 now. :>","created_at":"2015-11-17T23:54:49Z","updated_at":"2015-11-17T23:54:49Z","html_url":"https://github.com/Sylius/Sylius-Docs/pull/347#discussion_r45141096","pull_request_url":"https://api.github.com/repos/Sylius/Sylius-Docs/pulls/347","_links":{"self":{"href":"https://api.github.com/repos/Sylius/Sylius-Docs/pulls/comments/45141096"},"html":{"href":"https://github.com/Sylius/Sylius-Docs/pull/347#discussion_r45141096"},"pull_request":{"href":"https://api.github.com/repos/Sylius/Sylius-Docs/pulls/347"}}},"pull_request":{"url":"https://api.github.com/repos/Sylius/Sylius-Docs/pulls/347","id":49130418,"html_url":"https://github.com/Sylius/Sylius-Docs/pull/347","diff_url":"https://github.com/Sylius/Sylius-Docs/pull/347.diff","patch_url":"https://github.com/Sylius/Sylius-Docs/pull/347.patch","issue_url":"https://api.github.com/repos/Sylius/Sylius-Docs/issues/347","number":347,"state":"open","locked":false,"title":"[Taxation] Documentation update of Taxation component","user":{"login":"tuka217","id":8963048,"avatar_url":"https://avatars.githubusercontent.com/u/8963048?v=3","gravatar_id":"","url":"https://api.github.com/users/tuka217","html_url":"https://github.com/tuka217","followers_url":"https://api.github.com/users/tuka217/followers","following_url":"https://api.github.com/users/tuka217/following{/other_user}","gists_url":"https://api.github.com/users/tuka217/gists{/gist_id}","starred_url":"https://api.github.com/users/tuka217/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tuka217/subscriptions","organizations_url":"https://api.github.com/users/tuka217/orgs","repos_url":"https://api.github.com/users/tuka217/repos","events_url":"https://api.github.com/users/tuka217/events{/privacy}","received_events_url":"https://api.github.com/users/tuka217/received_events","type":"User","site_admin":false},"body":"| Q             | A\r\n| ------------- | ---\r\n| Doc fix?      | yes\r\n| New docs?  | no\r\n| Fixed tickets   | -","created_at":"2015-10-29T12:03:17Z","updated_at":"2015-11-17T23:54:49Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a9e203790ab2b82b0c1e07fc72f1c854f6fe89f5","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Sylius/Sylius-Docs/pulls/347/commits","review_comments_url":"https://api.github.com/repos/Sylius/Sylius-Docs/pulls/347/comments","review_comment_url":"https://api.github.com/repos/Sylius/Sylius-Docs/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Sylius/Sylius-Docs/issues/347/comments","statuses_url":"https://api.github.com/repos/Sylius/Sylius-Docs/statuses/96ed49e6f94df78640a66eb9ade6b1ab6b00bad4","head":{"label":"tuka217:taxation-doc","ref":"taxation-doc","sha":"96ed49e6f94df78640a66eb9ade6b1ab6b00bad4","user":{"login":"tuka217","id":8963048,"avatar_url":"https://avatars.githubusercontent.com/u/8963048?v=3","gravatar_id":"","url":"https://api.github.com/users/tuka217","html_url":"https://github.com/tuka217","followers_url":"https://api.github.com/users/tuka217/followers","following_url":"https://api.github.com/users/tuka217/following{/other_user}","gists_url":"https://api.github.com/users/tuka217/gists{/gist_id}","starred_url":"https://api.github.com/users/tuka217/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tuka217/subscriptions","organizations_url":"https://api.github.com/users/tuka217/orgs","repos_url":"https://api.github.com/users/tuka217/repos","events_url":"https://api.github.com/users/tuka217/events{/privacy}","received_events_url":"https://api.github.com/users/tuka217/received_events","type":"User","site_admin":false},"repo":{"id":44741949,"name":"Sylius-Docs","full_name":"tuka217/Sylius-Docs","owner":{"login":"tuka217","id":8963048,"avatar_url":"https://avatars.githubusercontent.com/u/8963048?v=3","gravatar_id":"","url":"https://api.github.com/users/tuka217","html_url":"https://github.com/tuka217","followers_url":"https://api.github.com/users/tuka217/followers","following_url":"https://api.github.com/users/tuka217/following{/other_user}","gists_url":"https://api.github.com/users/tuka217/gists{/gist_id}","starred_url":"https://api.github.com/users/tuka217/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tuka217/subscriptions","organizations_url":"https://api.github.com/users/tuka217/orgs","repos_url":"https://api.github.com/users/tuka217/repos","events_url":"https://api.github.com/users/tuka217/events{/privacy}","received_events_url":"https://api.github.com/users/tuka217/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/tuka217/Sylius-Docs","description":"Official documentation repository, hosted on readthedocs.org.","fork":true,"url":"https://api.github.com/repos/tuka217/Sylius-Docs","forks_url":"https://api.github.com/repos/tuka217/Sylius-Docs/forks","keys_url":"https://api.github.com/repos/tuka217/Sylius-Docs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tuka217/Sylius-Docs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tuka217/Sylius-Docs/teams","hooks_url":"https://api.github.com/repos/tuka217/Sylius-Docs/hooks","issue_events_url":"https://api.github.com/repos/tuka217/Sylius-Docs/issues/events{/number}","events_url":"https://api.github.com/repos/tuka217/Sylius-Docs/events","assignees_url":"https://api.github.com/repos/tuka217/Sylius-Docs/assignees{/user}","branches_url":"https://api.github.com/repos/tuka217/Sylius-Docs/branches{/branch}","tags_url":"https://api.github.com/repos/tuka217/Sylius-Docs/tags","blobs_url":"https://api.github.com/repos/tuka217/Sylius-Docs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tuka217/Sylius-Docs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tuka217/Sylius-Docs/git/refs{/sha}","trees_url":"https://api.github.com/repos/tuka217/Sylius-Docs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tuka217/Sylius-Docs/statuses/{sha}","languages_url":"https://api.github.com/repos/tuka217/Sylius-Docs/languages","stargazers_url":"https://api.github.com/repos/tuka217/Sylius-Docs/stargazers","contributors_url":"https://api.github.com/repos/tuka217/Sylius-Docs/contributors","subscribers_url":"https://api.github.com/repos/tuka217/Sylius-Docs/subscribers","subscription_url":"https://api.github.com/repos/tuka217/Sylius-Docs/subscription","commits_url":"https://api.github.com/repos/tuka217/Sylius-Docs/commits{/sha}","git_commits_url":"https://api.github.com/repos/tuka217/Sylius-Docs/git/commits{/sha}","comments_url":"https://api.github.com/repos/tuka217/Sylius-Docs/comments{/number}","issue_comment_url":"https://api.github.com/repos/tuka217/Sylius-Docs/issues/comments{/number}","contents_url":"https://api.github.com/repos/tuka217/Sylius-Docs/contents/{+path}","compare_url":"https://api.github.com/repos/tuka217/Sylius-Docs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tuka217/Sylius-Docs/merges","archive_url":"https://api.github.com/repos/tuka217/Sylius-Docs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tuka217/Sylius-Docs/downloads","issues_url":"https://api.github.com/repos/tuka217/Sylius-Docs/issues{/number}","pulls_url":"https://api.github.com/repos/tuka217/Sylius-Docs/pulls{/number}","milestones_url":"https://api.github.com/repos/tuka217/Sylius-Docs/milestones{/number}","notifications_url":"https://api.github.com/repos/tuka217/Sylius-Docs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tuka217/Sylius-Docs/labels{/name}","releases_url":"https://api.github.com/repos/tuka217/Sylius-Docs/releases{/id}","created_at":"2015-10-22T11:50:35Z","updated_at":"2015-10-22T11:50:37Z","pushed_at":"2015-11-17T13:19:30Z","git_url":"git://github.com/tuka217/Sylius-Docs.git","ssh_url":"git@github.com:tuka217/Sylius-Docs.git","clone_url":"https://github.com/tuka217/Sylius-Docs.git","svn_url":"https://github.com/tuka217/Sylius-Docs","homepage":"Sylius.org","size":1046,"stargazers_count":0,"watchers_count":0,"language":"HTML","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"Sylius:master","ref":"master","sha":"76bdfcf850a592f25780efcdf68d448b38870dd7","user":{"login":"Sylius","id":719423,"avatar_url":"https://avatars.githubusercontent.com/u/719423?v=3","gravatar_id":"","url":"https://api.github.com/users/Sylius","html_url":"https://github.com/Sylius","followers_url":"https://api.github.com/users/Sylius/followers","following_url":"https://api.github.com/users/Sylius/following{/other_user}","gists_url":"https://api.github.com/users/Sylius/gists{/gist_id}","starred_url":"https://api.github.com/users/Sylius/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Sylius/subscriptions","organizations_url":"https://api.github.com/users/Sylius/orgs","repos_url":"https://api.github.com/users/Sylius/repos","events_url":"https://api.github.com/users/Sylius/events{/privacy}","received_events_url":"https://api.github.com/users/Sylius/received_events","type":"Organization","site_admin":false},"repo":{"id":2892960,"name":"Sylius-Docs","full_name":"Sylius/Sylius-Docs","owner":{"login":"Sylius","id":719423,"avatar_url":"https://avatars.githubusercontent.com/u/719423?v=3","gravatar_id":"","url":"https://api.github.com/users/Sylius","html_url":"https://github.com/Sylius","followers_url":"https://api.github.com/users/Sylius/followers","following_url":"https://api.github.com/users/Sylius/following{/other_user}","gists_url":"https://api.github.com/users/Sylius/gists{/gist_id}","starred_url":"https://api.github.com/users/Sylius/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Sylius/subscriptions","organizations_url":"https://api.github.com/users/Sylius/orgs","repos_url":"https://api.github.com/users/Sylius/repos","events_url":"https://api.github.com/users/Sylius/events{/privacy}","received_events_url":"https://api.github.com/users/Sylius/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Sylius/Sylius-Docs","description":"Official documentation repository, hosted on readthedocs.org.","fork":false,"url":"https://api.github.com/repos/Sylius/Sylius-Docs","forks_url":"https://api.github.com/repos/Sylius/Sylius-Docs/forks","keys_url":"https://api.github.com/repos/Sylius/Sylius-Docs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Sylius/Sylius-Docs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Sylius/Sylius-Docs/teams","hooks_url":"https://api.github.com/repos/Sylius/Sylius-Docs/hooks","issue_events_url":"https://api.github.com/repos/Sylius/Sylius-Docs/issues/events{/number}","events_url":"https://api.github.com/repos/Sylius/Sylius-Docs/events","assignees_url":"https://api.github.com/repos/Sylius/Sylius-Docs/assignees{/user}","branches_url":"https://api.github.com/repos/Sylius/Sylius-Docs/branches{/branch}","tags_url":"https://api.github.com/repos/Sylius/Sylius-Docs/tags","blobs_url":"https://api.github.com/repos/Sylius/Sylius-Docs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Sylius/Sylius-Docs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Sylius/Sylius-Docs/git/refs{/sha}","trees_url":"https://api.github.com/repos/Sylius/Sylius-Docs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Sylius/Sylius-Docs/statuses/{sha}","languages_url":"https://api.github.com/repos/Sylius/Sylius-Docs/languages","stargazers_url":"https://api.github.com/repos/Sylius/Sylius-Docs/stargazers","contributors_url":"https://api.github.com/repos/Sylius/Sylius-Docs/contributors","subscribers_url":"https://api.github.com/repos/Sylius/Sylius-Docs/subscribers","subscription_url":"https://api.github.com/repos/Sylius/Sylius-Docs/subscription","commits_url":"https://api.github.com/repos/Sylius/Sylius-Docs/commits{/sha}","git_commits_url":"https://api.github.com/repos/Sylius/Sylius-Docs/git/commits{/sha}","comments_url":"https://api.github.com/repos/Sylius/Sylius-Docs/comments{/number}","issue_comment_url":"https://api.github.com/repos/Sylius/Sylius-Docs/issues/comments{/number}","contents_url":"https://api.github.com/repos/Sylius/Sylius-Docs/contents/{+path}","compare_url":"https://api.github.com/repos/Sylius/Sylius-Docs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Sylius/Sylius-Docs/merges","archive_url":"https://api.github.com/repos/Sylius/Sylius-Docs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Sylius/Sylius-Docs/downloads","issues_url":"https://api.github.com/repos/Sylius/Sylius-Docs/issues{/number}","pulls_url":"https://api.github.com/repos/Sylius/Sylius-Docs/pulls{/number}","milestones_url":"https://api.github.com/repos/Sylius/Sylius-Docs/milestones{/number}","notifications_url":"https://api.github.com/repos/Sylius/Sylius-Docs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Sylius/Sylius-Docs/labels{/name}","releases_url":"https://api.github.com/repos/Sylius/Sylius-Docs/releases{/id}","created_at":"2011-12-01T17:58:56Z","updated_at":"2015-11-12T14:30:17Z","pushed_at":"2015-11-17T22:32:53Z","git_url":"git://github.com/Sylius/Sylius-Docs.git","ssh_url":"git@github.com:Sylius/Sylius-Docs.git","clone_url":"https://github.com/Sylius/Sylius-Docs.git","svn_url":"https://github.com/Sylius/Sylius-Docs","homepage":"Sylius.org","size":1286,"stargazers_count":55,"watchers_count":55,"language":"HTML","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":128,"mirror_url":null,"open_issues_count":46,"forks":128,"open_issues":46,"watchers":55,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Sylius/Sylius-Docs/pulls/347"},"html":{"href":"https://github.com/Sylius/Sylius-Docs/pull/347"},"issue":{"href":"https://api.github.com/repos/Sylius/Sylius-Docs/issues/347"},"comments":{"href":"https://api.github.com/repos/Sylius/Sylius-Docs/issues/347/comments"},"review_comments":{"href":"https://api.github.com/repos/Sylius/Sylius-Docs/pulls/347/comments"},"review_comment":{"href":"https://api.github.com/repos/Sylius/Sylius-Docs/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Sylius/Sylius-Docs/pulls/347/commits"},"statuses":{"href":"https://api.github.com/repos/Sylius/Sylius-Docs/statuses/96ed49e6f94df78640a66eb9ade6b1ab6b00bad4"}}}}