Hi,
As we wants to override the method of "CalculateShippingTax" it's unable to hit when we called.
Otherthan this methods are being called. For example "CalculateReturnSalesTax", "CalculateSalesTax".
But "CalculateShippingTax" method is not going to fire. Really wondering that why it's happening with this method only.
Here is my code snippet, Please let me know if anything I missed.
public class CustomShippingTaxCalculator : DefaultShippingCalculator
{
public CustomShippingTaxCalculator ()
: base(
ServiceLocator.Current.GetInstance<ILineItemCalculator>(),
ServiceLocator.Current.GetInstance<IReturnLineItemCalculator>(),
ServiceLocator.Current.GetInstance<ITaxCalculator>(),
ServiceLocator.Current.GetInstance<ServiceCollectionAccessor<IShippingPlugin>>(),
ServiceLocator.Current.GetInstance<ServiceCollectionAccessor<IShippingGateway>>()
)
{
protected override Money CalculateShippingTax(IShipment shipment, IMarket market, Currency currency)
{
var shippingTax = GetShippingGstAmount(shipment, market, currency);
return new Money(currency.Round(shippingTax), currency);
}
protected override Money CalculateSalesTax(IShipment shipment, IMarket market, Currency currency)
{
var shippingTax = GetShippingGstAmount(shipment, market, currency);
return new Money(currency.Round(shippingTax), currency);
}
}
}
Calling these methods using this code:
var _calc = ServiceLocator.Current.GetInstance<IShippingCalculator>();
var returnTax = _calc.GetReturnSalesTax(shipment, market, currency);
var salesTax = _calc.GetSalesTax(shipment, market, currency);
var shippTax = _shippingCalculator.GetShippingTax(shipment, market, currency);
Thank you!!