namespace Bhaveshpp\Custom\ViewModel;
use Magento\Sales\Api\Data\OrderInterfaceFactory;
class OrderPendingMessage implements \Magento\Framework\View\Element\Block\ArgumentInterface
{
protected $orderFactory;
public function __construct(
OrderInterfaceFactory $orderFactory
) {
$this->orderFactory = $orderFactory;
}
public function hasPendingStatus($orderId)
{
$order = $this->getOrder($orderId);
$status = $order->getStatus();
$payment = $order->getPayment();
$method = $payment->getMethodInstance();
$methodCode = $method->getCode();
if (($status == "pending")&&(strpos($methodCode,"monetico"))) {
return true;
}
return false;
}
public function getOrder($id)
{
return $this->orderFactory->Create()->loadByIncrementId($id);
}
}