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 Filter params in completetransaction #18321

Merged
merged 1 commit into from
Sep 3, 2020

Conversation

mattwire
Copy link
Contributor

@mattwire mattwire commented Sep 2, 2020

Overview

Partial from #18313. This makes it clear which $input params are being set from completetransaction and makes the implementation consistent with repeattransaction.

Technical Details

Comments

@civibot
Copy link

civibot bot commented Sep 2, 2020

(Standard links)

@civibot civibot bot added the master label Sep 2, 2020
Comment on lines +482 to +484
if (isset($params['payment_processor_id'])) {
$input['payment_processor_id'] = $params['payment_processor_id'];
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moving this here prepares for a follow-up PR by making it clear that payment_processor_id is only used by loadRelatedObjects

@mattwire
Copy link
Contributor Author

mattwire commented Sep 2, 2020

The next follow-up will allow us to get rid of $ids param from _ipn_process_transaction() - 11ae9f4

@eileenmcnaughton
Copy link
Contributor

I dropped the sig-refactor label since you added our standard one on & it's a duplicate

if (!$contribution->loadRelatedObjects($input, $ids, TRUE)) {
throw new API_Exception('failed to load related objects');
}
elseif ($contribution->contribution_status_id == CRM_Core_PseudoConstant::getKey('CRM_Contribute_BAO_Contribution', 'contribution_status_id', 'Completed')) {
throw new API_Exception(ts('Contribution already completed'), 'contribution_completed');
}
$input['trxn_id'] = $params['trxn_id'] ?? $contribution->trxn_id;
$params['trxn_id'] = $params['trxn_id'] ?? $contribution->trxn_id;
Copy link
Contributor

Choose a reason for hiding this comment

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

This is setting the same value twice?

@eileenmcnaughton
Copy link
Contributor

I'm doing a triage pass & I think think this is ok-without-test.

In general the first goal of refactoring is to identify gaps in test cover as they relate to the code being touched but I can't think of one here

@eileenmcnaughton
Copy link
Contributor

Despite the mistake I pointed out I'm going to merge this. I agree we should pass payment_processor_id into completeOrder as 'input'

I have doubts about our current practice of loading trxn_id if one is not supplied - I guess we are probably stuck with that until we switch the code over to call this via Payment.create rather than directly

@eileenmcnaughton eileenmcnaughton merged commit 4f6011a into civicrm:master Sep 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants