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

dev/core#1317 - Fix total_amount on repeattransaction when tax amount is involved. #15517

Merged
merged 2 commits into from
Oct 15, 2019
Merged
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions CRM/Contribute/BAO/Contribution.php
Original file line number Diff line number Diff line change
Expand Up @@ -2510,6 +2510,9 @@ protected static function repeatTransaction(&$contribution, &$input, $contributi
if (isset($contribution->contribution_page_id) && is_numeric($contribution->contribution_page_id)) {
$contributionParams['contribution_page_id'] = $contribution->contribution_page_id;
}
if (!empty($contribution->tax_amount)) {
$contributionParams['tax_amount'] = $contribution->tax_amount;
}

$createContribution = civicrm_api3('Contribution', 'create', $contributionParams);
$contribution->id = $createContribution['id'];
Expand Down
3 changes: 3 additions & 0 deletions tests/phpunit/api/v3/ContributionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4344,6 +4344,9 @@ public function testRepeatContributionWithTaxAmount() {
'contribution_status_id' => 'Completed',
'trxn_id' => uniqid(),
]);
$payments = $this->callAPISuccess('Contribution', 'get', ['sequential' => 1])['values'];
//Assert if first payment and repeated payment has the same contribution amount.
$this->assertEquals($payments[0]['total_amount'], $payments[1]['total_amount']);
$this->callAPISuccessGetCount('Contribution', [], 2);
}

Expand Down