Merge pull request #15640 from eileenmcnaughton/pp_pay
authorEileen McNaughton <emcnaughton@wikimedia.org>
Tue, 5 Nov 2019 20:44:53 +0000 (09:44 +1300)
committerGitHub <noreply@github.com>
Tue, 5 Nov 2019 20:44:53 +0000 (09:44 +1300)
Fix Payment.create bug whereby payment_processor_id is not being used for the to_account_id

1  2 
CRM/Contribute/BAO/Contribution.php
CRM/Financial/BAO/Payment.php
api/v3/Payment.php
api/v3/PaymentProcessor.php
tests/phpunit/api/v3/PaymentTest.php

Simple merge
index 841827e8aa8abe97780c7629b7f36920809594b0,d6051d3bf283a46f468cf3bf07b4c05a5dfce298..b5276735b7ff43f54ed43a1c9b37548d9e57f837
@@@ -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']);
Simple merge
Simple merge
Simple merge