-
-
Notifications
You must be signed in to change notification settings - Fork 827
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
Fix Financial Items incorrectly recorded when using Payment API #26987
Conversation
Thank you for contributing to CiviCRM! ❤️ We will need to test and review the PR. 👷 Introduction for new contributors
Quick links for reviewers |
@mattwire it would be nice to get a PR with those 2 variables renamed for a quick merge to make this more readable - totally makes sense that |
@eileenmcnaughton already done here #26986 |
nice! |
…price_field_value_id as it is guaranteed to be unique and more correct.
Cleaned up, added more comments to code. This PR is now ready for review (assuming tests pass) and I think fixes an important issue. |
retest this please |
@mattwire Comparing IDs was what I thought fixed this - as you seem to have gathered from previous discussion - so nice one for doing this 👍 |
So I had this PR on my to-do list but hadn't looked yet cos it needed a unit test so I wasn't in a hurry to deal with that. And then fortuitously I fixed another test to be more correct & hit this bug - #27277 - I was able to confirm that this fix makes that test work so that makes it 'has-test' & the fact it fixed it combined with review from @kcristiano & @christianwach makes me happy to merge it. Thanks for the fix! |
Overview
See: https://lab.civicrm.org/extensions/mjwshared/-/issues/20
Related: https://lab.civicrm.org/dev/financial/-/issues/188
@kcristiano and @christianwach came to the same conclusion independently here: https://lab.civicrm.org/dev/financial/-/issues/188#note_66337
There appear to be various situations where financial items can get incorrectly recorded. This PR was a result of https://lab.civicrm.org/extensions/mjwshared/-/issues/20 which we thought was an issue with drupal webform (where we could reproduce it) but it turns out to be a problem with the recommended way of recording payments - ie. API3
Payment.create
.Before
Missing data (eg. financial account) in some cases.
After
Recorded correctly.
Technical Details
Hopefully explained in the comments that I've added to the function as it was difficult to understand what was going on in the code before.
Comments
@kcristiano @christianwach @JoeMurray