|
|
@@ -41,7 +41,9 @@ class OrderShopPriceUtils implements OrderShopPriceUtilsInterface |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public function getTotalOrderProductsTaxes(OrderShopInterface $orderShop):float { |
|
|
|
public function getTotalOrderProductsTaxes(OrderShopInterface $orderShop):float |
|
|
|
{ |
|
|
|
return 0 ; |
|
|
|
} |
|
|
|
|
|
|
|
public function getOrderProductsTaxesAsArray(OrderShopInterface $orderShop):array |
|
|
@@ -71,9 +73,9 @@ class OrderShopPriceUtils implements OrderShopPriceUtilsInterface |
|
|
|
return $this->getTotalOrderProducts($orderShop) / $this->getTotalOrderProductsWithReductions($orderShop); |
|
|
|
} |
|
|
|
|
|
|
|
private function getTaxRateAverage(OrderShopInterface $order):float |
|
|
|
private function getTaxRateAverage(OrderShopInterface $orderShop):float |
|
|
|
{ |
|
|
|
return $this->getTotalOrderProductsWithTax() / $this->getTotalOrderProducts(); |
|
|
|
return $this->getTotalOrderProductsWithTax($orderShop) / $this->getTotalOrderProducts($orderShop); |
|
|
|
} |
|
|
|
|
|
|
|
public function getTotalOrderProductsWithReductions(OrderShopInterface $orderShop) |
|
|
@@ -126,7 +128,7 @@ class OrderShopPriceUtils implements OrderShopPriceUtilsInterface |
|
|
|
if ($orderReductionCart->getBehaviorTaxRate() == 'tax-excluded') { |
|
|
|
$price = $orderReductionCart->getValue(); |
|
|
|
} else if ($orderReductionCart->getBehaviorTaxRate() == 'tax-included') { |
|
|
|
$price = $orderReductionCart->getValue() / $this->getTaxRateAverage(); |
|
|
|
$price = $orderReductionCart->getValue() / $this->getTaxRateAverage($order); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
@@ -137,34 +139,37 @@ class OrderShopPriceUtils implements OrderShopPriceUtilsInterface |
|
|
|
|
|
|
|
public function getOrderProductsReductionCartAmountWithTax(OrderShopInterface $order, $orderReductionCart) |
|
|
|
{ |
|
|
|
$amount = 0; |
|
|
|
|
|
|
|
$amount =0; |
|
|
|
if($orderReductionCart->getAppliedTo() === ReductionCart::APPLIED_TO_ORDER_PRODUCTS) { |
|
|
|
if ($orderReductionCart->getUnit() == 'percent') { |
|
|
|
|
|
|
|
$amount = $this->amountReductionByPercentValue( |
|
|
|
$this->getTotalOrderProductsWithTax($order), |
|
|
|
$orderReductionCart->getValue() |
|
|
|
); |
|
|
|
} else if ($orderReductionCart->getUnit() == 'amount') { |
|
|
|
} |
|
|
|
elseif ($orderReductionCart->getUnit() == 'amount') { |
|
|
|
if ($orderReductionCart->getBehaviorTaxRate() == 'tax-excluded') { |
|
|
|
$amount = $orderReductionCart->getValue() * $this->getTaxRateAverage(); |
|
|
|
} else if ($orderReductionCart->getBehaviorTaxRate() == 'tax-included') { |
|
|
|
$amount = $orderReductionCart->getValue() * $this->getTaxRateAverage($order); |
|
|
|
} |
|
|
|
elseif ($orderReductionCart->getBehaviorTaxRate() == 'tax-included') { |
|
|
|
$amount = $orderReductionCart->getValue() ; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return $amount ; |
|
|
|
} |
|
|
|
|
|
|
|
public function getOrderProductsReductionCreditAmountWithoutTax(OrderShopInterface $order, OrderReductionCreditInterface $orderReductionCredit) |
|
|
|
{ |
|
|
|
$amount =0; |
|
|
|
$amount = 0; |
|
|
|
if ($orderReductionCredit->getBehaviorTaxRate() == 'tax-excluded') { |
|
|
|
$amount = $orderReductionCredit->getValue(); |
|
|
|
} else if ($orderReductionCredit->getBehaviorTaxRate() == 'tax-included') { |
|
|
|
$amount = $orderReductionCredit->getValue() / $this->getTaxRateAverage(); |
|
|
|
} |
|
|
|
else if ($orderReductionCredit->getBehaviorTaxRate() == 'tax-included') { |
|
|
|
$amount = $orderReductionCredit->getValue() / $this->getTaxRateAverage($order); |
|
|
|
} |
|
|
|
|
|
|
|
return $amount; |
|
|
@@ -172,12 +177,14 @@ class OrderShopPriceUtils implements OrderShopPriceUtilsInterface |
|
|
|
|
|
|
|
public function getOrderProductsReductionCreditAmountWithTax(OrderShopInterface $order, OrderReductionCreditInterface $orderReductionCredit) |
|
|
|
{ |
|
|
|
$amount =0; |
|
|
|
$amountWithTax = 0; |
|
|
|
if ($orderReductionCredit->getBehaviorTaxRate() == 'tax-excluded') { |
|
|
|
$amountWithTax = $orderReductionCredit->getValue() * $this->getTaxRateAverage(); |
|
|
|
} else if ($orderReductionCredit->getBehaviorTaxRate() == 'tax-included') { |
|
|
|
$amountWithTax = $orderReductionCredit->getValue() * $this->getTaxRateAverage($order); |
|
|
|
} |
|
|
|
elseif ($orderReductionCredit->getBehaviorTaxRate() == 'tax-included') { |
|
|
|
$amountWithTax = $orderReductionCredit->getValue(); |
|
|
|
} |
|
|
|
|
|
|
|
return $amountWithTax; |
|
|
|
} |
|
|
|
} |