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

Move notification log under authorization avoiding spamming the server

with large messages
parent 6cfc68a0
...@@ -84,7 +84,6 @@ class Json extends \Magento\Framework\App\Action\Action ...@@ -84,7 +84,6 @@ class Json extends \Magento\Framework\App\Action\Action
*/ */
public function execute() public function execute()
{ {
// if version is in the notification string show the module version // if version is in the notification string show the module version
$response = $this->getRequest()->getParams(); $response = $this->getRequest()->getParams();
if (isset($response['version'])) { if (isset($response['version'])) {
...@@ -99,14 +98,10 @@ class Json extends \Magento\Framework\App\Action\Action ...@@ -99,14 +98,10 @@ class Json extends \Magento\Framework\App\Action\Action
try { try {
$notificationItems = json_decode(file_get_contents('php://input'), true); $notificationItems = json_decode(file_get_contents('php://input'), true);
// log the notification
$this->_adyenLogger->addAdyenNotification(
"The content of the notification is: " . print_r($notificationItems, 1)
);
$notificationMode = isset($notificationItems['live']) ? $notificationItems['live'] : ""; $notificationMode = isset($notificationItems['live']) ? $notificationItems['live'] : "";
if ($notificationMode !== "" && $this->_validateNotificationMode($notificationMode)) { if ($notificationMode !== "" && $this->_validateNotificationMode($notificationMode)) {
foreach ($notificationItems['notificationItems'] as $notificationItem) { foreach ($notificationItems['notificationItems'] as $notificationItem) {
$status = $this->_processNotification( $status = $this->_processNotification(
$notificationItem['NotificationRequestItem'], $notificationItem['NotificationRequestItem'],
...@@ -178,6 +173,12 @@ class Json extends \Magento\Framework\App\Action\Action ...@@ -178,6 +173,12 @@ class Json extends \Magento\Framework\App\Action\Action
{ {
// validate the notification // validate the notification
if ($this->authorised($response)) { if ($this->authorised($response)) {
// log the notification
$this->_adyenLogger->addAdyenNotification(
"The content of the notification item is: " . print_r($response, 1)
);
// check if notification already exists // check if notification already exists
if (!$this->_isDuplicate($response)) { if (!$this->_isDuplicate($response)) {
try { try {
......
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