From bb492236c0bedcc4e1c0dccb593d124bb23a12ca Mon Sep 17 00:00:00 2001 From: Nico Koprowski Date: Thu, 20 Jun 2024 13:58:13 +0800 Subject: [PATCH] feat: add taxJurisdictionCode field to business partner's physical address - changed API models - added database column - adapted the mappings - enhanced the test data - updated the api documentation implements to #955 --- CHANGELOG.md | 1 + .../BusinessPartnerGenericCommonValues.kt | 3 +- .../BusinessPartnerTestDataFactory.kt | 3 +- .../pool/BusinessPartnerNonVerboseValues.kt | 3 + .../pool/BusinessPartnerRequestFactory.kt | 3 +- .../pool/BusinessPartnerVerboseValues.kt | 8 ++- .../ExpectedBusinessPartnerResultFactory.kt | 13 +++- .../dto/IBasePhysicalPostalAddressDto.kt | 3 + .../PostalAddressDescription.kt | 3 + .../api/model/PhysicalPostalAddressDto.kt | 3 +- .../gate/entity/PhysicalPostalAddressDb.kt | 8 ++- .../upsert/output/PhysicalPostalAddress.kt | 3 +- .../gate/service/BusinessPartnerMappings.kt | 3 +- .../gate/service/GoldenRecordUpdateService.kt | 6 +- .../bpdm/gate/service/OrchestratorMappings.kt | 6 +- .../bpdm/gate/service/ResponseMappings.kt | 3 +- .../V6_1_0_3__add_tax_jurisdiction_code.sql | 2 + .../orchestrator/api/model/BusinessPartner.kt | 6 +- .../api/model/PhysicalPostalAddressDto.kt | 3 +- .../model/PhysicalPostalAddressVerboseDto.kt | 3 +- .../pool/entity/PhysicalPostalAddressDb.kt | 7 +- .../service/BusinessPartnerBuildService.kt | 3 +- .../BusinessPartnerEquivalenceMapper.kt | 6 +- .../bpdm/pool/service/ResponseMappings.kt | 3 +- .../bpdm/pool/service/TaskStepBuildService.kt | 25 +++----- .../V6_1_0_0__add_tax_jurisdiction_code.sql | 2 + docs/api/gate.json | 53 +++++++++------ docs/api/gate.yaml | 37 +++++++---- docs/api/orchestrator.json | 35 +++++++++- docs/api/orchestrator.yaml | 23 ++++++- docs/api/pool.json | 64 +++++++++++++++---- docs/api/pool.yaml | 51 +++++++++++---- 32 files changed, 296 insertions(+), 99 deletions(-) create mode 100644 bpdm-gate/src/main/resources/db/migration/V6_1_0_3__add_tax_jurisdiction_code.sql create mode 100644 bpdm-pool/src/main/resources/db/migration/V6_1_0_0__add_tax_jurisdiction_code.sql diff --git a/CHANGELOG.md b/CHANGELOG.md index 6ddd4e7f2..cc421c683 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ For changes to the BPDM Helm charts please consult the [changelog](charts/bpdm/C - BPDM Gate: Post endpoint to upload business partner input data using csv file.(#700) - BPDM Gate: GET endpoint to download the csv file template for business partner upload. (#700) +- Apps: Tax Jurisdiction Code to the physical address of a business partner (#955) ## [6.0.1] - [2024-05-27] diff --git a/bpdm-common-test/src/main/kotlin/org/eclipse/tractusx/bpdm/test/testdata/gate/BusinessPartnerGenericCommonValues.kt b/bpdm-common-test/src/main/kotlin/org/eclipse/tractusx/bpdm/test/testdata/gate/BusinessPartnerGenericCommonValues.kt index 721ad0c8e..0f911ecd9 100644 --- a/bpdm-common-test/src/main/kotlin/org/eclipse/tractusx/bpdm/test/testdata/gate/BusinessPartnerGenericCommonValues.kt +++ b/bpdm-common-test/src/main/kotlin/org/eclipse/tractusx/bpdm/test/testdata/gate/BusinessPartnerGenericCommonValues.kt @@ -57,7 +57,8 @@ object BusinessPartnerGenericCommonValues { industrialZone = "industrial-zone", building = "building", floor = "floor", - door = "door" + door = "door", + taxJurisdictionCode = "123" ), alternativeAddress = AlternativeAddress( geographicCoordinates = GeoCoordinate(0.6f, 0.6f, 0.6f), diff --git a/bpdm-common-test/src/main/kotlin/org/eclipse/tractusx/bpdm/test/testdata/orchestrator/BusinessPartnerTestDataFactory.kt b/bpdm-common-test/src/main/kotlin/org/eclipse/tractusx/bpdm/test/testdata/orchestrator/BusinessPartnerTestDataFactory.kt index 11872146c..152e91961 100644 --- a/bpdm-common-test/src/main/kotlin/org/eclipse/tractusx/bpdm/test/testdata/orchestrator/BusinessPartnerTestDataFactory.kt +++ b/bpdm-common-test/src/main/kotlin/org/eclipse/tractusx/bpdm/test/testdata/orchestrator/BusinessPartnerTestDataFactory.kt @@ -132,7 +132,8 @@ class BusinessPartnerTestDataFactory( industrialZone = "Industrial Zone $seed", building = "Building $seed", floor = "Floor $seed", - door = "Door $seed" + door = "Door $seed", + taxJurisdictionCode = "123" ), alternativeAddress = AlternativeAddress( geographicCoordinates = GeoCoordinate(longitude = random.nextFloat(), latitude = random.nextFloat(), altitude = random.nextFloat()), diff --git a/bpdm-common-test/src/main/kotlin/org/eclipse/tractusx/bpdm/test/testdata/pool/BusinessPartnerNonVerboseValues.kt b/bpdm-common-test/src/main/kotlin/org/eclipse/tractusx/bpdm/test/testdata/pool/BusinessPartnerNonVerboseValues.kt index f3ed06d3e..29795bec2 100644 --- a/bpdm-common-test/src/main/kotlin/org/eclipse/tractusx/bpdm/test/testdata/pool/BusinessPartnerNonVerboseValues.kt +++ b/bpdm-common-test/src/main/kotlin/org/eclipse/tractusx/bpdm/test/testdata/pool/BusinessPartnerNonVerboseValues.kt @@ -175,6 +175,7 @@ object BusinessPartnerNonVerboseValues { floor = BusinessPartnerVerboseValues.address1.floor, door = BusinessPartnerVerboseValues.address1.door, street = BusinessPartnerVerboseValues.address1.street, + taxJurisdictionCode = BusinessPartnerVerboseValues.address1.taxJurisdictionCode ) private val postalAddress2 = PhysicalPostalAddressDto( @@ -192,6 +193,7 @@ object BusinessPartnerNonVerboseValues { floor = BusinessPartnerVerboseValues.address2.floor, door = BusinessPartnerVerboseValues.address2.door, street = BusinessPartnerVerboseValues.address2.street, + taxJurisdictionCode = BusinessPartnerVerboseValues.address2.taxJurisdictionCode ) private val postalAddress3 = PhysicalPostalAddressDto( @@ -209,6 +211,7 @@ object BusinessPartnerNonVerboseValues { floor = BusinessPartnerVerboseValues.address3.floor, door = BusinessPartnerVerboseValues.address3.door, street = BusinessPartnerVerboseValues.address3.street, + taxJurisdictionCode = BusinessPartnerVerboseValues.address3.taxJurisdictionCode ) val logisticAddress1 = LogisticAddressDto( diff --git a/bpdm-common-test/src/main/kotlin/org/eclipse/tractusx/bpdm/test/testdata/pool/BusinessPartnerRequestFactory.kt b/bpdm-common-test/src/main/kotlin/org/eclipse/tractusx/bpdm/test/testdata/pool/BusinessPartnerRequestFactory.kt index f1697a101..26e23d0c6 100644 --- a/bpdm-common-test/src/main/kotlin/org/eclipse/tractusx/bpdm/test/testdata/pool/BusinessPartnerRequestFactory.kt +++ b/bpdm-common-test/src/main/kotlin/org/eclipse/tractusx/bpdm/test/testdata/pool/BusinessPartnerRequestFactory.kt @@ -180,7 +180,8 @@ class BusinessPartnerRequestFactory( industrialZone = "Industrial Zone $seed", building = "Building $seed", floor = "Floor $seed", - door = "Door $seed" + door = "Door $seed", + taxJurisdictionCode = "Tax Jurisdiction Code $seed" ), alternativePostalAddress = AlternativePostalAddressDto( geographicCoordinates = GeoCoordinateDto(longitude = random.nextFloat(), latitude = random.nextFloat(), altitude = random.nextFloat()), diff --git a/bpdm-common-test/src/main/kotlin/org/eclipse/tractusx/bpdm/test/testdata/pool/BusinessPartnerVerboseValues.kt b/bpdm-common-test/src/main/kotlin/org/eclipse/tractusx/bpdm/test/testdata/pool/BusinessPartnerVerboseValues.kt index c0d4ae0e4..b739d8938 100644 --- a/bpdm-common-test/src/main/kotlin/org/eclipse/tractusx/bpdm/test/testdata/pool/BusinessPartnerVerboseValues.kt +++ b/bpdm-common-test/src/main/kotlin/org/eclipse/tractusx/bpdm/test/testdata/pool/BusinessPartnerVerboseValues.kt @@ -163,6 +163,7 @@ object BusinessPartnerVerboseValues { additionalNameSuffix = "add name suffix 1", additionalNamePrefix = "add name prefix 1" ), + taxJurisdictionCode = "123" ) val address2 = PhysicalPostalAddressVerboseDto( @@ -189,7 +190,8 @@ object BusinessPartnerVerboseValues { namePrefix = "name prefix 2", additionalNameSuffix = "add name suffix 2", additionalNamePrefix = "add name prefix 2" - ) + ), + taxJurisdictionCode = "456" ) val address3 = PhysicalPostalAddressVerboseDto( @@ -217,6 +219,7 @@ object BusinessPartnerVerboseValues { additionalNameSuffix = "add name suffix 3", additionalNamePrefix = "add name prefix 3" ), + taxJurisdictionCode = "789" ) val addressPartner1 = LogisticAddressVerboseDto( @@ -361,6 +364,7 @@ object BusinessPartnerVerboseValues { floor = null, door = null, street = null, + taxJurisdictionCode = null ), bpnLegalEntity = null, bpnSite = null, @@ -401,6 +405,7 @@ object BusinessPartnerVerboseValues { floor = null, door = null, street = null, + taxJurisdictionCode = null ), bpnLegalEntity = null, bpnSite = null, @@ -441,6 +446,7 @@ object BusinessPartnerVerboseValues { floor = null, door = null, street = null, + taxJurisdictionCode = null ), bpnLegalEntity = null, bpnSite = null, diff --git a/bpdm-common-test/src/main/kotlin/org/eclipse/tractusx/bpdm/test/testdata/pool/ExpectedBusinessPartnerResultFactory.kt b/bpdm-common-test/src/main/kotlin/org/eclipse/tractusx/bpdm/test/testdata/pool/ExpectedBusinessPartnerResultFactory.kt index 7adebbb5d..76a316858 100644 --- a/bpdm-common-test/src/main/kotlin/org/eclipse/tractusx/bpdm/test/testdata/pool/ExpectedBusinessPartnerResultFactory.kt +++ b/bpdm-common-test/src/main/kotlin/org/eclipse/tractusx/bpdm/test/testdata/pool/ExpectedBusinessPartnerResultFactory.kt @@ -264,7 +264,18 @@ class ExpectedBusinessPartnerResultFactory( geographicCoordinates = geographicCoordinates, countryVerbose = TypeKeyNameVerboseDto(country, country.getName()), administrativeAreaLevel1Verbose = administrativeAreaLevel1?.let { mapToExpectedResult(it) }, - administrativeAreaLevel2, administrativeAreaLevel3, postalCode, city, district, street, companyPostalCode, industrialZone, building, floor, door + administrativeAreaLevel2, + administrativeAreaLevel3, + postalCode, + city, + district, + street, + companyPostalCode, + industrialZone, + building, + floor, + door, + taxJurisdictionCode ) } } diff --git a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/IBasePhysicalPostalAddressDto.kt b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/IBasePhysicalPostalAddressDto.kt index f6c4fa4e3..b96a262f4 100644 --- a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/IBasePhysicalPostalAddressDto.kt +++ b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/IBasePhysicalPostalAddressDto.kt @@ -69,4 +69,7 @@ interface IBasePhysicalPostalAddressDto { @get:Schema(description = PostalAddressDescription.door) val door: String? + + @get:Schema(description = PostalAddressDescription.taxJurisdictionCode) + val taxJurisdictionCode: String? } diff --git a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/openapidescription/PostalAddressDescription.kt b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/openapidescription/PostalAddressDescription.kt index bbcabd782..f6062dfa0 100644 --- a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/openapidescription/PostalAddressDescription.kt +++ b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/openapidescription/PostalAddressDescription.kt @@ -50,4 +50,7 @@ object PostalAddressDescription { "is assigned multiple times in some cities." const val deliveryServiceNumber = "The number indicating the delivery service endpoint of the alternative postal address to which the delivery is " + "to be delivered, such as a P.O. box number or a private bag number." + + const val taxJurisdictionCode = + "Tax jurisdiction codes are used to identify the specific jurisdiction(s) that a company belong to, particularly in bureaucratic processes such as tax returns and IRS forms." } diff --git a/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/PhysicalPostalAddressDto.kt b/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/PhysicalPostalAddressDto.kt index e90faf0e8..434635136 100644 --- a/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/PhysicalPostalAddressDto.kt +++ b/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/PhysicalPostalAddressDto.kt @@ -44,6 +44,7 @@ data class PhysicalPostalAddressDto( override val industrialZone: String? = null, override val building: String? = null, override val floor: String? = null, - override val door: String? = null + override val door: String? = null, + override val taxJurisdictionCode: String? = null ) : IBasePhysicalPostalAddressDto diff --git a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/entity/PhysicalPostalAddressDb.kt b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/entity/PhysicalPostalAddressDb.kt index 19c0f96ce..4299b3ca8 100644 --- a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/entity/PhysicalPostalAddressDb.kt +++ b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/entity/PhysicalPostalAddressDb.kt @@ -113,5 +113,11 @@ data class PhysicalPostalAddressDb( * Describes the door/room/suite on the respective floor the delivery shall take place */ @Column(name = "phy_door") - val door: String? + val door: String?, + + /** + * The tax jurisdiction code defines the tax authority to which taxes must be paid + */ + @Column(name = "phy_tax_jurisdiction") + val taxJurisdictionCode: String? = null ) diff --git a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/model/upsert/output/PhysicalPostalAddress.kt b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/model/upsert/output/PhysicalPostalAddress.kt index 624f1bef9..6e1b5dbe1 100644 --- a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/model/upsert/output/PhysicalPostalAddress.kt +++ b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/model/upsert/output/PhysicalPostalAddress.kt @@ -35,5 +35,6 @@ data class PhysicalPostalAddress( val industrialZone: String?, val building: String?, val floor: String?, - val door: String? + val door: String?, + val taxJurisdictionCode: String? ) \ No newline at end of file diff --git a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/BusinessPartnerMappings.kt b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/BusinessPartnerMappings.kt index 1aae0e337..17d31da7a 100644 --- a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/BusinessPartnerMappings.kt +++ b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/BusinessPartnerMappings.kt @@ -221,7 +221,8 @@ class BusinessPartnerMappings { industrialZone = dto.industrialZone, building = dto.building, floor = dto.floor, - door = dto.door + door = dto.door, + taxJurisdictionCode = dto.taxJurisdictionCode ) private fun toAlternativePostalAddress(dto: AlternativePostalAddressDto) = diff --git a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/GoldenRecordUpdateService.kt b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/GoldenRecordUpdateService.kt index af02ee462..16e7da2c8 100644 --- a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/GoldenRecordUpdateService.kt +++ b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/GoldenRecordUpdateService.kt @@ -218,7 +218,8 @@ class GoldenRecordUpdateService( building = building, floor = floor, door = door, - street = street?.toUpsertData() + street = street?.toUpsertData(), + taxJurisdictionCode = taxJurisdictionCode ) } @@ -345,7 +346,8 @@ class GoldenRecordUpdateService( industrialZone = industrialZone, building = building, floor = floor, - door = door + door = door, + taxJurisdictionCode = taxJurisdictionCode ) private fun StreetDto.toEntity() = diff --git a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/OrchestratorMappings.kt b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/OrchestratorMappings.kt index b7d81003f..60eaa2387 100644 --- a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/OrchestratorMappings.kt +++ b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/OrchestratorMappings.kt @@ -116,7 +116,8 @@ class OrchestratorMappings( industrialZone = industrialZone, building = building, floor = floor, - door = door + door = door, + taxJurisdictionCode = taxJurisdictionCode ) } } ?: PhysicalAddress.empty, @@ -272,7 +273,8 @@ class OrchestratorMappings( industrialZone = dto.industrialZone, building = dto.building, floor = dto.floor, - door = dto.door + door = dto.door, + taxJurisdictionCode = dto.taxJurisdictionCode ) private fun toAlternativePostalAddress(dto: AlternativeAddress) = diff --git a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/ResponseMappings.kt b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/ResponseMappings.kt index d2ee418fc..82966819d 100644 --- a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/ResponseMappings.kt +++ b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/ResponseMappings.kt @@ -54,7 +54,8 @@ fun PhysicalPostalAddressDb.toPhysicalPostalAddress(): PhysicalPostalAddressDto building = building, floor = floor, door = door, - street = street?.toStreetDto() + street = street?.toStreetDto(), + taxJurisdictionCode = taxJurisdictionCode ) fun GeographicCoordinateDb.toGeographicCoordinateDto(): GeoCoordinateDto { diff --git a/bpdm-gate/src/main/resources/db/migration/V6_1_0_3__add_tax_jurisdiction_code.sql b/bpdm-gate/src/main/resources/db/migration/V6_1_0_3__add_tax_jurisdiction_code.sql new file mode 100644 index 000000000..efe85ff2c --- /dev/null +++ b/bpdm-gate/src/main/resources/db/migration/V6_1_0_3__add_tax_jurisdiction_code.sql @@ -0,0 +1,2 @@ +ALTER TABLE postal_addresses +ADD COLUMN phy_tax_jurisdiction VARCHAR(255); \ No newline at end of file diff --git a/bpdm-orchestrator-api/src/main/kotlin/org/eclipse/tractusx/orchestrator/api/model/BusinessPartner.kt b/bpdm-orchestrator-api/src/main/kotlin/org/eclipse/tractusx/orchestrator/api/model/BusinessPartner.kt index 957d15667..eca48e867 100644 --- a/bpdm-orchestrator-api/src/main/kotlin/org/eclipse/tractusx/orchestrator/api/model/BusinessPartner.kt +++ b/bpdm-orchestrator-api/src/main/kotlin/org/eclipse/tractusx/orchestrator/api/model/BusinessPartner.kt @@ -116,13 +116,15 @@ data class PhysicalAddress( val industrialZone: String?, val building: String?, val floor: String?, - val door: String? + val door: String?, + val taxJurisdictionCode: String? ){ companion object { val empty: PhysicalAddress = PhysicalAddress( GeoCoordinate.empty, null, null, null, null, null, null, null, Street.empty, null, null, - null, null, null ) + null, null, null, null + ) } } diff --git a/bpdm-pool-api/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/api/model/PhysicalPostalAddressDto.kt b/bpdm-pool-api/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/api/model/PhysicalPostalAddressDto.kt index 30a674855..d9fb8fa53 100644 --- a/bpdm-pool-api/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/api/model/PhysicalPostalAddressDto.kt +++ b/bpdm-pool-api/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/api/model/PhysicalPostalAddressDto.kt @@ -44,6 +44,7 @@ data class PhysicalPostalAddressDto( override val industrialZone: String?, override val building: String?, override val floor: String?, - override val door: String? + override val door: String?, + override val taxJurisdictionCode: String? ) : IBasePhysicalPostalAddressDto diff --git a/bpdm-pool-api/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/api/model/PhysicalPostalAddressVerboseDto.kt b/bpdm-pool-api/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/api/model/PhysicalPostalAddressVerboseDto.kt index 127fc5146..341f6f086 100644 --- a/bpdm-pool-api/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/api/model/PhysicalPostalAddressVerboseDto.kt +++ b/bpdm-pool-api/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/api/model/PhysicalPostalAddressVerboseDto.kt @@ -54,7 +54,8 @@ data class PhysicalPostalAddressVerboseDto( override val industrialZone: String?, override val building: String?, override val floor: String?, - override val door: String? + override val door: String?, + override val taxJurisdictionCode: String? ) : IBasePhysicalPostalAddressDto { diff --git a/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/entity/PhysicalPostalAddressDb.kt b/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/entity/PhysicalPostalAddressDb.kt index ff000f6b4..0f99301a8 100644 --- a/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/entity/PhysicalPostalAddressDb.kt +++ b/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/entity/PhysicalPostalAddressDb.kt @@ -127,4 +127,9 @@ class PhysicalPostalAddressDb( @Column(name = "phy_door") val door: String? = null, - ) \ No newline at end of file + /** + * The tax jurisdiction code defines the tax authority to which taxes must be paid + */ + @Column(name = "phy_tax_jurisdiction") + val taxJurisdictionCode: String? = null +) \ No newline at end of file diff --git a/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/BusinessPartnerBuildService.kt b/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/BusinessPartnerBuildService.kt index b30bf9684..3f18ba62a 100644 --- a/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/BusinessPartnerBuildService.kt +++ b/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/BusinessPartnerBuildService.kt @@ -634,7 +634,8 @@ class BusinessPartnerBuildService( industrialZone = physicalAddress.industrialZone, building = physicalAddress.building, floor = physicalAddress.floor, - door = physicalAddress.door + door = physicalAddress.door, + taxJurisdictionCode = physicalAddress.taxJurisdictionCode ) } diff --git a/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/BusinessPartnerEquivalenceMapper.kt b/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/BusinessPartnerEquivalenceMapper.kt index 2bc84ccd6..8a12999d7 100644 --- a/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/BusinessPartnerEquivalenceMapper.kt +++ b/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/BusinessPartnerEquivalenceMapper.kt @@ -94,7 +94,8 @@ class BusinessPartnerEquivalenceMapper { additionalNameSuffix ) } - } + }, + taxJurisdictionCode = taxJurisdictionCode ) }, alternativePostalAddress = with(logisticAddress.alternativePostalAddress) { @@ -198,7 +199,8 @@ class BusinessPartnerEquivalenceMapper { override val industrialZone: String?, override val building: String?, override val floor: String?, - override val door: String? + override val door: String?, + override val taxJurisdictionCode: String? ) : IBasePhysicalPostalAddressDto data class AlternativeEquivalenceDto( diff --git a/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/ResponseMappings.kt b/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/ResponseMappings.kt index e8f8d7cf5..a1e465861 100644 --- a/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/ResponseMappings.kt +++ b/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/ResponseMappings.kt @@ -165,7 +165,8 @@ fun PhysicalPostalAddressDb.toDto(): PhysicalPostalAddressVerboseDto { building = building, floor = floor, door = door, - street = street?.toDto() + street = street?.toDto(), + taxJurisdictionCode = taxJurisdictionCode ) } diff --git a/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/TaskStepBuildService.kt b/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/TaskStepBuildService.kt index 963da0569..251280424 100644 --- a/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/TaskStepBuildService.kt +++ b/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/TaskStepBuildService.kt @@ -23,15 +23,7 @@ import com.neovisionaries.i18n.CountryCode import jakarta.transaction.Transactional import org.eclipse.tractusx.bpdm.common.dto.GeoCoordinateDto import org.eclipse.tractusx.bpdm.common.dto.PaginationRequest -import org.eclipse.tractusx.bpdm.pool.api.model.AddressIdentifierDto -import org.eclipse.tractusx.bpdm.pool.api.model.AddressStateDto -import org.eclipse.tractusx.bpdm.pool.api.model.LegalEntityDto -import org.eclipse.tractusx.bpdm.pool.api.model.LegalEntityIdentifierDto -import org.eclipse.tractusx.bpdm.pool.api.model.LegalEntityStateDto -import org.eclipse.tractusx.bpdm.pool.api.model.LogisticAddressDto -import org.eclipse.tractusx.bpdm.pool.api.model.SiteDto -import org.eclipse.tractusx.bpdm.pool.api.model.SiteStateDto -import org.eclipse.tractusx.bpdm.pool.api.model.StreetDto +import org.eclipse.tractusx.bpdm.pool.api.model.* import org.eclipse.tractusx.bpdm.pool.api.model.request.* import org.eclipse.tractusx.bpdm.pool.exception.BpdmValidationException import org.eclipse.tractusx.orchestrator.api.model.* @@ -177,8 +169,8 @@ class TaskStepBuildService( private fun updateLegalEntity( bpnL: String, - legalEntityDto: LegalEntityDto, - legalAddressDto: LogisticAddressDto + legalEntityDto: LegalEntityPoolDto, + legalAddressDto: LogisticAddressPoolDto ): LegalEntityBpns { val updateRequest = LegalEntityPartnerUpdateRequest( bpnl = bpnL, @@ -245,7 +237,7 @@ class TaskStepBuildService( } private fun createSite( - poolSite: SiteDto, + poolSite: SitePoolDto, legalEntityBpn: String, isSiteMainAndLegalAddress: Boolean ): SiteBpns { @@ -277,7 +269,7 @@ class TaskStepBuildService( private fun updateSite( bpnS: String, - poolSite: SiteDto, + poolSite: SitePoolDto, ): SiteBpns { val updateRequest = SitePartnerUpdateRequest( bpns = bpnS, @@ -339,7 +331,7 @@ class TaskStepBuildService( } private fun createLogisticAddress( - poolAddress: LogisticAddressDto, + poolAddress: LogisticAddressPoolDto, legalEntityBpn: String, siteBpn: String? ): String { @@ -360,7 +352,7 @@ class TaskStepBuildService( private fun updateLogisticAddress( bpnA: String, - poolAddress: LogisticAddressDto, + poolAddress: LogisticAddressPoolDto, ): String { val addressUpdateRequest = AddressPartnerUpdateRequest( bpna = bpnA, @@ -440,7 +432,8 @@ class TaskStepBuildService( nameSuffix, additionalNameSuffix ) - } + }, + taxJurisdictionCode = taxJurisdictionCode ) } diff --git a/bpdm-pool/src/main/resources/db/migration/V6_1_0_0__add_tax_jurisdiction_code.sql b/bpdm-pool/src/main/resources/db/migration/V6_1_0_0__add_tax_jurisdiction_code.sql new file mode 100644 index 000000000..b8a02c380 --- /dev/null +++ b/bpdm-pool/src/main/resources/db/migration/V6_1_0_0__add_tax_jurisdiction_code.sql @@ -0,0 +1,2 @@ +ALTER TABLE logistic_addresses +ADD COLUMN phy_tax_jurisdiction VARCHAR(255); \ No newline at end of file diff --git a/docs/api/gate.json b/docs/api/gate.json index 9af5725bd..fea2b5d1b 100644 --- a/docs/api/gate.json +++ b/docs/api/gate.json @@ -3,7 +3,7 @@ "info": { "title": "Business Partner Data Management Gate", "description": "A gate for a member to share business partner data with CatenaX", - "version": "6.0.0" + "version": "6.1.0-SNAPSHOT" }, "servers": [ { @@ -11,6 +11,14 @@ "description": "Generated server url" } ], + "security": [ + { + "open_id_scheme": [] + }, + { + "bearer_scheme": [] + } + ], "paths": { "/v6/input/business-partners": { "put": { @@ -450,21 +458,6 @@ "default": "10" } }, - { - "name": "businessPartnerType", - "in": "query", - "description": "Business partner type", - "required": false, - "schema": { - "type": "string", - "enum": [ - "LEGAL_ENTITY", - "SITE", - "ADDRESS", - "GENERIC" - ] - } - }, { "name": "externalIds", "in": "query", @@ -498,7 +491,6 @@ "AddressComponentOutputDto": { "required": [ "addressBpn", - "alternativePostalAddress", "bpnA", "confidenceCriteria", "physicalPostalAddress", @@ -544,7 +536,6 @@ }, "AddressRepresentationInputDto": { "required": [ - "alternativePostalAddress", "physicalPostalAddress", "states" ], @@ -1874,6 +1865,10 @@ "door": { "type": "string", "description": "The number of a door in the building on the respective floor addressed by the physical postal address, synonyms: room, suite." + }, + "taxJurisdictionCode": { + "type": "string", + "description": "Tax jurisdiction codes are used to identify the specific jurisdiction(s) that a company belong to, particularly in bureaucratic processes such as tax returns and IRS forms." } }, "description": "A physical postal address describes the physical location of an office, warehouse, gate, etc." @@ -2141,6 +2136,28 @@ }, "description": "The street of the physical postal address, synonyms: road, avenue, lane, boulevard, highway" } + }, + "securitySchemes": { + "open_id_scheme": { + "type": "oauth2", + "flows": { + "clientCredentials": { + "tokenUrl": "http://localhost:8180/realms/CX-Central/protocol/openid-connect/token", + "scopes": {} + }, + "authorizationCode": { + "authorizationUrl": "http://localhost:8180/realms/CX-Central/protocol/openid-connect/auth", + "tokenUrl": "http://localhost:8180/realms/CX-Central/protocol/openid-connect/token", + "refreshUrl": "http://localhost:8180/realms/CX-Central/protocol/openid-connect/token", + "scopes": {} + } + } + }, + "bearer_scheme": { + "type": "http", + "scheme": "bearer", + "bearerFormat": "JWT" + } } } } \ No newline at end of file diff --git a/docs/api/gate.yaml b/docs/api/gate.yaml index df09ab30a..59b86e749 100644 --- a/docs/api/gate.yaml +++ b/docs/api/gate.yaml @@ -2,10 +2,13 @@ openapi: 3.0.1 info: title: Business Partner Data Management Gate description: A gate for a member to share business partner data with CatenaX - version: 6.0.0 + version: 6.1.0-SNAPSHOT servers: - url: http://localhost:8081 description: Generated server url +security: + - open_id_scheme: [] + - bearer_scheme: [] paths: /v6/input/business-partners: put: @@ -294,17 +297,6 @@ paths: minimum: 0 type: string default: '10' - - name: businessPartnerType - in: query - description: Business partner type - required: false - schema: - type: string - enum: - - LEGAL_ENTITY - - SITE - - ADDRESS - - GENERIC - name: externalIds in: query description: External IDs @@ -325,7 +317,6 @@ components: AddressComponentOutputDto: required: - addressBpn - - alternativePostalAddress - bpnA - confidenceCriteria - physicalPostalAddress @@ -359,7 +350,6 @@ components: description: Address properties of business partner output data AddressRepresentationInputDto: required: - - alternativePostalAddress - physicalPostalAddress - states type: object @@ -1494,6 +1484,9 @@ components: door: type: string description: 'The number of a door in the building on the respective floor addressed by the physical postal address, synonyms: room, suite.' + taxJurisdictionCode: + type: string + description: Tax jurisdiction codes are used to identify the specific jurisdiction(s) that a company belong to, particularly in bureaucratic processes such as tax returns and IRS forms. description: A physical postal address describes the physical location of an office, warehouse, gate, etc. PostSharingStateReadyRequest: required: @@ -1688,3 +1681,19 @@ components: type: string description: The cardinal direction describing where the exit to the location of the addressed object on large highways / motorways is located, such as Highway 101 South. description: 'The street of the physical postal address, synonyms: road, avenue, lane, boulevard, highway' + securitySchemes: + open_id_scheme: + type: oauth2 + flows: + clientCredentials: + tokenUrl: http://localhost:8180/realms/CX-Central/protocol/openid-connect/token + scopes: {} + authorizationCode: + authorizationUrl: http://localhost:8180/realms/CX-Central/protocol/openid-connect/auth + tokenUrl: http://localhost:8180/realms/CX-Central/protocol/openid-connect/token + refreshUrl: http://localhost:8180/realms/CX-Central/protocol/openid-connect/token + scopes: {} + bearer_scheme: + type: http + scheme: bearer + bearerFormat: JWT diff --git a/docs/api/orchestrator.json b/docs/api/orchestrator.json index 38def9ca6..1bc0eb595 100644 --- a/docs/api/orchestrator.json +++ b/docs/api/orchestrator.json @@ -3,7 +3,7 @@ "info": { "title": "Business Partner Data Management Orchestrator", "description": "Orchestrator component acts as a passive component and offers for each processing steps individual endpoints", - "version": "6.0.0" + "version": "6.1.0-SNAPSHOT" }, "servers": [ { @@ -11,6 +11,14 @@ "description": "Generated server url" } ], + "security": [ + { + "open_id_scheme": [] + }, + { + "bearer_scheme": [] + } + ], "paths": { "/v6/golden-record-tasks": { "post": { @@ -438,6 +446,9 @@ }, "door": { "type": "string" + }, + "taxJurisdictionCode": { + "type": "string" } } }, @@ -877,6 +888,28 @@ } } } + }, + "securitySchemes": { + "open_id_scheme": { + "type": "oauth2", + "flows": { + "clientCredentials": { + "tokenUrl": "http://localhost:8180/realms/CX-Central/protocol/openid-connect/token", + "scopes": {} + }, + "authorizationCode": { + "authorizationUrl": "http://localhost:8180/realms/CX-Central/protocol/openid-connect/auth", + "tokenUrl": "http://localhost:8180/realms/CX-Central/protocol/openid-connect/token", + "refreshUrl": "http://localhost:8180/realms/CX-Central/protocol/openid-connect/token", + "scopes": {} + } + } + }, + "bearer_scheme": { + "type": "http", + "scheme": "bearer", + "bearerFormat": "JWT" + } } } } \ No newline at end of file diff --git a/docs/api/orchestrator.yaml b/docs/api/orchestrator.yaml index b1e8ae716..199e413fc 100644 --- a/docs/api/orchestrator.yaml +++ b/docs/api/orchestrator.yaml @@ -2,10 +2,13 @@ openapi: 3.0.1 info: title: Business Partner Data Management Orchestrator description: Orchestrator component acts as a passive component and offers for each processing steps individual endpoints - version: 6.0.0 + version: 6.1.0-SNAPSHOT servers: - url: http://localhost:8085 description: Generated server url +security: + - open_id_scheme: [] + - bearer_scheme: [] paths: /v6/golden-record-tasks: post: @@ -294,6 +297,8 @@ components: type: string door: type: string + taxJurisdictionCode: + type: string PostalAddress: required: - bpnReference @@ -605,3 +610,19 @@ components: $ref: '#/components/schemas/BusinessState' address: $ref: '#/components/schemas/PostalAddress' + securitySchemes: + open_id_scheme: + type: oauth2 + flows: + clientCredentials: + tokenUrl: http://localhost:8180/realms/CX-Central/protocol/openid-connect/token + scopes: {} + authorizationCode: + authorizationUrl: http://localhost:8180/realms/CX-Central/protocol/openid-connect/auth + tokenUrl: http://localhost:8180/realms/CX-Central/protocol/openid-connect/token + refreshUrl: http://localhost:8180/realms/CX-Central/protocol/openid-connect/token + scopes: {} + bearer_scheme: + type: http + scheme: bearer + bearerFormat: JWT diff --git a/docs/api/pool.json b/docs/api/pool.json index 40e3ee022..5f5da1e9d 100644 --- a/docs/api/pool.json +++ b/docs/api/pool.json @@ -3,7 +3,7 @@ "info": { "title": "Business Partner Data Management Pool", "description": "Service that manages and shares business partner data with other CatenaX services", - "version": "6.0.0" + "version": "6.1.0-SNAPSHOT" }, "servers": [ { @@ -11,6 +11,14 @@ "description": "Generated server url" } ], + "security": [ + { + "open_id_scheme": [] + }, + { + "bearer_scheme": [] + } + ], "tags": [ { "name": "Changelog Controller", @@ -2189,11 +2197,11 @@ "$ref": "#/components/schemas/ErrorInfoAddressCreateError" } }, - "entityCount": { + "errorCount": { "type": "integer", "format": "int32" }, - "errorCount": { + "entityCount": { "type": "integer", "format": "int32" } @@ -2352,11 +2360,11 @@ "$ref": "#/components/schemas/ErrorInfoAddressUpdateError" } }, - "entityCount": { + "errorCount": { "type": "integer", "format": "int32" }, - "errorCount": { + "entityCount": { "type": "integer", "format": "int32" } @@ -4226,11 +4234,11 @@ "$ref": "#/components/schemas/ErrorInfoLegalEntityCreateError" } }, - "entityCount": { + "errorCount": { "type": "integer", "format": "int32" }, - "errorCount": { + "entityCount": { "type": "integer", "format": "int32" } @@ -4401,11 +4409,11 @@ "$ref": "#/components/schemas/ErrorInfoLegalEntityUpdateError" } }, - "entityCount": { + "errorCount": { "type": "integer", "format": "int32" }, - "errorCount": { + "entityCount": { "type": "integer", "format": "int32" } @@ -5374,6 +5382,10 @@ "door": { "type": "string", "description": "The number of a door in the building on the respective floor addressed by the physical postal address, synonyms: room, suite." + }, + "taxJurisdictionCode": { + "type": "string", + "description": "Tax jurisdiction codes are used to identify the specific jurisdiction(s) that a company belong to, particularly in bureaucratic processes such as tax returns and IRS forms." } }, "description": "A physical postal address describes the physical location of an office, warehouse, gate, etc." @@ -5436,6 +5448,10 @@ "door": { "type": "string", "description": "The number of a door in the building on the respective floor addressed by the physical postal address, synonyms: room, suite." + }, + "taxJurisdictionCode": { + "type": "string", + "description": "Tax jurisdiction codes are used to identify the specific jurisdiction(s) that a company belong to, particularly in bureaucratic processes such as tax returns and IRS forms." } }, "description": "A physical postal address describes the physical location of an office, warehouse, gate, etc." @@ -5831,11 +5847,11 @@ "$ref": "#/components/schemas/ErrorInfoSiteCreateError" } }, - "entityCount": { + "errorCount": { "type": "integer", "format": "int32" }, - "errorCount": { + "entityCount": { "type": "integer", "format": "int32" } @@ -5961,11 +5977,11 @@ "$ref": "#/components/schemas/ErrorInfoSiteUpdateError" } }, - "entityCount": { + "errorCount": { "type": "integer", "format": "int32" }, - "errorCount": { + "entityCount": { "type": "integer", "format": "int32" } @@ -6548,6 +6564,28 @@ }, "description": "Named type uniquely identified by its technical key" } + }, + "securitySchemes": { + "open_id_scheme": { + "type": "oauth2", + "flows": { + "clientCredentials": { + "tokenUrl": "http://localhost:8180/realms/CX-Central/protocol/openid-connect/token", + "scopes": {} + }, + "authorizationCode": { + "authorizationUrl": "http://localhost:8180/realms/CX-Central/protocol/openid-connect/auth", + "tokenUrl": "http://localhost:8180/realms/CX-Central/protocol/openid-connect/token", + "refreshUrl": "http://localhost:8180/realms/CX-Central/protocol/openid-connect/token", + "scopes": {} + } + } + }, + "bearer_scheme": { + "type": "http", + "scheme": "bearer", + "bearerFormat": "JWT" + } } } } \ No newline at end of file diff --git a/docs/api/pool.yaml b/docs/api/pool.yaml index 1dbef439f..579b85dda 100644 --- a/docs/api/pool.yaml +++ b/docs/api/pool.yaml @@ -2,10 +2,13 @@ openapi: 3.0.1 info: title: Business Partner Data Management Pool description: Service that manages and shares business partner data with other CatenaX services - version: 6.0.0 + version: 6.1.0-SNAPSHOT servers: - url: http://localhost:8080 description: Generated server url +security: + - open_id_scheme: [] + - bearer_scheme: [] tags: - name: Changelog Controller description: Read change events of business partner data @@ -1628,10 +1631,10 @@ components: type: array items: $ref: '#/components/schemas/ErrorInfoAddressCreateError' - entityCount: + errorCount: type: integer format: int32 - errorCount: + entityCount: type: integer format: int32 description: Holds information about successfully and failed entities after the creating/updating of several objects @@ -1749,10 +1752,10 @@ components: type: array items: $ref: '#/components/schemas/ErrorInfoAddressUpdateError' - entityCount: + errorCount: type: integer format: int32 - errorCount: + entityCount: type: integer format: int32 description: Holds information about successfully and failed entities after the creating/updating of several objects @@ -3421,10 +3424,10 @@ components: type: array items: $ref: '#/components/schemas/ErrorInfoLegalEntityCreateError' - entityCount: + errorCount: type: integer format: int32 - errorCount: + entityCount: type: integer format: int32 description: Holds information about successfully and failed entities after the creating/updating of several objects @@ -3552,10 +3555,10 @@ components: type: array items: $ref: '#/components/schemas/ErrorInfoLegalEntityUpdateError' - entityCount: + errorCount: type: integer format: int32 - errorCount: + entityCount: type: integer format: int32 description: Holds information about successfully and failed entities after the creating/updating of several objects @@ -4354,6 +4357,9 @@ components: door: type: string description: 'The number of a door in the building on the respective floor addressed by the physical postal address, synonyms: room, suite.' + taxJurisdictionCode: + type: string + description: Tax jurisdiction codes are used to identify the specific jurisdiction(s) that a company belong to, particularly in bureaucratic processes such as tax returns and IRS forms. description: A physical postal address describes the physical location of an office, warehouse, gate, etc. PhysicalPostalAddressVerboseDto: required: @@ -4399,6 +4405,9 @@ components: door: type: string description: 'The number of a door in the building on the respective floor addressed by the physical postal address, synonyms: room, suite.' + taxJurisdictionCode: + type: string + description: Tax jurisdiction codes are used to identify the specific jurisdiction(s) that a company belong to, particularly in bureaucratic processes such as tax returns and IRS forms. description: A physical postal address describes the physical location of an office, warehouse, gate, etc. RegionDto: required: @@ -4760,10 +4769,10 @@ components: type: array items: $ref: '#/components/schemas/ErrorInfoSiteCreateError' - entityCount: + errorCount: type: integer format: int32 - errorCount: + entityCount: type: integer format: int32 description: Holds information about successfully and failed entities after the creating/updating of several objects @@ -4857,10 +4866,10 @@ components: type: array items: $ref: '#/components/schemas/ErrorInfoSiteUpdateError' - entityCount: + errorCount: type: integer format: int32 - errorCount: + entityCount: type: integer format: int32 description: Holds information about successfully and failed entities after the creating/updating of several objects @@ -5360,3 +5369,19 @@ components: type: string description: Name or denotation of this type description: Named type uniquely identified by its technical key + securitySchemes: + open_id_scheme: + type: oauth2 + flows: + clientCredentials: + tokenUrl: http://localhost:8180/realms/CX-Central/protocol/openid-connect/token + scopes: {} + authorizationCode: + authorizationUrl: http://localhost:8180/realms/CX-Central/protocol/openid-connect/auth + tokenUrl: http://localhost:8180/realms/CX-Central/protocol/openid-connect/token + refreshUrl: http://localhost:8180/realms/CX-Central/protocol/openid-connect/token + scopes: {} + bearer_scheme: + type: http + scheme: bearer + bearerFormat: JWT