Skip to content
Snippets Groups Projects
Commit c627a1fe authored by mattwire's avatar mattwire
Browse files

Add retry task for PaymentprocessorWebhooks

parent 29c7152c
No related branches found
No related tags found
No related merge requests found
<?php
namespace Civi\PaymentprocessorWebhook;
use Civi\Core\Service\AutoSubscriber;
use CRM_Mjwshared_ExtensionUtil as E;
class Tasks extends AutoSubscriber {
public static function getSubscribedEvents() {
return [
'&hook_civicrm_searchKitTasks' => 'onSearchKitTasks',
];
}
public function onSearchKitTasks(array &$tasks, bool $checkPermissions, ?int $userID): void {
$tasks['PaymentprocessorWebhook']['retry'] = [
'title' => E::ts('Retry Paymentprocessor Webhooks'),
'icon' => 'fa-rectangle-refresh',
'apiBatch' => [
'action' => 'update',
'params' => ['values' => ['status' => 'new', 'processed_date' => NULL]],
'confirmMsg' => E::ts('Schedule retry for %1 %2.'),
'runMsg' => E::ts('Scheduling retry for %1 %2...'),
'successMsg' => E::ts('%1 %2 have been scheduled for retry (will retry next time scheduled jobs are run).'),
'errorMsg' => E::ts('An error occurred while attempting to schedule retry for %1 %2.'),
],
];
}
}
......@@ -79,14 +79,16 @@ return [
'created_date' => [
'title' => E::ts('Created Date'),
'sql_type' => 'timestamp',
'input_type' => NULL,
'input_type' => 'Date',
'readonly' => TRUE,
'description' => E::ts('When the webhook was first received by the IPN code'),
'default' => 'CURRENT_TIMESTAMP',
],
'processed_date' => [
'title' => E::ts('Processed Date'),
'sql_type' => 'timestamp',
'input_type' => NULL,
'input_type' => 'Date',
'readonly' => TRUE,
'description' => E::ts('Has this webhook been processed yet?'),
'default' => NULL,
],
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment