classyllama / ClassyLlama_AvaTax

This extension has been deprecated in favor of https://github.com/avadev/Avalara-AvaTax-for-Magento2
Open Software License 3.0
23 stars 15 forks source link

Tax Summary with multiple rates doesnt show details on multiple lines #70

Closed marieevekroy closed 6 years ago

marieevekroy commented 7 years ago

Steps to reproduce In Stores > Config > Sales > Tax, set "Display Full Tax Summary" to Yes In cart/checkout, choose an address where multiple rates are applicable

Actual result When you expand the summary, it shows all the rates with the percentage, with only the tax total on the first line.

Expected result When you expand the summary, in cart, checkout, in order admin panel, it should show the detailed amount of tax $$ per rate ($1.00 on the first line, $1.99 on the second line) instead of $2.99

capture d ecran 2017-07-04 a 10 15 27 capture d ecran 2017-07-04 a 10 14 09

jeremybouvet commented 7 years ago

I'm having the same issue !

erikhansen commented 7 years ago

Unfortunately, Magento's native "tax summary" does not support displaying the prices on each individual row. I'm the one who built this part of the extension and we're feeding data into Magento in the exact same way that native tax rates are being fed into the system.

As a point of comparison, I turned off AvaTax and configured some native tax rates to try and emulate the behavior to see how the native tax summary was displayed.

Screenshots of configuration:

magento admin-kuuax

magento admin-unlk6

09-39-02 shopping cart-708jm

Since this is not an issue with this extension, I'm closing this issue. Feel free to submit an issue or PR to the Magento 2 Github.

marieevekroy commented 7 years ago

Hi Erik,

Unfortunately, your settings are not quite correct for the example I try to explain. Native Magento works well.

In Tax Rules, when you have multiple rules applicable, the totals summary display correctly on two lines.

capture d ecran 2017-07-12 a 15 08 52 capture d ecran 2017-07-12 a 15 09 15

From what I understand, the problem lies somewhere in TaxCalculation class where the data received from Avatax is converted in Magento object. All taxes are converted in only one applied tax.

With the same example of Quebec taxes, when using native magento tax rules, for a quote item the $appliedTaxes looks like something like this

$appliedTaxes array(2)
    ['ca-gst'] (magento\tax\model\taxdetails\appliedtax)(28)
        ['data'] array(4)
            amount = 1
            percent = 5
            tax_rate_key = "ca-gst"
            rates = array(1)
                ca-gst (magento\tax\model\taxdetails\appliedtaxrate)(28)
                    data array(3)
                        percent = 5
                        code = ca-gst
                        title = ca-gst
    ['qc-qst'] (magento\tax\model\taxdetails\appliedtax)(28)
        ['data'] array(4)
            amount = 1.99
            percent = 9.975
            tax_rate_key = "qc-qst"
            rates = array(1)
                qc-qst (magento\tax\model\taxdetails\appliedtaxrate)(28)
                    data array(3)
                        percent = 9.975
                        code = qc-qst
                        title = qc-qst

When using Avatax module, it seems all the taxes are added together. The same $appliedTaxes looks like this

$appliedTaxes array(1)
    ['ca-gst-qc-qst'] (magento\tax\model\taxdetails\appliedtax)(28)
        ['data'] array(4)
            amount = 2.99
            percent = 14.975
            tax_rate_key = "ca-gst-qc-qst"
            rates = array(2)
                ca-gst (magento\tax\model\taxdetails\appliedtaxrate)(28)
                    data array(3)
                        percent = 5
                        code = ca-gst
                        title = ca-gst
                qc-qst (magento\tax\model\taxdetails\appliedtaxrate)(28)
                    data array(3)
                        percent = 9.975
                        code = qc-qst
                        title = qc-qst

I don't have access to our client Avatax account so I don't know if there is another configuration to set, but with that same account, in their Magento 1 website the taxes correctly appears on two lines.

Hope this helps,

Thanks!

erikhansen commented 7 years ago

@marieevekroy Thanks for the additional info. It may be some time before we're able to get to this issue. In the meantime, you're welcome to submit a pull request to fix the issue.

jeremybouvet commented 7 years ago

Hi !

Has any update been done on this issue ? The ticket has been created about 3 months ago, and right now it makes Avatax not work properly for countries with multiple taxes (like Canada for example).

Thank you,

rsisco commented 7 years ago

@jeremybouvet - Can you provide details on an example where the tax calculation is incorrect?

jeremybouvet commented 7 years ago

Hi @rsisco ,

The calculation isn't incorrect. It's the display that is. It should be displayed on 2 lines when there is 2 taxes being applied.

The law in Canada requires that the provincial (state) and federal taxes are shown on different lines, with their amount, and not as one line.

Thank you,

jeremybouvet commented 6 years ago

Hi !

Any news ?

Thanks

jeremybouvet commented 6 years ago

Hi !

We are talking 4 months before this gets fixed and we get absolutely no support.

Can we get an ETA ?

Thanks,

rsisco commented 6 years ago

@jeremybouvet - I am in the final stages of developing an update that should address this need. I expect to have a new release out within the next few days.

jeremybouvet commented 6 years ago

Awesome news ! Thank you !!

erikhansen commented 6 years ago

@jeremybouvet We spent over 20 hours working on a solution for this and have finally come up with what we believe to be the best solution, considering Magento's approach for handling this summary information.

The challenge we ran into is that when native Magento is calculating taxes for each cart item, it knows the exact amount of tax that each cart item is contributing towards the total. For example:

Magento's native tax calculation adds each of these tax breakdowns into individual "applied taxes" array items. However when we get the taxes back from Avalara's API, we only know about the breakdown for the total of the items in the cart, not for the individual cart items. Because of this, we had to do a good bit of work to get this information to display on the cart/checkout without breaking how native Magento works. I could delve into more technical details of why this was a challenge, but I don't know that it is necessary at this point.

Can you install our updated code on a stage/dev environment to see if it solves your problem? You can do that using this command (assuming you installed it via Composer to begin with):

composer require classyllama/module-avatax:dev-feature/AVS-421_64-add-tax-summary

Once you test and confirm everything is working, we can merge this into develop and include this in an official release.

Let us know if you have questions.

jeremybouvet commented 6 years ago

Hi !

It seems to be working properly on our end ! You can go ahead and merge.

Thanks,

rsisco commented 6 years ago

This issue has been resolved as of release 1.2.2. Closing issue.