Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use Civi\Paymentprocessingcore\Service\WebhookQueueRunnerService;

/**
* WebhookQueueRunner.Run API.
* PaymentWebhookRunner.Run API.
*
* Process queued webhook events from payment processors.
*
Expand All @@ -29,7 +29,7 @@
*
* @throws \CRM_Core_Exception
*/
function civicrm_api3_webhook_queue_runner_Run(array $params): array {
function civicrm_api3_payment_webhook_runner_Run(array $params): array {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For consistency and long-term maintainability, consider renaming the internal WebhookQueueRunnerService to PaymentWebhookQueueRunnerService and its service definition from paymentprocessingcore.webhook_queue_runner to paymentprocessingcore.payment_webhook_queue_runner. While I understand from the PR description that this was an intentional choice to limit the scope, aligning the internal service name with the public API name (PaymentWebhookRunner) would prevent potential confusion for future developers maintaining this code.

$processorType = $params['processor_type'] ?? 'all';
$batchSize = (int) ($params['batch_size'] ?? WebhookQueueRunnerService::DEFAULT_BATCH_SIZE);

Expand All @@ -44,16 +44,16 @@ function civicrm_api3_webhook_queue_runner_Run(array $params): array {
$result = [$processorType => $runnerService->runQueue($processorType, $batchSize)];
}

return civicrm_api3_create_success($result, $params, 'WebhookQueueRunner', 'Run');
return civicrm_api3_create_success($result, $params, 'PaymentWebhookRunner', 'Run');
}

/**
* WebhookQueueRunner.Run API specification.
* PaymentWebhookRunner.Run API specification.
*
* @param array $spec
* API specification array.
*/
function _civicrm_api3_webhook_queue_runner_Run_spec(array &$spec): void {
function _civicrm_api3_payment_webhook_runner_Run_spec(array &$spec): void {
$spec['processor_type'] = [
'title' => 'Processor Type',
'description' => 'Payment processor type. Use "all" (default) to process webhooks from all registered processors, or specify one: stripe, gocardless, deluxe, etc.',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@
* handlers via the WebhookHandlerRegistry, it automatically appears in the
* processing queue without any configuration changes.
*
* @see api/v3/WebhookQueueRunner/Run.php
* @see api/v3/PaymentWebhookRunner/Run.php
*/
return [
[
'name' => 'Job:WebhookQueueRunner',
'name' => 'Job:PaymentWebhookRunner',
'entity' => 'Job',
'params' => [
'version' => 3,
'name' => 'Process Payment Webhooks',
'description' => 'Process queued webhook events from all registered payment processors (Stripe, GoCardless, Deluxe, etc.). Automatically processes webhooks from all enabled processors with retry logic and exponential backoff.',
'run_frequency' => 'Always',
'api_entity' => 'WebhookQueueRunner',
'api_entity' => 'PaymentWebhookRunner',
'api_action' => 'Run',
'parameters' => 'processor_type=all&batch_size=250',
'is_active' => 1,
Expand Down