CRM-21323 : Fix backend credit card payment processor selection
authorJitendra Purohit <jitendra@fuzion.co.nz>
Tue, 16 Jan 2018 13:48:59 +0000 (19:18 +0530)
committerJitendra Purohit <jitendra@fuzion.co.nz>
Tue, 16 Jan 2018 13:48:59 +0000 (19:18 +0530)
CRM/Contribute/Form/AbstractEditPayment.php

index c09e51d276ffc8ff098f15942d9fc36ccde48407..7789e7ac10c9b6dee4db8e3d920fe7545d275f85 100644 (file)
@@ -355,6 +355,11 @@ WHERE  contribution_id = {$id}
     elseif (empty($this->_paymentProcessors) || array_keys($this->_paymentProcessors) === array(0)) {
       throw new CRM_Core_Exception(ts('You will need to configure the %1 settings for your Payment Processor before you can submit a credit card transactions.', array(1 => $this->_mode)));
     }
+    //Assign submitted processor value if it is different from the loaded one.
+    if (!empty($this->_submitValues['payment_processor_id'])
+      && $this->_paymentProcessor['id'] != $this->_submitValues['payment_processor_id']) {
+      $this->_paymentProcessor = CRM_Financial_BAO_PaymentProcessor::getPayment($this->_submitValues['payment_processor_id']);
+    }
     $this->_processors = array();
     foreach ($this->_paymentProcessors as $id => $processor) {
       // @todo review this. The inclusion of this IF was to address test processors being incorrectly loaded.