Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unit test for #15166 fix #15229

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Unit test for #15166 fix
  • Loading branch information
Jitendra Purohit committed Sep 6, 2019
commit 49a711994304eb9a0e5cb3e8857b7e1b489dba14
46 changes: 46 additions & 0 deletions tests/phpunit/api/v3/PaymentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,52 @@ public function testGetPayment() {
]);
}

/**
* Retrieve Payment using trxn_id.
*/
public function testGetPaymentWithTrxnID() {
$this->_individualId2 = $this->individualCreate();
$params1 = [
'contact_id' => $this->_individualId,
'trxn_id' => 111111,
'total_amount' => 10,
];
$contributionID1 = $this->contributionCreate($params1);

$params2 = [
'contact_id' => $this->_individualId2,
'trxn_id' => 222222,
'total_amount' => 20,
];
$contributionID2 = $this->contributionCreate($params2);

$paymentParams = ['trxn_id' => 111111];
$payment = $this->callAPISuccess('payment', 'get', $paymentParams);
$expectedResult = [
$payment['id'] => [
'total_amount' => 10,
'trxn_id' => 111111,
'status_id' => 1,
'is_payment' => 1,
'contribution_id' => $contributionID1,
],
];
$this->checkPaymentResult($payment, $expectedResult);

$paymentParams = ['trxn_id' => 222222];
$payment = $this->callAPISuccess('payment', 'get', $paymentParams);
$expectedResult = [
$payment['id'] => [
'total_amount' => 20,
'trxn_id' => 222222,
'status_id' => 1,
'is_payment' => 1,
'contribution_id' => $contributionID2,
],
];
$this->checkPaymentResult($payment, $expectedResult);
}

/**
* Test email receipt for partial payment.
*/
Expand Down