diff --git a/CRM/Contribute/BAO/Contribution.php b/CRM/Contribute/BAO/Contribution.php index 41c2b3a1cd6618a5ff3b08cd7db0aa5efe4d3379..b42475b09e071cd4508b2c7d1d5414c84836be9a 100644 --- a/CRM/Contribute/BAO/Contribution.php +++ b/CRM/Contribute/BAO/Contribution.php @@ -4189,7 +4189,7 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac * Moving it out of the BaseIPN class is just the first step. * * @param array $input - * @param array $ids + * @param int $recurringContributionID * @param int|null $contributionID * @param bool $isPostPaymentCreate * Is this being called from the payment.create api. If so the api has taken care of financial entities. @@ -4201,15 +4201,8 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac * @throws \CRM_Core_Exception * @throws \CiviCRM_API3_Exception */ - public static function completeOrder($input, $ids, $contributionID, $isPostPaymentCreate = FALSE) { + public static function completeOrder($input, $recurringContributionID, $contributionID, $isPostPaymentCreate = FALSE) { $transaction = new CRM_Core_Transaction(); - // @todo see if we even need this - it's used further down to create an activity - // but the BAO layer should create that - we just need to add a test to cover it & can - // maybe remove $ids altogether. - $recurringContributionID = $ids['contributionRecur']; - - // Unset ids just to make it clear it's not used again. - unset($ids); $inputContributionWhiteList = [ 'fee_amount', diff --git a/CRM/Core/Payment/AuthorizeNetIPN.php b/CRM/Core/Payment/AuthorizeNetIPN.php index 8514f9ce2eff0436f70896ab6e756ce9e6022e07..a2416e61d3195fb5e94f0495b9acec3e8343510d 100644 --- a/CRM/Core/Payment/AuthorizeNetIPN.php +++ b/CRM/Core/Payment/AuthorizeNetIPN.php @@ -170,10 +170,7 @@ class CRM_Core_Payment_AuthorizeNetIPN extends CRM_Core_Payment_BaseIPN { return FALSE; } - CRM_Contribute_BAO_Contribution::completeOrder($input, [ - 'participant' => NULL, - 'contributionRecur' => $recur->id, - ], $contribution->id ?? NULL); + CRM_Contribute_BAO_Contribution::completeOrder($input, $recur->id, $contribution->id ?? NULL); return $isFirstOrLastRecurringPayment; } diff --git a/CRM/Core/Payment/BaseIPN.php b/CRM/Core/Payment/BaseIPN.php index 9c68336776bca4bce8f8593c718429c5fc738845..a09264b93b7fc8c8aebe0e7ed66233f53c19c5cc 100644 --- a/CRM/Core/Payment/BaseIPN.php +++ b/CRM/Core/Payment/BaseIPN.php @@ -421,11 +421,7 @@ class CRM_Core_Payment_BaseIPN { */ public function completeTransaction($input, $ids, $objects) { CRM_Core_Error::deprecatedFunctionWarning('Use Payment.create api'); - CRM_Contribute_BAO_Contribution::completeOrder($input, [ - 'related_contact' => $ids['related_contact'] ?? NULL, - 'participant' => !empty($objects['participant']) ? $objects['participant']->id : NULL, - 'contributionRecur' => !empty($objects['contributionRecur']) ? $objects['contributionRecur']->id : NULL, - ], $objects['contribution']->id ?? NULL); + CRM_Contribute_BAO_Contribution::completeOrder($input, !empty($objects['contributionRecur']) ? $objects['contributionRecur']->id : NULL, $objects['contribution']->id ?? NULL); } /** diff --git a/CRM/Core/Payment/PayPalIPN.php b/CRM/Core/Payment/PayPalIPN.php index b08cd07781461c1e9bd0f4d4b530fa83a1dd164f..a91de00adeeac404b9a309a3d23b158f807d3b73 100644 --- a/CRM/Core/Payment/PayPalIPN.php +++ b/CRM/Core/Payment/PayPalIPN.php @@ -224,7 +224,7 @@ class CRM_Core_Payment_PayPalIPN extends CRM_Core_Payment_BaseIPN { return; } - CRM_Contribute_BAO_Contribution::completeOrder($input, $ids, $contribution->id ?? NULL); + CRM_Contribute_BAO_Contribution::completeOrder($input, $ids['contributionRecur'] ?? NULL, $contribution->id ?? NULL); } /** diff --git a/CRM/Core/Payment/PayPalProIPN.php b/CRM/Core/Payment/PayPalProIPN.php index b11df6aa8ef1da0dbf8178bc0fb7b8cd30c85e1d..70c4923afec7308fe15c13b539bb978ec5569361 100644 --- a/CRM/Core/Payment/PayPalProIPN.php +++ b/CRM/Core/Payment/PayPalProIPN.php @@ -350,7 +350,7 @@ class CRM_Core_Payment_PayPalProIPN extends CRM_Core_Payment_BaseIPN { return; } - CRM_Contribute_BAO_Contribution::completeOrder($input, $ids, $contribution->id ?? NULL); + CRM_Contribute_BAO_Contribution::completeOrder($input, $ids['contributionRecur'] ?? NULL, $contribution->id ?? NULL); } /** diff --git a/CRM/Event/Form/Task/Batch.php b/CRM/Event/Form/Task/Batch.php index 19e5a13c92cb8d1bf016559c46d2b6110e53d3e5..430285370c1d427c9ac64a5069db241cbf3ce1b9 100644 --- a/CRM/Event/Form/Task/Batch.php +++ b/CRM/Event/Form/Task/Batch.php @@ -358,11 +358,7 @@ class CRM_Event_Form_Task_Batch extends CRM_Event_Form_Task { //complete the contribution. // @todo use the api - ie civicrm_api3('Contribution', 'completetransaction', $input); // as this method is not preferred / supported. - CRM_Contribute_BAO_Contribution::completeOrder($input, [ - 'related_contact' => NULL, - 'participant' => $params['component_id'], - 'contributionRecur' => NULL, - ], $contribution->id ?? NULL); + CRM_Contribute_BAO_Contribution::completeOrder($input, NULL, $contribution->id ?? NULL); // reset template values before processing next transactions $template->clearTemplateVars(); diff --git a/api/v3/Contribution.php b/api/v3/Contribution.php index 277c368d4b7b592055020957f01c22916857605e..a4a358136157181ca6d03e1daaeedc388a63a456 100644 --- a/api/v3/Contribution.php +++ b/api/v3/Contribution.php @@ -681,11 +681,9 @@ function _ipn_process_transaction($params, $contribution, $input, $ids) { if (!empty($params['payment_instrument_id'])) { $input['payment_instrument_id'] = $params['payment_instrument_id']; } - return CRM_Contribute_BAO_Contribution::completeOrder($input, [ - 'related_contact' => $ids['related_contact'] ?? NULL, - 'participant' => !empty($objects['participant']) ? $objects['participant']->id : NULL, - 'contributionRecur' => !empty($objects['contributionRecur']) ? $objects['contributionRecur']->id : NULL, - ], $objects['contribution']->id ?? NULL, + return CRM_Contribute_BAO_Contribution::completeOrder($input, + !empty($objects['contributionRecur']) ? $objects['contributionRecur']->id : NULL, + $objects['contribution']->id ?? NULL, $params['is_post_payment_create'] ?? NULL); }