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

Initial refactor of PayPal core processor to stop using doDirectPayment/doTransferCheckout #20030

Merged
merged 2 commits into from
Apr 11, 2021

Conversation

mattwire
Copy link
Contributor

Overview

PayPal core payment processor is calling doDirectPayment and doTransferCheckout via parent doPayment() method. This PR re-implements doPayment() directly on the PayPal class and renames the doDirectPayment/doTransferCheckout methods to make it clear that they have no dependency on legacy core code.

Before

Relies on legacy core code to call legacy methods.

After

Self-contained code using standard doPayment() as entry-point.

Technical Details

This would allow for further refactoring/simplification in the future. It is now obvious that the methods are internal to PayPal.

Comments

@civibot
Copy link

civibot bot commented Apr 10, 2021

(Standard links)

@civibot civibot bot added the master label Apr 10, 2021

if ($this->_paymentProcessor['billing_mode'] == 4) {
$this->doPaymentRedirectToPayPal($params, $component);
// redirect calls CiviExit() so execution is stopped
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Core doPayment() assumes that doTransferCheckout() returns but for PayPal it does not because CRM_Utils_System::redirect() is called at the end of the function.

@eileenmcnaughton
Copy link
Contributor

I gave the code a quick skim & this makes sense - I haven't gone through more carefully/tested at this stage

@eileenmcnaughton
Copy link
Contributor

@mattwire it's a looong time since we consolidated on doPayment but it used to be the case that doTransferCheckout & doDirectPayment were directly called. Until your PR yesterday we never actually put a deprecation notice in them!

I think I'd feel more comfortable is we added them back with a deprecation notice & a call to the renamed function just in case

@mattwire
Copy link
Contributor Author

@eileenmcnaughton Ok that makes sense. I've added the legacy methods with deprecated warnings.

@eileenmcnaughton
Copy link
Contributor

thanks @mattwire

@eileenmcnaughton
Copy link
Contributor

OK - I've read through this a couple more times & I'm pretty comfortable that it is just moving the furniture and won't change (break) anything

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants