Skip to content

Fix VIES integrity check: tolerate country-code prefix on echoed VAT number (uptake fix) - #11657

Merged
dcenic merged 1 commit into
mainfrom
bugs/650565VIESFixIntegrityCheck
Sep 21, 2026
Merged

dcenic merged 1 commit into
mainfrom
bugs/650565VIESFixIntegrityCheck

Conversation

@dcenic

@dcenic dcenic commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

What & why

Follow-up fix to #11435 (merged). The VIES response-integrity check added there compared the echoed vatNumber against VAT 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 echoing DE813261484 was wrongly rejected as "did not match the requested identifiers" against the stripped request value 813261484.

Because ValidateResponseIntegrity runs inside the VAT 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-Internal ERM VAT VIES Lookup WebService tests (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

  • AL diagnostics clean.
  • Traced all 10 failing mocks (DE/DE813261484) -> now pass; reject/mismatch unit tests still reject.
  • Full end-to-end runs in the NAV uptake gate (mock service required). Verified this locally, ran the affected test codeunit 134192 with MockService running locally. All pass.
  • Codeunit 134192 runs in NAV but not in BCApps because it needs MockService. It needs it because it is mocking a SOAP request and cannot use HttpRequestHandler pattern for mocking.

Fixes AB#650565

@dcenic
dcenic requested a review from a team as a code owner September 21, 2026 11:22
@github-actions github-actions Bot added AL: Apps (W1) Add-on apps for W1 Ownership: Needs Review Ownership is Other, low confidence, or needs manual correction Team: Other GitHub request for other area than SCM, Finance or Integration labels Sep 21, 2026
@github-actions github-actions Bot added this to the Version 30.0 milestone Sep 21, 2026
… 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
dcenic force-pushed the bugs/650565VIESFixIntegrityCheck branch from e6837de to d1ff40f Compare September 21, 2026 11:29
@github-actions github-actions Bot removed the AL: Apps (W1) Add-on apps for W1 label Sep 21, 2026
@JesperSchulz Jesper Schulz-Wedde (JesperSchulz) added Team: Finance GitHub request for Finance area Ownership: Manual Preserve the manually selected team ownership and removed Team: Other GitHub request for other area than SCM, Finance or Integration Ownership: Needs Review Ownership is Other, low confidence, or needs manual correction labels Sep 21, 2026
@dcenic
dcenic added this pull request to the merge queue Sep 21, 2026
Merged via the queue into main with commit a9db399 Sep 21, 2026
180 checks passed
@dcenic
dcenic deleted the bugs/650565VIESFixIntegrityCheck branch September 21, 2026 19:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Ownership: Manual Preserve the manually selected team ownership Team: Finance GitHub request for Finance area

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants