Skip to content

Commit

Permalink
ensure correct payment_instrument_id
Browse files Browse the repository at this point in the history
https://lab.civicrm.org/dev/core/issues/7

Otherwise, after first recurring contribution, contributions are coded
as check, not credit card.
  • Loading branch information
jmcclelland committed Mar 5, 2018
1 parent 38cb217 commit 9bee639
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions CRM/Core/Payment/AuthorizeNetIPN.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ public function recur(&$input, &$ids, &$objects, $first) {
$contribution->amount_level = $objects['contribution']->amount_level;
$contribution->address_id = $objects['contribution']->address_id;
$contribution->campaign_id = $objects['contribution']->campaign_id;
$contribution->_relatedObjects = $objects['contribution']->_relatedObjects;

$objects['contribution'] = &$contribution;
}
Expand Down
3 changes: 3 additions & 0 deletions tests/phpunit/CRM/Core/Payment/AuthorizeNetIPNTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,9 @@ public function testIPNPaymentMembershipRecurSuccess() {
'sequential' => 1,
));
$this->assertEquals(2, $contribution['count']);
// Ensure both contributions are coded as credit card contributions.
$this->assertEquals(1, $contribution['values'][0]['payment_instrument_id']);
$this->assertEquals(1, $contribution['values'][1]['payment_instrument_id']);
$this->assertEquals('second_one', $contribution['values'][1]['trxn_id']);
$this->callAPISuccessGetSingle('membership_payment', array('contribution_id' => $contribution['values'][1]['id']));
$this->callAPISuccessGetSingle('line_item', array(
Expand Down

0 comments on commit 9bee639

Please sign in to comment.