Skip to content

Commit

Permalink
NG Processor: Throws error for event payment Project60#17 - The api w…
Browse files Browse the repository at this point in the history
…rapper for contribution completetransaction does not work so we use hook_postSave_civicrm_contribution() instead.
  • Loading branch information
Martin Correll committed Nov 12, 2024
1 parent 7b25997 commit 4d22095
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
5 changes: 5 additions & 0 deletions CRM/Core/Payment/SDDNG.php
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,11 @@ public static function getPendingContributionID()
return null;
}

public static function setPendingContributionID(int $contribution_id) {
self::$_pending_mandate['contribution_id'] = $contribution_id;
self::$_pending_mandate['contributionID'] = $contribution_id;
}

public static function releasePendingMandateData($contribution_id)
{
if (!self::$_pending_mandate) {
Expand Down
18 changes: 14 additions & 4 deletions sepapp.php
Original file line number Diff line number Diff line change
Expand Up @@ -265,15 +265,25 @@ function sepapp_civicrm_postProcess($formName, &$form)
throw new Exception("Couldn't find PaymentProcessorType [{$pp_id}]");
}
}
} elseif ('CRM_Contribute_Form_Contribution_Confirm' == $formName) {
// post process the contributions created
CRM_Core_Payment_SDD::processPartialMandates();
} elseif ('CRM_Event_Form_Registration_Confirm' == $formName) {
} elseif ('CRM_Contribute_Form_Contribution_Confirm' == $formName || 'CRM_Event_Form_Registration_Confirm' == $formName) {
// SDD: make sure mandate is created:
CRM_Core_Payment_SDDNGPostProcessor::createPendingMandate();

// post process the contributions created
CRM_Core_Payment_SDD::processPartialMandates();
}
}

/**
* Implements hook_civicrm_postSave_[table_name].
*
* We have to use this because comletetransaction apiWrapper does not work.
*/
function sepapp_civicrm_postSave_civicrm_contribution($dao) {
$contribution_id = $dao->id;
CRM_Core_Payment_SDDNG::setPendingContributionID($contribution_id);
}

/**
* Will install the SEPA payment processor
*/
Expand Down

0 comments on commit 4d22095

Please sign in to comment.