Vulnerability in EPiServer.Forms
We use serialised carts and currently are unable to set the tax value on the cart.
We can get the tax value using the taxcalculator, but it looks like setting the tax value isn't exposed on the new seralised carts/orderforms/ordergroups.
Documentation here: https://world.episerver.com/documentation/developer-guides/archive/commerce/orders/10-11/ shows how to get the tax but not set the tax.
Any assistance or direction to documentation would be great.
You would need to implement ITaxCalculator to return the tax value you would want to, and they will be set for you.
Also, in Commerce 11 or before the tax is calculated every time IOrderGroup is loaded. I would suggest to upgrade go later version (Commerce 12) for better performance.
Would this allow us to dynamically set the tax total ourselves...lets say we've already precalculated the tax at £100 and we just want to set this tax on the cart how is this possible?
In Commerce 12 you have PricesIncludeTax property in IMarket. That indicates your prices already have precalculated taxes (like in EU). i guess that is what you want
What I want to do is to be able to set TaxTotal on the serialised cart and subsequent orderforms/ordergroup/purchaseorder. This property isn't exposed in the current interfaces and I cannot see how to set it anywhere else.
Unfortunatly while commerce 12 is on the road map to upgrade it currently isn't possible and so we have to develop this on 11.8.2
I don't know a guaranteed workaround, but you should be able to cast the instance to the concrete implementation and set it. of course that's an ugly way to do so.
What prevents you from upgrading to Commerce 12?
Time frames prevent the upgrade to Commerce 12, as I said it is on the roadmap but for later down the line.
I have tried to use the concrete implementations:
((PurchaseOrder)purchaseOrder).TaxTotal = 100.0M; // Not hard coded just as an example
In doing the above I can see TaxTotal on the PurchaseOrder, but, as soon as we save it the TaxTotal is zero'd
Did you try this?