Do not create recurring orders if last payment was from another gateway #115
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
All Submissions:
Changes proposed in this Pull Request:
Fixed issue in PMPro v3.0+ where recurring orders could be created for old Check orders even if the last payment was from a different payment gateway.
This means that if a user paid by check and then switched to paying with Stripe, recurring check orders could still be created in
pending
status and, if not marked assuccess
, the user's membership could be canceled.The change in PMPro v3.0 that brought about this issue was the removal of the
cancelled
status. The query fix by this PR only looks for orders inpending
orsuccess
status to create a recurring order for, and since orders for old memberships were incancelled
status previously, recurring orders would not be created for them. Now that allcancelled
orders are nowsuccess
, this safeguard no longer works.The fix in this PR changes the query to say "Only create recurring order if there is an old
Check
order that does not have orders from ANY gateway following it".The fact that all orders are now
success
means that this query is now a lot less performant. We want to update this Add On to utilize Subs Table ASAP to both fix edge cases and improve performance.Other information:
Changelog entry