Closed ds-mmaul closed 3 weeks ago
@ds-mmaul : which env? cannot reproduce on DEV:
Policy:
{
"validUntil": "2025-12-12T23:59:59.999Z",
"businessPartnerNumber": "BPNL1234567890AB",
"payload":
{
"@context": {
"odrl": "http://www.w3.org/ns/odrl/2/"
},
"@id": "test-policy",
"policy": {
"odrl:permission": [
{
"odrl:action": "use",
"odrl:constraint": {
"odrl:and": [
{
"odrl:leftOperand": "Membership",
"odrl:operator": {
"@id": "odrl:eq"
},
"odrl:rightOperand": "active"
},
{
"odrl:leftOperand": "PURPOSE",
"odrl:operator": {
"@id": "odrl:eq"
},
"odrl:rightOperand": "ID 3.1 Trace"
}
]
}
}
]
}
}
}
Update:
PUT /irs/policies
{
"validUntil": "2025-12-12T23:59:59.999Z",
"businessPartnerNumbers": [
"BPNL00000001CRHK", "BPNL00000001ABCD"
],
"policyIds": [
"test-policy"
]
}
Get all policies:
GET /irs/policies
=>
{
"BPNL00000001CRHK": [
{
"validUntil": "2025-12-12T23:59:59.999Z",
"payload": {
"@context": {
"odrl": "http://www.w3.org/ns/odrl/2/"
},
"@id": "test-policy",
"policy": {
"policyId": "test-policy",
"createdOn": "2024-06-13T10:11:35.206518778Z",
"validUntil": "2025-12-12T23:59:59.999Z",
"permissions": [
{
"action": "use",
"constraint": {
"and": [
{
"leftOperand": "Membership",
"operator": {
"@id": "eq"
},
"odrl:rightOperand": "active"
},
{
"leftOperand": "PURPOSE",
"operator": {
"@id": "eq"
},
"odrl:rightOperand": "ID 3.1 Trace"
}
],
"or": null
}
}
]
}
}
}
],
"BPNL00000001ABCD": [
{
"validUntil": "2025-12-12T23:59:59.999Z",
"payload": {
"@context": {
"odrl": "http://www.w3.org/ns/odrl/2/"
},
"@id": "test-policy",
"policy": {
"policyId": "test-policy",
"createdOn": "2024-06-13T10:11:35.206518778Z",
"validUntil": "2025-12-12T23:59:59.999Z",
"permissions": [
{
"action": "use",
"constraint": {
"and": [
{
"leftOperand": "Membership",
"operator": {
"@id": "eq"
},
"odrl:rightOperand": "active"
},
{
"leftOperand": "PURPOSE",
"operator": {
"@id": "eq"
},
"odrl:rightOperand": "ID 3.1 Trace"
}
],
"or": null
}
}
]
}
}
}
],
....
}
Get policies for BPN:
GET https://irs.dev.demo.catena-x.net/irs/policies?businessPartnerNumbers=BPNL00000001CRHK&businessPartnerNumbers=BPNL00000001ABCD
=>same result as above, only limited to the given businessPartnerNumbers
Hi @dsmf , thanks for having a look on this issue. I have retried it on the irs dev environment and the behaviour seems to be, that when a BPN should get updated, no matter how many or which BPNs, the policy will always be assigned to the "default" BPN array. Any update to the bpn field of a policy results it to be changed to "default":
request was: { "validUntil": "2029-05-08T09:19:57.074412585Z", "businessPartnerNumber": [ "BPNL1234567890CD", "BPNL00000003CML1" ], "policyIds": [ "default-policy3342" ] }
@ds-mmaul: still cannot reproduce. There is also a test https://jira.catena-x.net/browse/TRI-1953 that covers updating.
I assume that you CREATE the policy initially without a businessPartnerNumber. In this case the policy becomes the default policy. When you create the policy you need to create it with one initial businessPartnerNumber. Otherwise it becomes the default policy. Unfortunately that is how the API was defined. I know this is inconvenient which is why we have an improvement story here: https://github.com/eclipse-tractusx/item-relationship-service/issues/561. But I am not sure when this will be implemented.
Example:
POST /irs/policies
{
"validUntil": "2025-12-12T23:59:59.999Z",
"businessPartnerNumber": "BPNL1234567890CD",
"payload":
{
"@context": {
"odrl": "http://www.w3.org/ns/odrl/2/"
},
"@id": "the-policy-id",
"policy": {
...
}
}
Afterwards you can update.
relates to
Error was in the structure of request, closing issue. Thank you.
wontdo
For the sake of documentation: The error was that in the update request the attribute should be plural "businessPartnerNumbers" and not singluar "businessPartnerNumber".
Description
Current behaviour
Expected behavior
Steps to reproduce the Bug
exampl request to PUT: { "validUntil": "2029-05-15T09:19:57.074412585Z", "businessPartnerNumber": [ "BPNL1234567890CD", // add BPN here and see if change affects data ], "policyIds": [ "abc" ] }
policy is not added to the added bpn when requesting getPolicies