Tax Integration

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
trozzi
Lieutenant Commander (LCDR)
Lieutenant Commander (LCDR)
Posts: 104
Joined: Wed Oct 05, 2005 4:44 pm
Contact:

Tax Integration

Post by trozzi » Thu Sep 11, 2008 8:10 am

I was able to integrate our tax provider into able commerce ok. I have several questions regarding the whole taxation process.

1) When during the checkout process does able commerce invoke the tax calculator.

2) I need to have a unique identifier for each order for my tax provider. It doesn't appear that I can just use basket.BasketId for this purpose because it appears that once a user creates a basket, that basketid remains with the user forever. It appears that the basketitems are deleted when an order is placed, but not the row in table ac_baskets. So if a user places multiple orders, they will always have the same basketid.

So I created a pseudo it with the basketid and a guid. If the basket has no tax entries, I repopulated this pseudo id again. I saved this in the line message column. The issue I am having is that when the tax Calculate method is called, I look in the basket for a tax trasaction so I can assign the pseudo id with the value I previosuly had assigned to it, but the value keeps changing. It appears that all tax transactions are deleted prior to the Caculate(basket) Method is called.

Code used is as follows.

string basketIdentifier = "";

foreach (BasketItem item in basket.Items)
{
if (item.OrderItemType == OrderItemType.Tax)
{
basketIdentifier = item.LineMessage;
break;
}
}

// Delete current tax items in basket.
foreach (BasketItem item in basket.Items)
{
if (item.OrderItemType == OrderItemType.Tax)
{
int basketItemId = item.BasketItemId;
int index = basket.Items.IndexOf(basketItemId);
if ((index > -1))
{
basket.Items.DeleteAt(index);
}
}
}
basket.Save();

if (basketIdentifier.Trim().Length == 0)
{
basketIdentifier = basket.BasketId.ToString().Trim() + ":" + System.Guid.NewGuid();
}

Can anyone help?

Thanks
Thomas

Post Reply