spaze/vat-calculator

Turkey vat apply bug still continues

Closed this issue · 5 comments

Hi, I just trying your package. I got the same problem with "mpociot/vat-calculator" and more. When I try to query the country with divisions sample "United Kingdom", it gives 500 error. But the same query work well with "mpociot/vat-calculator".

spaze commented

Hi, I'm afraid I don't understand. Can you share your code that triggers the error, and the error message 9r stack trace you see? Thanks.

spaze commented

Aha, TR is already in VatRules although it shouldn't be. I misunderstood your bug in upstream, and it's not clear from this bug either.

However, I still don't understand what's the problem where you see HTTP 500.

I just trying to get rate with
$vatRate = new VatCalculator(); $rates = $vatRate->getTaxRateForLocation($code);
it gives 18% vat for turkey and failed with UK

spaze commented

Thanks but please show me the exact code and the error message you see with UK.

The UK rate is tested so that's why I'm interested:

// Valid UK post code
$postalCode = 'S1A 2AA';
$result = $this->vatCalculator->calculate(24.00, 'GB', $postalCode, false);
//Expect standard rate for UK
$this->assertEquals(28.80, $result->getPrice());
$this->assertEquals(0.20, $result->getTaxRate());
$this->assertEquals(4.80, $result->getTaxValue());

The VatCalculator constructor requires VatRates object:

public function __construct(VatRates $vatRates)

But as it gives you some result for Turkey, it's probably a typo here.

The Turkey's 18% is wrong unless you add the rules manually by calling addRatesForCountry, see #8.

spaze commented

Just released a new version 3.4.0 that removes TR from the default VAT config.

I'll close this one, please open a new issue with the code and error message you see when calculating GB rate, see my comment above. Thanks.