// @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.
- $contributionContactID = $ids['related_contact'] ?? NULL;
+ $contributionContactID = $ids['related_contact'];
+ $participantID = $ids['participant'];
+ $recurringContributionID = $ids['contributionRecur'];
+
// Unset ids just to make it clear it's not used again.
unset($ids);
// The previous details are used when calculating line items so keep it before any code that 'does something'
'financial_type_id',
];
- $participant = $objects['participant'] ?? NULL;
- $recurContrib = $objects['contributionRecur'] ?? NULL;
- $recurringContributionID = (empty($recurContrib->id)) ? NULL : $recurContrib->id;
$event = $objects['event'] ?? NULL;
$paymentProcessorId = '';
}
else {
if (empty($input['IAmAHorribleNastyBeyondExcusableHackInTheCRMEventFORMTaskClassThatNeedsToBERemoved'])) {
- $participantParams['id'] = $participant->id;
+ $participantParams['id'] = $participantID;
$participantParams['status_id'] = 'Registered';
civicrm_api3('Participant', 'create', $participantParams);
}
* @throws \CiviCRM_API3_Exception
*/
public function completeTransaction($input, $ids, $objects) {
- CRM_Contribute_BAO_Contribution::completeOrder($input, $ids, $objects);
+ 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);
}
/**
//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, $ids, $objects);
+ CRM_Contribute_BAO_Contribution::completeOrder($input, [
+ 'related_contact' => $ids['related_contact'] ?? NULL,
+ 'participant' => !empty($objects['participant']) ? $objects['participant']->id : NULL,
+ 'contributionRecur' => NULL,
+ ], $objects);
// reset template values before processing next transactions
$template->clearTemplateVars();
if (!empty($params['payment_instrument_id'])) {
$input['payment_instrument_id'] = $params['payment_instrument_id'];
}
- return CRM_Contribute_BAO_Contribution::completeOrder($input, $ids, $objects,
+ 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,
$params['is_post_payment_create'] ?? NULL);
}