update
This commit is contained in:
@@ -10,6 +10,7 @@ use App\Modules\Accounting\ReceiptRepository;
|
||||
use App\Modules\Automation\AutomationRepository;
|
||||
use App\Modules\Automation\AutomationService;
|
||||
use App\Modules\Automation\AutomationExecutionLogRepository;
|
||||
use App\Modules\Automation\OrderStatusAgedService;
|
||||
use App\Modules\Email\AttachmentGenerator;
|
||||
use App\Modules\Email\EmailSendingService;
|
||||
use App\Modules\Email\VariableResolver;
|
||||
@@ -106,15 +107,16 @@ final class CronHandlerFactory
|
||||
$shopproStatusMappingRepo,
|
||||
$this->db
|
||||
);
|
||||
$automationService = $this->buildAutomationService($ordersRepository);
|
||||
|
||||
$shopproPaymentSyncService = new ShopproPaymentStatusSyncService(
|
||||
$shopproIntegrationsRepo,
|
||||
new ShopproApiClient(),
|
||||
$ordersRepository,
|
||||
$this->db
|
||||
$this->db,
|
||||
$automationService
|
||||
);
|
||||
|
||||
$automationService = $this->buildAutomationService($ordersRepository);
|
||||
|
||||
return new CronRunner(
|
||||
$cronRepository,
|
||||
$logger,
|
||||
@@ -166,6 +168,13 @@ final class CronHandlerFactory
|
||||
'automation_history_cleanup' => new AutomationHistoryCleanupHandler(
|
||||
new AutomationExecutionLogRepository($this->db)
|
||||
),
|
||||
'order_status_aged' => new OrderStatusAgedHandler(
|
||||
new OrderStatusAgedService(
|
||||
new AutomationRepository($this->db),
|
||||
$automationService,
|
||||
$this->db
|
||||
)
|
||||
),
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
27
src/Modules/Cron/OrderStatusAgedHandler.php
Normal file
27
src/Modules/Cron/OrderStatusAgedHandler.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Modules\Cron;
|
||||
|
||||
use App\Modules\Automation\OrderStatusAgedService;
|
||||
|
||||
final class OrderStatusAgedHandler
|
||||
{
|
||||
public function __construct(private readonly OrderStatusAgedService $service)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, mixed> $payload
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function handle(array $payload): array
|
||||
{
|
||||
$triggered = $this->service->scan();
|
||||
|
||||
return [
|
||||
'ok' => true,
|
||||
'triggered_count' => $triggered,
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user