|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(isset($reductionCatalogValue) && isset($reductionCatalogUnit) && isset($reductionCatalogBehaviorTaxRate)) { |
|
|
if(isset($reductionCatalogValue) && isset($reductionCatalogUnit) && isset($reductionCatalogBehaviorTaxRate)) { |
|
|
if ($reductionCatalogUnit == 'percent') { |
|
|
if ($reductionCatalogUnit == 'percent') { |
|
|
return $this->applyReductionPercent( |
|
|
|
|
|
|
|
|
$priceWithTax = $this->applyReductionPercent( |
|
|
$priceWithTax, |
|
|
$priceWithTax, |
|
|
$reductionCatalogValue |
|
|
$reductionCatalogValue |
|
|
); |
|
|
); |
|
|
} |
|
|
} |
|
|
elseif ($reductionCatalogUnit == 'amount') { |
|
|
elseif ($reductionCatalogUnit == 'amount') { |
|
|
if($reductionCatalogBehaviorTaxRate == 'tax-excluded') { |
|
|
if($reductionCatalogBehaviorTaxRate == 'tax-excluded') { |
|
|
return $this->applyTax( |
|
|
|
|
|
|
|
|
$priceWithTax = $this->applyTax( |
|
|
$this->applyReductionAmount( |
|
|
$this->applyReductionAmount( |
|
|
$price, |
|
|
$price, |
|
|
$reductionCatalogValue |
|
|
$reductionCatalogValue |
|
|
|
|
|
|
|
|
); |
|
|
); |
|
|
} |
|
|
} |
|
|
elseif($reductionCatalogBehaviorTaxRate == 'tax-included') { |
|
|
elseif($reductionCatalogBehaviorTaxRate == 'tax-included') { |
|
|
return $this->applyReductionAmount( |
|
|
|
|
|
|
|
|
$priceWithTax = $this->applyReductionAmount( |
|
|
$priceWithTax, |
|
|
$priceWithTax, |
|
|
$reductionCatalogValue |
|
|
$reductionCatalogValue |
|
|
); |
|
|
); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return $priceWithTax ; |
|
|
|
|
|
|
|
|
return $this->round($priceWithTax) ; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public function applyTax($price, $taxRateValue) |
|
|
public function applyTax($price, $taxRateValue) |