From 9e98fa85c45944e04ae0f3a44ee154e49b92ab76 Mon Sep 17 00:00:00 2001 From: eileenmcnaughton Date: Wed, 8 Jul 2015 02:55:54 +0000 Subject: [PATCH] CRM-16737 further fix as test showed now quite right --- CRM/Contribute/BAO/Contribution/Utils.php | 2 +- CRM/Member/BAO/Membership.php | 5 +++++ api/v3/examples/ContributionPage/Submit.php | 2 +- tests/phpunit/api/v3/ContributionPageTest.php | 2 +- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/CRM/Contribute/BAO/Contribution/Utils.php b/CRM/Contribute/BAO/Contribution/Utils.php index 04b9ddffc2..174e122181 100644 --- a/CRM/Contribute/BAO/Contribution/Utils.php +++ b/CRM/Contribute/BAO/Contribution/Utils.php @@ -335,7 +335,7 @@ class CRM_Contribute_BAO_Contribution_Utils { $contribution->trxn_id = $result['trxn_id']; } if (!empty($result['payment_status_id'])) { - $contribution->contribution_status_id = $result['payment_status_id']; + $contribution->payment_status_id = $result['payment_status_id']; } } $membershipResult[1] = $contribution; diff --git a/CRM/Member/BAO/Membership.php b/CRM/Member/BAO/Membership.php index fcce6d2285..31e293d5e5 100644 --- a/CRM/Member/BAO/Membership.php +++ b/CRM/Member/BAO/Membership.php @@ -2317,7 +2317,12 @@ INNER JOIN civicrm_contact contact ON ( contact.id = membership.contact_id AND */ public static function createOrRenewMembership($membershipParams, $contactID, $customFieldsFormatted, $membershipID, $memType, $isTest, $numTerms, $membershipContribution, &$form) { if (!empty($membershipContribution)) { + // CRM-16737 contribution_status_id is the deprecated return parameter from the payment processor. Use + // payment_status_id. $pending = ($membershipContribution->contribution_status_id == 2) ? TRUE : FALSE; + if (isset($membershipContribution->payment_status_id)) { + $pending = ($membershipContribution->payment_status_id == 2) ? TRUE : $pending; + } } $membership = self::renewMembershipFormWrapper($contactID, $memType, $isTest, $form, NULL, diff --git a/api/v3/examples/ContributionPage/Submit.php b/api/v3/examples/ContributionPage/Submit.php index aa56052703..5a6d2ff093 100644 --- a/api/v3/examples/ContributionPage/Submit.php +++ b/api/v3/examples/ContributionPage/Submit.php @@ -70,7 +70,7 @@ function contribution_page_submit_expectedresult() { /* * This example has been generated from the API test suite. -* The test that created it is called "testSubmitMembershipPriceSetPaymentPaymentProcessorRecurDelayed" +* The test that created it is called "testLegacySubmitMembershipPriceSetPaymentPaymentProcessorRecurDelayed" * and can be found at: * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContributionPageTest.php * diff --git a/tests/phpunit/api/v3/ContributionPageTest.php b/tests/phpunit/api/v3/ContributionPageTest.php index ab7fad4a39..c42bc70703 100644 --- a/tests/phpunit/api/v3/ContributionPageTest.php +++ b/tests/phpunit/api/v3/ContributionPageTest.php @@ -262,7 +262,7 @@ class api_v3_ContributionPageTest extends CiviUnitTestCase { * - the first creates a new membership, completed contribution, in progress recurring. Check these * - create another - end date should be extended */ - public function testSubmitMembershipPriceSetPaymentPaymentProcessorRecur() { + public function testSubmitMembershipPriceSetPaymentPaymentProcessorRecurInstantPayment() { $this->params['is_recur'] = 1; $var = array(); $this->params['recur_frequency_unit'] = 'month'; -- 2.25.1