diff --git a/CRM/Financial/BAO/Payment.php b/CRM/Financial/BAO/Payment.php index be7c9042585..d08e9c827df 100644 --- a/CRM/Financial/BAO/Payment.php +++ b/CRM/Financial/BAO/Payment.php @@ -102,7 +102,6 @@ public static function create($params) { } elseif ($params['total_amount'] < 0) { $trxn = self::recordRefundPayment($params['contribution_id'], $params, FALSE); - CRM_Contribute_BAO_Contribution::recordPaymentActivity($params['contribution_id'], CRM_Utils_Array::value('participant_id', $params), $params['total_amount'], $trxn->currency, $trxn->trxn_date); } if ($isPaymentCompletesContribution) { @@ -133,7 +132,7 @@ public static function create($params) { ] ); } - + CRM_Contribute_BAO_Contribution::recordPaymentActivity($params['contribution_id'], CRM_Utils_Array::value('participant_id', $params), $params['total_amount'], $trxn->currency, $trxn->trxn_date); return $trxn; } diff --git a/tests/phpunit/api/v3/PaymentTest.php b/tests/phpunit/api/v3/PaymentTest.php index 56fb75cad21..5b3104cbe34 100644 --- a/tests/phpunit/api/v3/PaymentTest.php +++ b/tests/phpunit/api/v3/PaymentTest.php @@ -633,7 +633,9 @@ public function testCreatePaymentPayLater() { } /** - * Test create payment api for paylater contribution with partial payment. + * Test create payment api for pay later contribution with partial payment. + * + * @throws \Exception */ public function testCreatePaymentPayLaterPartialPayment() { $this->createLoggedInUser(); @@ -717,7 +719,7 @@ public function testCreatePaymentPayLaterPartialPayment() { 'id' => $contribution['id'], ]); $this->callAPISuccess('OptionValue', 'get', ['name' => 'Completed', 'option_group_id' => 'contribution_status', 'api.OptionValue.create' => ['label' => 'Completed']]); - + $this->callAPISuccessGetCount('Activity', ['target_contact_id' => $this->_individualId, 'activity_type_id' => 'Payment'], 2); } /**