#3194070: LocalTaxTypeBase::checkRegistrations() does not consider Jurisdictions with multiple tax zones changed the implementation of LocalTaxTypeBase::checkRegistrations() to a more simplified version of country code matching. This is causing a regression for certain zones. The funny side of this is, that our customer fulfilled the new EU law conditions by accident with this bug :D It's however not working as expected. So let's have a look at the setup
- The store address is located in Austria
- Billing and shipping countries are set to Austria and Germany
- Tax registration however was only set to Austria (now, it's legally only correct to select Germany as well, but only Austria was selected though)
Before the mentioned change, for German customers the Austrian VAT rate of 20% was calculated, but after the change the German 19% are calculated, even if Germany is not within the tax registration countries. Why? Because the German zone does not only include Germany, but also includes a handful of Austrian postal codes. After the change, only the country code is compared and that's why the 19% are used. So the change may have solved the Madeira-like excluded postal codes problem, but introduced a new one for included postal codes :(
| Comment | File | Size | Author |
|---|---|---|---|
| #26 | diff_23-26.txt | 1.05 KB | dwkitchen |
| #26 | 3263578-26.patch | 4.8 KB | dwkitchen |
Issue fork commerce-3263578
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
agoradesign commentedComment #3
jsacksick commentedIMO, even though reverting the fix from the issue linked fixes the problem... That isn't where the problem lies.
I think the problem is coming from
resolveZones()that affects this particular usecase, because of the following code:I think this part should be rewritten to call a different method that doesn't only check the country code.
Comment #4
agoradesign commentedlet's try this one, if it breaks any test
Comment #6
jsacksick commentedThe attached patch should hopefully fix your usecase.
Comment #7
agoradesign commentedyes it does :)
Comment #9
jsacksick commentedComment #11
agoradesign commentedto not forget it, my last comment on Slack:
Comment #12
jsacksick commentedI have a fix that seems to work, however if it is the right fix, it needs better comment... And perhaps the fix itself can be improved :)....
Comment #13
jsacksick commentedSame patch, with a coding standard fix.
Comment #14
jsacksick commentedSame patch in an attempt to make it more readable :p.
Comment #15
jsacksick commentedLast patch of the day...
Comment #16
agoradesign commentedgreeeeeeeeeeeeeeaaaaaaaaat job!
Comment #17
agoradesign commentedit only took a whole day and > 255 replies in the Slack thread for both of us :D
Comment #18
dwkitchen commentedAdd additional test for Switzerland with German customers in Büsingen
Comment #19
jsacksick commented-
Comment #20
jsacksick commentedComment #21
agoradesign commentedmakes sense anyway, because there are German postal codes within Swiss zone.. we have seen so many WTF's today. so this additional test is great
Comment #22
agoradesign commentedwhy should they fail, when they're inside SwissVatTest?
Comment #23
jsacksick commentedComment #24
jsacksick commentedComment #25
agoradesign commentedit's green :)
Comment #26
dwkitchen commented@jsacksick here is a patch with the additional test we discussed on the EU VAT to check that DE VAT is not applied to a customer in Büsingen
Comment #27
jsacksick commented@dwkitchen: We need to configure the Swiss VAT tax in the test if we want to make sure of that.
Comment #28
dwkitchen commentedNo, the test assumes that the Swiss Tax Type is not enabled.
This new test is testing EuTaxType line 300; that Büsingen is excluded from Germany
['country_code' => 'DE', 'excluded_postal_codes' => '27498, 78266'],Comment #31
jsacksick commentedCommitted! Thanks everyone!