Skip to content

Commit

Permalink
Merge pull request #35 from vurt2/ng-error-event-payment-17
Browse files Browse the repository at this point in the history
NG Processor: Throws error for event payment #17
  • Loading branch information
vurt2 authored Nov 20, 2024
2 parents 240dfee + 4d22095 commit 8a3595b
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 8a3595b

Please sign in to comment.