Refine example scenario for eshop

This commit is contained in:
Philipp Theyssen 2023-02-27 11:48:03 +01:00
parent 395d23cee9
commit a283d4be46
5 changed files with 117 additions and 30 deletions

View File

@ -3,35 +3,35 @@
"type": "http", "type": "http",
"httpMethod": "post", "httpMethod": "post",
"arguments": [ "arguments": [
{
"name": "items",
"required": true,
"type": "object"
},
{ {
"name": "buyerId", "name": "buyerId",
"required": true, "required": true,
"type": "guid" "type": "guid"
}, },
],
"dynamicVariables": [
{ {
"name": "basket-item-id", "name": "item-1",
"type": "unsignedInt" "required": true,
"type": "object"
},
{
"name": "item-2",
"required": true,
"type": "object"
},
{
"name": "item-3",
"required": true,
"type": "object"
} }
] ],
"payload": { "requestPayload": {
"type": "json", "type": "json",
"content": { "content": {
"buyerId": "{{buyerId}}", "buyerId": "{{buyerId}}",
"items": [ "items": [
"id": "1", "{{item-1}}",
"productId": "{{items}}", "{{item-2}}",
"productName": "string", "{{item-3}}"
"unitPrice": 0,
"oldUnitPrice": 0,
"quantity": 0,
"pictureUrl": ""
] ]
} }
}, },

View File

@ -2,6 +2,10 @@
"id": "catalog-add-item", "id": "catalog-add-item",
"type": "http", "type": "http",
"httpMethod": "post", "httpMethod": "post",
"arguments": [
"name": "product-id",
"type": "unsignedInt"
]
"dynamicVariables": [ "dynamicVariables": [
{ {
"name": "item-name", "name": "item-name",
@ -35,7 +39,7 @@
"payload": { "payload": {
"type": "json", "type": "json",
"content": { "content": {
"id": 0, "id": "{{product-id}}",
"name": "{{item-name}}", "name": "{{item-name}}",
"description": "{{item-description}}", "description": "{{item-description}}",
"price": "{{price}}", "price": "{{price}}",

View File

@ -7,6 +7,23 @@
"key": "pageSize", "key": "pageSize",
"value": 3 "value": 3
} }
], ],
"returnValues": [
{
"key": "item-1",
"value": "@@response.payload.data[0]@@",
"type": "object"
},
{
"key": "item-2",
"value": "@@response.payload.data[1]@@",
"type": "object"
},
{
"key": "item-3",
"value": "@@response.payload.data[2]@@",
"type": "object"
}
]
"url": "http://localhost:5101/catalog-api/api/v1/Catalog/items" "url": "http://localhost:5101/catalog-api/api/v1/Catalog/items"
} }

View File

@ -0,0 +1,19 @@
{
"id": "catalog-update-price",
"type": "http",
"httpMethod": "put",
"arguments": [
{
"name": "item-1",
"required": true,
"type": "object"
}
],
"payload": {
"type": "json",
"content": {
"{{item-1}}"
}
},
"url": "http://localhost:5101/catalog-api/api/v1/Catalog/items"
}

View File

@ -1,17 +1,64 @@
transaction: "transaction":
{ {
"id": "add-items-to-basket", "id": "add-items-to-basket",
"operations": [ "arguments": [
{ {
operationRefId: "catalog-get-items", "name": "user-id",
id: "op-1", "type": "guid"
}
],
"operations": [
{
"operationRefId": "catalog-get-items",
"id": "op-1",
}, },
{ {
operationRefId: "op-id-2", "operationRefId": "basket-add-item",
id: "second-op-in-this-transaction", "id": "op-2",
arguments: [ "providedValues": [
userId, {
@first-op-in-this-transaction.response.id "key": "buyerId",
"value": "{{user-id}}"
},
{
"key": "item-1",
"value":
{
"id": "1",
"productId": "@@op-1.response[0].id@@",
"productName": "@@op-1.response[0].name@@",
"unitPrice": "@@op-1.response[0].price@@",
"oldUnitPrice": "@@op-1.response[0].price@@",
"quantity": "@@op-1.response[0].availablestock@@",
"pictureUrl": ""
},
},
{
"key": "item-2",
"value":
{
"id": "2",
"productId": "@@op-1.response[1].id@@",
"productName": "@@op-1.response[1].name@@",
"unitPrice": "@@op-1.response[1].price@@",
"oldUnitPrice": "@@op-1.response[1].price@@",
"quantity": "@@op-1.response[1].availablestock@@",
"pictureUrl": ""
},
},
{
"key": "item-3",
"value":
{
"id": "3",
"productId": "@@op-1.response[2].id@@",
"productName": "@@op-1.response[2].name@@",
"unitPrice": "@@op-1.response[2].price@@",
"oldUnitPrice": "@@op-1.response[2].price@@",
"quantity": "@@op-1.response[2].availablestock@@",
"pictureUrl": ""
}
}
] ]
} }
] ]