Merge pull request #7679 from JMAConsulting/CRM-16259-8
authorEileen McNaughton <eileen@mcnaughty.com>
Thu, 3 Mar 2016 11:16:18 +0000 (00:16 +1300)
committerEileen McNaughton <eileen@mcnaughty.com>
Thu, 3 Mar 2016 11:16:18 +0000 (00:16 +1300)
CRM-16259

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

Simple merge
index e53a967b7dd048a828f177b613dde7fe47f1c74d,a5087f6c4f75dc56a10b9f622c927defc04dff2d..20dc98e5f6daefefb8f55effd3abc354294a94df
@@@ -405,8 -392,22 +405,22 @@@ class api_v3_PaymentTest extends CiviUn
      $payment = $this->callAPIFailure('payment', 'create', $params, 'API permission check failed for Payment/get call; insufficient permission: require access CiviCRM and edit contributions');
  
      array_push(CRM_Core_Config::singleton()->userPermissionClass->permissions, 'access CiviCRM', 'edit contributions');
 -    $payment = $this->callAPIAndDocument('payment', 'create', $params, __FUNCTION__, __FILE__);
 +    $payment = $this->callAPIAndDocument('payment', 'create', $params, __FUNCTION__, __FILE__, 'Update Payment', 'UpdatePayment');
  
+     // Check for proportional cancelled payment against lineitems.
+     $minParams = array(
+       'entity_table' => 'civicrm_financial_item',
+       'financial_trxn_id' => $payment['id'] - 1,
+     );
+     $eft = $this->callAPISuccess('EntityFinancialTrxn', 'get', $minParams);
+     $amounts = array(-33.33, -16.67);
+     foreach ($eft['values'] as $value) {
+       $this->assertEquals($value['amount'], array_pop($amounts));
+     }
+     // Check for proportional updated payment against lineitems.
      $params = array(
        'entity_table' => 'civicrm_financial_item',
        'financial_trxn_id' => $payment['id'],