Skip to content

Commit

Permalink
Merge branch '1.0' into feature/add-cart-shipping-option-endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
repl6669 committed Nov 28, 2024
2 parents 3f29dea + a3c9fd9 commit f4c17a9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### Changes

- Removed relationship links from responses by default
- Changed price taxation config to `lunar.pricing.stored_inclusive_of_tax` from `lunar-api.general.taxation.prices_with_default_tax`

### ⚠️ Breaking changes

Expand Down
5 changes: 0 additions & 5 deletions config/general.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,6 @@
'max_size' => 48,
],

// Tax defaults
'taxation' => [
'prices_with_default_tax' => true,
],

// Purchasable
'purchasable' => [
'non_eloquent_types' => [
Expand Down
7 changes: 4 additions & 3 deletions src/Domain/Prices/Actions/GetPrice.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class GetPrice

public function __construct()
{
$this->withTax = Config::get('lunar-api.general.taxation.prices_with_default_tax');
$this->withTax = Config::get('lunar.pricing.stored_inclusive_of_tax');

$this->getPriceWithDefaultTax = new GetPriceWithDefaultTax;
}
Expand All @@ -24,10 +24,11 @@ public function __construct()
*/
public function __invoke(Price $price, Purchasable $purchasable): Price
{
// NOTE: If prices are stored inclusive of tax, we can return the price as is
if ($this->withTax) {
return ($this->getPriceWithDefaultTax)($price, $purchasable);
return $price;
}

return $price;
return ($this->getPriceWithDefaultTax)($price, $purchasable);
}
}

0 comments on commit f4c17a9

Please sign in to comment.