n8n-backup/workflows/MyToys.json

620 lines
15 KiB
JSON

{
"active": false,
"connections": {
"Auftragsdaten CSV einlesen": {
"main": [
[
{
"node": "Set1",
"type": "main",
"index": 0
}
]
]
},
"FTP": {
"main": [
[
{
"node": "FTP1",
"type": "main",
"index": 0
}
]
]
},
"PDF": {
"main": [
[],
[
{
"node": "Auftragsdaten CSV einlesen",
"type": "main",
"index": 0
},
{
"node": "Ins Archiv verschieben",
"type": "main",
"index": 0
}
]
]
},
"FTP1": {
"main": [
[
{
"node": "PDF",
"type": "main",
"index": 0
}
]
]
},
"Execute Command": {
"main": [
[
{
"node": "Billbee ShopID + Token",
"type": "main",
"index": 0
}
]
]
},
"Set1": {
"main": [
[
{
"node": "Bestellung an Billbee senden",
"type": "main",
"index": 0
}
]
]
},
"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": [
[
{
"node": "FTP2",
"type": "main",
"index": 0
}
]
]
}
},
"createdAt": "2023-01-17T13:26:26.485Z",
"id": 1,
"name": "MyToys",
"nodes": [
{
"parameters": {
"protocol": "sftp",
"operation": "list",
"path": "/archiv"
},
"id": "77792d6c-723a-4021-a25b-866c87195fea",
"name": "FTP",
"type": "n8n-nodes-base.ftp",
"typeVersion": 1,
"position": [
400,
-180
],
"credentials": {
"sftp": {
"id": "1",
"name": "SFTP MyToys"
}
}
},
{
"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,
"values": {
"string": [
{
"name": "BillbeeShopID",
"value": "97989"
},
{
"name": "X-Billbee-Api-Key",
"value": "={{$json[\"stdout\"]}}"
}
]
},
"options": {}
},
"id": "b9512729-4416-4712-a2fb-7aaa63af9f61",
"name": "Billbee ShopID + Token",
"type": "n8n-nodes-base.set",
"typeVersion": 1,
"position": [
380,
180
]
},
{
"parameters": {
"authentication": "basicAuth",
"requestMethod": "POST",
"url": "=https://app.billbee.io/api/v1/orders?shopId={{$node[\"Billbee ShopID + Token\"].parameter[\"values\"][\"string\"][0][\"value\"]}}",
"options": {},
"headerParametersUi": {
"parameter": [
{
"name": "={{$node[\"Billbee ShopID + Token\"].parameter[\"values\"][\"string\"][1][\"name\"]}}",
"value": "=2855BE2C-1D67-4AB0-9DEB-3073E6D27B1C"
}
]
}
},
"name": "Bestellung an Billbee senden",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 1,
"position": [
1140,
180
],
"id": "c81d1331-8653-4693-ada1-6697dc9ee038",
"credentials": {
"httpBasicAuth": {
"id": "2",
"name": "Billbee"
}
}
},
{
"parameters": {
"operation": "toFile",
"fileFormat": "csv",
"options": {
"fileName": "=DESADV_ORD_{{$now}}.csv",
"headerRow": true
}
},
"id": "8ad49263-f0f0-4be8-84e3-7cee543e356b",
"name": "Rückmeldung CSV erzeugen",
"type": "n8n-nodes-base.spreadsheetFile",
"typeVersion": 1,
"position": [
1240,
600
]
},
{
"parameters": {
"binaryPropertyName": "=data",
"options": {
"headerRow": true
}
},
"id": "5de70737-ab1b-48e7-8fd7-3a722fbc00a9",
"name": "Auftragsdaten CSV einlesen",
"type": "n8n-nodes-base.spreadsheetFile",
"typeVersion": 1,
"position": [
1160,
-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"
},
"id": "65c16259-a7d8-453a-a542-3d840328f396",
"name": "Execute Command",
"type": "n8n-nodes-base.executeCommand",
"typeVersion": 1,
"position": [
180,
180
]
},
{
"parameters": {
"conditions": {
"string": [
{
"value1": "={{$json[\"name\"]}}",
"operation": "endsWith",
"value2": "pdf"
}
]
}
},
"id": "d54af494-70dc-46ac-ad19-91c90fa53f69",
"name": "PDF",
"type": "n8n-nodes-base.if",
"typeVersion": 1,
"position": [
840,
-180
]
},
{
"parameters": {
"protocol": "sftp",
"path": "=/archiv/_done_with_errors_20230119_115617_ORDER_01mydk_lana.xml"
},
"id": "ee40a4c2-d570-4a61-8373-e4e4c46536fd",
"name": "FTP1",
"type": "n8n-nodes-base.ftp",
"typeVersion": 1,
"position": [
620,
-180
],
"credentials": {
"sftp": {
"id": "1",
"name": "SFTP MyToys"
}
}
},
{
"parameters": {
"keepOnlySet": true,
"values": {
"string": [
{
"name": "CreatedAt",
"value": "={{ $today.toISODate()}}"
},
{
"name": "Ordernumber",
"value": "={{ $json[\"TB_ORDER_ID\"] }}"
},
{
"name": "invoiceAddress.Company",
"value": "={{ $json[\"CUST_SHIP_EXTENSION\"] }}"
},
{
"name": "invoiceAddress.Company",
"value": "={{ $json[\"CUST_SHIP_SURNAME\"] }}"
},
{
"name": "invoiceAddress.Street",
"value": "={{ $json[\"CUST_SHIP_STREET_NO\"] }}"
},
{
"name": "invoiceAddress.City",
"value": "={{ $json[\"CUST_SHIP_CITY\"] }}"
},
{
"name": "invoiceAddress.Zip",
"value": "={{$json[\"CUST_SHIP_ZIP\"]}}"
},
{
"name": "invoiceAddress.Country",
"value": "={{ $json[\"CUST_SHIP_COUNTRY_CODE\"] }}"
},
{
"name": "invoiceAddress.CountryISO2",
"value": "={{$json[\"CUST_SHIP_COUNTRY_CODE\"]}}"
},
{
"name": "invoiceAddress.FirstName",
"value": "={{$json[\"CUST_SHIP_FIRSTNAME\"]}}"
},
{
"name": "invoiceAddress.LastName",
"value": "={{$json[\"CUST_SHIP_FIRSTNAME\"]}}"
},
{
"name": "invoiceAddress.Email",
"value": "={{$json[\"CUST_SHIP_EMAIL\"]}}"
},
{
"name": "shippingAddress.Company",
"value": "={{ $json[\"CUST_SHIP_EXTENSION\"] }}"
},
{
"name": "shippingAddress.Company",
"value": "={{ $json[\"CUST_SHIP_SURNAME\"] }}"
},
{
"name": "shippingAddress.Street",
"value": "={{ $json[\"CUST_SHIP_STREET_NO\"] }}"
},
{
"name": "shippingAddress.City",
"value": "={{ $json[\"CUST_SHIP_CITY\"] }}"
},
{
"name": "shippingAddress.Zip",
"value": "={{$json[\"CUST_SHIP_ZIP\"]}}"
},
{
"name": "shippingAddress.Country",
"value": "={{ $json[\"CUST_SHIP_COUNTRY_CODE\"] }}"
},
{
"name": "shippingAddress.CountryISO2",
"value": "={{$json[\"CUST_SHIP_COUNTRY_CODE\"]}}"
},
{
"name": "shippingAddress.FirstName",
"value": "={{$json[\"CUST_SHIP_FIRSTNAME\"]}}"
},
{
"name": "shippingAddress.LastName",
"value": "={{$json[\"CUST_SHIP_FIRSTNAME\"]}}"
},
{
"name": "shippingAddress.Email",
"value": "={{$json[\"CUST_SHIP_EMAIL\"]}}"
},
{
"name": "=orderItems[0].product.SKU",
"value": "={{$json[\"POS_ANR\"]}}"
},
{
"name": "=orderItems[0].Quantity",
"value": "={{$json[\"POS_QUANTITY\"]}}"
},
{
"name": "=orderItems[0].TotalPrice",
"value": "={{$json[\"POS_SALESPRICE\"]}}"
},
{
"name": "Customer.Name",
"value": "MyToys Group"
},
{
"name": "Customer.Email",
"value": "dev@lanakk.com"
}
],
"number": [
{
"name": "PaymentMethod",
"value": "3"
},
{
"name": "Customer.Id",
"value": 163662708
},
{
"name": "Customer.Number",
"value": 20089
}
]
},
"options": {
"dotNotation": true
}
},
"id": "50b02a14-bac8-4748-be52-d2e789633254",
"name": "Set1",
"type": "n8n-nodes-base.set",
"typeVersion": 1,
"position": [
860,
180
]
},
{
"parameters": {
"protocol": "sftp",
"operation": "rename",
"oldPath": "={{$binary.data.directory}}/{{$binary.data.fileName}}",
"newPath": "=/archiv/{{$binary.data.fileName}}",
"options": {}
},
"id": "8e265faa-72f6-4d78-92f2-d946aa866f2f",
"name": "Ins Archiv verschieben",
"type": "n8n-nodes-base.ftp",
"typeVersion": 1,
"position": [
1500,
180
],
"credentials": {
"sftp": {
"id": "1",
"name": "SFTP MyToys"
}
}
},
{
"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",
"operation": "upload",
"path": "=/in/{{$binary.data.fileName}}"
},
"id": "cd13302a-3bcf-4fdf-88a5-1ef5a40a725f",
"name": "FTP2",
"type": "n8n-nodes-base.ftp",
"typeVersion": 1,
"position": [
1620,
620
],
"credentials": {
"sftp": {
"id": "1",
"name": "SFTP MyToys"
}
}
}
],
"pinData": {},
"settings": {},
"staticData": null,
"tags": [],
"updatedAt": "2023-01-19T13:53:17.913Z"
}