![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/old/app/code/Cnc/Checkout/Helper/ |
<?php /** * Copyright (c) 2019 Kaliop Digital Commerce (https://digitalcommerce.kaliop.com) All Rights Reserved. * https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) * cnc_checkout_m2 * <[email protected]> */ namespace Cnc\Checkout\Helper; use Magento\Framework\App\Helper\AbstractHelper; use Magento\Framework\App\Helper\Context; use Magento\Framework\Exception\InputException; use Magento\Framework\Exception\NoSuchEntityException; use Magento\Sales\Model\Order; use Magento\Sales\Model\Order\Payment; use Magento\Sales\Model\OrderRepository; class Data extends AbstractHelper { /** * @var OrderRepository */ private $orderRepository; /** * Helper constructor. * @param Context $context * @param OrderRepository $orderRepository */ public function __construct(Context $context, OrderRepository $orderRepository) { parent::__construct($context); $this->orderRepository = $orderRepository; } /** * Can show proforma. * * @param $orderId int * @return bool * @throws InputException * @throws NoSuchEntityException */ public function canShowProforma($orderId) { if (!$orderId) { return false; } $methods = []; $value = $this->scopeConfig->getValue(Config::PROFORMA_AVAILABLE_METHODS_XML_PATH); if ($value) { $methods = explode(',', $value); } if (empty($methods)) { return false; } /** @var Order $order */ $order = $this->orderRepository->get($orderId); if (in_array($order->getState(), ['complete', 'canceled', 'closed'])) { return false; } $payments = $order->getAllPayments(); /** @var Payment $payment */ foreach ($payments as $payment) { if (in_array($payment->getMethod(), $methods)) { return true; } } return true; } /** * Get message of confirmation of shipping time on request. * * @return mixed */ public function getConfirmationOfShippingTimeOnRequestMessage() { return $this->scopeConfig->getValue(Config::CONFIRMATION_SHIPPING_TIME_ON_REQUEST_SUCCESS_MESSAGE_XML_PATH); } }