Skip to content

Commit

Permalink
Merge pull request #59 from lukepolo/taxation_item_hash
Browse files Browse the repository at this point in the history
Taxation item hash
  • Loading branch information
lukepolo committed Jan 22, 2016
2 parents b90a310 + 519cee4 commit 9af1b29
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/CartItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,14 @@ public function __construct($id, $name, $qty, $price, $options = [], $taxable =
$this->id = $id;
$this->qty = $qty;
$this->name = $name;
foreach($options as $option => $value) {
$this->$option = $value;
}
$this->taxable = $taxable;
$this->lineItem = $lineItem;
$this->price = floatval($price);
$this->tax = config('laracart.tax');

foreach($options as $option => $value) {
$this->$option = $value;
}
}

/**
Expand Down
6 changes: 6 additions & 0 deletions tests/ItemsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -207,5 +207,11 @@ public function testDifferentTaxes() {
$item->tax = .3;

$this->assertEquals('2.35', $this->laracart->total(false));

$item = $this->addItem(1, 1, true, [
'tax' => .7
]);

$this->assertEquals('1.70', $item->subTotal(true, false));
}
}

0 comments on commit 9af1b29

Please sign in to comment.