eclipse-tractusx / item-relationship-service

https://eclipse-tractusx.github.io/item-relationship-service/docs/
Apache License 2.0
7 stars 22 forks source link

Add BPN to UsagePolicyException tombstone from CatalogOffer #404

Closed mkanal closed 8 months ago

mkanal commented 9 months ago

As business app I want BPNL for a UsagePolicyException tombstone so that am able to assign a tombstone with UsagePolicyException and policy to a BPNL

Hints / Details

Outcome / Acceptance Criteria

Outcome

"tombstones": [
  {
    "catenaXId": "urn:uuid:6ce41c0b-c84a-46b0-b4c4-78fce958663d",
    "endpointURL": null,
    "businessPartnerNumber": "<businessPartnerNumber>",
    "policy": {},
    "processingError": {
       "processStep": "UsagePolicyValidation", 
       "errorDetail": "Consumption of asset (itemId) is not permitted as the required catalog offer policies do not comply with defined IRS policies.",
       "lastAttempt": "2024-01-17T09:02:36.648055745Z",
       "retryCounter": 3
    }
  }
],

Out of Scope

jzbmw commented 9 months ago

Image

ds-jhartmann commented 9 months ago

Since we handle the UsagePolicyException at SubmodelDelegate and RelationshipDelegate level, we already have the BPNL of the company, where we want to request data from, available. By using this BPNL, we do not have the need to extract it from the Catalog and can add it to the tombstone directly.

ds-jhartmann commented 9 months ago

An additional point to consider is adding the BPNL to the tombstone message instead of adding another field. If we keep adding field which are only filled in specific cases, the tombstone object will become messy soon. Son instead of

"tombstones": [
  {
    "catenaXId": "urn:uuid:6ce41c0b-c84a-46b0-b4c4-78fce958663d",
    "endpointURL": null,
    "businessPartnerNumber": "<businessPartnerNumber>",
    "policy": {},
    "processingError": {
       "processStep": "UsagePolicyValidation", 
       "errorDetail": "Consumption of asset (itemId) is not permitted as the required catalog offer policies do not comply with defined IRS policies.",
       "lastAttempt": "2024-01-17T09:02:36.648055745Z",
       "retryCounter": 3
    }
  }
],

it would be

  {
    "catenaXId": "urn:uuid:6ce41c0b-c84a-46b0-b4c4-78fce958663d",
    "endpointURL": null,
    "policy": {},
    "processingError": {
       "processStep": "UsagePolicyValidation", 
       "errorDetail": "Consumption of asset (itemId) is not permitted for company <businessPartnerNumber>, as the required catalog offer policies do not comply with defined IRS policies.",
       "lastAttempt": "2024-01-17T09:02:36.648055745Z",
       "retryCounter": 3
    }
  }
ds-alexander-bulgakov commented 8 months ago

Hi @ds-ext-kmassalski, as discussed in the daily please provide a testdatafile with an asset which can be used for automated tests. Thank you!

ds-alexander-bulgakov commented 8 months ago

Testdata was provided and tavern test created in branch #404-create-tavern-tests. Once the feature is successfully deployt on DEV the test can be run.

ds-ext-kmassalski commented 8 months ago

PR's with impl: https://github.com/catenax-ng/tx-item-relationship-service/pull/790

Test data: https://github.com/catenax-ng/tx-item-relationship-service/pull/796

done - In case UsagePolicyException is thrown, BPN is written to UsagePolicyException tombstone if available done - businessPartnerNumber is provided inside an UsagePolicyException tombstone if CatalogOffer provides edc:participantId done - businessPartnerNumber is null if edc:participantId is not provided CatalogOffer