[REF] Simplify a couple of variables
authoreileen <emcnaughton@wikimedia.org>
Mon, 22 Mar 2021 02:41:55 +0000 (15:41 +1300)
committereileen <emcnaughton@wikimedia.org>
Mon, 22 Mar 2021 02:41:55 +0000 (15:41 +1300)
Rather than rely on these being passed around retrieve them with
a consistent function.

Note tax_amount is retrieved one other place but that is fixed in
https://github.com/civicrm/civicrm-core/pull/19757

Line item will be used less once
https://github.com/civicrm/civicrm-core/pull/19801 is merged

CRM/Member/Form/Membership.php

index 272ea3f6dc8aa26d2c380507b7e8984ee5d75e1f..05d31fd420d3c969529240061684b9cbc1d9dab3 100644 (file)
@@ -1219,14 +1219,14 @@ DESC limit 1");
           $paymentParams,
           [
             'contact_id' => $this->_contributorContactID,
-            'line_item' => $lineItem,
+            'line_item' => [$this->order->getPriceSetID() => $this->order->getLineItems()],
             'is_test' => $this->isTest(),
             'campaign_id' => $paymentParams['campaign_id'] ?? NULL,
             'source' => CRM_Utils_Array::value('source', $paymentParams, CRM_Utils_Array::value('description', $paymentParams)),
             'payment_instrument_id' => $this->getPaymentInstrumentID(),
             'financial_type_id' => $this->getFinancialTypeID(),
             'receive_date' => CRM_Utils_Time::date('YmdHis'),
-            'tax_amount' => $params['tax_amount'] ?? NULL,
+            'tax_amount' => $this->order->getTotalTaxAmount(),
             'total_amount' => $this->order->getTotalAmount(),
             'invoice_id' => $this->getInvoiceID(),
             'currency' => $this->getCurrency(),