Skip to content
Snippets Groups Projects
Commit 6f31d6bc authored by Rich's avatar Rich Committed by mattwire
Browse files

Implement processWebhookEvent

parent e05a9bd8
No related branches found
Tags 0.9.8
1 merge request!26Proposal for widening use case to GoCardless (and others)
...@@ -55,7 +55,13 @@ function civicrm_api3_job_process_paymentprocessor_webhooks($params) { ...@@ -55,7 +55,13 @@ function civicrm_api3_job_process_paymentprocessor_webhooks($params) {
foreach ($paymentProcessorWebhooks as $webhook) { foreach ($paymentProcessorWebhooks as $webhook) {
$paymentProcessor = \Civi\Payment\System::singleton() $paymentProcessor = \Civi\Payment\System::singleton()
->getById($webhook['payment_processor_id']); ->getById($webhook['payment_processor_id']);
switch ($paymentProcessor->getPaymentProcessor()['class_name']) {
if (method_exists('processWebhookEvent', $paymentProcessor)) {
$paymentProcessor->processWebhookEvent($webhook);
}
else {
// Legacy support.
switch ($paymentProcessor->getPaymentProcessor()['class_name']) {
case 'Payment_Stripe': case 'Payment_Stripe':
try { try {
$results[$webhook['id']] = civicrm_api3('Stripe', 'Ipn', [ $results[$webhook['id']] = civicrm_api3('Stripe', 'Ipn', [
...@@ -72,6 +78,8 @@ function civicrm_api3_job_process_paymentprocessor_webhooks($params) { ...@@ -72,6 +78,8 @@ function civicrm_api3_job_process_paymentprocessor_webhooks($params) {
->execute(); ->execute();
} }
break; break;
}
} }
} }
......
...@@ -22,7 +22,7 @@ function _civicrm_api3_mjwpayment_notificationretry_spec(&$params) { ...@@ -22,7 +22,7 @@ function _civicrm_api3_mjwpayment_notificationretry_spec(&$params) {
*/ */
function civicrm_api3_mjwpayment_notificationretry($params) { function civicrm_api3_mjwpayment_notificationretry($params) {
if (!empty($params['system_log_id'])) { if (!empty($params['system_log_id'])) {
// lets replace params with this rather than allow altering // let's replace params with this rather than allow altering
$logEntry = civicrm_api3('system_log', 'getsingle', ['id' => $params['system_log_id'], 'return' => ['context', 'message']]); $logEntry = civicrm_api3('system_log', 'getsingle', ['id' => $params['system_log_id'], 'return' => ['context', 'message']]);
} }
$dataRaw = $logEntry['context']; $dataRaw = $logEntry['context'];
......
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