);
}
$form->postProcessPremium($premiumParams, $contribution);
-
+ if (is_array($result) && !empty($result['trxn_id'])) {
+ $contribution->trxn_id = $result['trxn_id'];
+ }
$membershipResult[1] = $contribution;
}
$contributionParams['payment_instrument_id'] = 1;
}
}
+ if ($paymentProcessorOutcome) {
+ $contributionParams['payment_processor'] = CRM_Utils_Array::value('payment_processor', $paymentProcessorOutcome);
+ }
if (!$pending && $paymentProcessorOutcome) {
$contributionParams += array(
'fee_amount' => CRM_Utils_Array::value('fee_amount', $paymentProcessorOutcome),
'receipt_date' => $receiptDate,
// also add financial_trxn details as part of fix for CRM-4724
'trxn_result_code' => CRM_Utils_Array::value('trxn_result_code', $paymentProcessorOutcome),
- 'payment_processor' => CRM_Utils_Array::value('payment_processor', $paymentProcessorOutcome),
);
}
// Do not send an email if Recurring transaction is done via Direct Mode
// Email will we sent when the IPN is received.
if (!empty($form->_params['is_recur']) && $form->_contributeMode == 'direct') {
+ if (!empty($membershipContribution->trxn_id)) {
+ try {
+ civicrm_api3('contribution', 'completetransaction', array('id' => $membershipContribution->id, 'trxn_id' => $membershipContribution->trxn_id));
+ }
+ catch (CiviCRM_API3_Exception $e) {
+ // if for any reason it is already completed this will fail - e.g extensions hacking around core not completing transactions prior to CRM-15296
+ // so let's be gentle here
+ CRM_Core_Error::debug_log_message('contribution ' . $membershipContribution->id . ' not completed with trxn_id ' . $membershipContribution->trxn_id . ' and message ' . $e->getMessage());
+ }
+ }
return;
}