This commit is contained in:
Patrick Henninger
2019-09-27 19:00:10 +02:00
parent bfbebfd391
commit 14e8a40534
2 changed files with 21 additions and 7 deletions

View File

@@ -58,6 +58,13 @@ class CartItem implements Arrayable, Jsonable
*/
public $options;
/**
* The tax rate for the cart item.
*
* @var int|float
*/
public $taxRate = 0;
/**
* The FQN of the associated model.
*
@@ -65,13 +72,6 @@ class CartItem implements Arrayable, Jsonable
*/
private $associatedModel = null;
/**
* The tax rate for the cart item.
*
* @var int|float
*/
private $taxRate = 0;
/**
* The discount rate for the cart item.
*

View File

@@ -756,6 +756,20 @@ class CartTest extends TestCase
$this->assertEquals('1.050,00', $cart->tax(2, ',', '.'));
}
/** @test */
public function it_can_access_tax_as_percentage()
{
$cart = $this->getCart();
$cart->add(new BuyableProduct(1, 'Some title', 10.00), 1);
$cart->setTax('027c91341fd5cf4d2579b49c4b6a90da', 19);
$cartItem = $cart->get('027c91341fd5cf4d2579b49c4b6a90da');
$this->assertEquals(19, $cartItem->taxRate);
}
/** @test */
public function it_can_return_the_subtotal()
{