Hi,
Thank you for your advice. Many of the problems with the software have been solved.
I am now trying to use TaxCategoryService and CustomerService in my TaxProvider class. Here is the method:
public CalculateTaxResult GetTaxRate(CalculateTaxRequest calculateTaxRequest)
{
//get tax class name, based on ID
//update customer information with validated address
}
Do I use IDependencyRegistrar somehow? The problem is that I'm calling this from a handler and I cannot adjust the constructor.
I am calling my tax provider in the EntityUpdated<Order> event like this:
public class OrderUpdatedHandler : IConsumer<EntityUpdated<Order>>
{
...
public void HandleEvent(EntityUpdated<Order> eventMessage)
{
var order = eventMessage.Entity;
if (order.OrderStatus == OrderStatus.Complete)
{
//TO DO: Insert TaxCategoryService into this method
api.InsertTaxIntoAvalara(order);
}
}
I cannot adjust the constructor because then it won't implement the interface. Do you have any advice?
Thank you for your advice. Many of the problems with the software have been solved.
I am now trying to use TaxCategoryService and CustomerService in my TaxProvider class. Here is the method:
public CalculateTaxResult GetTaxRate(CalculateTaxRequest calculateTaxRequest)
{
//get tax class name, based on ID
//update customer information with validated address
}
Do I use IDependencyRegistrar somehow? The problem is that I'm calling this from a handler and I cannot adjust the constructor.
I am calling my tax provider in the EntityUpdated<Order> event like this:
public class OrderUpdatedHandler : IConsumer<EntityUpdated<Order>>
{
...
public void HandleEvent(EntityUpdated<Order> eventMessage)
{
var order = eventMessage.Entity;
if (order.OrderStatus == OrderStatus.Complete)
{
//TO DO: Insert TaxCategoryService into this method
api.InsertTaxIntoAvalara(order);
}
}
I cannot adjust the constructor because then it won't implement the interface. Do you have any advice?
Actually adding a constructor will not break the interface. Consumers are wired up using dependency injection as well. As long as all the objects are correctly mapped in the dependency registrar your code should work just fine.