CRM-17256 fix payment being by-passed for membership
authoreileenmcnaugton <eileen@fuzion.co.nz>
Thu, 15 Oct 2015 12:48:57 +0000 (01:48 +1300)
committereileenmcnaugton <eileen@fuzion.co.nz>
Thu, 15 Oct 2015 12:57:07 +0000 (01:57 +1300)
CRM/Contribute/Form/Contribution/Confirm.php
CRM/Core/Payment/Form.php
CRM/Event/Form/Registration/Confirm.php

index d61e469a4e39dd1ea501d359a5ce786bff06a63d..db2bf893c8d737b9e23c3b53cc6c1964032f4025 100644 (file)
@@ -1568,14 +1568,15 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr
     if (isset($membershipContributionID)) {
       $form->_values['contribution_id'] = $membershipContributionID;
     }
-    // The concept of contributeMode is deprecated.
-    // the is_monetary concept probably should be too as it can be calculated from
-    // the existence of 'amount' & seems fragile.
-    if ($form->_contributeMode) {
+
+    if ($form->_paymentProcessor) {
+      // the is_monetary concept probably should be deprecated as it can be calculated from
+      // the existence of 'amount' & seems fragile.
       if ($form->_values['is_monetary'] && $form->_amount > 0.0 && !$form->_params['is_pay_later']) {
         // call postProcess hook before leaving
         $form->postProcessHook();
       }
+
       $payment = Civi\Payment\System::singleton()->getByProcessor($form->_paymentProcessor);
       $paymentActionResult = $payment->doPayment($form->_params, 'contribute');
       $this->completeTransaction($paymentActionResult, $paymentResult['contribution']->id);
index ae03e8fa7890a769a28ab039bde58115a22fbf45..07a1e446571cf1cd2d92357646971bd9b7babd48 100644 (file)
@@ -346,7 +346,7 @@ class CRM_Core_Payment_Form {
   public static function mapParams($id, $src, &$dst, $reverse = FALSE) {
     // Set text version of state & country if present.
     if (isset($src["billing_state_province_id-{$id}"])) {
-      $src["billing_state_province-{$id}"] = CRM_Core_PseudoConstant::stateProvinceAbbreviation ($src["billing_state_province_id-{$id}"]);
+      $src["billing_state_province-{$id}"] = CRM_Core_PseudoConstant::stateProvinceAbbreviation($src["billing_state_province_id-{$id}"]);
     }
     if (isset($src["billing_country_id-{$id}"])) {
       $src["billing_country-{$id}"] = CRM_Core_PseudoConstant::countryIsoCode($src["billing_country_id-{$id}"]);;
index b51afc97df8f91c4e64098ccdfcb1437d9fb4934..052533502f2afec0dc1b84b2318b7d977df418e1 100644 (file)
@@ -599,7 +599,6 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration {
           if (is_object($payment)) {
             try {
               $result = $payment->doPayment($value);
-              dpm($result);
               $value = array_merge($value, $result);
             }
             catch (\Civi\Payment\Exception\PaymentProcessorException $e) {