Fix VIES integrity check: tolerate country-code prefix on echoed VAT number (uptake fix) - #11657
Merged
Merged
Conversation
… echoed VAT number The integrity check compared the echoed vatNumber against GetVATRegNo(), which strips the leading country-code prefix. A VIES response may echo the number with or without that prefix (member states / mocks differ), so a response echoing DE813261484 was wrongly rejected as 'did not match the requested identifiers' against the stripped request value 813261484. Because the check runs inside the VAT Registration No. OnValidate, this hard-blocked saving the field. Normalize both sides to the prefix-stripped form before comparing so a cosmetic prefix difference is not a mismatch while a genuinely different number/country is still rejected. Fixes the MOCKSERVICETESTS-Internal ERM VAT VIES Lookup WebService tests failing in NAV uptake. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
dcenic
force-pushed
the
bugs/650565VIESFixIntegrityCheck
branch
from
September 21, 2026 11:29
e6837de to
d1ff40f
Compare
Jesper Schulz-Wedde (JesperSchulz)
deployed
to
triage
September 21, 2026 12:06 — with
GitHub Actions
Active
Jesper Schulz-Wedde (JesperSchulz)
deployed
to
triage
September 21, 2026 12:06 — with
GitHub Actions
Active
Jesper Schulz-Wedde (JesperSchulz)
deployed
to
triage
September 21, 2026 12:06 — with
GitHub Actions
Active
Maria Zhelezova (mazhelez)
approved these changes
Sep 21, 2026
Anders (AndersLarsenMicrosoft)
approved these changes
Sep 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
Follow-up fix to #11435 (merged). The VIES response-integrity check added there compared the echoed
vatNumberagainstVAT Registration Log.GetVATRegNo(), which strips the leading country-code prefix. A VIES response can echo the number with or without that prefix (member states and the test mock differ), so a response echoingDE813261484was wrongly rejected as "did not match the requested identifiers" against the stripped request value813261484.Because
ValidateResponseIntegrityruns inside theVAT Registration No.OnValidate, this didn't just fail a test — it hard-blocked saving the VAT number.Fix
Normalize both sides to the prefix-stripped form before comparing (strip the response's own echoed country-code prefix from its
vatNumber). A cosmetic prefix difference is no longer a mismatch, while a genuinely different number or country is still rejected (security intent preserved).Impact
Fixes the
MOCKSERVICETESTS-InternalERM VAT VIES Lookup WebServicetests (codeunit 134192) failing in BCApps uptake in the NAV repo (10 tests). That bucket needs a live mock service and does not run in the BCApps PR gate, which is why the regression wasn't caught here before merge.Validation
DE813261484) -> now pass; reject/mismatch unit tests still reject.Fixes AB#650565