Stop passing unused invoiceID to doPayment
authorEileen McNaughton <emcnaughton@wikimedia.org>
Mon, 4 Dec 2023 20:01:24 +0000 (09:01 +1300)
committerEileen McNaughton <emcnaughton@wikimedia.org>
Mon, 4 Dec 2023 21:09:12 +0000 (10:09 +1300)
CRM/Contribute/Form/AdditionalPayment.php

index 912deb2844dc944d60a91971457585bce47abbff..62927030949d936e5388f5a6801a54a960529c10 100644 (file)
@@ -327,7 +327,7 @@ class CRM_Contribute_Form_AdditionalPayment extends CRM_Contribute_Form_Abstract
       'contribution_id' => $this->getContributionID(),
       'payment_processor_id' => $this->getPaymentProcessorID(),
       'card_type_id' => CRM_Core_PseudoConstant::getKey('CRM_Core_BAO_FinancialTrxn', 'card_type_id', $this->getSubmittedValue('credit_card_type')),
-      'pan_truncation' => substr($this->getSubmittedValue('credit_card_number'), -4),
+      'pan_truncation' => substr((string) $this->getSubmittedValue('credit_card_number'), -4),
       'trxn_result_code' => $paymentResult['trxn_result_code'] ?? NULL,
       'payment_instrument_id' => $this->getSubmittedValue('payment_instrument_id'),
       'trxn_id' => $paymentResult['trxn_id'] ?? NULL,
@@ -369,18 +369,8 @@ class CRM_Contribute_Form_AdditionalPayment extends CRM_Contribute_Form_Abstract
       $this->assign('displayName', $displayName);
     }
 
-    if (empty($this->_params['invoice_id'])) {
-      $this->_params['invoiceID'] = md5(uniqid(rand(), TRUE));
-    }
-    else {
-      $this->_params['invoiceID'] = $this->_params['invoice_id'];
-    }
-
     $this->assign('address', CRM_Utils_Address::getFormattedBillingAddressFieldsFromParameters($this->_params));
 
-    //Add common data to formatted params
-    $params = $this->_params;
-    CRM_Contribute_Form_AdditionalInfo::postProcessCommon($params, $this->_params, $this);
     // at this point we've created a contact and stored its address etc
     // all the payment processors expect the name and address to be in the
     // so we copy stuff over to first_name etc.