-
-
Notifications
You must be signed in to change notification settings - Fork 825
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 Payment.create to update (recalculate) contribution fee_amount #20008
Conversation
(Standard links)
|
This recalculates the fee amount when a payment is received. Our data integrity expects the fee amount on the contribution to equal the sum of the fee amount on the payments. However, it's possible a pending contribution has an 'estimated' fee amount so we can't just add on the fee_amount and assume it will be right
c4d8afb
to
dbdad83
Compare
This looks like the right approach - it is probably the fix for this issue too: https://lab.civicrm.org/extensions/stripe/-/issues/267 |
@mattwire I was assuming the reason Ana pinged you on chat was because she thought it related to Stripe |
@mattwire I have tested the patch in my local and does the right thing by recalculating the fee and net amount. Also there is a uni-test which passed. Is there any concern which need to be addressed before merging this PR? |
@monishdeb No, just needed a review which you have now done :-) |
thanks @mattwire @monishdeb |
… is created Included CiviCRM 5.38.0 PR: civicrm#20008
Included CiviCRM 5.38.0 PR: civicrm#20008
Included CiviCRM 5.38.0 PR: civicrm#20008
Included CiviCRM 5.38.0 PR: civicrm#20008
Overview
Fixes a bug identified by @ananelson (I think) on chat whereby adding a payment to a contribution does not update the contributions fee_amount
Before
Payment create does not alter fee_amount & net_amount at the contribution level
After
Payment create forces a recalculate of fee_amount & net_amount based on the sum of the payments
Technical Details
Our data integrity expects the fee amount on the contribution to equal the sum of the fee amount on the payments. However, it's possible a pending contribution has an 'estimated' fee amount so we can't just add on
the fee_amount and assume it will be right.
I had some different thoughts about how to calculate the fee amount but I also hit some gaps when I tried so this approach seems simple & the test locks it in
Comments
@mattwire @monishdeb