valeriansaliou/node-sales-tax

Tax details are generated for regions in Spain with tax exemptions.

lfalck opened this issue ยท 2 comments

Hi, great project! ๐Ÿ™‚

I think i found an issue. For regions in Spain with tax exemption, rate and total are correctly calculated, but the tax details still contain the country tax:

SalesTax.getAmountWithSalesTax("ES", "GC", 1000.00)
  .then((amountWithTax) => {
    console.log(amountWithTax);
  });
{
    type: 'vat',
    rate: 0,
    price: 1000,
    total: 1000,
    area: 'worldwide',
    exchange: 'consumer',
    charge: {
        direct: true,
        reverse: false
    },
    details: [{
            type: 'vat',
            rate: 0.21,
            amount: 210
        }
    ]
}

Hello there!

Given that the area returned is worldwide, you may not have set your legal tax origin (ie. your company location), thus VATMOSS is not being applied in calculations.

See: https://github.com/valeriansaliou/node-sales-tax#white_check_mark-specify-the-country-you-charge-from

Ah sorry, I should have done that in the example. Results are the same though:

SalesTax.setTaxOriginCountry("FR");

SalesTax.getAmountWithSalesTax("ES", "GC", 1000.00)
  .then((amountWithTax) => {
    console.log(amountWithTax);
  });
{
    type: 'vat',
    rate: 0,
    price: 1000,
    total: 1000,
    area: 'regional',
    exchange: 'consumer',
    charge: {
        direct: true,
        reverse: false
    },
    details: [{
            type: 'vat',
            rate: 0.21,
            amount: 210
        }
    ]
}