jofme / D365FinanceToolbox

A collection of extensions, enhancements and 'nice-to-haves' for D365 finance and related workloads.
MIT License
14 stars 2 forks source link

VIES: Tax registration numbers seem to be stripped for letters causing invalid Tax registration number #55

Open MortenAbildgaard opened 3 days ago

MortenAbildgaard commented 3 days ago

We have tested the VIES functionality and our findings are that the functionality strips all letters from the Tax exempt number when generating the VAT VIES number for querying
This poses a problem for example for NLD. A valid VIES VAT number for Netherlands contain the letter B for the 10th figure of 12 figures. 123456789B12. When the B is stripped, we end up with 11 figures and the Tax exempt number becomes invalid when validating.

jofme commented 3 days ago

Hi Morten,

Thanks for the feedback! I have a good idea of where the issue might be. This line of code strips all letters from the VAT number: https://github.com/jofme/D365FinanceToolbox/blob/dev/Metadata/FinanceToolbox/FinanceToolbox/AxClass/FTBXECVIESCheckResult.xml#L39

vatNumTested = strKeep(vatNum, '0123456789');

It should be an easy fix. I'll look into it shortly.