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

Remove unused parameter recur from CompleteOrder signature #15800

Merged
merged 1 commit into from
Nov 18, 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: 1 addition & 2 deletions CRM/Contribute/BAO/Contribution.php
Original file line number Diff line number Diff line change
Expand Up @@ -4442,7 +4442,6 @@ public static function isSingleLineItem($id) {
* @param array $ids
* @param array $objects
* @param CRM_Core_Transaction $transaction
* @param int $recur
* @param CRM_Contribute_BAO_Contribution $contribution
* @param bool $isPostPaymentCreate
* Is this being called from the payment.create api. If so the api has taken care of financial entities.
Expand All @@ -4453,7 +4452,7 @@ public static function isSingleLineItem($id) {
* @throws \CRM_Core_Exception
* @throws \CiviCRM_API3_Exception
*/
public static function completeOrder($input, &$ids, $objects, $transaction, $recur, $contribution, $isPostPaymentCreate = FALSE) {
public static function completeOrder($input, &$ids, $objects, $transaction, $contribution, $isPostPaymentCreate = FALSE) {
$primaryContributionID = isset($contribution->id) ? $contribution->id : $objects['first_contribution']->id;
// The previous details are used when calculating line items so keep it before any code that 'does something'
if (!empty($contribution->id)) {
Expand Down
8 changes: 0 additions & 8 deletions CRM/Core/Payment/AuthorizeNetIPN.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,14 +134,6 @@ public function recur(&$input, &$ids, &$objects, $first) {

$now = date('YmdHis');

// fix dates that already exist
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We haven't needed to reformat get-dao for save-dao for years now

$dates = ['create_date', 'start_date', 'end_date', 'cancel_date', 'modified_date'];
foreach ($dates as $name) {
if ($recur->$name) {
$recur->$name = CRM_Utils_Date::isoToMysql($recur->$name);
}
}

//load new contribution object if required.
if (!$first) {
// create a contribution and then get it processed
Expand Down
5 changes: 2 additions & 3 deletions CRM/Core/Payment/BaseIPN.php
Original file line number Diff line number Diff line change
Expand Up @@ -473,15 +473,14 @@ private function cancelMembership($membership, $membershipStatusID, $onlyCancelP
* @param array $ids
* @param array $objects
* @param CRM_Core_Transaction $transaction
* @param bool $recur
*
* @throws \CRM_Core_Exception
* @throws \CiviCRM_API3_Exception
*/
public function completeTransaction(&$input, &$ids, &$objects, &$transaction, $recur = FALSE) {
public function completeTransaction(&$input, &$ids, &$objects, &$transaction) {
$contribution = &$objects['contribution'];

CRM_Contribute_BAO_Contribution::completeOrder($input, $ids, $objects, $transaction, $recur, $contribution);
CRM_Contribute_BAO_Contribution::completeOrder($input, $ids, $objects, $transaction, $contribution);
}

/**
Expand Down
4 changes: 3 additions & 1 deletion api/v3/Contribution.php
Original file line number Diff line number Diff line change
Expand Up @@ -656,6 +656,8 @@ function civicrm_api3_contribution_repeattransaction($params) {
* @param CRM_Contribute_BAO_Contribution $firstContribution
*
* @return mixed
* @throws \CRM_Core_Exception
* @throws \CiviCRM_API3_Exception
*/
function _ipn_process_transaction(&$params, $contribution, $input, $ids, $firstContribution = NULL) {
$objects = $contribution->_relatedObjects;
Expand Down Expand Up @@ -690,7 +692,7 @@ function _ipn_process_transaction(&$params, $contribution, $input, $ids, $firstC
$input['pan_truncation'] = CRM_Utils_Array::value('pan_truncation', $params);
$transaction = new CRM_Core_Transaction();
return CRM_Contribute_BAO_Contribution::completeOrder($input, $ids, $objects, $transaction,
!empty($contribution->contribution_recur_id), $contribution, CRM_Utils_Array::value('is_post_payment_create', $params));
$contribution, CRM_Utils_Array::value('is_post_payment_create', $params));
}

/**
Expand Down
2 changes: 2 additions & 0 deletions tests/phpunit/CRM/Core/Payment/AuthorizeNetIPNTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,8 @@ public function testIPNPaymentRecurSuccessSuppliedReceiveDate() {

/**
* Test IPN response updates contribution_recur & contribution for first & second contribution
*
* @throws \CRM_Core_Exception
*/
public function testIPNPaymentMembershipRecurSuccess() {
$this->createRepeatMembershipOrder();
Expand Down