diff --git a/Cron/Orders.php b/Cron/Orders.php index 43e5123..cf61756 100644 --- a/Cron/Orders.php +++ b/Cron/Orders.php @@ -107,6 +107,7 @@ public function execute() ); } + $this->ordersHelper->setFeedatyCustomerNotified($order->getEntityId()); $i++; } @@ -117,7 +118,10 @@ public function execute() foreach ($response['Data'] as $data){ //if order Success or Duplicated set Feedaty Customer Notification true if($data['Status'] == '1' || $data['Status'] == '201'){ - $this->ordersHelper->setFeedatyCustomerNotified((int)$data['OrderID']); + $this->logger->info("Feedaty | Order sent successfull: order ID " . $order->getEntityId() . ' - date: ' . date('Y-m-d H:i:s') ); + } + else { + $this->logger->critical("Feedaty | Order not sent: order ID " .$order->getEntityId() . ' - date: ' . date('Y-m-d H:i:s') ); } } } diff --git a/Helper/Orders.php b/Helper/Orders.php index f595a67..ee78e51 100644 --- a/Helper/Orders.php +++ b/Helper/Orders.php @@ -137,12 +137,18 @@ public function getOrders() $ordersNotified[] = 0; } try { + $to = date("Y-m-d h:i:s"); // current date + $range = strtotime('-1 hours', strtotime($to)); + $from = date('Y-m-d h:i:s', $range); // 24 hours before + $criteria = $this->searchCriteriaBuilder - ->addFilter('status',$status,'eq') + ->addFilter('status', $status,'eq') ->addFilter('entity_id', $ordersNotified, 'nin') + ->addFilter('updated_at', $from, 'gteq') ->setPageSize(50) ->setCurrentPage(1) ->create(); + $orderResult = $this->orderRepository->getList($criteria); $orders = $orderResult->getItems(); diff --git a/composer.json b/composer.json index 52b7db2..540a698 100755 --- a/composer.json +++ b/composer.json @@ -35,7 +35,7 @@ "AFL-3.0" ], - "version": "2.7.5-stable", + "version": "2.7.6-stable", "type": "magento2-module",