[REF] Cleanup code to determine financial_type_id #19756
Merged
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
[REF] Cleanup code to determine financial_type_id
Before
financial_type_id is hard to track as it is passed from array to array & calculated twice
After
retrieved via a consistent function that uses a utils class to retrieve the cached information.
Test cover
Technical Details
Financial type id is really simple on this form - it's either required or
it can be determined form the price set.
However, the code passes the financial_type_id from array to array, calculating
it in more than one place which rather hides the underlying simplicity of it.
This retrieves it using a function that does the same from anywhere in the code.
Note that if someone tried to add it before this->order is built it would
hard fail & kill a bunch of tests. this->order is built at the start of the
submit routine
Comments