From 09073114d8bc8dd59992ee320e4b0b636599599f Mon Sep 17 00:00:00 2001 From: Vitalij Mik Date: Mon, 9 Dec 2024 15:58:02 +0100 Subject: [PATCH] NTR: fix order expire --- src/Components/OrderExpiration/ExpireAction.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Components/OrderExpiration/ExpireAction.php b/src/Components/OrderExpiration/ExpireAction.php index 654f444db..fb3c4fc3b 100644 --- a/src/Components/OrderExpiration/ExpireAction.php +++ b/src/Components/OrderExpiration/ExpireAction.php @@ -3,6 +3,7 @@ namespace Kiener\MolliePayments\Components\OrderExpiration; +use Kiener\MolliePayments\Handler\Method\BankTransferPayment; use Kiener\MolliePayments\Repository\Order\OrderRepositoryInterface; use Kiener\MolliePayments\Repository\SalesChannel\SalesChannelRepositoryInterface; use Kiener\MolliePayments\Service\Order\OrderExpireService; @@ -32,7 +33,8 @@ public function __construct( OrderExpireService $orderExpireService, SettingsService $settingsService, LoggerInterface $logger - ) { + ) + { $this->orderRepository = $orderRepository; $this->salesChannelRepository = $salesChannelRepository; $this->orderExpireService = $orderExpireService; @@ -74,7 +76,7 @@ private function expireOrdersInSalesChannel(SalesChannelEntity $salesChannelEnti $this->logger->info('Start expire orders for saleschannel', ['salesChannel' => $salesChannelEntity->getName()]); $date = new \DateTime(); - $date->modify('-2 months'); + $date->modify(sprintf('-%d days', (BankTransferPayment::DUE_DATE_MAX_DAYS + 1))); $criteria = new Criteria(); $criteria->addAssociation('transactions.stateMachineState'); @@ -85,7 +87,9 @@ private function expireOrdersInSalesChannel(SalesChannelEntity $salesChannelEnti $criteria->addSorting(new FieldSorting('orderDateTime', FieldSorting::DESCENDING)); $criteria->setLimit(10); - $this->logger->debug('Search for orders with payment status in progress'); + $this->logger->debug('Search for orders with payment status in progress older than date',[ + 'date' => $date->format(Defaults::STORAGE_DATE_TIME_FORMAT), + ]); $searchResult = $this->orderRepository->search($criteria, $context); if ($searchResult->count() === 0) {