CRM-16737 further fix as test showed now quite right
authoreileenmcnaughton <eileen@fuzion.co.nz>
Wed, 8 Jul 2015 02:55:54 +0000 (02:55 +0000)
committereileenmcnaughton <eileen@fuzion.co.nz>
Wed, 8 Jul 2015 02:55:54 +0000 (02:55 +0000)
CRM/Contribute/BAO/Contribution/Utils.php
CRM/Member/BAO/Membership.php
api/v3/examples/ContributionPage/Submit.php
tests/phpunit/api/v3/ContributionPageTest.php

index 04b9ddffc2012129007339a56501767082c954ff..174e12218128529a888914148a5e1c8ace66c7bf 100644 (file)
@@ -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;
index fcce6d2285d81053633d94e3dabc7ce1f0a5bd39..31e293d5e5c2f5cb42a11e82d83c82a1107ba330 100644 (file)
@@ -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,
index aa5605270316a256be91287c85971e083115a95a..5a6d2ff093e28c783766d4296088ca897fe8f070 100644 (file)
@@ -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
 *
index ab7fad4a39a61a63c6c819a3e024a0cb1de30e0a..c42bc70703d4f62ee2a38e3cfbf5faf541cc6f3c 100644 (file)
@@ -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';