From d3bba6a7d37beacfb3ece1c780f25ec1f29574e3 Mon Sep 17 00:00:00 2001 From: eileenmcnaugton Date: Tue, 4 Aug 2015 00:39:08 +1200 Subject: [PATCH] CRM-16926 fix up patch for 4.7 --- CRM/Contribute/Form/Contribution/Confirm.php | 21 ++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/CRM/Contribute/Form/Contribution/Confirm.php b/CRM/Contribute/Form/Contribution/Confirm.php index a8e4da5e0d..23e4bc5e30 100644 --- a/CRM/Contribute/Form/Contribution/Confirm.php +++ b/CRM/Contribute/Form/Contribution/Confirm.php @@ -2307,12 +2307,21 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr // @todo move premium processing to complete transaction if it truly is an 'after' action. $this->postProcessPremium($premiumParams, $result['contribution']); if (CRM_Utils_Array::value('payment_status_id', $result) == 1) { - civicrm_api3('contribution', 'completetransaction', array( - 'id' => $result['contribution']->id, - 'trxn_id' => CRM_Utils_Array::value('trxn_id', $result), - 'payment_processor_id' => $this->_paymentProcessor['id'], - ) - ); + try { + civicrm_api3('contribution', 'completetransaction', array( + 'id' => $result['contribution']->id, + 'trxn_id' => CRM_Utils_Array::value('trxn_id', $result), + 'payment_processor_id' => $this->_paymentProcessor['id'], + 'is_transactional' => FALSE, + ) + ); + } + catch (CiviCRM_API3_Exception $e) { + if ($e->getErrorCode() != 'contribution_completed') { + throw new CRM_Core_Exception('Failed to update contribution in database'); + } + } + } return $result; } -- 2.25.1