Skip to content

Commit

Permalink
Merge pull request #200 from catenax-ng/feat/api_rename_postcode_Post…
Browse files Browse the repository at this point in the history
…alCode

Feat/api rename postcode to postal code
  • Loading branch information
nicoprow authored May 25, 2023
2 parents bb3cb3a + 8335490 commit 006abf4
Show file tree
Hide file tree
Showing 17 changed files with 42 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ data class BasePostalAddressDto(
val country: CountryCode,

@get:Schema(description = "A postal code, also known as postcode, PIN or ZIP Code")
val postCode: String? = null,
val postalCode: String? = null,

@get:Schema(description = "The city of the address (Synonym: Town, village, municipality)")
val city: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ data class PhysicalPostalAddressDto(
val areaPart: AreaDistrictDto,

@get:Schema(description = "A separate postal code for a company, also known as postcode, PIN or ZIP Code")
val companyPostCode: String? = null,
val companyPostalCode: String? = null,

@get:Schema(description = "The practice of designating an area for industrial development")
val industrialZone: String? = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ data class BasePostalAddressResponse(
val country: TypeKeyNameDto<CountryCode>,

@get:Schema(description = "A postal code, also known as postcode, PIN or ZIP Code")
val postCode: String? = null,
val postalCode: String? = null,

@get:Schema(description = "The city of the address (Synonym: Town, village, municipality)")
val city: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ data class PhysicalPostalAddressResponse(

@get:Schema(description = "Street")
val street: StreetDto? = null,

@field:JsonUnwrapped
val areaPart: AreaDistrictResponse,

@get:Schema(description = "A separate postal code for a company, also known as postcode, PIN or ZIP Code")
val companyPostCode: String? = null,
val companyPostalCode: String? = null,

@get:Schema(description = "The practice of designating an area for industrial development")
val industrialZone: String? = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ object SaasMappings {
}

return PhysicalPostalAddressDto(
companyPostCode = map.companyPostCode(),
companyPostalCode = map.companyPostCode(),
industrialZone = map.industrialZone(),
building = map.building(),
floor = map.floor(),
Expand All @@ -228,7 +228,7 @@ object SaasMappings {
geographicCoordinates = map.geoCoordinates(),
city = city,
country = country,
postCode = map.postcode(),
postalCode = map.postcode(),
)
)
}
Expand Down Expand Up @@ -259,7 +259,7 @@ object SaasMappings {
geographicCoordinates = map.geoCoordinates(),
city = city,
country = country,
postCode = map.postcode(),
postalCode = map.postcode(),
)
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ fun AlternativePostalAddressDto.toAlternativePostalAddressEntity(): AlternativeP
geographicCoordinates = baseAddress.geographicCoordinates?.toGeographicCoordinateEntity(),
country = baseAddress.country,
administrativeAreaLevel1 = null, // TODO Add region mapping Logic
postCode = baseAddress.postCode,
postCode = baseAddress.postalCode,
city = baseAddress.city,
deliveryServiceType = deliveryServiceType,
deliveryServiceNumber = deliveryServiceNumber
Expand All @@ -79,11 +79,11 @@ fun PhysicalPostalAddressDto.toPhysicalPostalAddressEntity(): PhysicalPostalAddr
administrativeAreaLevel1 = null, // TODO Add region mapping Logic
administrativeAreaLevel2 = areaPart.administrativeAreaLevel2,
administrativeAreaLevel3 = areaPart.administrativeAreaLevel3,
postCode = baseAddress.postCode,
postCode = baseAddress.postalCode,
city = baseAddress.city,
districtLevel1 = areaPart.district,
street = street?.toStreetEntity(),
companyPostCode = companyPostCode,
companyPostCode = companyPostalCode,
industrialZone = industrialZone,
building = building,
floor = floor,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,13 @@ class SaasDtoToSaasAddressMapping(private val postalAdress: BasePostalAddressDto

fun postcodes(physicalAddress: PhysicalPostalAddressDto?): Collection<PostCodeSaas> {
return listOfNotNull(
postalAdress.postCode?.let {
postalAdress.postalCode?.let {
PostCodeSaas(
value = it,
type = SaasPostCodeType.REGULAR.toSaasTypeDto()
)
},
physicalAddress?.companyPostCode?.let {
physicalAddress?.companyPostalCode?.let {
PostCodeSaas(
value = it,
type = SaasPostCodeType.LARGE_MAIL_USER.toSaasTypeDto()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class SaasDtoToSaasAddressMappingTest {
assertThat(areaPart.district).isEqualTo(findValue(addressSaas.localities, SaasLocalityType.DISTRICT))
assertThat(baseAddressDto.geographicCoordinates?.latitude).isEqualTo(addressSaas.geographicCoordinates?.latitude)
assertThat(baseAddressDto.geographicCoordinates?.longitude).isEqualTo(addressSaas.geographicCoordinates?.longitude)
assertThat(baseAddressDto.postCode).isEqualTo(findValue(addressSaas.postCodes, SaasPostCodeType.REGULAR))
assertThat(baseAddressDto.postalCode).isEqualTo(findValue(addressSaas.postCodes, SaasPostCodeType.REGULAR))
assertThat(streetDto?.name).isEqualTo(findObject(addressSaas.thoroughfares, SaasThoroughfareType.STREET)?.name)
assertThat(streetDto?.houseNumber).isEqualTo(findObject(addressSaas.thoroughfares, SaasThoroughfareType.STREET)?.number)
assertThat(streetDto?.direction).isEqualTo(findObject(addressSaas.thoroughfares, SaasThoroughfareType.STREET)?.direction)
Expand Down Expand Up @@ -75,7 +75,7 @@ class SaasDtoToSaasAddressMappingTest {
assertThat(areaPart.district).isEqualTo(findValue(addressSaas.localities, SaasLocalityType.DISTRICT))
assertThat(baseAddressDto.geographicCoordinates?.latitude).isEqualTo(addressSaas.geographicCoordinates?.latitude)
assertThat(baseAddressDto.geographicCoordinates?.longitude).isEqualTo(addressSaas.geographicCoordinates?.longitude)
assertThat(baseAddressDto.postCode).isEqualTo(findValue(addressSaas.postCodes, SaasPostCodeType.REGULAR))
assertThat(baseAddressDto.postalCode).isEqualTo(findValue(addressSaas.postCodes, SaasPostCodeType.REGULAR))
assertThat(streetDto?.name).isEqualTo(findObject(addressSaas.thoroughfares, SaasThoroughfareType.STREET)?.name)
assertThat(streetDto?.houseNumber).isEqualTo(findObject(addressSaas.thoroughfares, SaasThoroughfareType.STREET)?.number)
assertThat(streetDto?.direction).isEqualTo(findObject(addressSaas.thoroughfares, SaasThoroughfareType.STREET)?.direction)
Expand Down Expand Up @@ -104,7 +104,7 @@ class SaasDtoToSaasAddressMappingTest {
assertThat(areaPart.district).isEqualTo(findValue(addressSaas.localities, SaasLocalityType.DISTRICT))
assertThat(baseAddressDto.geographicCoordinates?.latitude).isEqualTo(addressSaas.geographicCoordinates?.latitude)
assertThat(baseAddressDto.geographicCoordinates?.longitude).isEqualTo(addressSaas.geographicCoordinates?.longitude)
assertThat(baseAddressDto.postCode).isEqualTo(findValue(addressSaas.postCodes, SaasPostCodeType.REGULAR))
assertThat(baseAddressDto.postalCode).isEqualTo(findValue(addressSaas.postCodes, SaasPostCodeType.REGULAR))
assertThat(streetDto?.name).isEqualTo(findObject(addressSaas.thoroughfares, SaasThoroughfareType.STREET)?.name)
assertThat(streetDto?.houseNumber).isEqualTo(findObject(addressSaas.thoroughfares, SaasThoroughfareType.STREET)?.number)
assertThat(streetDto?.direction).isEqualTo(findObject(addressSaas.thoroughfares, SaasThoroughfareType.STREET)?.direction)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ object RequestValues {
baseAddress = BasePostalAddressDto(
geographicCoordinates = geoCoordinate1,
country = CommonValues.country1,
postCode = CommonValues.postCode1,
postalCode = CommonValues.postCode1,
city = CommonValues.city1,
)
)
Expand All @@ -150,7 +150,7 @@ object RequestValues {
baseAddress = BasePostalAddressDto(
geographicCoordinates = geoCoordinate2,
country = CommonValues.country2,
postCode = CommonValues.postCode2,
postalCode = CommonValues.postCode2,
city = CommonValues.city2,
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ object ResponseValues {
baseAddress = BasePostalAddressResponse(
geographicCoordinates = geoCoordinate1,
country = country1,
postCode = CommonValues.postCode1,
postalCode = CommonValues.postCode1,
city = CommonValues.city1,
)
)
Expand All @@ -197,7 +197,7 @@ object ResponseValues {
baseAddress = BasePostalAddressResponse(
geographicCoordinates = geoCoordinate2,
country = country2,
postCode = CommonValues.postCode2,
postalCode = CommonValues.postCode2,
city = CommonValues.city2,
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -432,11 +432,11 @@ class BusinessPartnerBuildService(
administrativeAreaLevel1 = null,
administrativeAreaLevel2 = area.administrativeAreaLevel2,
administrativeAreaLevel3 = area.administrativeAreaLevel3,
postCode = baseAddress.postCode,
postCode = baseAddress.postalCode,
city = baseAddress.city,
districtLevel1 = area.district,
street = physicalAddress.street?.let { createStreet(it) },
companyPostCode = physicalAddress.companyPostCode,
companyPostCode = physicalAddress.companyPostalCode,
industrialZone = physicalAddress.industrialZone,
building = physicalAddress.building,
floor = physicalAddress.floor,
Expand All @@ -455,7 +455,7 @@ class BusinessPartnerBuildService(
// metadataMap.regions[it] ?: throw BpdmNotFoundException(Region::class, it)
// },
administrativeAreaLevel1 = null,
postCode = baseAddress.postCode,
postCode = baseAddress.postalCode,
city = baseAddress.city,
deliveryServiceType = alternativeAddress.deliveryServiceType,
deliveryServiceNumber = alternativeAddress.deliveryServiceNumber
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ fun PhysicalPostalAddress.toDto(): PhysicalPostalAddressResponse {
baseAddress = BasePostalAddressResponse(
geographicCoordinates = geographicCoordinates?.toDto(),
country = country.toDto(),
postCode = postCode,
postalCode = postCode,
city = city,
),
street = street?.toDto(),
Expand All @@ -161,7 +161,7 @@ fun PhysicalPostalAddress.toDto(): PhysicalPostalAddressResponse {
administrativeAreaLevel3 = administrativeAreaLevel3,
district = districtLevel1,
),
companyPostCode = companyPostCode,
companyPostalCode = companyPostCode,
industrialZone = industrialZone,
building = building,
floor = floor,
Expand All @@ -174,7 +174,7 @@ fun AlternativePostalAddress.toDto(): AlternativePostalAddressResponse {
baseAddress = BasePostalAddressResponse(
geographicCoordinates = geographicCoordinates?.toDto(),
country = country.toDto(),
postCode = postCode,
postalCode = postCode,
city = city,
),
areaPart = AreaDistrictAlternativResponse(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class SaasAddressToDtoMappingTest {
Assertions.assertThat(areaDto.district).isEqualTo(findValue(addressSaas.localities, SaasLocalityType.DISTRICT))
Assertions.assertThat(baseAddressDto.geographicCoordinates?.latitude).isEqualTo(addressSaas.geographicCoordinates?.latitude)
Assertions.assertThat(baseAddressDto.geographicCoordinates?.longitude).isEqualTo(addressSaas.geographicCoordinates?.longitude)
Assertions.assertThat(baseAddressDto.postCode).isEqualTo(findValue(addressSaas.postCodes, SaasPostCodeType.REGULAR))
Assertions.assertThat(baseAddressDto.postalCode).isEqualTo(findValue(addressSaas.postCodes, SaasPostCodeType.REGULAR))
Assertions.assertThat(streetDto?.name).isEqualTo(findObject(addressSaas.thoroughfares, SaasThoroughfareType.STREET)?.name)
Assertions.assertThat(streetDto?.houseNumber).isEqualTo(findObject(addressSaas.thoroughfares, SaasThoroughfareType.STREET)?.number)
Assertions.assertThat(streetDto?.direction).isEqualTo(findObject(addressSaas.thoroughfares, SaasThoroughfareType.STREET)?.direction)
Expand All @@ -88,7 +88,7 @@ class SaasAddressToDtoMappingTest {
Assertions.assertThat(areaDto.district).isEqualTo(findValue(addressSaas.localities, SaasLocalityType.DISTRICT))
Assertions.assertThat(baseAddressDto.geographicCoordinates?.latitude).isEqualTo(addressSaas.geographicCoordinates?.latitude)
Assertions.assertThat(baseAddressDto.geographicCoordinates?.longitude).isEqualTo(addressSaas.geographicCoordinates?.longitude)
Assertions.assertThat(baseAddressDto.postCode).isEqualTo(findValue(addressSaas.postCodes, SaasPostCodeType.REGULAR))
Assertions.assertThat(baseAddressDto.postalCode).isEqualTo(findValue(addressSaas.postCodes, SaasPostCodeType.REGULAR))
Assertions.assertThat(streetDto?.name).isEqualTo(findObject(addressSaas.thoroughfares, SaasThoroughfareType.STREET)?.name)
Assertions.assertThat(streetDto?.houseNumber).isEqualTo(findObject(addressSaas.thoroughfares, SaasThoroughfareType.STREET)?.number)
Assertions.assertThat(streetDto?.direction).isEqualTo(findObject(addressSaas.thoroughfares, SaasThoroughfareType.STREET)?.direction)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ class AddressControllerSearchIT @Autowired constructor(
)

val addressSearchRequest = AddressPartnerSearchRequest(
postCode = givenAddress1.physicalPostalAddress.baseAddress.postCode
postCode = givenAddress1.physicalPostalAddress.baseAddress.postalCode
)

val pageResponse = poolClient.addresses().getAddresses(addressSearchRequest, PaginationRequest())
Expand Down Expand Up @@ -275,7 +275,7 @@ class AddressControllerSearchIT @Autowired constructor(

val addressSearchRequest = AddressPartnerSearchRequest()
addressSearchRequest.postalDeliveryPoint = RequestValues.addressPartnerCreate1.address.alternativePostalAddress!!.deliveryServiceNumber
addressSearchRequest.postCode = RequestValues.addressPartnerCreate1.address.physicalPostalAddress.baseAddress.postCode
addressSearchRequest.postCode = RequestValues.addressPartnerCreate1.address.physicalPostalAddress.baseAddress.postalCode
val pageResponse = poolClient.addresses().getAddresses(addressSearchRequest, PaginationRequest())

assertPageEquals(pageResponse, expected)
Expand All @@ -295,7 +295,7 @@ class AddressControllerSearchIT @Autowired constructor(


val addressSearchRequest = AddressPartnerSearchRequest()
addressSearchRequest.postCode = RequestValues.addressPartnerCreate1.address.physicalPostalAddress.baseAddress.postCode
addressSearchRequest.postCode = RequestValues.addressPartnerCreate1.address.physicalPostalAddress.baseAddress.postalCode
addressSearchRequest.administrativeArea = "someNonexistentValue"
val pageResponse = poolClient.addresses().getAddresses(addressSearchRequest, PaginationRequest())

Expand Down Expand Up @@ -335,7 +335,7 @@ class AddressControllerSearchIT @Autowired constructor(
)

val addressSearchRequest = AddressPartnerSearchRequest(
postCode = givenAddress3.physicalPostalAddress.baseAddress.postCode
postCode = givenAddress3.physicalPostalAddress.baseAddress.postalCode
)
val pageResponse = poolClient.addresses().getAddresses(addressSearchRequest, PaginationRequest())

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ class SuggestionControllerIT @Autowired constructor(
expectedLegalEntityName
),
Arguments.of(
expectedLegalAddress.physicalPostalAddress.baseAddress.postCode,
expectedLegalAddress.physicalPostalAddress.baseAddress.postalCode,
EndpointValues.CATENA_SUGGESTION_ADDRESS_POST_CODE_PATH,
expectedLegalEntityName
),
Expand Down Expand Up @@ -154,7 +154,7 @@ class SuggestionControllerIT @Autowired constructor(
nonlatinLegalAddress.physicalPostalAddress.areaPart.administrativeAreaLevel2,
EndpointValues.CATENA_SUGGESTION_ADDRESS_ADMIN_AREA_PATH
),
Arguments.of(nonlatinLegalAddress.physicalPostalAddress.baseAddress.postCode, EndpointValues.CATENA_SUGGESTION_ADDRESS_POST_CODE_PATH),
Arguments.of(nonlatinLegalAddress.physicalPostalAddress.baseAddress.postalCode, EndpointValues.CATENA_SUGGESTION_ADDRESS_POST_CODE_PATH),
Arguments.of(nonlatinLegalAddress.physicalPostalAddress.baseAddress.city, EndpointValues.CATENA_SUGGESTION_ADDRESS_LOCALITY_PATH),
Arguments.of(nonlatinLegalAddress.physicalPostalAddress.street!!.name, EndpointValues.CATENA_SUGGESTION_ADDRESS_THOROUGHFARE_PATH),
Arguments.of(nonlatinLegalAddress.physicalPostalAddress.building, EndpointValues.CATENA_SUGGESTION_ADDRESS_PREMISE_PATH),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ object RequestValues {
val version1 = AddressVersionDto(CommonValues.characterSet1, CommonValues.language0)

val postalAddress1 = PhysicalPostalAddressDto(
companyPostCode = CommonValues.postCode2,
companyPostalCode = CommonValues.postCode2,
industrialZone = CommonValues.industrialZone1,
building = CommonValues.building1,
floor = CommonValues.floor1,
Expand All @@ -105,7 +105,7 @@ object RequestValues {
baseAddress = BasePostalAddressDto(
geographicCoordinates = null,
country = CommonValues.country1,
postCode = CommonValues.postCode1,
postalCode = CommonValues.postCode1,
city = CommonValues.city1,
)
)
Expand All @@ -124,7 +124,7 @@ object RequestValues {
baseAddress = BasePostalAddressDto(
geographicCoordinates = null,
country = CommonValues.country2,
postCode = CommonValues.postCode2,
postalCode = CommonValues.postCode2,
city = CommonValues.city2,
)
)
Expand All @@ -143,7 +143,7 @@ object RequestValues {
baseAddress = BasePostalAddressDto(
geographicCoordinates = null,
country = CommonValues.country3,
postCode = CommonValues.postCode3,
postalCode = CommonValues.postCode3,
city = CommonValues.city3,
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ object ResponseValues {
private val classification5 = ClassificationResponse(CommonValues.classification5, null, classificationType)

private val address1 = PhysicalPostalAddressResponse(
companyPostCode = CommonValues.postCode2,
companyPostalCode = CommonValues.postCode2,
industrialZone = CommonValues.industrialZone1,
building = CommonValues.building1,
floor = CommonValues.floor1,
Expand All @@ -108,7 +108,7 @@ object ResponseValues {
baseAddress = BasePostalAddressResponse(
geographicCoordinates = null,
country = country1,
postCode = CommonValues.postCode1,
postalCode = CommonValues.postCode1,
city = CommonValues.city1,
)
)
Expand All @@ -127,7 +127,7 @@ object ResponseValues {
baseAddress = BasePostalAddressResponse(
geographicCoordinates = null,
country = country2,
postCode = CommonValues.postCode2,
postalCode = CommonValues.postCode2,
city = CommonValues.city2,
)
)
Expand All @@ -146,7 +146,7 @@ object ResponseValues {
baseAddress = BasePostalAddressResponse(
geographicCoordinates = null,
country = country3,
postCode = CommonValues.postCode3,
postalCode = CommonValues.postCode3,
city = CommonValues.city3,
)
)
Expand Down

0 comments on commit 006abf4

Please sign in to comment.