diff --git a/Directory.Packages.props b/Directory.Packages.props index 48292f0e..c6e87244 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -9,7 +9,7 @@ - + @@ -39,7 +39,7 @@ - + \ No newline at end of file diff --git a/src/API.Core/Services/PostalCodeParser.cs b/src/API.Core/Services/PostalCodeParser.cs index 46aafdf9..87a9a600 100644 --- a/src/API.Core/Services/PostalCodeParser.cs +++ b/src/API.Core/Services/PostalCodeParser.cs @@ -95,7 +95,7 @@ public ParserResult ParsePostalCode( CountryInfo country, string inputPostalCode) { - var key = country.TwoLetterISORegionName; + var key = country.PrincipalRegion.TwoLetterISORegionName; if (PostalCodeParsers.TryGetValue(key, out var parser)) { diff --git a/src/API.Core/Validators/AddressValidator.cs b/src/API.Core/Validators/AddressValidator.cs index 49d6f473..90dfe48a 100644 --- a/src/API.Core/Validators/AddressValidator.cs +++ b/src/API.Core/Validators/AddressValidator.cs @@ -36,6 +36,6 @@ private static bool BranchAddressPostalCodeMustBeValidForCounpanyAddressCountry( private static string BranchAddressPostalCodeMustBeValidForCounpanyAddressCountryErrorMessage( Address address, string postalCode) { - return $"Postal Code '{postalCode}' for Country '{address.Country.TwoLetterISORegionName} - [{address.Country.PrincipalRegion.EnglishName}]' is invalid."; + return $"Postal Code '{postalCode}' for Country '{address.Country} - [{address.Country.PrincipalRegion.EnglishName}]' is invalid."; } } diff --git a/src/API.Core/Validators/BranchCommandValidatorHelper.cs b/src/API.Core/Validators/BranchCommandValidatorHelper.cs index 6c5198e4..87f3b834 100644 --- a/src/API.Core/Validators/BranchCommandValidatorHelper.cs +++ b/src/API.Core/Validators/BranchCommandValidatorHelper.cs @@ -32,7 +32,7 @@ public static string BranchAddressCountryMustBeCompanyCountryErrorMessage(T c static string GetAddressCountryCodeAndName(Address address) { - return $"{address.Country.TwoLetterISORegionName} - [{address.Country.PrincipalRegion.EnglishName}]"; + return $"{address.Country} - [{address.Country.PrincipalRegion.EnglishName}]"; } } diff --git a/src/API.Core/Validators/CompanyCommandValidatorHelper.cs b/src/API.Core/Validators/CompanyCommandValidatorHelper.cs index 1c24e4d0..bf0888c6 100644 --- a/src/API.Core/Validators/CompanyCommandValidatorHelper.cs +++ b/src/API.Core/Validators/CompanyCommandValidatorHelper.cs @@ -17,6 +17,6 @@ public static async Task CompanyCountryMustBeLicensedAsync( public static string CompanyCountryMustBeLicensedErrorMessage(T command, CountryInfo property) { - return $"Country '{property.TwoLetterISORegionName} - {property.PrincipalRegion.EnglishName}' is not licensed."; + return $"Country '{property} - {property.PrincipalRegion.EnglishName}' is not licensed."; } } diff --git a/src/API.Infrastructure/Messages/Events/BranchCreatedEventBusHandler.cs b/src/API.Infrastructure/Messages/Events/BranchCreatedEventBusHandler.cs index f5f98dc1..4f62ec12 100644 --- a/src/API.Infrastructure/Messages/Events/BranchCreatedEventBusHandler.cs +++ b/src/API.Infrastructure/Messages/Events/BranchCreatedEventBusHandler.cs @@ -28,7 +28,7 @@ protected override BranchChangedProtoEvent Map(BranchCreatedEvent domainEvent) City = s.City, Subdivision = s.Subdivision, PostalCode = s.PostalCode, - CountryCode = s.Country.TwoLetterISORegionName + CountryCode = s.Country.PrincipalRegion.TwoLetterISORegionName }, default(Address)), TimeZoneId = domainEvent.TimeZone.Id, }; diff --git a/src/API.Infrastructure/Messages/Events/BranchUpdatedEventBusHandler.cs b/src/API.Infrastructure/Messages/Events/BranchUpdatedEventBusHandler.cs index b664c630..951438bf 100644 --- a/src/API.Infrastructure/Messages/Events/BranchUpdatedEventBusHandler.cs +++ b/src/API.Infrastructure/Messages/Events/BranchUpdatedEventBusHandler.cs @@ -28,7 +28,7 @@ protected override BranchChangedProtoEvent Map(BranchUpdatedEvent domainEvent) City = s.City, Subdivision = s.Subdivision, PostalCode = s.PostalCode, - CountryCode = s.Country.TwoLetterISORegionName + CountryCode = s.Country.PrincipalRegion.TwoLetterISORegionName }, default(Address)), TimeZoneId = domainEvent.TimeZone.Id, }; diff --git a/src/API.Infrastructure/Messages/Events/CompanyCreatedEventBusHandler.cs b/src/API.Infrastructure/Messages/Events/CompanyCreatedEventBusHandler.cs index dca5f37d..99fb45ba 100644 --- a/src/API.Infrastructure/Messages/Events/CompanyCreatedEventBusHandler.cs +++ b/src/API.Infrastructure/Messages/Events/CompanyCreatedEventBusHandler.cs @@ -20,7 +20,7 @@ protected override CompanyChangedProtoEvent Map(CompanyCreatedEvent domainEvent) { CompanyId = domainEvent.CompanyId.AsPrimitive(), Name = domainEvent.Name, - CountryCode = domainEvent.Country?.TwoLetterISORegionName + CountryCode = domainEvent.Country?.PrincipalRegion.TwoLetterISORegionName }; protected override long ResolveEntityId(CompanyCreatedEvent domainEvent) diff --git a/src/API.Infrastructure/Messages/Events/CompanyUpdatedEventBusHandler.cs b/src/API.Infrastructure/Messages/Events/CompanyUpdatedEventBusHandler.cs index 11abe408..e8c421fa 100644 --- a/src/API.Infrastructure/Messages/Events/CompanyUpdatedEventBusHandler.cs +++ b/src/API.Infrastructure/Messages/Events/CompanyUpdatedEventBusHandler.cs @@ -20,7 +20,7 @@ protected override CompanyChangedProtoEvent Map(CompanyUpdatedEvent domainEvent) { CompanyId = domainEvent.CompanyId.AsPrimitive(), Name = domainEvent.Name, - CountryCode = domainEvent.Country?.TwoLetterISORegionName + CountryCode = domainEvent.Country?.PrincipalRegion.TwoLetterISORegionName }; protected override long ResolveEntityId(CompanyUpdatedEvent domainEvent) diff --git a/src/API.Persistence/Mongo/Mappers/AddressMongoMapper.cs b/src/API.Persistence/Mongo/Mappers/AddressMongoMapper.cs index 7c4632c6..e2d2a579 100644 --- a/src/API.Persistence/Mongo/Mappers/AddressMongoMapper.cs +++ b/src/API.Persistence/Mongo/Mappers/AddressMongoMapper.cs @@ -26,7 +26,7 @@ public AddressMongo Map(Address source) City = source.City.Trim(), Subdivision = source.Subdivision.Trim(), PostalCode = source.PostalCode.Trim(), - CountryCode = source.Country.TwoLetterISORegionName, + CountryCode = source.Country.PrincipalRegion.TwoLetterISORegionName, }; } diff --git a/src/API.Persistence/Mongo/Mappers/CompanyMongoMapper.cs b/src/API.Persistence/Mongo/Mappers/CompanyMongoMapper.cs index 3d69f859..65c33b81 100644 --- a/src/API.Persistence/Mongo/Mappers/CompanyMongoMapper.cs +++ b/src/API.Persistence/Mongo/Mappers/CompanyMongoMapper.cs @@ -39,7 +39,7 @@ public CompanyMongoEntity Map(CompanyEntity source) ID = _domainIdentityToDataIdentityMapper.Map(source.ID), TenantID = source.TenantID, Name = source.Name, - CountryCode = source.Country.TwoLetterISORegionName, + CountryCode = source.Country.PrincipalRegion.TwoLetterISORegionName, }; } } diff --git a/src/API.Web/Mappers/AddressModelMapper.cs b/src/API.Web/Mappers/AddressModelMapper.cs index 665f2063..a7b32be9 100644 --- a/src/API.Web/Mappers/AddressModelMapper.cs +++ b/src/API.Web/Mappers/AddressModelMapper.cs @@ -26,7 +26,7 @@ public AddressModel Map(Address source) source.City.Trim(), source.Subdivision.Trim(), source.PostalCode.Trim(), - source.Country.TwoLetterISORegionName); + source.Country.PrincipalRegion.TwoLetterISORegionName); } public Address Map(AddressModel source) diff --git a/src/API.Web/Mappers/CompanyRetrievalModelMapper.cs b/src/API.Web/Mappers/CompanyRetrievalModelMapper.cs index d4f132f4..9e3e12f5 100644 --- a/src/API.Web/Mappers/CompanyRetrievalModelMapper.cs +++ b/src/API.Web/Mappers/CompanyRetrievalModelMapper.cs @@ -19,6 +19,6 @@ public CompanyRetrievalModel Map(CompanyEntity source) return new CompanyRetrievalModel( _domainIdentityToDataIdentityMapper.Map(source.ID), source.Name, - source.Country.TwoLetterISORegionName); + source.Country.PrincipalRegion.TwoLetterISORegionName); } } diff --git a/src/API.Web/Mappers/CountryModelMapper.cs b/src/API.Web/Mappers/CountryModelMapper.cs index d9219018..8ed9f110 100644 --- a/src/API.Web/Mappers/CountryModelMapper.cs +++ b/src/API.Web/Mappers/CountryModelMapper.cs @@ -8,6 +8,6 @@ public class CountryModelMapper : IMapper { public CountryModel Map(CountryInfo source) { - return new CountryModel(source.PrincipalRegion.EnglishName, source.TwoLetterISORegionName); + return new CountryModel(source.PrincipalRegion.EnglishName, source.PrincipalRegion.TwoLetterISORegionName); } } diff --git a/src/API.Web/Mappers/TimeZoneModelMapper.cs b/src/API.Web/Mappers/TimeZoneModelMapper.cs index d2e9fe9b..23919f96 100644 --- a/src/API.Web/Mappers/TimeZoneModelMapper.cs +++ b/src/API.Web/Mappers/TimeZoneModelMapper.cs @@ -24,7 +24,7 @@ public TimeZoneModel Map(DateTimeZone source) return new TimeZoneModel( source.Id, TzdbDateTimeZoneSource.Default.TzdbToWindowsIds[source.Id], - _dateTimeZoneLookup.ResolveTimeZoneCountry(source).TwoLetterISORegionName, + _dateTimeZoneLookup.ResolveTimeZoneCountry(source).PrincipalRegion.TwoLetterISORegionName, source.GetUtcOffset(_clock.GetCurrentInstant()).ToTimeSpan()); } }