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
Fix intermittent mis-recording on negative contributions.
Before
On some systems recording a negative contribution results in a $0 contribution due to an earlier 'mis-fix' - #5767.
The testEnterNegativeContribution fails locally for me. When I add thousandSeparator testing testSubmitContributionPageWithPriceSet passes locally & fails remotely
After
locally the test & UI submission work for negative amounts & on testSubmitContributionPageWithPriceSet
Technical Details
The correct place to clean money is on submission & the correct place to format it is immediately prior to use. It was being formatted deep in the BAO - this moves it to the processor class.
Comments
@mattwire @adixon I think we should do this small fix rather than hang off for the big fix discussed on CRM-16460 - if we do a bigger fix we can call it from this function
Payment processor writers that rely on this code may need to ensure they are formatting the amounts or using the new function. Omnipay, IATS are not affected