public static function completeOrder($input, &$ids, $objects, $isPostPaymentCreate = FALSE) {
$transaction = new CRM_Core_Transaction();
$contribution = $objects['contribution'];
- $primaryContributionID = $contribution->id ?? $objects['first_contribution']->id;
// The previous details are used when calculating line items so keep it before any code that 'does something'
if (!empty($contribution->id)) {
$input['prevContribution'] = CRM_Contribute_BAO_Contribution::getValues(['id' => $contribution->id]);
if (!$this->loadObjects($input, $ids, $objects, $required, $paymentProcessorID)) {
return FALSE;
}
- //the process is that the loadObjects is kind of hacked by loading the objects for the original contribution and then somewhat inconsistently using them for the
- //current contribution. Here we ensure that the original contribution is available to the complete transaction function
- //we don't want to fix this in the payment processor classes because we would have to fix all of them - so better to fix somewhere central
- if (isset($objects['contributionRecur'])) {
- $objects['first_contribution'] = $objects['contribution'];
- }
return TRUE;
}
function _ipn_process_transaction(&$params, $contribution, $input, $ids, $firstContribution = NULL) {
$objects = $contribution->_relatedObjects;
$objects['contribution'] = &$contribution;
-
- if ($firstContribution) {
- $objects['first_contribution'] = $firstContribution;
- }
$input['component'] = $contribution->_component;
$input['is_test'] = $contribution->is_test;
$input['amount'] = empty($input['total_amount']) ? $contribution->total_amount : $input['total_amount'];