jetsgit / spree_tax_cloud

Spree Interface for TaxCloud SOAP API
19 stars 32 forks source link

Tax category TICs rather than TIC per Product? #64

Closed MattFenelon closed 10 years ago

MattFenelon commented 10 years ago

I'm evaluating this gem for use in a store. Something that's come up as I've looked through the code is that the TICs are assigned per product. Is there any reason why it's done that way rather than using Spree's Tax Category model?

jetsgit commented 10 years ago

It does use Spree Tax Category.

+) Create a Tax Zone: USA, selecting country USA +) Create a Tax Category: Taxable, description Tax Cloud lookup and set it as default +) Create a Tax Rate:
Name: TaxCloud Rate: 0.0 Calculator: No Op TaxCloud Calculator Zone: USA Tax Category: Taxable

+) Set TIC on per product level

 If all existing products have the same tic, you could just set them directly in your db.

For sales to other countries, you would create other zones, Tax Categories, Tax Rates.

Per product TIC'S are now used on line_item level so you can have products in an order that are taxed at a different level, or not at all, depending on the TIC.

I would like to note also that my 2-2-stable branch has diverged from the spree/contrib branch, as I did not feel the way they proceeded with implementing a Tax Calulator inheriting from Default Tax Calculator was the best way to proceed.

I had experienced multiple problems with that when I originally wrote spree_tax_cloud. I feel it will continue to be a source of problems in the future.

The lookup of taxes by spree_tax_cloud is outside of the strategy implemented by Spree. The Spree strategy is excellent at fixed tax rates that are static. SpreeTaxCloud is dynamic creation of taxes at runtime.

The approach taken by the spree/contrib branch attempts to graft on a dynamic calculator to the static model. It is not the best implementation in my opinion.

I completely re-wrote the code base of SpreeTaxCloud bases on the SpreeAvatax gem. This in my mind is an elegant design solution which more appropriately mirrors the actual situation. It also incorporates the ideas @bbuchalter, @brchristion, and I discussed.

There is a NOOP calculator that is a facade, and never used. All real computation is done in class SpreeTaxCloudTaxComputer.

At this time my 2-2-stable branch is correctly calculating taxes when there is a promotion (deducting promotion amount from each line_item product), and other wise working quite well.

The specs will be updated over the next couple of days.

Return Merchandise implementation will be implemented in the near future.

Hope that helps!

Cheers,
    Jerry