feat: add Shoppro payment status synchronization service
- Implemented ShopproPaymentStatusSyncService to handle payment status synchronization between Shoppro and Orderpro. - Added methods for resolving watched status codes, finding candidate orders, and syncing individual order payments. - Introduced ShopproStatusMappingRepository for managing status mappings between Shoppro and Orderpro. - Created ShopproStatusSyncService to facilitate synchronization of order statuses from Shoppro to Orderpro.
This commit is contained in:
@@ -102,17 +102,19 @@ final class CronRepository
|
||||
/**
|
||||
* @return array<int, array<string, mixed>>
|
||||
*/
|
||||
public function listPastJobs(int $limit = 50): array
|
||||
public function listPastJobs(int $limit = 50, int $offset = 0): array
|
||||
{
|
||||
$safeLimit = max(1, min(200, $limit));
|
||||
$safeOffset = max(0, $offset);
|
||||
$statement = $this->pdo->prepare(
|
||||
'SELECT id, job_type, status, priority, attempts, max_attempts, scheduled_at, started_at, completed_at, last_error, created_at
|
||||
FROM cron_jobs
|
||||
WHERE status IN ("completed", "failed", "cancelled")
|
||||
ORDER BY completed_at DESC, id DESC
|
||||
LIMIT :limit'
|
||||
LIMIT :limit OFFSET :offset'
|
||||
);
|
||||
$statement->bindValue(':limit', $safeLimit, PDO::PARAM_INT);
|
||||
$statement->bindValue(':offset', $safeOffset, PDO::PARAM_INT);
|
||||
$statement->execute();
|
||||
$rows = $statement->fetchAll(PDO::FETCH_ASSOC);
|
||||
if (!is_array($rows)) {
|
||||
@@ -122,6 +124,18 @@ final class CronRepository
|
||||
return array_map(fn (array $row): array => $this->normalizeJobRow($row), $rows);
|
||||
}
|
||||
|
||||
public function countPastJobs(): int
|
||||
{
|
||||
$statement = $this->pdo->query(
|
||||
'SELECT COUNT(*)
|
||||
FROM cron_jobs
|
||||
WHERE status IN ("completed", "failed", "cancelled")'
|
||||
);
|
||||
$value = $statement !== false ? $statement->fetchColumn() : 0;
|
||||
|
||||
return max(0, (int) $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<int, array<string, mixed>>
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user