richardhj / isotope-klarna-checkout

Klarna Checkout for Isotope eCommerce (replaces Isotope's entire checkout).
GNU Lesser General Public License v3.0
3 stars 4 forks source link

Klarna Error “Bad value: total_tax_amount” and "tax_rate" #13

Open albirs opened 1 year ago

albirs commented 1 year ago

it seems like this is the same calculation for different vars ??

https://github.com/richardhj/isotope-klarna-checkout/blob/5dfd3d3346e12d1792546d5fa065b772d59cef91/src/Dto/Surcharge.php#L32-L33

i fixed this with $this->tax_rate = (int) round(($surcharge->total_price / $surcharge->tax_free_total_price - 1 ) * 10000); in line 37

d0p3fish commented 3 months ago

This should be pushed to the master branch. It took me hours to figure out. I had a follow-up error in ShippingOption.php while calculating the tax_amount. isotope-klarna-checkout/src/Dto/ShippingOption.php

Changed to $this->tax_amount = (int) round($includes->calculateAmountIncludedInPrice($this->price));

richardhj commented 3 months ago

Can you open the PR? :-)