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 37f8a7d5 authored by attilak's avatar attilak

Replace $minutesUntilProcessing calculation to use timestamps

The minute formatter only returned the minutes but not the hours, days,
etc
parent 1f507047
...@@ -352,9 +352,9 @@ class Cron ...@@ -352,9 +352,9 @@ class Cron
// Remove OFFER_CLOSED notifications arrived in the last 10 minutes from the list to process to ensure it // Remove OFFER_CLOSED notifications arrived in the last 10 minutes from the list to process to ensure it
// won't close any order which has an AUTHORISED notification arrived a bit later than the OFFER_CLOSED one. // won't close any order which has an AUTHORISED notification arrived a bit later than the OFFER_CLOSED one.
$createdAt = \DateTime::createFromFormat('Y-m-d H:i:s', $notification['created_at']); $createdAt = \DateTime::createFromFormat('Y-m-d H:i:s', $notification['created_at']);
// Difference between $offerClosedMinDate and $createdAt in minutes is the time until processing the // To get the difference between $offerClosedMinDate and $createdAt, $offerClosedMinDate time in seconds is
// notification in minutes // deducted from $createdAt time in seconds, divided by 60 and rounded down to integer
$minutesUntilProcessing = $offerClosedMinDate->diff($createdAt)->i; $minutesUntilProcessing = floor(($createdAt->getTimestamp() - $offerClosedMinDate->getTimestamp()) / 60);
if ($notification['event_code'] == Notification::OFFER_CLOSED && $minutesUntilProcessing > 0) { if ($notification['event_code'] == Notification::OFFER_CLOSED && $minutesUntilProcessing > 0) {
$this->_adyenLogger->addAdyenNotificationCronjob( $this->_adyenLogger->addAdyenNotificationCronjob(
sprintf('OFFER_CLOSED notification %s skipped! Wait %s minute(s) before processing.', sprintf('OFFER_CLOSED notification %s skipped! Wait %s minute(s) before processing.',
......
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