We will be off from 27/1 (Monday) to 31/1 (Friday) (GMT +7) for our Tet Holiday (Lunar New Year) in our country

Commit ab20f519 authored by Alexandros Moraitis's avatar Alexandros Moraitis Committed by GitHub

Separate Checks IP and HMAC (#809)

* Separate Checks IP and HMAC

* Merge the if statements
parent c36a919e
......@@ -205,29 +205,28 @@ class Json extends \Magento\Framework\App\Action\Action
*/
protected function _processNotification($response, $notificationMode)
{
if ($this->configHelper->getNotificationsIpCheck()) {
//Validate if the notification comes from a verified IP
if (!$this->isIpValid()) {
//Validate if Ip check is enabled and if the notification comes from a verified IP
if ($this->configHelper->getNotificationsIpCheck() && !$this->isIpValid()) {
$this->_adyenLogger->addAdyenNotification(
"Notification has been rejected because the IP address could not be verified"
);
return false;
}
if ($this->configHelper->getNotificationsHmacCheck() && $this->hmacSignature->isHmacSupportedEventCode(
$response
)) {
//Validate the Hmac calculation
if (!$this->hmacSignature->isValidNotificationHMAC(
$this->configHelper->getNotificationsHmacKey(),
$response
)) {
$this->_adyenLogger->addAdyenNotification(
"Notification has been rejected because the IP address could not be verified"
'HMAC key validation failed ' . print_r($response, 1)
);
return false;
}
if ($this->configHelper->getNotificationsHmacCheck()) {
if ($this->hmacSignature->isHmacSupportedEventCode($response)) {
//Validate the Hmac calculation
if (!$this->hmacSignature->isValidNotificationHMAC(
$this->configHelper->getNotificationsHmacKey(),
$response
)) {
$this->_adyenLogger->addAdyenNotification(
'HMAC key validation failed ' . print_r($response, 1)
);
return false;
}
}
}
}
// validate the notification
if ($this->authorised($response)) {
// log the notification
......
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