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] Minor extraction #21296

Merged
merged 1 commit into from
Aug 28, 2021
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
17 changes: 14 additions & 3 deletions CRM/Core/Payment/AuthorizeNetIPN.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public function main() {
// Check if the contribution exists
// make sure contribution exists and is valid
$contribution = new CRM_Contribute_BAO_Contribution();
$contribution->id = $contributionID = $ids['contribution'];
$contribution->id = $contributionID = $this->getContributionID();
if (!$contribution->find(TRUE)) {
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)]);
}
Expand Down Expand Up @@ -210,8 +210,8 @@ public function getInput(&$input) {
* @throws \CRM_Core_Exception
*/
public function getIDs(&$ids, $input) {
$ids['contribution'] = (int) $this->retrieve('x_invoice_num', 'Integer');
$contributionRecur = $this->getContributionRecurObject($input['subscription_id'], (int) $this->retrieve('x_cust_id', 'Integer', FALSE, 0), $ids['contribution']);
$ids['contribution'] = $this->getContributionID();
$contributionRecur = $this->getContributionRecurObject($input['subscription_id'], (int) $this->retrieve('x_cust_id', 'Integer', FALSE, 0), $this->getContributionID());
$ids['contributionRecur'] = (int) $contributionRecur->id;
}

Expand Down Expand Up @@ -339,4 +339,15 @@ protected function getRecurProcessorID(): string {
return $this->retrieve('x_subscription_id', 'String');
}

/**
* Get the contribution ID to be updated.
*
* @return int
*
* @throws \CRM_Core_Exception
*/
protected function getContributionID(): int {
return (int) $this->retrieve('x_invoice_num', 'Integer');
}

}