priceSolver = $priceSolver; $this->orderShopSolver = $orderShopSolver; } public function hasOrderProductAlreadyInCart( OrderShopInterface $orderShop, OrderProductInterface $orderProductTest ): ?OrderProductInterface { foreach ($orderShop->getOrderProducts() as $orderProduct) { if ($orderProduct->getProduct() == $orderProductTest->getProduct()) { return $orderProduct; } } return null; } public function isValid(OrderShopInterface $orderShop): bool { if ($orderShop->getOrderStatus() && in_array( $orderShop->getOrderStatus()->getAlias(), OrderStatusModel::$statusAliasAsValid ) > 0) { return true; } return false; } public function isCart(OrderShopInterface $orderShop): bool { if ($orderShop->getOrderStatus() && in_array( $orderShop->getOrderStatus()->getAlias(), OrderStatusModel::$statusAliasAsCart ) > 0) { return true; } return false; } // isOrderShopPositiveAmount public function isPositiveAmount(OrderShopInterface $orderShop): bool { return $this->priceSolver->getTotalWithTax($orderShop) >= 0; } public function isPaid(OrderShopInterface $orderShop, $mergeComplementaryOrderShop = false): bool { $totalOrderPayments = $this->orderShopSolver->getTotalOrderPayments($orderShop, $mergeComplementaryOrderShop); $totalOrder = $this->priceSolver->getTotalWithTax($orderShop); if ((abs($totalOrderPayments - $totalOrder) < 0.00001 || $totalOrderPayments >= $totalOrder) && $totalOrder > 0) { return true; } else { return false; } } // isOrderShopPositiveAmountRemainingToBePaid public function isPositiveAmountRemainingToBePaid(OrderShopInterface $orderShop): bool { return $this->orderShopSolver->getTotalRemainingToBePaid($orderShop) > 0; } public function isCartAllowToBeOrder(OrderShopInterface $orderShop): bool { return true; } }