PUT /api/administration/user/owncompany/users/\{companyUserId}/businessPartnerNumbers/\{businessPartnerNumber}
POST /api/administration/user/owncompany/users/\{companyUserId}/businessPartnerNumber
Both endpoints are used to enhance the user linked BPNs. The user linked BPNs are stored inside the portal db as well as the user jwt token (via keycloak user attributes).
The backend logic of both those endpoints need to get enhanced. The BPN submitted by the user via the api endpoints need to get validated against the BPDM service GET /api/catena/legal-entities/\{bpnl}/sites
Only if the users company BPN is connected to the submitted BPN(s), the BPN(s) should get added to the respektive user (portal db and keycloak user attribute). For those BPNs where the BPDM service check GET /api/catena/legal-entities/\{bpnl}/sites is unsuccessful, the request should fail and the user attributes/portal db should not get updated for those specific BPN(s).
Please use for the implementation extended error handling.
Means: if the user tries to add 3 BPNs; one of them being valid and the other two not connected to the company BPNL; in this case the response should be the following
API Response of the both API endpoints mentioned above should include following details:
- list of successful added BPNLs
- list of unsuccessful added BPNLs ++ the reason why the BPNL could not get added
In the current implementation additional BPNs can get added to user account.
The solution does not verify/support to validate if the BPN is a valid BPN or if this BPN is really correctly added.
With one of the latest BPDM feature enhancements, this is now possible.
Endpoint supported by BPDM:
GET /api/catena/legal-entities/\{bpnl}/sites
BPDM Pool Swagger
Details of the needed change:
Backend
Portal Endpoints impacted by the new function
PUT /api/administration/user/owncompany/users/\{companyUserId}/businessPartnerNumbers/\{businessPartnerNumber}
POST /api/administration/user/owncompany/users/\{companyUserId}/businessPartnerNumber
Both endpoints are used to enhance the user linked BPNs. The user linked BPNs are stored inside the portal db as well as the user jwt token (via keycloak user attributes).
The backend logic of both those endpoints need to get enhanced. The BPN submitted by the user via the api endpoints need to get validated against the BPDM service
GET /api/catena/legal-entities/\{bpnl}/sites
Only if the users company BPN is connected to the submitted BPN(s), the BPN(s) should get added to the respektive user (portal db and keycloak user attribute). For those BPNs where the BPDM service check
GET /api/catena/legal-entities/\{bpnl}/sites
is unsuccessful, the request should fail and the user attributes/portal db should not get updated for those specific BPN(s).Please use for the implementation extended error handling.
Means: if the user tries to add 3 BPNs; one of them being valid and the other two not connected to the company BPNL; in this case the response should be the following
API Response of the both API endpoints mentioned above should include following details:
Frontend Changes
https://github.com/eclipse-tractusx/portal-frontend/issues/989