Skip to content

fix: only map customer address if existant, address validation is based on invoice type and VAT registration presence#17

Merged
sevaske merged 2 commits into
sevaske:mainfrom
SohaibSEG:fix/mapping-an-empty-address
Dec 1, 2025
Merged

fix: only map customer address if existant, address validation is based on invoice type and VAT registration presence#17
sevaske merged 2 commits into
sevaske:mainfrom
SohaibSEG:fix/mapping-an-empty-address

Conversation

@SohaibSEG

Copy link
Copy Markdown
Contributor

This pull request updates the customer mapping and validation logic to more accurately handle address requirements based on VAT registration and invoice type. The changes ensure that address information is validated and mapped only when appropriate, aligning with business rules and ZATCA requirements.

Customer Address Mapping and Validation:

  • Refactored the CustomerMapper so that the Party object is always created, and the postal address is only set if address data is provided. This prevents empty address objects from being set when no address is supplied. [1] [2]

Validation Logic Improvements:

  • Updated CustomerValidator to require address validation if the customer is VAT-registered, regardless of invoice type, or if address data is present. This ensures compliance with ZATCA and business requirements.
  • Added explicit address validation for VAT-registered customers in validateVatRegisteredCustomer, ensuring address is always validated for such customers.
  • Added address validation for non-VAT customers when not simplified invoices, or when address data is provided, in validateNonVatCustomer.

@sevaske
sevaske merged commit 752bb91 into sevaske:main Dec 1, 2025
2 checks passed
@SohaibSEG
SohaibSEG deleted the fix/mapping-an-empty-address branch December 1, 2025 20:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants