|
|
@@ -16,41 +16,67 @@ class OrderShopPriceUtils implements OrderShopPriceUtilsInterface |
|
|
|
$this->orderProductPriceUtils = $orderProductPriceUtils ; |
|
|
|
} |
|
|
|
|
|
|
|
public function getTotal(OrderShopInterface $orderShop) |
|
|
|
//Inclus les ReductionCatalog des OrderProducts |
|
|
|
public function getTotalOrderProducts(OrderShopInterface $orderShop):float |
|
|
|
{ |
|
|
|
// A tester calculer ce montant en faisant TotalOrderWithTax - TotalOrderTaxes |
|
|
|
|
|
|
|
$total = 0; |
|
|
|
foreach ($orderShop->getOrderProducts() as $orderProduct) { |
|
|
|
$total += $this->orderProductPriceUtils->getTotalWithReduction($orderProduct); |
|
|
|
} |
|
|
|
return $total; |
|
|
|
} |
|
|
|
|
|
|
|
public function getTotalWithReductionCatalog(OrderShopInterface $orderShop) |
|
|
|
public function getTotalOrderProductsWithTax(OrderShopInterface $orderShop):float |
|
|
|
{ |
|
|
|
$total = 0; |
|
|
|
foreach ($orderShop->getOrderProducts() as $orderProduct) { |
|
|
|
$total += $this->orderProductPriceUtils->getTotalWithTaxAndReduction($orderProduct); |
|
|
|
} |
|
|
|
return $total; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
public function getTotalWithReductionCart(OrderShopInterface $orderShop) |
|
|
|
{ |
|
|
|
|
|
|
|
public function getTotalOrderProductsTaxes(OrderShopInterface $orderShop):float { |
|
|
|
} |
|
|
|
|
|
|
|
public function getTotalWithReductions(OrderShopInterface $orderShop) |
|
|
|
public function getOrderProductsTaxesAsArray(OrderShopInterface $orderShop):array |
|
|
|
{ |
|
|
|
$orderProductsTaxes = []; |
|
|
|
foreach ($orderShop->getOrderProducts() as $orderProduct) { |
|
|
|
|
|
|
|
} |
|
|
|
$idTaxRate = $orderProduct->getTaxRate()->getId() ; |
|
|
|
|
|
|
|
public function getTotalWithTax(OrderShopInterface $orderShop) |
|
|
|
{ |
|
|
|
if(!isset($orderProductsTaxes[$idTaxRate])) { |
|
|
|
$orderProductsTaxes[$idTaxRate] = [ |
|
|
|
'label' => $orderProduct->getTaxRate()->getValue() . '%', |
|
|
|
'totalOrderProducts' => 0, |
|
|
|
'totalTaxes' => 0, |
|
|
|
]; |
|
|
|
} |
|
|
|
|
|
|
|
$orderProductsTaxes[$idTaxRate]['totalOrderProducts'] += $this->orderProductPriceUtils->getTotalWithReduction($orderProduct) * $this->getReductionsCoef($orderShop); |
|
|
|
$orderProductsTaxes[$idTaxRate]['totalTaxes'] += $this->orderProductPriceUtils->getTotalTaxes($orderProduct) * $this->getReductionsCoef($orderShop) ; |
|
|
|
} |
|
|
|
|
|
|
|
return $orderProductsTaxes ; |
|
|
|
} |
|
|
|
|
|
|
|
public function getTotalWithTaxAndReductionCatalog(OrderShopInterface $orderShop) |
|
|
|
private function getReductionsCoef(OrderShopInterface $orderShop) :float |
|
|
|
{ |
|
|
|
|
|
|
|
return $this->getTotalOrderProducts($orderShop) / $this->getTotalOrderProductsWithReductions($orderShop); |
|
|
|
} |
|
|
|
|
|
|
|
public function getTotalWithTaxAndReductionCart(OrderShopInterface $orderShop) |
|
|
|
|
|
|
|
|
|
|
|
public function getTotalOrderProductsWithReductions(OrderShopInterface $orderShop) |
|
|
|
{ |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public function getTotalWithTaxAndReductions(OrderShopInterface $orderShop) |
|
|
|
{ |
|
|
|
|