Skip to content

Commit

Permalink
Issue#521: Send notification after successful contribution payment
Browse files Browse the repository at this point in the history
  • Loading branch information
nishant-bhorodia committed Mar 19, 2021
1 parent e4e20a1 commit b6038fc
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
13 changes: 13 additions & 0 deletions CRM/Contribute/BAO/Contribution.php
Original file line number Diff line number Diff line change
Expand Up @@ -4259,6 +4259,19 @@ public static function completeOrder($input, $ids, $contribution, $isPostPayment

$transaction->commit();
\Civi::log()->info("Contribution {$contributionParams['id']} updated successfully");
$contributionSoft = civicrm_api4('ContributionSoft', 'get', [
'where' => [
['contribution_id', '=', $contributionID],
],
'checkPermissions' => FALSE,
]);

if (!empty($contributionSoft)) {
//Send notification to owner for PCP
if ($contributionSoft->column('pcp_id')) {
CRM_Contribute_Form_Contribution_Confirm::pcpNotifyOwner($contribution, $contributionSoft[0]);
}
}

// @todo - check if Contribution::create does this, test, remove.
CRM_Contribute_BAO_ContributionRecur::updateRecurLinkedPledge($contributionID, $recurringContributionID,
Expand Down
4 changes: 0 additions & 4 deletions CRM/Contribute/BAO/ContributionSoft.php
Original file line number Diff line number Diff line change
Expand Up @@ -607,10 +607,6 @@ protected static function processPCP($pcp, $contribution) {
$softParams['pcp_personal_note'] = $pcp['pcp_personal_note'] ?? NULL;
$softParams['soft_credit_type_id'] = CRM_Core_PseudoConstant::getKey('CRM_Contribute_BAO_ContributionSoft', 'soft_credit_type_id', 'pcp');
$contributionSoft = self::add($softParams);
//Send notification to owner for PCP
if ($contributionSoft->pcp_id && empty($pcpId)) {
CRM_Contribute_Form_Contribution_Confirm::pcpNotifyOwner($contribution, (array) $contributionSoft);
}
}
//Delete PCP against this contribution and create new on submitted PCP information
elseif ($pcpId) {
Expand Down
2 changes: 1 addition & 1 deletion CRM/Contribute/Form/Contribution/Confirm.php
Original file line number Diff line number Diff line change
Expand Up @@ -1225,7 +1225,7 @@ public static function processOnBehalfOrganization(&$behalfOrganization, &$conta
*
* @param object $contribution
* @param array $contributionSoft
* Contribution object.
* Contribution array.
*
* @throws \API_Exception
* @throws \CRM_Core_Exception
Expand Down

0 comments on commit b6038fc

Please sign in to comment.