diff --git a/Controller/Adminhtml/Order/Unhold.php b/Controller/Adminhtml/Order/Unhold.php index 2a1ab3e2..1f08ac26 100644 --- a/Controller/Adminhtml/Order/Unhold.php +++ b/Controller/Adminhtml/Order/Unhold.php @@ -20,32 +20,26 @@ class Unhold extends \Magento\Sales\Controller\Adminhtml\Order\Unhold */ public function execute() { - $resultRedirect = parent::execute(); + try { + $order = $this->orderRepository->get($this->getRequest()->getParam('order_id')); + } catch (NoSuchEntityException $e) { + return parent::execute(); + } - /** @var \Magento\Sales\Model\Order $order */ - $order = $this->_coreRegistry->registry('current_order'); - $order->canUnhold(); + /** @var $case \Signifyd\Connect\Model\Casedata */ + $case = $this->_objectManager->get('Signifyd\Connect\Model\Casedata'); + $case->load($order->getIncrementId()); - if ($order->getStatus() != Order::STATE_HOLDED) { - $case = $this->getCase($order); + if (!$case->isHoldReleased()) { + $case->setEntries('hold_released', 1); + $case->save(); + } - if (!$case->isHoldReleased()) { - $case->setEntries('hold_released', 1); - $case->save(); + $resultRedirect = parent::execute(); - $order->addStatusHistoryComment('Order released from hold by merchant'); - $order->save(); - } - } + $order->addStatusHistoryComment('Order released from hold by merchant'); + $order->save(); return $resultRedirect; } - - public function getCase(Order $order) - { - /** @var $case \Signifyd\Connect\Model\Casedata */ - $case = $this->_objectManager->get('Signifyd\Connect\Model\Casedata'); - $case->load($order->getIncrementId()); - return $case; - } } diff --git a/Observer/Purchase.php b/Observer/Purchase.php index dd21ff21..9f7c35c3 100644 --- a/Observer/Purchase.php +++ b/Observer/Purchase.php @@ -45,8 +45,7 @@ class Purchase implements ObserverInterface protected $specialMethods = ['payflow_express']; -// protected $restrictedMethods = ['checkmo', 'banktransfer', 'purchaseorder', 'cashondelivery']; - protected $restrictedMethods = ['banktransfer', 'purchaseorder', 'cashondelivery']; + protected $restrictedMethods = ['checkmo', 'banktransfer', 'purchaseorder', 'cashondelivery']; public function __construct( LogHelper $logger, diff --git a/etc/crontab.xml b/etc/crontab.xml index c3096758..03c8fa0a 100644 --- a/etc/crontab.xml +++ b/etc/crontab.xml @@ -2,7 +2,7 @@ - */1 * * * * + */15 * * * * diff --git a/view/adminhtml/web/js/sales_order_view.js b/view/adminhtml/web/js/sales_order_view.js index 99d22bf0..d318bc72 100644 --- a/view/adminhtml/web/js/sales_order_view.js +++ b/view/adminhtml/web/js/sales_order_view.js @@ -32,8 +32,6 @@ define([ var msg = $.mage.__('Signifyd has not reviewed this order, are you sure you want to unhold?'), url = $('#order-view-unhold-button').data('url'); - console.log(url); - confirm({ 'content': msg, 'actions': {