From b1b7f4e35bbe566d9efccac1055d311245420974 Mon Sep 17 00:00:00 2001 From: "Matthew Wire (MJW Consulting)" Date: Wed, 11 Sep 2019 09:08:20 +0100 Subject: [PATCH] Use the prepareParamsForPaymentProcessor function in more places --- CRM/Event/Form/Participant.php | 4 +--- CRM/Event/Form/Registration/Confirm.php | 9 +-------- CRM/Event/Form/Registration/Register.php | 11 +---------- 3 files changed, 3 insertions(+), 21 deletions(-) diff --git a/CRM/Event/Form/Participant.php b/CRM/Event/Form/Participant.php index bc1d548dee..603b7fe61a 100644 --- a/CRM/Event/Form/Participant.php +++ b/CRM/Event/Form/Participant.php @@ -1228,9 +1228,7 @@ class CRM_Event_Form_Participant extends CRM_Contribute_Form_AbstractEditPayment if ($this->_mode) { // add all the additional payment params we need - $this->_params["state_province-{$this->_bltID}"] = $this->_params["billing_state_province-{$this->_bltID}"] = CRM_Core_PseudoConstant::stateProvinceAbbreviation($this->_params["billing_state_province_id-{$this->_bltID}"]); - $this->_params["country-{$this->_bltID}"] = $this->_params["billing_country-{$this->_bltID}"] = CRM_Core_PseudoConstant::countryIsoCode($this->_params["billing_country_id-{$this->_bltID}"]); - + $this->_params = $this->prepareParamsForPaymentProcessor($this->_params); $this->_params['amount'] = $params['fee_amount']; $this->_params['amount_level'] = $params['amount_level']; $this->_params['currencyID'] = $config->defaultCurrency; diff --git a/CRM/Event/Form/Registration/Confirm.php b/CRM/Event/Form/Registration/Confirm.php index 18e9ca607c..05b5aa02ae 100644 --- a/CRM/Event/Form/Registration/Confirm.php +++ b/CRM/Event/Form/Registration/Confirm.php @@ -90,15 +90,8 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration { if (!$this->preProcessExpress()) { //process only primary participant params. $registerParams = $this->_params[0]; - if (isset($registerParams["billing_state_province_id-{$this->_bltID}"]) - && $registerParams["billing_state_province_id-{$this->_bltID}"] - ) { - $registerParams["billing_state_province-{$this->_bltID}"] = CRM_Core_PseudoConstant::stateProvinceAbbreviation($registerParams["billing_state_province_id-{$this->_bltID}"]); - } + $registerParams = $this->prepareParamsForPaymentProcessor($registerParams); - if (isset($registerParams["billing_country_id-{$this->_bltID}"]) && $registerParams["billing_country_id-{$this->_bltID}"]) { - $registerParams["billing_country-{$this->_bltID}"] = CRM_Core_PseudoConstant::countryIsoCode($registerParams["billing_country_id-{$this->_bltID}"]); - } if (isset($registerParams['credit_card_exp_date'])) { $registerParams['year'] = CRM_Core_Payment_Form::getCreditCardExpirationYear($registerParams); $registerParams['month'] = CRM_Core_Payment_Form::getCreditCardExpirationMonth($registerParams); diff --git a/CRM/Event/Form/Registration/Register.php b/CRM/Event/Form/Registration/Register.php index 77297e325a..f7df2577e1 100644 --- a/CRM/Event/Form/Registration/Register.php +++ b/CRM/Event/Form/Registration/Register.php @@ -1105,17 +1105,8 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration { $this->set('contributeMode', 'direct'); // This code is duplicated multiple places and should be consolidated. - if (isset($params["state_province_id-{$this->_bltID}"]) && - $params["state_province_id-{$this->_bltID}"] - ) { - $params["state_province-{$this->_bltID}"] = CRM_Core_PseudoConstant::stateProvinceAbbreviation($params["state_province_id-{$this->_bltID}"]); - } + $params = $this->prepareParamsForPaymentProcessor($params); - if (isset($params["country_id-{$this->_bltID}"]) && - $params["country_id-{$this->_bltID}"] - ) { - $params["country-{$this->_bltID}"] = CRM_Core_PseudoConstant::countryIsoCode($params["country_id-{$this->_bltID}"]); - } if (isset($params['credit_card_exp_date'])) { $params['year'] = CRM_Core_Payment_Form::getCreditCardExpirationYear($params); $params['month'] = CRM_Core_Payment_Form::getCreditCardExpirationMonth($params); -- 2.25.1