Skip to content

Commit

Permalink
MAG1-97
Browse files Browse the repository at this point in the history
Adjustments to allow order to be released from hold
  • Loading branch information
ebanolopes committed Dec 9, 2017
1 parent a002dc3 commit f8c50b5
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 26 deletions.
36 changes: 15 additions & 21 deletions Controller/Adminhtml/Order/Unhold.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
3 changes: 1 addition & 2 deletions Observer/Purchase.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion etc/crontab.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Cron:etc/crontab.xsd">
<group id="default">
<job name="cron_retry" instance="Signifyd\Connect\Cron\RetryCaseJob" method="execute">
<schedule>*/1 * * * *</schedule>
<schedule>*/15 * * * *</schedule>
</job>
</group>
</config>
2 changes: 0 additions & 2 deletions view/adminhtml/web/js/sales_order_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -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': {
Expand Down

0 comments on commit f8c50b5

Please sign in to comment.