Skip to content

Commit b655183

Browse files
author
Stefan Wiedemann
authored
Merge pull request #2 from FIWARE/tmf-example
Adding example for TMForum Contract Management
2 parents 1699a6c + 33c640d commit b655183

File tree

3 files changed

+245
-0
lines changed

3 files changed

+245
-0
lines changed

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ FIWARE-Ops [data-space-connector repository](https://github.com/FIWARE-Ops/data-
2828
- [Service interaction (M2M)](#service-interaction-m2m)
2929
- [Implementation](#implementation)
3030
- [Examples](#examples)
31+
- [Contract Management via TMForum APIs](#contract-management-via-tmforum-apis)
3132

3233
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
3334

@@ -90,6 +91,7 @@ Precisely, the connector bundles the following components:
9091
| dsba-pdp | DSBA-compliant PDP | https://github.com/FIWARE/dsba-pdp |
9192
| Keyrock | Authorization Registry (storing role / ABAC-policy mappings) | https://github.com/ging/fiware-idm |
9293
| tmforum-api | [TMForum APIs](https://www.tmforum.org/oda/open-apis/) for contract management | https://github.com/FIWARE/tmforum-api |
94+
| contract-management | Notification listener for contract management events out of TMForum | https://github.com/FIWARE/contract-management |
9395
| MongoDB | Database | https://www.mongodb.com |
9496
| MySQL | Database | https://www.mysql.com |
9597
| PostgreSQL | Database | https://www.postgresql.org |
@@ -293,3 +295,19 @@ which also provides instructions for the deployment.
293295
including a data service provider based on the FIWARE Data Space Connector, can be found at the
294296
FIWARE-Ops [fiware-gitops repository](https://github.com/FIWARE-Ops/fiware-gitops/tree/master/aws/dsba)
295297

298+
299+
300+
#### Contract Management via TMForum APIs
301+
302+
With the [tmforum-api](https://github.com/FIWARE/tmforum-api) and the
303+
[contract-management](https://github.com/FIWARE/contract-management) notification listener, the FIWARE
304+
Data Space Connector provides components to perform contract management based on the TMForum APIs.
305+
306+
Via the TMForum APIs, providers can create product specifications and offerings. Consumer organisations
307+
can register as a party and place product orders. In the case of a product order, the TMForum APIs will
308+
send a notification to the contract-management notification listener, which will create an entry at the
309+
Trusted Issuers List for the consumer organisation. Also compare to the flow descriptions
310+
of [Consumer registration](#consumer-registration) and [Contract management](#contract-management).
311+
312+
A Postman collection providing example requests can be found [here](./examples/tmf/).
313+

examples/tmf/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# TMForum contract management example
2+
3+
This is an example Postman collection providing requests to interact with
4+
the TMForum API for
5+
* Creating a product specification (by the provider)
6+
* Creating a product offering (by the provider)
7+
* Registering as party at the provider (creating an organization by the consumer)
8+
* Creating a product order (by the consumer)
9+
Lines changed: 218 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,218 @@
1+
{
2+
"info": {
3+
"_postman_id": "8b482050-d18e-418b-b2df-f2e2b082eb2a",
4+
"name": "TMF-Demo",
5+
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
6+
"_exporter_id": "12955180"
7+
},
8+
"item": [
9+
{
10+
"name": "Create Product Spec (by provider)",
11+
"request": {
12+
"method": "POST",
13+
"header": [
14+
{
15+
"key": "Authorization",
16+
"value": "Bearer {{provider_employee_token}}",
17+
"type": "text"
18+
},
19+
{
20+
"key": "Content-Type",
21+
"value": "application/json",
22+
"type": "text"
23+
}
24+
],
25+
"body": {
26+
"mode": "raw",
27+
"raw": "{\n \"name\": \"Packet Delivery Premium Service Spec\",\n \"productSpecCharacteristic\": [\n {\n \"name\": \"Service Endpoint\",\n \"valueType\": \"string\",\n \"productSpecCharacteristicValue\": [\n {\n \"valueType\": \"string\",\n \"value\": \"https://<provider_NGSI-LD_endpoint>\"\n }\n ]\n }\n ]\n}"
28+
},
29+
"url": {
30+
"raw": "{{tmf_url}}/tmf-api/productCatalogManagement/v4/productSpecification",
31+
"host": [
32+
"{{tmf_url}}"
33+
],
34+
"path": [
35+
"tmf-api",
36+
"productCatalogManagement",
37+
"v4",
38+
"productSpecification"
39+
]
40+
}
41+
},
42+
"response": []
43+
},
44+
{
45+
"name": "Create Product Offering (by provider)",
46+
"request": {
47+
"method": "POST",
48+
"header": [
49+
{
50+
"key": "Authorization",
51+
"value": "Bearer {{provider_employee_token}}",
52+
"type": "text"
53+
},
54+
{
55+
"key": "Content-Type",
56+
"value": "application/json",
57+
"type": "text"
58+
}
59+
],
60+
"body": {
61+
"mode": "raw",
62+
"raw": "{\n \"description\": \"My Offering description\",\n \"isBundle\": false,\n \"isSellable\": true,\n \"lifecycleStatus\": \"Active\",\n \"name\": \"Packet Delivery Premium Service\",\n \"productSpecification\": {\n \"id\": \"<prodSpecID>\",\n \"name\": \"Packet Delivery Premium Service Spec\",\n }\n}"
63+
},
64+
"url": {
65+
"raw": "{{tmf_url}}/tmf-api/productCatalogManagement/v4/productOffering",
66+
"host": [
67+
"{{tmf_url}}"
68+
],
69+
"path": [
70+
"tmf-api",
71+
"productCatalogManagement",
72+
"v4",
73+
"productOffering"
74+
]
75+
}
76+
},
77+
"response": []
78+
},
79+
{
80+
"name": "Create Organization (by consumer)",
81+
"request": {
82+
"method": "POST",
83+
"header": [
84+
{
85+
"key": "Authorization",
86+
"value": "Bearer {{lear_token}}",
87+
"type": "text"
88+
},
89+
{
90+
"key": "Content-Type",
91+
"value": "application/json",
92+
"type": "text"
93+
}
94+
],
95+
"body": {
96+
"mode": "raw",
97+
"raw": "{\n \"name\": \"HappyPets\",\n \"tradingName\": \"HappyPets\",\n \"partyCharacteristic\": [\n {\n \"name\": \"did\",\n \"valueType\": \"string\",\n \"value\": \"did:web:happypets.dsba.fiware.dev:did\"\n }\n ]\n}"
98+
},
99+
"url": {
100+
"raw": "{{tmf_url}}/tmf-api/party/v4/organization",
101+
"host": [
102+
"{{tmf_url}}"
103+
],
104+
"path": [
105+
"tmf-api",
106+
"party",
107+
"v4",
108+
"organization"
109+
]
110+
}
111+
},
112+
"response": []
113+
},
114+
{
115+
"name": "Get Product Offerings (by Consumer)",
116+
"request": {
117+
"method": "GET",
118+
"header": [
119+
{
120+
"key": "Authorization",
121+
"value": "Bearer {{buyer_token}}",
122+
"type": "text"
123+
}
124+
],
125+
"url": {
126+
"raw": "{{tmf_url}}/tmf-api/productCatalogManagement/v4/productOffering",
127+
"host": [
128+
"{{tmf_url}}"
129+
],
130+
"path": [
131+
"tmf-api",
132+
"productCatalogManagement",
133+
"v4",
134+
"productOffering"
135+
]
136+
}
137+
},
138+
"response": []
139+
},
140+
{
141+
"name": "Create Product Order (by consumer)",
142+
"request": {
143+
"method": "POST",
144+
"header": [
145+
{
146+
"key": "Authorization",
147+
"value": "Bearer {{buyer_token}}",
148+
"type": "text"
149+
},
150+
{
151+
"key": "Content-Type",
152+
"value": "application/json",
153+
"type": "text"
154+
}
155+
],
156+
"body": {
157+
"mode": "raw",
158+
"raw": "{\n \"productOrderItem\": [\n {\n \"id\": \"<orderId>\",\n \"action\": \"add\",\n \"productOffering\": {\n \"id\": \"<prodOfferingId>\",\n \"name\": \"Packet Delivery Premium Service\"\n }\n }\n ],\n \"relatedParty\": [\n {\n \"id\": \"<HappyPets_OrgId>\",\n \"name\": \"HappyPets\"\n }\n ]\n}"
159+
},
160+
"url": {
161+
"raw": "{{tmf_url}}/tmf-api/productOrderingManagement/v4/productOrder",
162+
"host": [
163+
"{{tmf_url}}"
164+
],
165+
"path": [
166+
"tmf-api",
167+
"productOrderingManagement",
168+
"v4",
169+
"productOrder"
170+
]
171+
}
172+
},
173+
"response": []
174+
}
175+
],
176+
"event": [
177+
{
178+
"listen": "prerequest",
179+
"script": {
180+
"type": "text/javascript",
181+
"exec": [
182+
""
183+
]
184+
}
185+
},
186+
{
187+
"listen": "test",
188+
"script": {
189+
"type": "text/javascript",
190+
"exec": [
191+
""
192+
]
193+
}
194+
}
195+
],
196+
"variable": [
197+
{
198+
"key": "tmf_url",
199+
"value": "https://tmf-url.com",
200+
"type": "string"
201+
},
202+
{
203+
"key": "lear_token",
204+
"value": "<my-lear-token>",
205+
"type": "string"
206+
},
207+
{
208+
"key": "buyer_token",
209+
"value": "<my_buyer_token>",
210+
"type": "string"
211+
},
212+
{
213+
"key": "provider_employee_token",
214+
"value": "<my_provider_employee_token>",
215+
"type": "string"
216+
}
217+
]
218+
}

0 commit comments

Comments
 (0)