Skip to content

Commit

Permalink
feat(api): eclipse-tractusx#182 Remove Districts in Alternative Address
Browse files Browse the repository at this point in the history
  • Loading branch information
rainer-exxcellent committed May 25, 2023
1 parent d97e7cb commit bd5b501
Show file tree
Hide file tree
Showing 16 changed files with 41 additions and 62 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,4 @@ data class AreaDistrictAlternativDto(

@get:Schema(description = "Identifying code of the Region within the country (e.g. Bayern)")
val administrativeAreaLevel1: String? = null,

@get:Schema(description = "Divides the city in several smaller areas")
val districtLevel1: String? = null,

@get:Schema(description = "Divides the DistrictLevel1 in several smaller areas. Synonym: Subdistrict")
val districtLevel2: String? = null,

)
)
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ import io.swagger.v3.oas.annotations.media.Schema

@Schema(name = "IdentifierTypeDetailDto", description = "Identifier type validity details")
data class IdentifierTypeDetailDto(
@Schema(description = "Country in which this identifier is valid, null for universal identifiers")
@get:Schema(description = "Country in which this identifier is valid, null for universal identifiers")
val country: CountryCode?,

@Schema(description = "True if identifier is mandatory in this country")
@get:Schema(description = "True if identifier is mandatory in this country")
val mandatory: Boolean
)
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ import io.swagger.v3.oas.annotations.media.Schema

@Schema(name = "IdentifierTypeDto", description = "Identifier type definition for legal entity or address")
data class IdentifierTypeDto(
@Schema(description = "Unique key (in combination with lsaType) to be used as reference")
@get:Schema(description = "Unique key (in combination with lsaType) to be used as reference")
val technicalKey: String,

@Schema(description = "Specifies if this identifier type is valid for legal entities (L) or addresses (A)")
@get:Schema(description = "Specifies if this identifier type is valid for legal entities (L) or addresses (A)")
val lsaType: IdentifierLsaType,

@Schema(description = "Full name")
@get:Schema(description = "Full name")
val name: String,

@Schema(description = "Validity details")
@get:Schema(description = "Validity details")
val details: Collection<IdentifierTypeDetailDto> = listOf()
)
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ data class LegalEntityDto(
@ArraySchema(arraySchema = Schema(description = "Additional identifiers (except BPN)", required = false))
val identifiers: Collection<LegalEntityIdentifierDto> = emptyList(),

@Schema(description = "Legal name the partner goes by")
@get:Schema(description = "Legal name the partner goes by")
val legalName: NameDto,

@Schema(description = "Technical key of the legal form")
@get:Schema(description = "Technical key of the legal form")
val legalForm: String? = null,

@ArraySchema(arraySchema = Schema(description = "Business status"))
Expand All @@ -39,7 +39,7 @@ data class LegalEntityDto(
@ArraySchema(arraySchema = Schema(description = "Classifications", required = false))
val classifications: Collection<ClassificationDto> = emptyList(),

@Schema(description = "Address of the official seat of this legal entity")
@get:Schema(description = "Address of the official seat of this legal entity")
val legalAddress: LogisticAddressDto,

)
)
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ import io.swagger.v3.oas.annotations.media.Schema

@Schema(name = "LegalEntityIdentifier", description = "Identifier record for a legal entity")
data class LegalEntityIdentifierDto(
@Schema(description = "Value of the identifier")
@get:Schema(description = "Value of the identifier")
val value: String,

@Schema(description = "Technical key of the type to which this identifier belongs to")
@get:Schema(description = "Technical key of the type to which this identifier belongs to")
val type: String,

@Schema(description = "Body which issued the identifier")
@get:Schema(description = "Body which issued the identifier")
val issuingBody: String?
)
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ import java.time.LocalDateTime

@Schema(name = "LegalEntityState", description = "Status record of a legal entity")
data class LegalEntityStateDto(
@Schema(description = "Exact, official denotation of the status")
@get:Schema(description = "Exact, official denotation of the status")
val officialDenotation: String?,

@Schema(description = "Since when the status is/was valid")
@get:Schema(description = "Since when the status is/was valid")
val validFrom: LocalDateTime?,

@Schema(description = "Until the status was valid, if applicable")
@get:Schema(description = "Until the status was valid, if applicable")
val validTo: LocalDateTime?,

@Schema(description = "The type of this specified status")
@get:Schema(description = "The type of this specified status")
val type: BusinessStateType
)
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ import io.swagger.v3.oas.annotations.media.Schema

@Schema(name = "LogisticAddressDto", description = "Address record for a business partner")
data class LogisticAddressDto(
@Schema(description = "Name of the logistic address of the business partner. This is not according to official\n" +
"registers but according to the name the uploading sharing member chooses.")
@get:Schema(
description = "Name of the logistic address of the business partner. This is not according to official\n" +
"registers but according to the name the uploading sharing member chooses."
)
val name: String? = null,

@ArraySchema(arraySchema = Schema(description = "Indicates if the LogisticAddress is \"Active\" or \"Inactive\"."))
Expand All @@ -35,9 +37,9 @@ data class LogisticAddressDto(
@ArraySchema(arraySchema = Schema(description = "List of identifiers"))
val identifiers: Collection<AddressIdentifierDto> = emptyList(),

@Schema(description = "Physical postal address")
@get:Schema(description = "Physical postal address")
val physicalPostalAddress: PhysicalPostalAddressDto,

@Schema(description = "Alternative postal address")
@get:Schema(description = "Alternative postal address")
val alternativePostalAddress: AlternativePostalAddressDto? = null
)
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ import io.swagger.v3.oas.annotations.media.Schema

@Schema(name = "Name", description = "Name record for a business partner")
data class NameDto(
@Schema(description = "Full name")
@get:Schema(description = "Full name")
val value: String,

@Schema(description = "Abbreviated name or shorthand")
@get:Schema(description = "Abbreviated name or shorthand")
val shortName: String?
)
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ import io.swagger.v3.oas.annotations.media.Schema

@Schema(name = "NameRegioncodeDto", description = "Region within a country")
data class NameRegioncodeDto(
@Schema(description = "Describes the full name of the region within a country according to ISO 3166-214")
@get:Schema(description = "Describes the full name of the region within a country according to ISO 3166-214")
val name: String,

@Schema(description = "Abbreviation or shorthand of the area")
@get:Schema(description = "Abbreviation or shorthand of the area")
val regionCode: String,
)
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ import io.swagger.v3.oas.annotations.media.Schema

@Schema(name = "Site", description = "Site record")
data class SiteDto(
@Schema(description = "Site name")
@get:Schema(description = "Site name")
val name: String,

@ArraySchema(arraySchema = Schema(description = "Business status"))
val states: Collection<SiteStateDto> = emptyList(),

@Schema(description = "Main address where this site resides")
@get:Schema(description = "Main address where this site resides")
val mainAddress: LogisticAddressDto
)
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ import java.time.LocalDateTime

@Schema(name = "SiteState", description = "Status record of a site")
data class SiteStateDto(
@Schema(description = "Description of the status")
@get:Schema(description = "Description of the status")
val description: String?,

@Schema(description = "Since when the status is/was valid")
@get:Schema(description = "Since when the status is/was valid")
val validFrom: LocalDateTime?,

@Schema(description = "Until the status was valid, if applicable")
@get:Schema(description = "Until the status was valid, if applicable")
val validTo: LocalDateTime?,

@Schema(description = "The type of this specified status")
@get:Schema(description = "The type of this specified status")
val type: BusinessStateType
)
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ import io.swagger.v3.oas.annotations.media.Schema

@Schema(name = "Street", description = "A public road in a city, town, or village, typically with houses and buildings on one or both sides.")
data class StreetDto(
@Schema(description = "Describes the official Name of the Street.")
@get:Schema(description = "Describes the official Name of the Street.")
val name: String? = null,

@Schema(description = "Describes the House Number")
@get:Schema(description = "Describes the House Number")
val houseNumber: String? = null,

@Schema(description = "The Milestone is relevant for long roads without specific house numbers.")
@get:Schema(description = "The Milestone is relevant for long roads without specific house numbers.")
val milestone: String? = null,

@Schema(description = "Describes the direction")
val direction: String? = null
@get:Schema(description = "Describes the direction")
val direction: String? = null
)
Original file line number Diff line number Diff line change
Expand Up @@ -254,9 +254,7 @@ object SaasMappings {
deliveryServiceNumber = deliveryServiceNumber,
deliveryServiceType = deliveryServiceType,
areaPart = AreaDistrictAlternativDto(
administrativeAreaLevel1 = map.adminAreaLevel1(),
districtLevel1 = map.districtLevel1(),
districtLevel2 = map.districtLevel2(),
administrativeAreaLevel1 = map.adminAreaLevel1()
),
baseAddress = BasePostalAddressDto(
geographicCoordinates = map.geoCoordinates(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,6 @@ fun AlternativePostalAddressDto.toAlternativePostalAddressEntity(): AlternativeP
administrativeAreaLevel1 = null, // TODO Add region mapping Logic
postCode = baseAddress.postCode,
city = baseAddress.city,
districtLevel1 = areaPart.districtLevel1,
districtLevel2 = areaPart.districtLevel2,
street = baseAddress.street?.toStreetEntity(),
deliveryServiceType = deliveryServiceType,
deliveryServiceNumber = deliveryServiceNumber
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,17 +89,7 @@ class SaasDtoToSaasAddressMapping(private val postalAdress: BasePostalAddressDto
return listOfNotNull(
LocalitySaas(
value = postalAdress.city, type = SaasLocalityType.CITY.toSaasTypeDto()
),
alternateAddress?.areaPart?.districtLevel1?.let {
LocalitySaas(
value = it, type = SaasLocalityType.DISTRICT.toSaasTypeDto()
)
},
alternateAddress?.areaPart?.districtLevel2?.let {
LocalitySaas(
value = it, type = SaasLocalityType.QUARTER.toSaasTypeDto()
)
}
)
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -458,8 +458,6 @@ class BusinessPartnerBuildService(
administrativeAreaLevel1 = null,
postCode = baseAddress.postCode,
city = baseAddress.city,
districtLevel1 = area.districtLevel1,
districtLevel2 = area.districtLevel2,
street = baseAddress.street?.let { createStreet(it) },
deliveryServiceType = alternativeAddress.deliveryServiceType,
deliveryServiceNumber = alternativeAddress.deliveryServiceNumber
Expand Down

0 comments on commit bd5b501

Please sign in to comment.