-
-
Notifications
You must be signed in to change notification settings - Fork 825
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 refactor around retrieving processor id for recur #13643
Conversation
(Standard links)
|
CRM_Contact_Page_View_UserDashBoardTest::testDashboardContentContributionsWithInvoicingEnabled relates - will check |
555c48f
to
1a18d24
Compare
$mode | ||
); | ||
if (!$paymentProcessor) { | ||
if (empty($recur->payment_processor_id)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hit an enotice in the tests & when I looked here I found that we have just done a dao->fetch so we already have the payment_processor_id - looks to me like the check is for something obsolete anyway - see orphan paymentObject later on... - probably this was to get the url but that's not in the function now
* Payment processor id. If none found return 0 which represents the | ||
* pseudo processor used for pay-later. | ||
*/ | ||
public static function getPaymentProcessorID($recurID) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- @throws \CiviCRM_API3_Exception
Incremental cleanup for payment processor stuff which is good. @eileenmcnaughton I can't actually find where CRM_Contribute_BAO_ContributionRecur::getPaymentProcessor() is being called? |
@mattwire looks like I removed the one place in this PR :-) But I think this is my preferred of the 3 variants of the function so we should migrate to this one |
I've tested this locally and it works. It's a preliminary refactor with no visible change. ok to merge |
Overview
Minor extraction
Before
uses sql
After
uses api
Technical Details
This is primarily so that we can start calling the latter function in places where the id is only retrieved in order to check it exists -
CRM_Financial_BAO_PaymentProcessor::getProcessorForEntity($recurID, 'recur', 'obj')
and
getPaymentProcessorForRecurringContribution (which duplicates this although I think it uses a better method to load the object.)
Note that I think we should load the manual payment processor if the value is actually empty - that makes it editable which I think makes sense where they have been added other than via normal civi mechanisms - this could include imports or just odd requirements
Comments
@mattwire
preliminary towards https://lab.civicrm.org/dev/core/issues/704