I need to override the method GetTotal in the new IOrderGroup, to my own calculation.
Is there a way?
One possible way is to create your class (CustomPurchaseOrder for example) inherits from PurchaseOrder and override it there.
Make sure to use the new class when you use IOrderRepository
Why PurchaseOrder?Does PurchaseOrder have it? GetTotals()?
I need to use it like:
((IOrderGroup)Cart).GetTotals() and it will return a class "OrderGroupTotals" with all values.
The problem I have is that TaxTotal is "0"
GetTotals is a method of IOrderGroup, so you can override it with your custom PurchaseOrder.
But if your problem is TaxTotal then the solution can be different - implement your own ITaxCalculator and register it as the default implementation in your initialization module.
Is there any sample code of it?
I found "DefaultTaxCalculator"...
Some thing like this, your initialization module needs to implement IConfigurableModule
public void ConfigureContainer(ServiceConfigurationContext context)
context.Container.Configure(ce => ce.For<ITaxCalculator>().Add<YourTaxCalculator>());