|
- <?php
-
- namespace common\logic\Order\ProductOrder;
-
- use common\helpers\Price;
- use common\logic\BaseService;
- use common\logic\Order\Order\Order;
- use common\logic\SolverInterface;
-
- class ProductOrderSolver extends BaseService implements SolverInterface
- {
- /**
- * Retourne le prix du produit avec taxe
- */
- public function getPriceWithTax(ProductOrder $productOrder): float
- {
- return Price::getPriceWithTax($productOrder->price, $productOrder->taxRate->value);
- }
-
- public function getPriceByTypeTotal(ProductOrder $productOrder, string $typeTotal = Order::AMOUNT_TOTAL): float
- {
- if ($typeTotal == Order::INVOICE_AMOUNT_TOTAL && $productOrder->invoice_price) {
- return $productOrder->invoice_price;
- }
-
- return $productOrder->price;
- }
- }
|