Commit edd64cfc authored by mattwire's avatar mattwire Committed by mattwire
Browse files

Add ability to force (re)processing of a PaymentprocessorWebhook via API

parent b63826be
......@@ -29,11 +29,21 @@ function civicrm_api3_job_process_paymentprocessor_webhooks($params) {
->execute();
}
$paymentProcessorWebhooks = PaymentprocessorWebhook::get()
->setCheckPermissions(FALSE) // Replace with ::update(FALSE) when minversion = 5.29
->addWhere('processed_date', 'IS NULL')
->addWhere('status', 'IS NULL')
->execute();
if (!empty($params['id'])) {
// Allow to force processing of a single record
$paymentProcessorWebhooks = PaymentprocessorWebhook::get()
->setCheckPermissions(FALSE) // Replace with ::update(FALSE) when minversion = 5.29
->addWhere('id', '=', $params['id'])
->execute();
}
else {
$paymentProcessorWebhooks = PaymentprocessorWebhook::get()
->setCheckPermissions(FALSE) // Replace with ::update(FALSE) when minversion = 5.29
->addWhere('processed_date', 'IS NULL')
->addWhere('status', 'IS NULL')
->execute();
}
$results = [];
if (!empty($paymentProcessorWebhooks->rowCount)) {
PaymentprocessorWebhook::update()
......@@ -77,4 +87,8 @@ function _civicrm_api3_job_process_paymentprocessor_webhooks_spec(&$params) {
$params['delete_old']['api.default'] = '-3 month';
$params['delete_old']['title'] = 'Delete old records after (default: -3 month)';
$params['delete_old']['description'] = 'Delete old records from database. Specify 0 to disable. Default is "-3 month"';
$params['delete_old']['type'] = CRM_Utils_Type::T_STRING;
$params['id']['title'] = 'ID of PaymentprocessorWebhook record (for debugging)';
$params['id']['description'] = 'Specify an ID to FORCE processing and ignore the state of the status/processed_date fields';
$params['id']['type'] = CRM_Utils_TYPE::T_INT;
}
......@@ -14,7 +14,7 @@
<url desc="Release Notes">https://lab.civicrm.org/extensions/mjwshared/-/blob/master/docs/releasenotes.md</url>
<url desc="Licensing">http://www.gnu.org/licenses/agpl-3.0.html</url>
</urls>
<releaseDate>2021-03-28</releaseDate>
<releaseDate>2021-04-05</releaseDate>
<version>1.0-dev</version>
<develStage>beta</develStage>
<compatibility>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment