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

[REF] Remove unused lines from loadObjects #18389

Merged
merged 1 commit into from
Sep 6, 2020
Merged
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
15 changes: 2 additions & 13 deletions CRM/Core/Payment/BaseIPN.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,7 @@ public function validateData($input, &$ids, &$objects, $required = TRUE, $paymen
$contribution = new CRM_Contribute_BAO_Contribution();
$contribution->id = $ids['contribution'];
if (!$contribution->find(TRUE)) {
CRM_Core_Error::debug_log_message("Could not find contribution record: {$contribution->id} in IPN request: " . print_r($input, TRUE));
echo "Failure: Could not find contribution record for {$contribution->id}<p>";
return FALSE;
throw new CRM_Core_Exception('Failure: Could not find contribution record for ' . (int) $contribution->id, NULL, ['context' => "Could not find contribution record: {$contribution->id} in IPN request: " . print_r($input, TRUE)]);
Copy link
Contributor

Choose a reason for hiding this comment

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

@eileenmcnaughton I would note that I think this will cause HTTP 500 errors to be thrown rather than HTTP 200 back to the IPN

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@seamuslee001 - except you already merged the try-catch to wrap around it

Copy link
Contributor

Choose a reason for hiding this comment

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

ah ok I guess so right

}

// make sure contact exists and is valid
Expand Down Expand Up @@ -159,17 +157,8 @@ public function loadObjects($input, &$ids, &$objects, $required, $paymentProcess
'echo_error' => 1,
];
}
$contribution = &$objects['contribution'];
$ids['paymentProcessor'] = $paymentProcessorID;
if (is_a($objects['contribution'], 'CRM_Contribute_BAO_Contribution')) {
$contribution = &$objects['contribution'];
}
else {
//legacy support - functions are 'used' to be able to pass in a DAO
$contribution = new CRM_Contribute_BAO_Contribution();
$contribution->id = $ids['contribution'] ?? NULL;
$contribution->find(TRUE);
$objects['contribution'] = &$contribution;
}
try {
$success = $contribution->loadRelatedObjects($input, $ids);
if ($required && empty($contribution->_relatedObjects['paymentProcessor'])) {
Expand Down