diff --git a/CHANGELOG.md b/CHANGELOG.md index f27aa5c7d..6e02ffb49 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,20 @@ The format is based on Keep a Changelog (https://keepachangelog.com/en/1.0.0/), For changes to the BPDM Helm charts please consult the [changelog](charts/bpdm/CHANGELOG.md) of the charts directly. -## [6.2.0] - tbd +## [6.3.0] - tbd + +### Added + +- BPDM Pool: Post endpoint to fetch the BPNL/S/A based on the requested identifiers.([#1052](https://github.com/eclipse-tractusx/bpdm/issues/1052)) +- BPDM Gate & Orchestrator: Enhance the error handling mechanism for the orchestrator and gate components by extending the list of available error codes.([#1003](https://github.com/eclipse-tractusx/bpdm/pull/1003#pullrequestreview-2477395867)) + +### Changed + +- BPDM Gate: Fetched and updated legal name of legal entity from pool while performing partner upload process via CSV([#1141](https://github.com/eclipse-tractusx/bpdm/issues/1141)) +- BPDM Orchestrator: When trying to resolve tasks for a step that have has been resolved before, the request is ignored. A HTTP OK instead of a BadRequest will be returned ([#1092](https://github.com/eclipse-tractusx/bpdm/issues/1092)) + + +## [6.2.0] - 2024-11-28 ### Added @@ -41,6 +54,7 @@ For changes to the BPDM Helm charts please consult the [changelog](charts/bpdm/C - BPDM Cleaning Service Dummy: Removed assignment of uncategorized identifier while performing cleaning task process. ([#1098](https://github.com/eclipse-tractusx/bpdm/pull/1098)) - BPDM Pool: Fix error querying legal forms when non-gleif legacy legal forms are present in the database ([#1107](https://github.com/eclipse-tractusx/bpdm/issues/1107)) - BPDM: Fix denial of service attack vulnerability CVE-2024-47535 ([#1112](https://github.com/eclipse-tractusx/bpdm/issues/1112)) +- BPDM Gate: Fix error on writing golden record task result missing legal name into output stage. Result is now correctly written. ([#1115](https://github.com/eclipse-tractusx/bpdm/issues/1115)) ## [6.1.0] - [2024-07-15] @@ -50,7 +64,7 @@ For changes to the BPDM Helm charts please consult the [changelog](charts/bpdm/C - BPDM Gate: GET endpoint to download the csv file template for business partner upload. ([#700](https://github.com/eclipse-tractusx/sig-release/issues/700)) - Apps: Tax Jurisdiction Code to the physical address of a business partner ([#955](https://github.com/eclipse-tractusx/bpdm/issues/955)) - BPDM Orchestrator: Tasks will now be persisted ([#722](https://github.com/eclipse-tractusx/sig-release/issues/722)) -- BPDM Orchestrator: Tasks now come with a gate record identifier. This makes it possible for cleaning services to match tasks for the same Gate record ([#711](https://github.com/eclipse-tractusx/sig-release/issues/711)) +- BPDM Orchestrator: Tasks now come with a gate record identifier. This makes it possible for cleaning services to match tasks for the same Gate record ([#711](https://github.com/eclipse-tractusx/sig-release/issues/711)) ### Changed: @@ -93,15 +107,15 @@ For changes to the BPDM Helm charts please consult the [changelog](charts/bpdm/C ### Added -- BPDM Gate: Configuration to prevent the uploaded business partner input data to immediately enter the golden record process. -In this configuration the business partner data needs to be sent to the golden record process manually over the new state/ready API endpoint. -Default configuration remains automatically sharing. +- BPDM Gate: Configuration to prevent the uploaded business partner input data to immediately enter the golden record process. + In this configuration the business partner data needs to be sent to the golden record process manually over the new state/ready API endpoint. + Default configuration remains automatically sharing. - BPDM Gate: Limited multi-tenancy support. Business partners are now separated by owner-BPNL. -The owner is determined from the 'bpn' claim in the token. -This means users of a Gate can only see and edit their own business partner data. + The owner is determined from the 'bpn' claim in the token. + This means users of a Gate can only see and edit their own business partner data. - BPDM Pool: New API endpoints to query business partner data which belongs to Catena-X members only - APIs: Added a major version number to all API endpoint paths indicating the current version of the BPDM APIs. -In the future we will use version numbers in the URL to differentiate between all currently supported major versions of the API + In the future we will use version numbers in the URL to differentiate between all currently supported major versions of the API - BPDM Gate Client: Now supports the stats endpoints of the BPDM API ### Changed @@ -113,15 +127,15 @@ In the future we will use version numbers in the URL to differentiate between al - BPDM Gate: Fix not correctly updating business partner output data from golden record updates in the Pool. - JAVA version to 21 - BPDM API Permissions: Overhaul of the permissions needed to access the BPDM API endpoints. -Permissions are now more fine-granular and differentiate more clearly between read or write. -For more details consult the Arc42, API documentation and properties files of the respective applications. + Permissions are now more fine-granular and differentiate more clearly between read or write. + For more details consult the Arc42, API documentation and properties files of the respective applications. - BPDM App Configuration: Now all applications are secured (authenticated and authorized) by default. -You can still deactivate security in the BPDM apps for testing or development purposes though. + You can still deactivate security in the BPDM apps for testing or development purposes though. - BPDM Pool: Fix Pool trying to update golden records which the golden record process indicated to have no changes - BPDM Orchestrator: The business partner data for golden record process tasks has been completely overhauled. -Now business partner data is clearly divided into `uncategorized`, `legal entity`, `site` and `additonal address` data. -This model is less verbose and contains less duplicate data. -Additionally, both Pool and Gate can write and read from it making it unnecessary for a cleaning service to provide the data in two different models. + Now business partner data is clearly divided into `uncategorized`, `legal entity`, `site` and `additonal address` data. + This model is less verbose and contains less duplicate data. + Additionally, both Pool and Gate can write and read from it making it unnecessary for a cleaning service to provide the data in two different models. @@ -169,7 +183,7 @@ Additionally, both Pool and Gate can write and read from it making it unnecessar - BPDM Gate: New business partner type 'GENERIC' for changelog - BPDM Gate: New business partner type 'GENERIC' for sharing state - Workflows: Trivy now targets the latest alpha Docker image instead of the latest release version -- Apps: Increase projectreactor.netty version to fix Trivy vulnerability +- Apps: Increase projectreactor.netty version to fix Trivy vulnerability ## [4.0.1] - 2023-08-28 @@ -207,8 +221,8 @@ Please create a back-up of your business partner data before updating. - BPDM: Umbrella Chart with BPDM Bridge Dummy. ### Fixed - - BPDM: Deprecated endpoints for retrieving business partners in legacy format. - - Endpoint for retrieving changelog entries has now improved filtering (breaking API change) +- BPDM: Deprecated endpoints for retrieving business partners in legacy format. +- Endpoint for retrieving changelog entries has now improved filtering (breaking API change) ## [3.2.2] - 2023-05-12 @@ -252,7 +266,7 @@ Please create a back-up of your business partner data before updating. ### Fixed -- BPDM Gate: For a business partner with a child relation, this relation could be returned as parent relation erroneously. +- BPDM Gate: For a business partner with a child relation, this relation could be returned as parent relation erroneously. - BPDM Gate: When a business partner with a child relation was updated, this relation was erroneously deleted, rendering the previous child invalid. ## [3.0.3] - 2023-02-23 @@ -330,4 +344,4 @@ Please create a back-up of your business partner data before updating. ### Deprecated -- Endpoints for retrieving business partners in legacy format +- Endpoints for retrieving business partners in legacy format \ No newline at end of file diff --git a/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/exception/GateErrorCodes.kt b/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/exception/GateErrorCodes.kt index b49ca962f..36ccfb0d6 100644 --- a/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/exception/GateErrorCodes.kt +++ b/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/exception/GateErrorCodes.kt @@ -19,6 +19,8 @@ package org.eclipse.tractusx.bpdm.gate.api.exception +import io.swagger.v3.oas.annotations.media.Schema + /** * For every combination of possible errors a separate enum class is defined extending this marker interface. * We need separate enum classes in order to get the correct error codes for each endpoint in the Swagger schema. @@ -30,6 +32,12 @@ enum class BusinessPartnerSharingError : ErrorCode { SharingTimeout, BpnNotInPool, MissingTaskID, + NaturalPersonError, + BpnErrorNotFound, + BpnErrorTooManyOptions, + MandatoryFieldValidationFailed, + BlacklistCountryPresent, + UnknownSpecialCharacters } enum class ChangeLogOutputError : ErrorCode { diff --git a/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/response/SharingStateDto.kt b/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/response/SharingStateDto.kt index a0358be42..11b93806b 100644 --- a/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/response/SharingStateDto.kt +++ b/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/response/SharingStateDto.kt @@ -27,8 +27,7 @@ import java.time.LocalDateTime @Schema( description = "A sharing state entry shows the progress in the sharing process and is updated each time the " + "progress for a business partner changes. The business partner is identified by a combination " + - "of external ID and business partner type." -) + "of external ID and business partner type.\n") data class SharingStateDto( @get:Schema(description = "The external identifier of the business partner for which the sharing state entry was created.") @@ -37,7 +36,13 @@ data class SharingStateDto( @get:Schema(description = "One of the sharing state types of the current sharing state.") val sharingStateType: SharingStateType = SharingStateType.Initial, - @get:Schema(description = "One of the sharing error codes in case the current sharing state type is \"error\".") + @get:Schema(description = "One of the sharing error codes in case the current sharing state type is \"error\". \n" + + "* `NaturalPersonError`: The provided record contains natural person information.\n" + + "* `BpnErrorNotFound`: The provided record can not be matched to a legal entity or an address.\n" + + "* `BpnErrorTooManyOptions`: The provided record can not link to a clear legal entity.\n" + + "* `MandatoryFieldValidationFailed`: The provided record does not fulfill mandatory validation rules.\n" + + "* `BlacklistCountryPresent`: The provided record is part of a country that is not allowed to be processed by the GR process (example: Brazil).\n" + + "* `UnknownSpecialCharacters`: The provided record contains unallowed special characters.") val sharingErrorCode: BusinessPartnerSharingError? = null, @get:Schema(description = "The error message in case the current sharing state type is \"error\".") diff --git a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/TaskResolutionServices.kt b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/TaskResolutionServices.kt index 82a95c8fd..f8bb3d18d 100644 --- a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/TaskResolutionServices.kt +++ b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/TaskResolutionServices.kt @@ -38,6 +38,7 @@ import org.eclipse.tractusx.orchestrator.api.model.ResultState import org.eclipse.tractusx.orchestrator.api.model.TaskClientStateDto import org.eclipse.tractusx.orchestrator.api.model.TaskResultStateSearchRequest import org.eclipse.tractusx.orchestrator.api.model.TaskStateRequest +import org.eclipse.tractusx.orchestrator.api.model.* import org.springframework.data.domain.PageRequest import org.springframework.stereotype.Service import org.springframework.transaction.annotation.Transactional @@ -171,11 +172,22 @@ class TaskResolutionChunkService( return when (task.processingState.resultState) { ResultState.Pending -> RequestCreationResult(sharingState, null, null, null) ResultState.Success -> createUpsertRequestForSuccessfulTask(sharingState, task, input) - ResultState.Error -> RequestCreationResult.error( - sharingState, - BusinessPartnerSharingError.SharingProcessError, - if (task.processingState.errors.isNotEmpty()) task.processingState.errors.joinToString(" // ") { it.description }.take(255) else null - ) + ResultState.Error -> handleTaskErrorResult(sharingState, task) + } + } + + private fun handleTaskErrorResult( sharingState: SharingStateDb, task: TaskClientStateDto): RequestCreationResult { + val errorDescription = task.processingState.errors.joinToString(" // ") { it.description }.take(255).ifEmpty { null } + + return when (task.processingState.errors.firstOrNull()?.type) { + TaskErrorType.Timeout -> RequestCreationResult.error(sharingState, BusinessPartnerSharingError.SharingTimeout, errorDescription) + TaskErrorType.NaturalPersonError -> RequestCreationResult.error(sharingState, BusinessPartnerSharingError.NaturalPersonError, errorDescription) + TaskErrorType.BpnErrorNotFound -> RequestCreationResult.error(sharingState, BusinessPartnerSharingError.BpnErrorNotFound, errorDescription) + TaskErrorType.BpnErrorTooManyOptions -> RequestCreationResult.error(sharingState, BusinessPartnerSharingError.BpnErrorTooManyOptions, errorDescription) + TaskErrorType.MandatoryFieldValidationFailed -> RequestCreationResult.error(sharingState, BusinessPartnerSharingError.MandatoryFieldValidationFailed, errorDescription) + TaskErrorType.BlacklistCountryPresent -> RequestCreationResult.error(sharingState, BusinessPartnerSharingError.BlacklistCountryPresent, errorDescription) + TaskErrorType.UnknownSpecialCharacters -> RequestCreationResult.error(sharingState, BusinessPartnerSharingError.UnknownSpecialCharacters, errorDescription) + else -> RequestCreationResult.error(sharingState, BusinessPartnerSharingError.SharingProcessError, errorDescription ) } } diff --git a/bpdm-gate/src/test/kotlin/org/eclipse/tractusx/bpdm/gate/controller/BusinessPartnerControllerAndSharingControllerIT.kt b/bpdm-gate/src/test/kotlin/org/eclipse/tractusx/bpdm/gate/controller/BusinessPartnerControllerAndSharingControllerIT.kt index 9b5d33551..dd97ee0ac 100644 --- a/bpdm-gate/src/test/kotlin/org/eclipse/tractusx/bpdm/gate/controller/BusinessPartnerControllerAndSharingControllerIT.kt +++ b/bpdm-gate/src/test/kotlin/org/eclipse/tractusx/bpdm/gate/controller/BusinessPartnerControllerAndSharingControllerIT.kt @@ -199,7 +199,7 @@ class BusinessPartnerControllerAndSharingControllerIT @Autowired constructor( SharingStateDto( externalId = externalId5, sharingStateType = SharingStateType.Error, - sharingErrorCode = BusinessPartnerSharingError.SharingProcessError, + sharingErrorCode = BusinessPartnerSharingError.SharingTimeout, sharingErrorMessage = "Major Error // Minor Error", sharingProcessStarted = null, taskId = "1" diff --git a/bpdm-gate/src/test/kotlin/org/eclipse/tractusx/bpdm/gate/controller/BusinessPartnerControllerIT.kt b/bpdm-gate/src/test/kotlin/org/eclipse/tractusx/bpdm/gate/controller/BusinessPartnerControllerIT.kt index d4caf81a8..5a201fffb 100644 --- a/bpdm-gate/src/test/kotlin/org/eclipse/tractusx/bpdm/gate/controller/BusinessPartnerControllerIT.kt +++ b/bpdm-gate/src/test/kotlin/org/eclipse/tractusx/bpdm/gate/controller/BusinessPartnerControllerIT.kt @@ -336,7 +336,7 @@ class BusinessPartnerControllerIT @Autowired constructor( SharingStateDto( externalId = externalId5, sharingStateType = SharingStateType.Error, - sharingErrorCode = BusinessPartnerSharingError.SharingProcessError, + sharingErrorCode = BusinessPartnerSharingError.SharingTimeout, sharingErrorMessage = "Major Error // Minor Error", sharingProcessStarted = null, taskId = "1" diff --git a/bpdm-orchestrator-api/src/main/kotlin/org/eclipse/tractusx/orchestrator/api/model/TaskErrorDto.kt b/bpdm-orchestrator-api/src/main/kotlin/org/eclipse/tractusx/orchestrator/api/model/TaskErrorDto.kt index 6f8f42204..187258bc7 100644 --- a/bpdm-orchestrator-api/src/main/kotlin/org/eclipse/tractusx/orchestrator/api/model/TaskErrorDto.kt +++ b/bpdm-orchestrator-api/src/main/kotlin/org/eclipse/tractusx/orchestrator/api/model/TaskErrorDto.kt @@ -21,10 +21,16 @@ package org.eclipse.tractusx.orchestrator.api.model import io.swagger.v3.oas.annotations.media.Schema -@Schema(description = "Describes an error that happened during processing of a task") +@Schema(description = "Describes an error that happened during processing of a task \n") data class TaskErrorDto( - @get:Schema(description = "The type of error that occurred", required = true) + @get:Schema(description = "The type of error that occurred. \n" + + "* `NaturalPersonError`: The provided record contains natural person information.\n" + + "* `BpnErrorNotFound`: The provided record can not be matched to a legal entity or an address.\n" + + "* `BpnErrorTooManyOptions`: The provided record can not link to a clear legal entity.\n" + + "* `MandatoryFieldValidationFailed`: The provided record does not fulfill mandatory validation rules.\n" + + "* `BlacklistCountryPresent`: The provided record is part of a country that is not allowed to be processed by the GR process (example: Brazil).\n" + + "* `UnknownSpecialCharacters`: The provided record contains unallowed special characters.\n" , required = true) val type: TaskErrorType, @get:Schema(description = "The free text, detailed description of the error", required = true) diff --git a/bpdm-orchestrator-api/src/main/kotlin/org/eclipse/tractusx/orchestrator/api/model/TaskErrorType.kt b/bpdm-orchestrator-api/src/main/kotlin/org/eclipse/tractusx/orchestrator/api/model/TaskErrorType.kt index 7f18c36a9..bcea3c6cb 100644 --- a/bpdm-orchestrator-api/src/main/kotlin/org/eclipse/tractusx/orchestrator/api/model/TaskErrorType.kt +++ b/bpdm-orchestrator-api/src/main/kotlin/org/eclipse/tractusx/orchestrator/api/model/TaskErrorType.kt @@ -19,7 +19,15 @@ package org.eclipse.tractusx.orchestrator.api.model +import io.swagger.v3.oas.annotations.media.Schema + enum class TaskErrorType { Timeout, - Unspecified + Unspecified, + NaturalPersonError, + BpnErrorNotFound, + BpnErrorTooManyOptions, + MandatoryFieldValidationFailed, + BlacklistCountryPresent, + UnknownSpecialCharacters } \ No newline at end of file diff --git a/bpdm-orchestrator/src/main/resources/db/migration/V6_3_0_0__add_extend_error_code.sql b/bpdm-orchestrator/src/main/resources/db/migration/V6_3_0_0__add_extend_error_code.sql new file mode 100644 index 000000000..690388bca --- /dev/null +++ b/bpdm-orchestrator/src/main/resources/db/migration/V6_3_0_0__add_extend_error_code.sql @@ -0,0 +1,11 @@ +ALTER TABLE task_errors DROP CONSTRAINT task_errors_type_check; +ALTER TABLE task_errors ADD CONSTRAINT task_errors_type_check CHECK (type IN ( + 'Timeout', + 'Unspecified', + 'NaturalPersonError', + 'BpnErrorNotFound', + 'BpnErrorTooManyOptions', + 'MandatoryFieldValidationFailed', + 'BlacklistCountryPresent', + 'UnknownSpecialCharacters' +)); \ No newline at end of file diff --git a/docs/api/gate.yaml b/docs/api/gate.yaml index cf0955775..df90657fd 100644 --- a/docs/api/gate.yaml +++ b/docs/api/gate.yaml @@ -1676,6 +1676,12 @@ components: - SharingTimeout - BpnNotInPool - MissingTaskID + - NaturalPersonError + - BpnErrorNotFound + - BpnErrorTooManyOptions + - MandatoryFieldValidationFailed + - BlacklistCountryPresent + - UnknownSpecialCharacters sharingErrorMessage: type: string description: The error message in case the current sharing state type is "error". diff --git a/docs/api/orchestrator.yaml b/docs/api/orchestrator.yaml index a5a432811..666e640b2 100644 --- a/docs/api/orchestrator.yaml +++ b/docs/api/orchestrator.yaml @@ -647,6 +647,12 @@ components: enum: - Timeout - Unspecified + - NaturalPersonError + - BpnErrorNotFound + - BpnErrorTooManyOptions + - MandatoryFieldValidationFailed + - BlacklistCountryPresent + - UnknownSpecialCharacters description: type: string description: The free text, detailed description of the error