We will work on Apr 26th (Saturday) and will be off from Apr 30th (Wednesday) until May 2nd (Friday) for public holiday in our country

Commit 4737c28a authored by Rik ter Beek's avatar Rik ter Beek Committed by GitHub

Merge pull request #138 from shruti-ranium/cron-fix

Added new column processing to adyen notification table to know if no…
parents 8a1ca3e3 76081f24
...@@ -224,8 +224,17 @@ class Cron ...@@ -224,8 +224,17 @@ class Cron
// create collection // create collection
$notifications = $this->_notificationFactory->create(); $notifications = $this->_notificationFactory->create();
$notifications->addFieldToFilter('done', 0); $notifications->addFieldToFilter('done', 0);
$notifications->addFieldToFilter('processing', 0);
$notifications->addFieldToFilter('created_at', $dateRange); $notifications->addFieldToFilter('created_at', $dateRange);
foreach ($notifications as $notification) {
// set Cron processing to true
$dateEnd = new \DateTime();
$notification->setProcessing(true);
$notification->setUpdatedAt($dateEnd);
$notification->save();
}
// loop over the notifications // loop over the notifications
$count = 0; $count = 0;
foreach ($notifications as $notification) { foreach ($notifications as $notification) {
...@@ -322,6 +331,7 @@ class Cron ...@@ -322,6 +331,7 @@ class Cron
// set done to true // set done to true
$dateEnd = new \DateTime(); $dateEnd = new \DateTime();
$notification->setDone(true); $notification->setDone(true);
$notification->setProcessing(false);
$notification->setUpdatedAt($dateEnd); $notification->setUpdatedAt($dateEnd);
$notification->save(); $notification->save();
$this->_adyenLogger->addAdyenNotificationCronjob( $this->_adyenLogger->addAdyenNotificationCronjob(
......
...@@ -59,6 +59,10 @@ class UpgradeSchema implements UpgradeSchemaInterface ...@@ -59,6 +59,10 @@ class UpgradeSchema implements UpgradeSchemaInterface
$this->updateSchemaVersion204($setup); $this->updateSchemaVersion204($setup);
} }
if (version_compare($context->getVersion(), '2.0.7', '<')) {
$this->updateSchemaVersion207($setup);
}
$setup->endSetup(); $setup->endSetup();
} }
...@@ -262,4 +266,32 @@ class UpgradeSchema implements UpgradeSchemaInterface ...@@ -262,4 +266,32 @@ class UpgradeSchema implements UpgradeSchemaInterface
] ]
); );
} }
/**
* Upgrade to 2.0.7
*
* @param SchemaSetupInterface $setup
* @return void
*/
public function updateSchemaVersion207(SchemaSetupInterface $setup)
{
$connection = $setup->getConnection();
$tableName = $setup->getTable('adyen_notification');
$adyenNotificationProcessingColumn = [
'type' => Table::TYPE_BOOLEAN,
'length' => 1,
'nullable' => true,
'default' => 0,
'comment' => 'Adyen Notification Cron Processing',
'after' => \Adyen\Payment\Model\Notification::DONE
];
$connection->addColumn(
$tableName,
'processing',
$adyenNotificationProcessingColumn
);
}
} }
\ No newline at end of file
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
--> -->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd"> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Adyen_Payment" setup_version="2.0.6"> <module name="Adyen_Payment" setup_version="2.0.7">
<sequence> <sequence>
<module name="Magento_Sales"/> <module name="Magento_Sales"/>
<module name="Magento_Quote"/> <module name="Magento_Quote"/>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment