Skip to content

Refactor Address to enforce required fields and validation#1583

Merged
StuartFerguson merged 3 commits intomasterfrom
bug/#1581_merchant_created_with_no_postcode
Mar 12, 2026
Merged

Refactor Address to enforce required fields and validation#1583
StuartFerguson merged 3 commits intomasterfrom
bug/#1581_merchant_created_with_no_postcode

Conversation

@StuartFerguson
Copy link
Copy Markdown
Member

Refactored Address to use a static Create method with validation for required fields (AddressLine1, Town, PostalCode, Country). Updated all usages to use Address.Create, ensuring invalid addresses cannot be instantiated. Added unit tests for validation. Also updated AddressModel and MerchantAddressModel instantiations for consistency. This centralizes and enforces address data integrity across the codebase.

fixes #1581

Refactored Address to use a static Create method with validation for required fields (AddressLine1, Town, PostalCode, Country). Updated all usages to use Address.Create, ensuring invalid addresses cannot be instantiated. Added unit tests for validation. Also updated AddressModel and MerchantAddressModel instantiations for consistency. This centralizes and enforces address data integrity across the codebase.
@StuartFerguson StuartFerguson added the bug Bugs and error-prone code label Mar 11, 2026
Introduce PostalCode field to all merchant-related BDD feature files and generated code-behind files. Update merchant creation and address update tables to include PostalCode, with sample values provided for all test merchants. Update SpecflowExtensions.cs to process and assign PostalCode when creating merchant requests. Remove the prlinked.yml GitHub Actions workflow file. These changes ensure PostalCode is consistently handled in integration tests, improving address data completeness and test reliability.
Previously, Address was always created with Guid.Empty as its ID in MerchantDomainService. Now, the AddressId from the command is used, enabling proper identification and handling of address updates.
@StuartFerguson StuartFerguson merged commit 98530f4 into master Mar 12, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Bugs and error-prone code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Merchant can be created without a post code

1 participant