Skip to content

Commit

Permalink
Merge pull request #14452 from eileenmcnaughton/payment_activity
Browse files Browse the repository at this point in the history
Create payment activity when creating a payment via the api, test
  • Loading branch information
mattwire authored Jun 12, 2019
2 parents 0da7751 + 8d54448 commit fbc5b5b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 1 addition & 2 deletions CRM/Financial/BAO/Payment.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
}

Expand Down
6 changes: 4 additions & 2 deletions tests/phpunit/api/v3/PaymentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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);
}

/**
Expand Down

0 comments on commit fbc5b5b

Please sign in to comment.