Fix Duplicate Financial Item For Membership Payments #32208
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.
Overview
This pr fixes an issue that results in duplicate financial items creation. To reproduce the issue create a membership for a contact with pending payment status and check that one financial item gets created then pay for the contribution through a contribution page now check the financial item table there will be an exact duplicate of financial item that was created previously.
Technical Details
The issue here is that in contribution confirm page we check if there is any active membership for the user and if there isn't one we treat it as new membership creation whereas there exists one more scenario when user is paying for a pending contribution and in this scenario we should not treat it as new membership creation.