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 fcff0224 authored by Ángel Campos's avatar Ángel Campos Committed by GitHub

Merge pull request #916 from Adyen/develop

Release 6.6.7
parents f2ded80d 9e7967cc
* @cyattilakiss @AlexandrosMor @msilvagarcia @acampos1916 @Aleffio @rikterbeek * @cyattilakiss @AlexandrosMor @msilvagarcia @acampos1916 @Aleffio @rikterbeek @peterojo
...@@ -382,21 +382,53 @@ class Cron ...@@ -382,21 +382,53 @@ class Cron
*/ */
private function shouldSkipProcessingNotification($notification) private function shouldSkipProcessingNotification($notification)
{ {
switch ($notification['event_code']) {
// Remove OFFER_CLOSED and AUTHORISATION success=false notifications for some time from the processing list
// to ensure they won't close any order which has an AUTHORISED notification arrived a bit later than the
// OFFER_CLOSED or the AUTHORISATION success=false one.
case Notification::OFFER_CLOSED:
// OFFER_CLOSED notifications needs to be at least 10 minutes old to be processed // OFFER_CLOSED notifications needs to be at least 10 minutes old to be processed
$offerClosedMinDate = new \DateTime(); $offerClosedMinDate = new \DateTime('-10 minutes');
$offerClosedMinDate->modify('-10 minutes'); $createdAt = \DateTime::createFromFormat('Y-m-d H:i:s', $notification['created_at']);
$minutesUntilProcessing = $createdAt->diff($offerClosedMinDate)->i;
if ($minutesUntilProcessing > 0) {
$this->_adyenLogger->addAdyenNotificationCronjob(
sprintf(
'OFFER_CLOSED notification (entity_id: %s) for merchant_reference: %s is skipped! Wait %s minute(s) before processing.',
$notification->getEntityId(),
$notification->getMerchantReference(),
$minutesUntilProcessing
)
);
return true;
}
break;
case Notification::AUTHORISATION:
// Only delay success=false notifications processing
if (
strcmp($notification['success'], 'true') == 0 ||
strcmp($notification['success'], '1') == 0
) {
// do not skip this notification but process it now
return false;
}
// Remove OFFER_CLOSED notifications arrived in the last 10 minutes from the list to process to ensure it // AUTHORISATION success=false notifications needs to be at least 10 minutes old to be processed
// won't close any order which has an AUTHORISED notification arrived a bit later than the OFFER_CLOSED one. $authorisationSuccessFalseMinDate = new \DateTime('-10 minutes');
$createdAt = \DateTime::createFromFormat('Y-m-d H:i:s', $notification['created_at']); $createdAt = \DateTime::createFromFormat('Y-m-d H:i:s', $notification['created_at']);
// To get the difference between $offerClosedMinDate and $createdAt, $offerClosedMinDate time in seconds is
// deducted from $createdAt time in seconds, divided by 60 and rounded down to integer $minutesUntilProcessing = $createdAt->diff($authorisationSuccessFalseMinDate)->i;
$minutesUntilProcessing = floor(($createdAt->getTimestamp() - $offerClosedMinDate->getTimestamp()) / 60);
if ($notification['event_code'] == Notification::OFFER_CLOSED && $minutesUntilProcessing > 0) { if ($minutesUntilProcessing > 0) {
$this->_adyenLogger->addAdyenNotificationCronjob( $this->_adyenLogger->addAdyenNotificationCronjob(
sprintf( sprintf(
'OFFER_CLOSED notification %s skipped! Wait %s minute(s) before processing.', 'AUTHORISATION success=false notification (entity_id: %s) for merchant_reference: %s is skipped! Wait %s minute(s) before processing.',
$notification->getEntityId(), $notification->getEntityId(),
$notification->getMerchantReference(),
$minutesUntilProcessing $minutesUntilProcessing
) )
); );
...@@ -404,6 +436,9 @@ class Cron ...@@ -404,6 +436,9 @@ class Cron
return true; return true;
} }
break;
}
return false; return false;
} }
...@@ -753,7 +788,8 @@ class Cron ...@@ -753,7 +788,8 @@ class Cron
// if payment method is klarna, ratepay or openinvoice/afterpay show the reservartion number // if payment method is klarna, ratepay or openinvoice/afterpay show the reservartion number
if ($this->_adyenHelper->isPaymentMethodOpenInvoiceMethod( if ($this->_adyenHelper->isPaymentMethodOpenInvoiceMethod(
$this->_paymentMethod) && !empty($this->_klarnaReservationNumber)) { $this->_paymentMethod
) && !empty($this->_klarnaReservationNumber)) {
$klarnaReservationNumberText = "<br /> reservationNumber: " . $this->_klarnaReservationNumber; $klarnaReservationNumberText = "<br /> reservationNumber: " . $this->_klarnaReservationNumber;
} else { } else {
$klarnaReservationNumberText = ""; $klarnaReservationNumberText = "";
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
* Author: Adyen <magento@adyen.com> * Author: Adyen <magento@adyen.com>
*/ */
namespace Adyen\Payment\Observer\Adminhtml; namespace Adyen\Payment\Observer;
use Adyen\Payment\Helper\Data as AdyenHelper; use Adyen\Payment\Helper\Data as AdyenHelper;
use Adyen\Payment\Logger\AdyenLogger; use Adyen\Payment\Logger\AdyenLogger;
......
<?xml version="1.0"?>
<!--
/**
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* Adyen Payment module (https://www.adyen.com/)
*
* Copyright (c) 2015 Adyen BV (https://www.adyen.com/)
* See LICENSE.txt for license details.
*
* Author: Adyen <magento@adyen.com>
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
<event name="sales_order_shipment_save_before">
<observer name="adyen_shipment_save_before" instance="Adyen\Payment\Observer\Adminhtml\BeforeShipmentObserver" />
</event>
</config>
<?xml version="1.0"?>
<csp_whitelist xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Csp/etc/csp_whitelist.xsd">
<policies>
<policy id="script-src">
<values>
<value id="adyen" type="host">*.adyen.com</value>
</values>
</policy>
<policy id="frame-src">
<values>
<value id="adyen" type="host">*.adyen.com</value>
</values>
</policy>
<policy id="img-src">
<values>
<value id="adyen" type="host">*.adyen.com</value>
</values>
</policy>
</policies>
</csp_whitelist>
...@@ -44,4 +44,7 @@ ...@@ -44,4 +44,7 @@
<event name="payment_method_assign_data_adyen_google_pay"> <event name="payment_method_assign_data_adyen_google_pay">
<observer name="adyen_google_pay_gateway_data_assign" instance="Adyen\Payment\Observer\AdyenGooglePayDataAssignObserver" /> <observer name="adyen_google_pay_gateway_data_assign" instance="Adyen\Payment\Observer\AdyenGooglePayDataAssignObserver" />
</event> </event>
<event name="sales_order_shipment_save_before">
<observer name="adyen_shipment_save_before" instance="Adyen\Payment\Observer\BeforeShipmentObserver" />
</event>
</config> </config>
...@@ -190,13 +190,7 @@ define( ...@@ -190,13 +190,7 @@ define(
self.installments(0); self.installments(0);
} }
} }
// for BCMC as this is not a core payment method inside magento use maestro as brand detection
if (creditCardType == "BCMC") {
self.creditCardType("MI");
} else {
self.creditCardType(creditCardType); self.creditCardType(creditCardType);
}
} else { } else {
self.creditCardType("") self.creditCardType("")
self.installments(0); self.installments(0);
......
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