From: Eileen McNaughton Date: Thu, 14 Dec 2023 20:34:04 +0000 (+1300) Subject: Fix amount not getting passed through in simple contribution flow X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=f726c26943e6013ae411ab9ff63265b0006ef900;p=civicrm-core.git Fix amount not getting passed through in simple contribution flow --- diff --git a/CRM/Contribute/Form/Contribution/Confirm.php b/CRM/Contribute/Form/Contribution/Confirm.php index 76cf517f8e..6375776a4a 100644 --- a/CRM/Contribute/Form/Contribution/Confirm.php +++ b/CRM/Contribute/Form/Contribution/Confirm.php @@ -1553,6 +1553,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr // If this is a single membership-related contribution, it won't have // be performed yet, so do it now. if ($isPaidMembership && !$this->isSeparatePaymentSelected()) { + $paymentParams['amount'] = $this->getMainContributionAmount(); $paymentActionResult = $payment->doPayment($paymentParams); $paymentResults[] = ['contribution_id' => $paymentResult['contribution']->id, 'result' => $paymentActionResult]; } @@ -1863,7 +1864,6 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr if ($form->isSeparateMembershipPayment()) { $amount -= $form->order->getMembershipTotalAmount(); } - $form->_amount = $params['amount'] = $form->_params['amount'] = $amount; // hack these in for test support. $form->_fields['billing_first_name'] = 1; $form->_fields['billing_last_name'] = 1; @@ -2215,7 +2215,8 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr } } } - + $paymentParams['amount'] = $this->getMainContributionAmount(); + $paymentParams['line_item'] = [$this->getPriceSetID() => $this->getMainContributionLineItems()]; $result = $this->processConfirm($paymentParams, $contactID, $this->wrangleFinancialTypeID($this->_values['financial_type_id']), @@ -2512,11 +2513,6 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr CRM_Utils_Date::mysqlToIso($form->_params['receive_date']) ); - if (empty($form->_values['amount'])) { - // If the amount is not in _values[], set it - $form->_values['amount'] = $form->_params['amount']; - } - if (isset($paymentParams['contribution_source'])) { $paymentParams['source'] = $paymentParams['contribution_source']; }