Skip to content

[REF] Paypal std ipn Move not-actually shared-code out of shared code function #18536

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

Merged
merged 1 commit into from
Sep 28, 2020

Conversation

eileenmcnaughton
Copy link
Contributor

@eileenmcnaughton eileenmcnaughton commented Sep 21, 2020

Overview

[REF] Move not-actually shared-code out of shared code function

Before

single function appears to hold a lot of code that is shared between the main function and the recur function but on looking at the recur function it turns out to be entirely unreachable from there.

After

non-shared code returned to the function that uses it.

Technical Details

On looking at the recur function it turns out it never calls without a
paymentStatus of 'Completed' ie it only proceeds to call single if $txnType == 'subscr_payment'

if ($txnType != 'subscr_payment') {

And if ``$txnType == 'subscr_payment'``` then paymentStatus must be Completed

if ($input['txnType'] === 'subscr_payment' &&

  • so the lines handling other payment statuses are not actually shared
    between the 2 code paths but specifically belong to the 'main' (non-recur) code path.

Moving it out of this function we start to see there is very little shared code & probably no case for
the function to exist when we get down to it

Comments

On looking at the recur function it turns out it never calls  without a
paymentStatus of 'Completed' - so the lines handling other payment statuses are not actually shared
between the 2 code paths but specifically belong to the 'main' (non-recur) code path.

Moving it out of this function we start to see there is very little shared code & probably no case for
the function to exist when we get down to it
@civibot
Copy link

civibot bot commented Sep 21, 2020

(Standard links)

@civibot civibot bot added the master label Sep 21, 2020
@eileenmcnaughton eileenmcnaughton changed the title [REF] Move not-actually shared-code out of shared code function [REF] Paypal std ipn Move not-actually shared-code out of shared code function Sep 21, 2020
@eileenmcnaughton
Copy link
Contributor Author

test this please

1 similar comment
@eileenmcnaughton
Copy link
Contributor Author

test this please

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