From b396c44777dd3ed0148ef26b46bcf4db93b7682d Mon Sep 17 00:00:00 2001 From: eileenmcnaughton Date: Wed, 29 Jul 2015 08:18:05 +0000 Subject: [PATCH] CRM-16923 pass payment processor in when calling completetransaction --- CRM/Contribute/Form/Contribution.php | 6 +++++- CRM/Contribute/Form/Contribution/Confirm.php | 2 ++ api/v3/examples/ContributionPage/Submit.php | 2 +- tests/phpunit/api/v3/ContributionPageTest.php | 1 + 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CRM/Contribute/Form/Contribution.php b/CRM/Contribute/Form/Contribution.php index 0eb1536676..c86eb49f04 100644 --- a/CRM/Contribute/Form/Contribution.php +++ b/CRM/Contribute/Form/Contribution.php @@ -1242,7 +1242,11 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP * = error or success, unless it is a recurring contribution in which case it is pending. */ if ($result['payment_status_id'] == array_search('Completed', $statuses)) { - civicrm_api3('contribution', 'completetransaction', array('id' => $contribution->id, 'trxn_id' => $result['trxn_id'])); + civicrm_api3('contribution', 'completetransaction', array( + 'id' => $contribution->id, + 'trxn_id' => $result['trxn_id'], + 'payment_processor_id' => $this->_paymentProcessor['id'], + )); } else { // Save the trxn_id. diff --git a/CRM/Contribute/Form/Contribution/Confirm.php b/CRM/Contribute/Form/Contribution/Confirm.php index e94d9d178a..a8e4da5e0d 100644 --- a/CRM/Contribute/Form/Contribution/Confirm.php +++ b/CRM/Contribute/Form/Contribution/Confirm.php @@ -1704,6 +1704,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr 'id' => $paymentResult['contribution']->id, 'trxn_id' => $paymentResult['contribution']->trxn_id, 'is_transactional' => FALSE, + 'payment_processor_id' => $form->_paymentProcessor['id'], )); } catch (CiviCRM_API3_Exception $e) { @@ -2309,6 +2310,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr civicrm_api3('contribution', 'completetransaction', array( 'id' => $result['contribution']->id, 'trxn_id' => CRM_Utils_Array::value('trxn_id', $result), + 'payment_processor_id' => $this->_paymentProcessor['id'], ) ); } diff --git a/api/v3/examples/ContributionPage/Submit.php b/api/v3/examples/ContributionPage/Submit.php index 5a6d2ff093..92660e1030 100644 --- a/api/v3/examples/ContributionPage/Submit.php +++ b/api/v3/examples/ContributionPage/Submit.php @@ -19,7 +19,7 @@ function contribution_page_submit_example() { 'selectMembership' => array( '0' => 1, ), - 'payment_processor' => 1, + 'payment_processor_id' => 1, 'credit_card_number' => '4111111111111111', 'credit_card_type' => 'Visa', 'credit_card_exp_date' => array( diff --git a/tests/phpunit/api/v3/ContributionPageTest.php b/tests/phpunit/api/v3/ContributionPageTest.php index 3206a83a2a..009d3c9684 100644 --- a/tests/phpunit/api/v3/ContributionPageTest.php +++ b/tests/phpunit/api/v3/ContributionPageTest.php @@ -402,6 +402,7 @@ class api_v3_ContributionPageTest extends CiviUnitTestCase { $this->callAPISuccess('contribution', 'completetransaction', array( 'id' => $contribution['id'], 'trxn_id' => 'ipn_called', + 'payment_processor_id' => $this->_paymentProcessor['id'], )); $membership = $this->callAPISuccessGetSingle('membership', array('id' => $membershipPayment['membership_id'])); //renew it with processor setting completed - should extend membership -- 2.25.1