From a506739a25a58591c9eabcd5c73dd3983ef03144 Mon Sep 17 00:00:00 2001 From: eileenmcnaugton Date: Fri, 16 Oct 2015 01:48:57 +1300 Subject: [PATCH] CRM-17256 fix payment being by-passed for membership --- CRM/Contribute/Form/Contribution/Confirm.php | 9 +++++---- CRM/Core/Payment/Form.php | 2 +- CRM/Event/Form/Registration/Confirm.php | 1 - 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/CRM/Contribute/Form/Contribution/Confirm.php b/CRM/Contribute/Form/Contribution/Confirm.php index d61e469a4e..db2bf893c8 100644 --- a/CRM/Contribute/Form/Contribution/Confirm.php +++ b/CRM/Contribute/Form/Contribution/Confirm.php @@ -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); diff --git a/CRM/Core/Payment/Form.php b/CRM/Core/Payment/Form.php index ae03e8fa78..07a1e44657 100644 --- a/CRM/Core/Payment/Form.php +++ b/CRM/Core/Payment/Form.php @@ -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}"]);; diff --git a/CRM/Event/Form/Registration/Confirm.php b/CRM/Event/Form/Registration/Confirm.php index b51afc97df..052533502f 100644 --- a/CRM/Event/Form/Registration/Confirm.php +++ b/CRM/Event/Form/Registration/Confirm.php @@ -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) { -- 2.25.1