Skip to content

Commit

Permalink
NTR: fix order expire
Browse files Browse the repository at this point in the history
Vitalij Mik committed Dec 9, 2024
1 parent c9e9577 commit 0907311
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/Components/OrderExpiration/ExpireAction.php
Original file line number Diff line number Diff line change
@@ -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) {

0 comments on commit 0907311

Please sign in to comment.