Fix bug where tax_amount is miscalculated on membership renewals
In order to replicate
1) enable tax & invoicing
2) configure a financial type with sales tax
3) renew a membership, entering an amount other than the default membership amount.
4) view the membership - tax amount will be the same as it would be if the default amount had been used.
Tangental bugs I noticed
1) regression in master on adding financial accounts - I will do a separate PR
2) tax term not assigned to the template - out of scope for now but I believe a pre-hook type
structure should exist, assigning this to the template when enabled (as part of moving some code to
a core-extension).
3) the form shows the tax amount & does not update it - this is pretty big already so that is also out of scope for now
This bug affects both membership & membership renewal pages. This PR only fixes for membership renewal
but the goal is to fix for membership too once this is merged. It is a fairly 'bug' fix in that it
introduces a new class with new methods to get the information otherwise provided by
CRM_Price_BAO_PriceSet::processAmount. processAmount is one of those functions that is hard to read
and understand & has been hacked to do various things. Code that calls it is hard
to read because of this. Having a cleaner way to operate has been a goal for a while. We
have plans to build up the Order api to be much more usable and used. However, we really
need to build up sensible helpers before we can address that. This PR adds a class
that has a whole lot of functions that are more readable to do what the processAmount otherwise
does. The goal is to deprecate processAmount.
I started on MembershipRenewal as
1) it has a bug currently and
2) it is pretty simple in that it doesn't actually support pricesets - which is especially
helpful when testing :-)