diff --git a/workflows/MyToys.json b/workflows/MyToys.json index a79595d..4658399 100644 --- a/workflows/MyToys.json +++ b/workflows/MyToys.json @@ -1,5 +1,5 @@ { - "active": false, + "active": true, "connections": { "Auftragsdaten CSV einlesen": { "main": [ @@ -73,28 +73,6 @@ ] ] }, - "Billbee Order lesen": { - "main": [ - [ - { - "node": "Set2", - "type": "main", - "index": 0 - } - ] - ] - }, - "Set2": { - "main": [ - [ - { - "node": "Rückmeldung CSV erzeugen", - "type": "main", - "index": 0 - } - ] - ] - }, "Rückmeldung CSV erzeugen": { "main": [ [ @@ -105,6 +83,28 @@ } ] ] + }, + "Webhook": { + "main": [ + [ + { + "node": "Code1", + "type": "main", + "index": 0 + } + ] + ] + }, + "Code1": { + "main": [ + [ + { + "node": "Rückmeldung CSV erzeugen", + "type": "main", + "index": 0 + } + ] + ] } }, "createdAt": "2023-01-17T13:26:26.485Z", @@ -115,7 +115,7 @@ "parameters": { "protocol": "sftp", "operation": "list", - "path": "/archiv" + "path": "/out" }, "id": "77792d6c-723a-4021-a25b-866c87195fea", "name": "FTP", @@ -132,19 +132,6 @@ } } }, - { - "parameters": { - "jsCode": "// Loop over input items and add a new field\n// called 'myNewField' to the JSON of each one\nfor (const item of $input.all()) {\n item.json.TB_ORDER_ID = item.json.data.Data.OrderNumber;\n item.json.ORDER_PAID = 0;\n item.json.TYPE = \"ship\";\n item.json.PARCEL_TYPE = \"DPD_STD_NATIONAL\";\n item.json.SHIP_CODE = \"12345-track-me\";\n item.json.IDCODE_RETURN_PROP\nOSAL = \"\";\n item.json.COMMENT_INTERN = \"Hier könnte Dein INTERNER Kommentar interner stehen.\";\n item.json.COMMENT = \"Hier könnte Dein Kommentar interner stehen.\"\n}\n\nreturn $input.all();" - }, - "id": "fb6645ac-6ef7-46a8-92cd-67ecb9549c79", - "name": "Code", - "type": "n8n-nodes-base.code", - "typeVersion": 1, - "position": [ - 300, - 480 - ] - }, { "parameters": { "keepOnlySet": true, @@ -215,8 +202,8 @@ "type": "n8n-nodes-base.spreadsheetFile", "typeVersion": 1, "position": [ - 1240, - 600 + 1260, + 620 ] }, { @@ -235,68 +222,6 @@ -160 ] }, - { - "parameters": { - "keepOnlySet": true, - "values": { - "string": [ - { - "name": "Ordernumber", - "value": "={{ $json[\"TB_ORDER_ID\"] }}" - }, - { - "name": "InvoiceAddress.Company", - "value": "={{ $json[\"CUST_SELL_EXTENSION\"] }}" - }, - { - "name": "InvoiceAddress.Street", - "value": "={{ $json[\"CUST_SELL_STREET_NO\"] }}" - }, - { - "name": "InvoiceAddress.City", - "value": "={{ $json[\"CUST_SHIP_CITY\"] }}" - }, - { - "name": "InvoiceAddress.Country", - "value": "={{ $json[\"CUST_SELL_COUNTRY_CODE\"] }}" - }, - { - "name": "InvoiceAddress.Zip", - "value": "={{$json[\"CUST_SHIP_ZIP\"]}}" - }, - { - "name": "InvoiceAddress.CountryISO2", - "value": "={{$json[\"CUST_SHIP_COUNTRY_CODE\"]}}" - }, - { - "name": "InvoiceAddress.FirstName", - "value": "={{$json[\"CUST_SHIP_FIRSTNAME\"]}}" - } - ], - "number": [ - { - "name": "CreatedAt", - "value": "={{ $today.toISODate()}}" - }, - { - "name": "InvoiceAddress.Country", - "value": "={{$json[\"CUST_SHIP_COUNTRY_CODE\"]}}" - } - ] - }, - "options": { - "dotNotation": true - } - }, - "id": "1860ac81-13fb-4b9d-a150-c88e00a80439", - "name": "Set", - "type": "n8n-nodes-base.set", - "typeVersion": 1, - "position": [ - 1400, - 820 - ] - }, { "parameters": { "command": "cat $BILLBEE_API_KEY" @@ -334,7 +259,7 @@ { "parameters": { "protocol": "sftp", - "path": "=/archiv/_done_with_errors_20230119_115617_ORDER_01mydk_lana.xml" + "path": "=/out/{{$json[\"name\"]}}" }, "id": "ee40a4c2-d570-4a61-8373-e4e4c46536fd", "name": "FTP1", @@ -506,8 +431,8 @@ "type": "n8n-nodes-base.ftp", "typeVersion": 1, "position": [ - 1500, - 180 + 1160, + -360 ], "credentials": { "sftp": { @@ -516,80 +441,6 @@ } } }, - { - "parameters": { - "keepOnlySet": true, - "values": { - "string": [ - { - "name": "TB_ORDER_ID", - "value": "={{$json[\"Data\"][\"OrderNumber\"]}}" - }, - { - "name": "ORDER_PAID", - "value": "0" - }, - { - "name": "TYPE", - "value": "ship" - }, - { - "name": "PARCEL_TYPE", - "value": "DPD_STD_NATIONAL" - }, - { - "name": "SHIP_CODE", - "value": "=" - }, - { - "name": "COMMENT_INTERN", - "value": "Testorder" - }, - { - "name": "COMMENT" - } - ] - }, - "options": {} - }, - "id": "ff3bdda6-15bd-4799-9cc0-ea85b6b111d8", - "name": "Set2", - "type": "n8n-nodes-base.set", - "typeVersion": 1, - "position": [ - 2080, - 380 - ] - }, - { - "parameters": { - "authentication": "basicAuth", - "url": "=https://app.billbee.io/api/v1/orders/findbyextref/1", - "options": {}, - "headerParametersUi": { - "parameter": [ - { - "name": "={{$node[\"Billbee ShopID + Token\"].parameter[\"values\"][\"string\"][1][\"name\"]}}", - "value": "=2855BE2C-1D67-4AB0-9DEB-3073E6D27B1C" - } - ] - } - }, - "name": "Billbee Order lesen", - "type": "n8n-nodes-base.httpRequest", - "typeVersion": 1, - "position": [ - 1860, - 380 - ], - "id": "7cd76aab-c1f2-42e4-9de1-189a6fa0c136", - "credentials": { - "httpBasicAuth": { - "id": "2", - "name": "Billbee" - } - } - }, { "parameters": { "protocol": "sftp", @@ -610,11 +461,39 @@ "name": "SFTP MyToys" } } + }, + { + "parameters": { + "path": "1730d70c-f532-4b6f-a20e-e2fc7edb2d45", + "options": {} + }, + "id": "5a16780d-19a1-4967-8710-9225ddc59ddf", + "name": "Webhook", + "type": "n8n-nodes-base.webhook", + "typeVersion": 1, + "position": [ + 1660, + 180 + ], + "webhookId": "1730d70c-f532-4b6f-a20e-e2fc7edb2d45" + }, + { + "parameters": { + "jsCode": "let lines = [];\n\nfor (const item of $input.all()) {\n let parcel_type;\n switch(item.json.query.id) {\n case \"Eurocourier\":\n parcel_type = \"EC_STD_NATIONAL\";\n break;\n case \"GLS\":\n parcel_type = \"GLS_STD_NATIONAL\";\n break;\n default:\n parcel_type = \"DPD_STD_NATIONAL\";\n}\n let line = {\n \"TB_ORDER_ID\": item.json.query.id,\n \"ORDER_PAID\" : 0,\n \"TYPE\" : item.json.query.type,\n \"PARCEL_TYPE\": parcel_type,\n \"SHIP_CODE\" : item.json.query.shipment,\n \"COMMENT_INTERN\" : \"\",\n \"COMMENT\" : \"\",\n }; \n lines.push(line);\n}\n\nreturn lines;" + }, + "id": "3f76d0dd-3525-4cdb-baab-e2205621ec39", + "name": "Code1", + "type": "n8n-nodes-base.code", + "typeVersion": 1, + "position": [ + 1880, + 180 + ] } ], "pinData": {}, "settings": {}, "staticData": null, "tags": [], - "updatedAt": "2023-01-19T13:53:17.913Z" + "updatedAt": "2023-01-20T15:51:45.866Z" } \ No newline at end of file