Skip to content

Conversation

@onbuyuka
Copy link
Contributor

@onbuyuka onbuyuka commented Feb 2, 2026

Problem

The unit test UnitTestUpdateTaxRegistrationIdForVATRegistrationNo in Shpfy Tax Id Mapping Test codeunit was failing when running on the Belgian (BE) localization.

The test was attempting to validate a VAT Registration No. on a Customer record, but Belgian localization requires customers to use the "Enterprise No." field instead of "VAT Registration No." for Belgian customers. This triggered the validation error:

"You must use Enterprise No. for Belgian customers."

Root Cause

When the Company Information has Country/Region Code = 'BE', the Customer.VAT Registration No. field validation rejects VAT Registration numbers because Belgian regulations require the use of the Enterprise No. field instead.

Solution

Added a condition in the test to detect when running on Belgian localization and handle it by:

  1. Setting the customer's Country/Region Code to 'DE' (Germany) to bypass the Belgian-specific validation
  2. Regenerating a valid VAT Registration No. for the German country code

Changes

  • ShpfyTaxIdMappingTest.Codeunit.al: Added conditional logic to handle Belgian localization in UnitTestUpdateTaxRegistrationIdForVATRegistrationNo test
if CompanyInformation."Country/Region Code" = 'BE' then begin
    Customer."Country/Region Code" := 'DE'; // VAT Reg No. not allowed for BE Customers
    Customer.Modify();
    NewTaxRegistrationId := LibraryERM.GenerateVATRegistrationNo(Customer."Country/Region Code");
end;

Fixes AB#618120

@onbuyuka onbuyuka requested a review from a team as a code owner February 2, 2026 15:24
@github-actions github-actions bot added the AL: Apps (W1) Add-on apps for W1 label Feb 2, 2026
@onbuyuka onbuyuka changed the title [S]Test failure in UnitTestUpdateTaxRegistrationIdForVATRegistrationNo for Belgian customers [Shopify] Test failure in UnitTestUpdateTaxRegistrationIdForVATRegistrationNo for Belgian customers Feb 2, 2026
@onbuyuka onbuyuka enabled auto-merge (squash) February 2, 2026 15:25
@github-actions github-actions bot added this to the Version 28.0 milestone Feb 2, 2026
@@ -171,6 +171,11 @@ codeunit 134246 "Shpfy Tax Id Mapping Test"
NewTaxRegistrationId := LibraryERM.GenerateVATRegistrationNo(CompanyInformation."Country/Region Code");
// [GIVEN] Customer with empty VAT Registration No.
CreateCustomerWithVATRegNo(Customer, '');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are we then losing code coverage here in BE?

Consider moving the code into CreateCustomerWithVATRegNo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AL: Apps (W1) Add-on apps for W1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants