Use the prepareParamsForPaymentProcessor function in more places
authorMatthew Wire (MJW Consulting) <mjw@mjwconsult.co.uk>
Wed, 11 Sep 2019 08:08:20 +0000 (09:08 +0100)
committerMatthew Wire (MJW Consulting) <mjw@mjwconsult.co.uk>
Thu, 12 Sep 2019 08:27:54 +0000 (09:27 +0100)
CRM/Event/Form/Participant.php
CRM/Event/Form/Registration/Confirm.php
CRM/Event/Form/Registration/Register.php

index bc1d548deea171e0e0a5f9c7b0ac884f372c29b7..603b7fe61a260e0275a12998f5d131dd1abcecf4 100644 (file)
@@ -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;
index 18e9ca607c533fb2f38e473123fc21d9f6126106..05b5aa02aedeadfe16401a36c249921abd97dce3 100644 (file)
@@ -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);
index 77297e325afd4d2eaba861e8438882e8eb3c5877..f7df2577e1f6ed5517fc73c08694822a7a1e006b 100644 (file)
@@ -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);