From 204efeddaefffecfb3452f1456ea0d306e838aa9 Mon Sep 17 00:00:00 2001 From: eileen Date: Wed, 16 Nov 2016 19:55:31 +1300 Subject: [PATCH] CRM-19213 fix another instance of mis-set payment_instrument_id --- CRM/Member/Form/Membership.php | 1 - tests/phpunit/CRM/Member/Form/MembershipTest.php | 2 ++ tests/phpunit/CiviTest/CiviUnitTestCase.php | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CRM/Member/Form/Membership.php b/CRM/Member/Form/Membership.php index 3ef459915f..3073c10494 100644 --- a/CRM/Member/Form/Membership.php +++ b/CRM/Member/Form/Membership.php @@ -1488,7 +1488,6 @@ class CRM_Member_Form_Membership extends CRM_Member_Form { ); $params['source'] = $formValues['source'] ? $formValues['source'] : $params['contribution_source']; $params['trxn_id'] = CRM_Utils_Array::value('trxn_id', $result); - $params['payment_instrument_id'] = 1; $params['is_test'] = ($this->_mode == 'live') ? 0 : 1; if (!empty($formValues['send_receipt'])) { $params['receipt_date'] = $now; diff --git a/tests/phpunit/CRM/Member/Form/MembershipTest.php b/tests/phpunit/CRM/Member/Form/MembershipTest.php index d7eb6a75bb..83e456ce09 100644 --- a/tests/phpunit/CRM/Member/Form/MembershipTest.php +++ b/tests/phpunit/CRM/Member/Form/MembershipTest.php @@ -596,6 +596,7 @@ class CRM_Member_Form_MembershipTest extends CiviUnitTestCase { 'trxn_id' => 'kettles boil water', 'fee_amount' => .14, )); + $processorDetail = $processor->getPaymentProcessor(); $this->callAPISuccess('MembershipType', 'create', array( 'id' => $this->membershipTypeAnnualFixedID, 'duration_unit' => 'month', @@ -618,6 +619,7 @@ class CRM_Member_Form_MembershipTest extends CiviUnitTestCase { $this->assertEquals(.14, $contribution['fee_amount']); $this->assertEquals('kettles boil water', $contribution['trxn_id']); + $this->assertEquals($processorDetail['payment_instrument_id'], $contribution['payment_instrument_id']); $this->callAPISuccessGetCount('LineItem', array( 'entity_id' => $membership['id'], diff --git a/tests/phpunit/CiviTest/CiviUnitTestCase.php b/tests/phpunit/CiviTest/CiviUnitTestCase.php index 86153cf004..1fd3c05d1d 100644 --- a/tests/phpunit/CiviTest/CiviUnitTestCase.php +++ b/tests/phpunit/CiviTest/CiviUnitTestCase.php @@ -1375,6 +1375,7 @@ class CiviUnitTestCase extends PHPUnit_Extensions_Database_TestCase { 'url_recur' => 'http://dummy.com', 'billing_mode' => 1, 'sequential' => 1, + 'payment_instrument_id' => 'Debit Card', ); $processor = $this->callAPISuccess('PaymentProcessor', 'create', $processorParams); return $processor['id']; -- 2.25.1