From: Eileen McNaughton Date: Tue, 5 Nov 2019 20:44:53 +0000 (+1300) Subject: Merge pull request #15640 from eileenmcnaughton/pp_pay X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=fa4dd075e22fd89b10a833fe571c2041af292a34;p=civicrm-core.git Merge pull request #15640 from eileenmcnaughton/pp_pay Fix Payment.create bug whereby payment_processor_id is not being used for the to_account_id --- fa4dd075e22fd89b10a833fe571c2041af292a34 diff --cc CRM/Financial/BAO/Payment.php index 841827e8aa,d6051d3bf2..b5276735b7 --- a/CRM/Financial/BAO/Payment.php +++ b/CRM/Financial/BAO/Payment.php @@@ -56,18 -56,13 +56,13 @@@ class CRM_Financial_BAO_Payment public static function create($params) { $contribution = civicrm_api3('Contribution', 'getsingle', ['id' => $params['contribution_id']]); $contributionStatus = CRM_Contribute_PseudoConstant::contributionStatus($contribution['contribution_status_id'], 'name'); - $isPaymentCompletesContribution = self::isPaymentCompletesContribution($params['contribution_id'], $params['total_amount']); + $lineItems = self::getPayableLineItems($params); - $whiteList = ['check_number', 'payment_processor_id', 'fee_amount', 'total_amount', 'contribution_id', 'net_amount', 'card_type_id', 'pan_truncation', 'trxn_result_code', 'payment_instrument_id', 'trxn_id']; + $whiteList = ['check_number', 'payment_processor_id', 'fee_amount', 'total_amount', 'contribution_id', 'net_amount', 'card_type_id', 'pan_truncation', 'trxn_result_code', 'payment_instrument_id', 'trxn_id', 'trxn_date']; $paymentTrxnParams = array_intersect_key($params, array_fill_keys($whiteList, 1)); $paymentTrxnParams['is_payment'] = 1; - if (!empty($params['payment_processor'])) { - // I can't find evidence this is passed in - I was gonna just remove it but decided to deprecate as I see getToFinancialAccount - // also anticipates it. - CRM_Core_Error::deprecatedFunctionWarning('passing payment_processor is deprecated - use payment_processor_id'); - $paymentTrxnParams['payment_processor_id'] = $params['payment_processor']; - } + if (isset($paymentTrxnParams['payment_processor_id']) && empty($paymentTrxnParams['payment_processor_id'])) { // Don't pass 0 - ie the Pay Later processor as it is a pseudo-processor. unset($paymentTrxnParams['payment_processor_id']);