2021-02-28 19:34:48 +01:00
|
|
|
[
|
|
|
|
{
|
|
|
|
"id": "e79fd0e1.60f55",
|
|
|
|
"type": "tab",
|
|
|
|
"label": "Get last Netflix Invoice and convert it as PDF",
|
|
|
|
"disabled": false,
|
|
|
|
"info": ""
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": "34256184.7e2b8e",
|
|
|
|
"type": "tab",
|
|
|
|
"label": "Post a invoice on Leeto",
|
|
|
|
"disabled": false,
|
|
|
|
"info": ""
|
|
|
|
},
|
2021-02-28 20:02:38 +01:00
|
|
|
{
|
|
|
|
"id": "fdd2168a.835ab8",
|
|
|
|
"type": "subflow",
|
|
|
|
"name": "Netflix HTTP Auth",
|
|
|
|
"info": "",
|
|
|
|
"category": "",
|
|
|
|
"in": [
|
|
|
|
{
|
|
|
|
"x": 20,
|
|
|
|
"y": 80,
|
|
|
|
"wires": [
|
|
|
|
{
|
|
|
|
"id": "bf25f228.3c6a5"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"out": [
|
|
|
|
{
|
|
|
|
"x": 600,
|
|
|
|
"y": 80,
|
|
|
|
"wires": [
|
|
|
|
{
|
|
|
|
"id": "6d4fb2bd.73cc2c",
|
|
|
|
"port": 0
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"env": [],
|
|
|
|
"color": "#DDAA99"
|
|
|
|
},
|
2021-12-22 17:36:33 +01:00
|
|
|
{
|
|
|
|
"id": "6d4fb2bd.73cc2c",
|
|
|
|
"type": "function",
|
|
|
|
"z": "fdd2168a.835ab8",
|
|
|
|
"name": "HTTP Headers for Netflix",
|
|
|
|
"func": "msg.headers = {};\nmsg.headers['User-Agent'] = 'Mozilla/5.0 (X11; Linux x86_64; rv:82.0) Gecko/20100101 Firefox/82.0';\nmsg.headers['Accept-Language'] = 'fr-FR,fr;q=0.5';\nmsg.headers['Cookie'] = [\n 'SecureNetflixId=' + msg.secureNetflixId,\n 'NetflixId=' + msg.netflixId,\n].join(';');\nreturn msg;",
|
|
|
|
"outputs": 1,
|
|
|
|
"noerr": 0,
|
|
|
|
"initialize": "",
|
|
|
|
"finalize": "",
|
|
|
|
"x": 410,
|
|
|
|
"y": 80,
|
|
|
|
"wires": [
|
|
|
|
[]
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": "bf25f228.3c6a5",
|
|
|
|
"type": "credentials",
|
|
|
|
"z": "fdd2168a.835ab8",
|
|
|
|
"name": "Netflix Credentials",
|
|
|
|
"props": [
|
|
|
|
{
|
|
|
|
"value": "netflixId",
|
|
|
|
"type": "msg"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"value": "secureNetflixId",
|
|
|
|
"type": "msg"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"x": 190,
|
|
|
|
"y": 80,
|
|
|
|
"wires": [
|
|
|
|
[
|
|
|
|
"6d4fb2bd.73cc2c"
|
|
|
|
]
|
|
|
|
]
|
|
|
|
},
|
2021-02-28 19:34:48 +01:00
|
|
|
{
|
|
|
|
"id": "f120e3b1.f67b38",
|
|
|
|
"type": "inject",
|
|
|
|
"z": "e79fd0e1.60f55",
|
2021-12-22 22:34:20 +01:00
|
|
|
"name": "Trigger",
|
2021-02-28 19:34:48 +01:00
|
|
|
"props": [
|
|
|
|
{
|
|
|
|
"p": "payload"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"repeat": "",
|
|
|
|
"crontab": "",
|
|
|
|
"once": false,
|
|
|
|
"onceDelay": 0.1,
|
|
|
|
"topic": "",
|
|
|
|
"payloadType": "date",
|
2021-12-22 22:34:20 +01:00
|
|
|
"x": 90,
|
2021-02-28 19:34:48 +01:00
|
|
|
"y": 40,
|
|
|
|
"wires": [
|
|
|
|
[
|
2021-02-28 20:02:38 +01:00
|
|
|
"2d46da6b.8dc806"
|
2021-02-28 19:34:48 +01:00
|
|
|
]
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": "a9e0512d.6cdd7",
|
|
|
|
"type": "http request",
|
|
|
|
"z": "e79fd0e1.60f55",
|
|
|
|
"name": "",
|
|
|
|
"method": "GET",
|
|
|
|
"ret": "txt",
|
|
|
|
"paytoqs": "ignore",
|
|
|
|
"url": "https://www.netflix.com/BillingActivity",
|
|
|
|
"tls": "",
|
|
|
|
"persist": false,
|
|
|
|
"proxy": "",
|
|
|
|
"authType": "",
|
2021-02-28 20:02:38 +01:00
|
|
|
"x": 350,
|
2021-02-28 19:34:48 +01:00
|
|
|
"y": 100,
|
|
|
|
"wires": [
|
|
|
|
[
|
2021-02-28 20:02:38 +01:00
|
|
|
"41d7704e.4f4a48"
|
2021-02-28 19:34:48 +01:00
|
|
|
]
|
|
|
|
],
|
|
|
|
"info": "Get invoice page from Netflix"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": "7ddcb19f.58034",
|
|
|
|
"type": "http request",
|
|
|
|
"z": "e79fd0e1.60f55",
|
|
|
|
"name": "",
|
|
|
|
"method": "GET",
|
|
|
|
"ret": "txt",
|
2021-02-28 20:02:38 +01:00
|
|
|
"paytoqs": "ignore",
|
2021-02-28 19:34:48 +01:00
|
|
|
"url": "",
|
2021-02-28 20:02:38 +01:00
|
|
|
"tls": "",
|
2021-02-28 19:34:48 +01:00
|
|
|
"persist": false,
|
2021-02-28 20:02:38 +01:00
|
|
|
"proxy": "",
|
2021-02-28 19:34:48 +01:00
|
|
|
"authType": "",
|
2021-02-28 20:02:38 +01:00
|
|
|
"x": 350,
|
|
|
|
"y": 160,
|
2021-02-28 19:34:48 +01:00
|
|
|
"wires": [
|
|
|
|
[
|
|
|
|
"b03fda42.1373b",
|
|
|
|
"690170f6.3fab38",
|
|
|
|
"174093e7.8794e4"
|
|
|
|
]
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": "b03fda42.1373b",
|
|
|
|
"type": "file",
|
|
|
|
"z": "e79fd0e1.60f55",
|
|
|
|
"name": "Save last invoice",
|
|
|
|
"filename": "/data/lastInvoice.html",
|
|
|
|
"appendNewline": false,
|
|
|
|
"createDir": false,
|
|
|
|
"overwriteFile": "true",
|
|
|
|
"encoding": "utf8",
|
2021-02-28 20:02:38 +01:00
|
|
|
"x": 590,
|
|
|
|
"y": 160,
|
2021-02-28 19:34:48 +01:00
|
|
|
"wires": [
|
|
|
|
[]
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": "6d08e306.82ab1c",
|
|
|
|
"type": "file",
|
|
|
|
"z": "e79fd0e1.60f55",
|
|
|
|
"name": "Save last invoice as a pdf",
|
|
|
|
"filename": "/data/lastInvoice.pdf",
|
|
|
|
"appendNewline": false,
|
|
|
|
"createDir": false,
|
|
|
|
"overwriteFile": "true",
|
|
|
|
"encoding": "none",
|
|
|
|
"x": 1030,
|
|
|
|
"y": 400,
|
|
|
|
"wires": [
|
|
|
|
[]
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": "5dab3bc3.1f8edc",
|
|
|
|
"type": "http request",
|
|
|
|
"z": "e79fd0e1.60f55",
|
|
|
|
"name": "Api Call for converting to PDF",
|
|
|
|
"method": "POST",
|
|
|
|
"ret": "bin",
|
|
|
|
"paytoqs": "ignore",
|
|
|
|
"url": "",
|
|
|
|
"tls": "",
|
|
|
|
"persist": false,
|
|
|
|
"proxy": "",
|
|
|
|
"authType": "",
|
|
|
|
"x": 1030,
|
|
|
|
"y": 300,
|
|
|
|
"wires": [
|
|
|
|
[
|
|
|
|
"6d08e306.82ab1c",
|
|
|
|
"d2bf2b71.93482"
|
|
|
|
]
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": "eb861026.5c287",
|
|
|
|
"type": "function",
|
|
|
|
"z": "e79fd0e1.60f55",
|
|
|
|
"name": "Config for url-to-pdf-api",
|
|
|
|
"func": "msg.headers = {};\nmsg.headers['Content-Type'] = 'text/html';\nmsg.headers['X-Api-Key'] = msg.apiToken;\nreturn msg;",
|
|
|
|
"outputs": 1,
|
|
|
|
"noerr": 0,
|
|
|
|
"initialize": "",
|
|
|
|
"finalize": "",
|
|
|
|
"x": 770,
|
|
|
|
"y": 300,
|
|
|
|
"wires": [
|
|
|
|
[
|
|
|
|
"5dab3bc3.1f8edc"
|
|
|
|
]
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": "690170f6.3fab38",
|
|
|
|
"type": "credentials",
|
|
|
|
"z": "e79fd0e1.60f55",
|
|
|
|
"name": "url-to-pdf-api Credentials",
|
|
|
|
"props": [
|
|
|
|
{
|
|
|
|
"value": "apiToken",
|
|
|
|
"type": "msg"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"value": "url",
|
|
|
|
"type": "msg"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"x": 530,
|
|
|
|
"y": 300,
|
|
|
|
"wires": [
|
|
|
|
[
|
|
|
|
"eb861026.5c287"
|
|
|
|
]
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": "4c6af2dc.2504bc",
|
|
|
|
"type": "link out",
|
|
|
|
"z": "e79fd0e1.60f55",
|
|
|
|
"name": "Last Netflix Invoice as PDF",
|
2021-12-22 17:36:33 +01:00
|
|
|
"mode": "link",
|
|
|
|
"links": [
|
|
|
|
"848ba398.23bef8"
|
|
|
|
],
|
|
|
|
"x": 635,
|
|
|
|
"y": 540,
|
2021-02-28 19:34:48 +01:00
|
|
|
"wires": []
|
|
|
|
},
|
|
|
|
{
|
2021-12-22 17:36:33 +01:00
|
|
|
"id": "174093e7.8794e4",
|
|
|
|
"type": "html",
|
|
|
|
"z": "e79fd0e1.60f55",
|
2021-02-28 19:34:48 +01:00
|
|
|
"name": "",
|
2021-12-22 17:36:33 +01:00
|
|
|
"property": "payload",
|
|
|
|
"outproperty": "payload",
|
|
|
|
"tag": ".invoiceFooter dd",
|
|
|
|
"ret": "text",
|
|
|
|
"as": "single",
|
|
|
|
"x": 170,
|
|
|
|
"y": 400,
|
|
|
|
"wires": [
|
|
|
|
[
|
|
|
|
"5f5a3dc9.eab71c"
|
|
|
|
]
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": "d2bf2b71.93482",
|
|
|
|
"type": "change",
|
|
|
|
"z": "e79fd0e1.60f55",
|
|
|
|
"name": "Move as payload.file",
|
|
|
|
"rules": [
|
2021-02-28 19:34:48 +01:00
|
|
|
{
|
2021-12-22 17:36:33 +01:00
|
|
|
"t": "move",
|
|
|
|
"p": "payload",
|
|
|
|
"pt": "msg",
|
|
|
|
"to": "payload.file",
|
|
|
|
"tot": "msg"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"t": "set",
|
|
|
|
"p": "payload.filename",
|
|
|
|
"pt": "msg",
|
|
|
|
"to": "netflix-invoice.pdf",
|
|
|
|
"tot": "str"
|
2021-02-28 19:34:48 +01:00
|
|
|
}
|
|
|
|
],
|
2021-12-22 17:36:33 +01:00
|
|
|
"action": "",
|
|
|
|
"property": "",
|
|
|
|
"from": "",
|
|
|
|
"to": "",
|
|
|
|
"reg": false,
|
|
|
|
"x": 660,
|
|
|
|
"y": 400,
|
2021-02-28 19:34:48 +01:00
|
|
|
"wires": [
|
|
|
|
[
|
2021-12-22 17:36:33 +01:00
|
|
|
"97cde9aaf371b9ac"
|
2021-02-28 19:34:48 +01:00
|
|
|
]
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
2021-12-22 17:36:33 +01:00
|
|
|
"id": "73c55749.b6bf7",
|
|
|
|
"type": "debug",
|
|
|
|
"z": "e79fd0e1.60f55",
|
|
|
|
"name": "Tap payload",
|
|
|
|
"active": true,
|
|
|
|
"tosidebar": true,
|
|
|
|
"console": false,
|
|
|
|
"tostatus": false,
|
|
|
|
"complete": "true",
|
|
|
|
"targetType": "full",
|
|
|
|
"statusVal": "",
|
|
|
|
"statusType": "auto",
|
|
|
|
"x": 690,
|
|
|
|
"y": 480,
|
|
|
|
"wires": []
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": "8e61a051.3430c8",
|
|
|
|
"type": "debug",
|
|
|
|
"z": "e79fd0e1.60f55",
|
|
|
|
"d": true,
|
|
|
|
"name": "Last invoice url",
|
|
|
|
"active": true,
|
|
|
|
"tosidebar": true,
|
|
|
|
"console": false,
|
|
|
|
"tostatus": false,
|
|
|
|
"complete": "url",
|
|
|
|
"targetType": "msg",
|
|
|
|
"statusVal": "",
|
|
|
|
"statusType": "auto",
|
|
|
|
"x": 800,
|
|
|
|
"y": 100,
|
|
|
|
"wires": []
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": "5f5a3dc9.eab71c",
|
|
|
|
"type": "change",
|
|
|
|
"z": "e79fd0e1.60f55",
|
|
|
|
"name": "parse amount",
|
|
|
|
"rules": [
|
2021-02-28 19:34:48 +01:00
|
|
|
{
|
2021-12-22 17:36:33 +01:00
|
|
|
"t": "move",
|
|
|
|
"p": "payload[0]",
|
|
|
|
"pt": "msg",
|
|
|
|
"to": "textAmount",
|
|
|
|
"tot": "msg"
|
2021-02-28 19:34:48 +01:00
|
|
|
},
|
|
|
|
{
|
2021-12-22 17:36:33 +01:00
|
|
|
"t": "set",
|
|
|
|
"p": "payload",
|
|
|
|
"pt": "msg",
|
|
|
|
"to": "{}",
|
|
|
|
"tot": "json"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"t": "set",
|
|
|
|
"p": "payload.amount",
|
|
|
|
"pt": "msg",
|
|
|
|
"to": "$number($replace($match(textAmount, /[0-9\\,]+/, 1).match, ',', '.'))",
|
|
|
|
"tot": "jsonata"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"t": "set",
|
|
|
|
"p": "payload.name",
|
|
|
|
"pt": "msg",
|
|
|
|
"to": "Netflix",
|
|
|
|
"tot": "str"
|
2021-02-28 19:34:48 +01:00
|
|
|
}
|
|
|
|
],
|
2021-12-22 17:36:33 +01:00
|
|
|
"action": "",
|
|
|
|
"property": "",
|
|
|
|
"from": "",
|
|
|
|
"to": "",
|
|
|
|
"reg": false,
|
|
|
|
"x": 360,
|
|
|
|
"y": 400,
|
2021-02-28 19:34:48 +01:00
|
|
|
"wires": [
|
|
|
|
[
|
2021-12-22 17:36:33 +01:00
|
|
|
"97cde9aaf371b9ac"
|
2021-02-28 19:34:48 +01:00
|
|
|
]
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
2021-12-22 17:36:33 +01:00
|
|
|
"id": "643c6d17.cec784",
|
2021-02-28 19:34:48 +01:00
|
|
|
"type": "function",
|
2021-12-22 17:36:33 +01:00
|
|
|
"z": "e79fd0e1.60f55",
|
|
|
|
"name": "Cleaning payload",
|
|
|
|
"func": "return {payload: msg.payload};",
|
2021-02-28 19:34:48 +01:00
|
|
|
"outputs": 1,
|
|
|
|
"noerr": 0,
|
|
|
|
"initialize": "",
|
|
|
|
"finalize": "",
|
2021-12-22 17:36:33 +01:00
|
|
|
"x": 470,
|
|
|
|
"y": 500,
|
2021-02-28 19:34:48 +01:00
|
|
|
"wires": [
|
|
|
|
[
|
2021-12-22 17:36:33 +01:00
|
|
|
"73c55749.b6bf7",
|
|
|
|
"4c6af2dc.2504bc"
|
2021-02-28 19:34:48 +01:00
|
|
|
]
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
2021-12-22 17:36:33 +01:00
|
|
|
"id": "2d46da6b.8dc806",
|
|
|
|
"type": "subflow:fdd2168a.835ab8",
|
|
|
|
"z": "e79fd0e1.60f55",
|
|
|
|
"name": "Netflix HTTP Auth",
|
|
|
|
"env": [],
|
|
|
|
"x": 170,
|
|
|
|
"y": 100,
|
2021-02-28 19:34:48 +01:00
|
|
|
"wires": [
|
|
|
|
[
|
2021-12-22 17:36:33 +01:00
|
|
|
"a9e0512d.6cdd7"
|
2021-02-28 19:34:48 +01:00
|
|
|
]
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
2021-12-22 17:36:33 +01:00
|
|
|
"id": "797b306d.21639",
|
|
|
|
"type": "subflow:fdd2168a.835ab8",
|
|
|
|
"z": "e79fd0e1.60f55",
|
|
|
|
"name": "Netflix HTTP Auth",
|
|
|
|
"env": [],
|
|
|
|
"x": 170,
|
|
|
|
"y": 160,
|
|
|
|
"wires": [
|
|
|
|
[
|
|
|
|
"7ddcb19f.58034"
|
|
|
|
]
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": "41d7704e.4f4a48",
|
|
|
|
"type": "change",
|
|
|
|
"z": "e79fd0e1.60f55",
|
|
|
|
"name": "Extract last invoice url",
|
|
|
|
"rules": [
|
|
|
|
{
|
|
|
|
"t": "set",
|
|
|
|
"p": "url",
|
|
|
|
"pt": "msg",
|
|
|
|
"to": "$join([\t 'https://www.netflix.com',\t $lookup($match(payload, /\\/invoice\\/print\\/[^\"]*/), 'match')[0]\t])",
|
|
|
|
"tot": "jsonata"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"action": "",
|
|
|
|
"property": "",
|
|
|
|
"from": "",
|
|
|
|
"to": "",
|
|
|
|
"reg": false,
|
|
|
|
"x": 540,
|
|
|
|
"y": 100,
|
|
|
|
"wires": [
|
|
|
|
[
|
|
|
|
"8e61a051.3430c8",
|
|
|
|
"797b306d.21639"
|
|
|
|
]
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": "97cde9aaf371b9ac",
|
|
|
|
"type": "join",
|
|
|
|
"z": "e79fd0e1.60f55",
|
|
|
|
"name": "",
|
|
|
|
"mode": "custom",
|
|
|
|
"build": "merged",
|
|
|
|
"property": "payload",
|
|
|
|
"propertyType": "msg",
|
|
|
|
"key": "topic",
|
|
|
|
"joiner": "\\n",
|
|
|
|
"joinerType": "str",
|
|
|
|
"accumulate": false,
|
|
|
|
"timeout": "",
|
|
|
|
"count": "3",
|
|
|
|
"reduceRight": false,
|
|
|
|
"reduceExp": "",
|
|
|
|
"reduceInit": "",
|
|
|
|
"reduceInitType": "",
|
|
|
|
"reduceFixup": "",
|
|
|
|
"x": 260,
|
|
|
|
"y": 520,
|
|
|
|
"wires": [
|
|
|
|
[
|
|
|
|
"643c6d17.cec784"
|
|
|
|
]
|
|
|
|
],
|
|
|
|
"info": "NOTE : How the fuck this join require 3 as number of messages and not 2 as expected."
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": "debc0868.c889a",
|
|
|
|
"type": "inject",
|
|
|
|
"z": "34256184.7e2b8e",
|
2021-12-22 22:34:20 +01:00
|
|
|
"name": "Trigger a test",
|
2021-12-22 17:36:33 +01:00
|
|
|
"props": [
|
|
|
|
{
|
|
|
|
"p": "payload"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"repeat": "",
|
|
|
|
"crontab": "",
|
|
|
|
"once": false,
|
|
|
|
"onceDelay": 0.1,
|
|
|
|
"topic": "",
|
|
|
|
"payloadType": "date",
|
2021-12-22 22:34:20 +01:00
|
|
|
"x": 130,
|
2021-12-22 17:36:33 +01:00
|
|
|
"y": 40,
|
|
|
|
"wires": [
|
|
|
|
[
|
|
|
|
"ac7c6734.52f8f"
|
|
|
|
]
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": "cfd9259a.79e2a8",
|
|
|
|
"type": "credentials",
|
|
|
|
"z": "34256184.7e2b8e",
|
|
|
|
"name": "Leeto Credentials",
|
|
|
|
"props": [
|
|
|
|
{
|
|
|
|
"value": "email",
|
|
|
|
"type": "msg"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"value": "password",
|
|
|
|
"type": "msg"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"x": 150,
|
|
|
|
"y": 220,
|
|
|
|
"wires": [
|
|
|
|
[
|
|
|
|
"e1a3a869.cb50a8"
|
|
|
|
]
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": "e1a3a869.cb50a8",
|
|
|
|
"type": "function",
|
|
|
|
"z": "34256184.7e2b8e",
|
|
|
|
"name": "Leeto payload for Login",
|
|
|
|
"func": "msg.headers = {};\nmsg.headers['User-Agent'] = 'Mozilla/5.0 (X11; Linux x86_64; rv:82.0) Gecko/20100101 Firefox/82.0';\nmsg.headers['Content-Type'] = 'application/json';\nmsg.headers['Accept'] = 'application/json, text/plain, */*';\nmsg.headers['Accept-Language'] = 'fr-FR,fr;q=0.5';\nmsg.payload = {\n user: {\n email: msg.email,\n password: msg.password\n }\n}\nreturn msg;",
|
|
|
|
"outputs": 1,
|
|
|
|
"noerr": 0,
|
|
|
|
"initialize": "",
|
|
|
|
"finalize": "",
|
|
|
|
"x": 370,
|
|
|
|
"y": 220,
|
|
|
|
"wires": [
|
|
|
|
[
|
|
|
|
"38582789.81bb28"
|
|
|
|
]
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": "38582789.81bb28",
|
|
|
|
"type": "http request",
|
|
|
|
"z": "34256184.7e2b8e",
|
|
|
|
"name": "Connect to Leeto",
|
|
|
|
"method": "POST",
|
|
|
|
"ret": "obj",
|
|
|
|
"paytoqs": "ignore",
|
|
|
|
"url": "https://api.leeto.co/api/v2/users/sign_in?locale=fr",
|
|
|
|
"tls": "",
|
|
|
|
"persist": false,
|
|
|
|
"proxy": "",
|
|
|
|
"authType": "",
|
|
|
|
"x": 590,
|
|
|
|
"y": 220,
|
|
|
|
"wires": [
|
|
|
|
[
|
|
|
|
"8a8f2737.aa3d"
|
|
|
|
]
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": "ac7c6734.52f8f",
|
|
|
|
"type": "file in",
|
|
|
|
"z": "34256184.7e2b8e",
|
|
|
|
"name": "Test invoice",
|
|
|
|
"filename": "/data/test.pdf",
|
|
|
|
"format": "",
|
|
|
|
"chunk": false,
|
|
|
|
"sendError": false,
|
2021-02-28 19:34:48 +01:00
|
|
|
"encoding": "none",
|
2021-12-22 22:34:20 +01:00
|
|
|
"x": 290,
|
2021-02-28 21:11:53 +01:00
|
|
|
"y": 40,
|
2021-02-28 19:34:48 +01:00
|
|
|
"wires": [
|
|
|
|
[
|
|
|
|
"ee1a1e10.8655a8"
|
|
|
|
]
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": "f5429dca.a2783",
|
|
|
|
"type": "http request",
|
|
|
|
"z": "34256184.7e2b8e",
|
|
|
|
"name": "Leeto Reimbursement Request",
|
|
|
|
"method": "POST",
|
|
|
|
"ret": "obj",
|
|
|
|
"paytoqs": "ignore",
|
|
|
|
"url": "",
|
|
|
|
"tls": "",
|
|
|
|
"persist": false,
|
|
|
|
"proxy": "",
|
|
|
|
"authType": "",
|
2021-02-28 21:11:53 +01:00
|
|
|
"x": 650,
|
2021-12-22 17:36:33 +01:00
|
|
|
"y": 440,
|
2021-02-28 19:34:48 +01:00
|
|
|
"wires": [
|
|
|
|
[
|
|
|
|
"337393c6.282844"
|
|
|
|
]
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": "5571d225.8e12dc",
|
|
|
|
"type": "function",
|
|
|
|
"z": "34256184.7e2b8e",
|
|
|
|
"name": "Leeto payload for reimbursement",
|
2021-12-22 17:36:33 +01:00
|
|
|
"func": "msg.headers = {};\nmsg.headers['User-Agent'] = 'Mozilla/5.0 (X11; Linux x86_64; rv:82.0) Gecko/20100101 Firefox/82.0';\nmsg.headers['Content-Type'] = 'multipart/form-data';\nmsg.headers['Accept'] = 'application/json, text/plain, */*';\nmsg.headers['Accept-Language'] = 'fr-FR,fr;q=0.5';\nmsg.headers['Authorization'] = 'Bearer ' + msg.leetoUser.token;\n\nmsg.payload = {\n 'reimbursement_request[user_id]': msg.leetoUser.id,\n 'reimbursement_request[grantable_id]': msg.leetoUser.id,\n 'reimbursement_request[grantable_type]': 'User',\n 'reimbursement_request[quotum_id]': msg.benefit.data[0].quotumId,\n 'reimbursement_request[purchases][][generate_certificate_of_honour]': false,\n // 'reimbursement_request[purchases][][comments_attributes][][user_id]': msg.leetoUser.id,\n // 'reimbursement_request[purchases][][comments_attributes][][organisation_id]': msg.leetoUser.organisation.id,\n // 'reimbursement_request[purchases][][comments_attributes][][body]': 'This a comment',\n 'reimbursement_request[purchases][][purchase_name]': msg.invoice.name,\n 'reimbursement_request[purchases][][amount]': (msg.benefit.data[0].remainingAmount < msg.invoice.amount) ? msg.benefit.data[0].remainingAmount : msg.invoice.amount,\n 'reimbursement_request[purchases][][requested_amount]': msg.invoice.amount,\n 'reimbursement_request[purchases][][receipts_attributes][][image]': {\n value: msg.invoice.file,\n options: {\n filename: msg.invoice.filename,\n contentType: msg.invoice.contentType,\n }\n }\n}\nreturn msg;",
|
2021-02-28 19:34:48 +01:00
|
|
|
"outputs": 1,
|
|
|
|
"noerr": 0,
|
|
|
|
"initialize": "",
|
|
|
|
"finalize": "",
|
2021-12-22 17:36:33 +01:00
|
|
|
"libs": [],
|
2021-02-28 21:11:53 +01:00
|
|
|
"x": 340,
|
2021-12-22 17:36:33 +01:00
|
|
|
"y": 440,
|
2021-02-28 19:34:48 +01:00
|
|
|
"wires": [
|
|
|
|
[
|
2021-12-22 17:36:33 +01:00
|
|
|
"f5429dca.a2783",
|
|
|
|
"a689e897.689f68"
|
2021-02-28 19:34:48 +01:00
|
|
|
]
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": "337393c6.282844",
|
|
|
|
"type": "debug",
|
|
|
|
"z": "34256184.7e2b8e",
|
|
|
|
"name": "",
|
|
|
|
"active": true,
|
|
|
|
"tosidebar": true,
|
|
|
|
"console": false,
|
|
|
|
"tostatus": false,
|
|
|
|
"complete": "true",
|
|
|
|
"targetType": "full",
|
|
|
|
"statusVal": "",
|
|
|
|
"statusType": "auto",
|
2021-02-28 21:11:53 +01:00
|
|
|
"x": 910,
|
2021-12-22 17:36:33 +01:00
|
|
|
"y": 440,
|
2021-02-28 19:34:48 +01:00
|
|
|
"wires": []
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": "38445ef0.73a4ca",
|
|
|
|
"type": "http request",
|
|
|
|
"z": "34256184.7e2b8e",
|
|
|
|
"name": "Leeto get benefit",
|
|
|
|
"method": "GET",
|
|
|
|
"ret": "obj",
|
|
|
|
"paytoqs": "ignore",
|
|
|
|
"url": "",
|
|
|
|
"tls": "",
|
|
|
|
"persist": false,
|
|
|
|
"proxy": "",
|
|
|
|
"authType": "",
|
2021-02-28 21:11:53 +01:00
|
|
|
"x": 550,
|
|
|
|
"y": 320,
|
2021-02-28 19:34:48 +01:00
|
|
|
"wires": [
|
|
|
|
[
|
2021-02-28 21:11:53 +01:00
|
|
|
"9eb06fc.6d8cb1"
|
2021-02-28 19:34:48 +01:00
|
|
|
]
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": "c63deac6.d6ff18",
|
|
|
|
"type": "function",
|
|
|
|
"z": "34256184.7e2b8e",
|
|
|
|
"name": "Leeto payload for get Benefit",
|
2021-02-28 21:11:53 +01:00
|
|
|
"func": "msg.headers = {};\nmsg.headers['User-Agent'] = 'Mozilla/5.0 (X11; Linux x86_64; rv:82.0) Gecko/20100101 Firefox/82.0';\nmsg.headers['Content-Type'] = 'multipart/form-data';\nmsg.headers['Accept'] = 'application/json, text/plain, */*';\nmsg.headers['Accept-Language'] = 'fr-FR,fr;q=0.5';\nmsg.headers['Authorization'] = 'Bearer ' + msg.leetoUser.token;\nreturn msg;",
|
2021-02-28 19:34:48 +01:00
|
|
|
"outputs": 1,
|
|
|
|
"noerr": 0,
|
|
|
|
"initialize": "",
|
|
|
|
"finalize": "",
|
2021-02-28 21:11:53 +01:00
|
|
|
"x": 320,
|
|
|
|
"y": 320,
|
2021-02-28 19:34:48 +01:00
|
|
|
"wires": [
|
|
|
|
[
|
|
|
|
"38445ef0.73a4ca"
|
|
|
|
]
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": "8e087080.9c07c8",
|
|
|
|
"type": "template",
|
|
|
|
"z": "34256184.7e2b8e",
|
|
|
|
"name": "Build URL",
|
|
|
|
"field": "url",
|
|
|
|
"fieldType": "msg",
|
|
|
|
"format": "handlebars",
|
|
|
|
"syntax": "mustache",
|
2021-12-22 17:36:33 +01:00
|
|
|
"template": "https://api.leeto.co/api/v2/organisations/{{leetoUser.organisationId}}/users/{{leetoUser.id}}/quotum_usages?filter[by_state]=active&locale=fr",
|
2021-02-28 19:34:48 +01:00
|
|
|
"output": "str",
|
2021-02-28 21:11:53 +01:00
|
|
|
"x": 120,
|
|
|
|
"y": 320,
|
2021-02-28 19:34:48 +01:00
|
|
|
"wires": [
|
|
|
|
[
|
|
|
|
"c63deac6.d6ff18"
|
|
|
|
]
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": "17d03aa5.9a232d",
|
|
|
|
"type": "template",
|
|
|
|
"z": "34256184.7e2b8e",
|
|
|
|
"name": "Build URL",
|
|
|
|
"field": "url",
|
|
|
|
"fieldType": "msg",
|
|
|
|
"format": "handlebars",
|
|
|
|
"syntax": "mustache",
|
2021-12-22 17:36:33 +01:00
|
|
|
"template": "https://api.leeto.co/api/v2/organisations/{{leetoUser.organisationId}}/reimbursement_requests/bulk_create?locale=fr",
|
2021-02-28 19:34:48 +01:00
|
|
|
"output": "str",
|
2021-02-28 21:11:53 +01:00
|
|
|
"x": 120,
|
2021-12-22 17:36:33 +01:00
|
|
|
"y": 440,
|
2021-02-28 19:34:48 +01:00
|
|
|
"wires": [
|
|
|
|
[
|
|
|
|
"5571d225.8e12dc"
|
|
|
|
]
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": "848ba398.23bef8",
|
|
|
|
"type": "link in",
|
|
|
|
"z": "34256184.7e2b8e",
|
|
|
|
"name": "Trigged from Netflix Last Invoice",
|
2021-12-22 17:36:33 +01:00
|
|
|
"links": [
|
|
|
|
"4c6af2dc.2504bc"
|
|
|
|
],
|
2021-02-28 21:11:53 +01:00
|
|
|
"x": 475,
|
|
|
|
"y": 120,
|
2021-02-28 19:34:48 +01:00
|
|
|
"wires": [
|
|
|
|
[
|
2021-02-28 21:11:53 +01:00
|
|
|
"8a75e7ed.ee7658"
|
2021-02-28 19:34:48 +01:00
|
|
|
]
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": "ee1a1e10.8655a8",
|
|
|
|
"type": "change",
|
|
|
|
"z": "34256184.7e2b8e",
|
|
|
|
"name": "Test payload",
|
|
|
|
"rules": [
|
|
|
|
{
|
|
|
|
"t": "move",
|
|
|
|
"p": "payload",
|
|
|
|
"pt": "msg",
|
|
|
|
"to": "file",
|
|
|
|
"tot": "msg"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"t": "set",
|
|
|
|
"p": "payload",
|
|
|
|
"pt": "msg",
|
|
|
|
"to": "{}",
|
|
|
|
"tot": "json"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"t": "set",
|
|
|
|
"p": "payload.file",
|
|
|
|
"pt": "msg",
|
|
|
|
"to": "file",
|
|
|
|
"tot": "msg"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"t": "set",
|
|
|
|
"p": "payload.filename",
|
|
|
|
"pt": "msg",
|
|
|
|
"to": "test.pdf",
|
|
|
|
"tot": "str"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"t": "set",
|
|
|
|
"p": "payload.amount",
|
|
|
|
"pt": "msg",
|
|
|
|
"to": "0",
|
|
|
|
"tot": "num"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"action": "",
|
|
|
|
"property": "",
|
|
|
|
"from": "",
|
|
|
|
"to": "",
|
|
|
|
"reg": false,
|
2021-12-22 22:34:20 +01:00
|
|
|
"x": 450,
|
2021-02-28 21:11:53 +01:00
|
|
|
"y": 40,
|
2021-02-28 19:34:48 +01:00
|
|
|
"wires": [
|
|
|
|
[
|
2021-02-28 21:11:53 +01:00
|
|
|
"8a75e7ed.ee7658"
|
2021-02-28 19:34:48 +01:00
|
|
|
]
|
|
|
|
]
|
|
|
|
},
|
2021-02-28 21:11:53 +01:00
|
|
|
{
|
|
|
|
"id": "8a75e7ed.ee7658",
|
|
|
|
"type": "change",
|
|
|
|
"z": "34256184.7e2b8e",
|
|
|
|
"name": "add invoice as message context",
|
|
|
|
"rules": [
|
|
|
|
{
|
|
|
|
"t": "move",
|
|
|
|
"p": "payload",
|
|
|
|
"pt": "msg",
|
|
|
|
"to": "invoice",
|
|
|
|
"tot": "msg"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"action": "",
|
|
|
|
"property": "",
|
|
|
|
"from": "",
|
|
|
|
"to": "",
|
|
|
|
"reg": false,
|
|
|
|
"x": 710,
|
|
|
|
"y": 120,
|
|
|
|
"wires": [
|
|
|
|
[
|
|
|
|
"cfd9259a.79e2a8"
|
|
|
|
]
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": "8a8f2737.aa3d",
|
|
|
|
"type": "change",
|
|
|
|
"z": "34256184.7e2b8e",
|
|
|
|
"name": "set leetoUser as message context",
|
|
|
|
"rules": [
|
|
|
|
{
|
|
|
|
"t": "move",
|
|
|
|
"p": "payload",
|
|
|
|
"pt": "msg",
|
|
|
|
"to": "leetoUser",
|
|
|
|
"tot": "msg"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"action": "",
|
|
|
|
"property": "",
|
|
|
|
"from": "",
|
|
|
|
"to": "",
|
|
|
|
"reg": false,
|
|
|
|
"x": 840,
|
|
|
|
"y": 220,
|
|
|
|
"wires": [
|
|
|
|
[
|
|
|
|
"8e087080.9c07c8"
|
|
|
|
]
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": "9eb06fc.6d8cb1",
|
|
|
|
"type": "change",
|
|
|
|
"z": "34256184.7e2b8e",
|
|
|
|
"name": "set benefit as message context",
|
|
|
|
"rules": [
|
|
|
|
{
|
|
|
|
"t": "move",
|
|
|
|
"p": "payload",
|
|
|
|
"pt": "msg",
|
|
|
|
"to": "benefit",
|
|
|
|
"tot": "msg"
|
2021-12-22 17:36:33 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"t": "set",
|
|
|
|
"p": "parts.id",
|
|
|
|
"pt": "msg",
|
|
|
|
"to": "leeto-infos",
|
|
|
|
"tot": "str"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"t": "set",
|
|
|
|
"p": "parts.index",
|
|
|
|
"pt": "msg",
|
|
|
|
"to": "0",
|
|
|
|
"tot": "str"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"t": "set",
|
|
|
|
"p": "parts.count",
|
|
|
|
"pt": "msg",
|
|
|
|
"to": "2",
|
|
|
|
"tot": "str"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"t": "set",
|
|
|
|
"p": "parts.type",
|
|
|
|
"pt": "msg",
|
|
|
|
"to": "object",
|
|
|
|
"tot": "str"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"t": "set",
|
|
|
|
"p": "parts.key",
|
|
|
|
"pt": "msg",
|
|
|
|
"to": "benefit",
|
|
|
|
"tot": "str"
|
2021-02-28 21:11:53 +01:00
|
|
|
}
|
|
|
|
],
|
|
|
|
"action": "",
|
|
|
|
"property": "",
|
|
|
|
"from": "",
|
|
|
|
"to": "",
|
|
|
|
"reg": false,
|
|
|
|
"x": 790,
|
|
|
|
"y": 320,
|
|
|
|
"wires": [
|
|
|
|
[
|
|
|
|
"17d03aa5.9a232d"
|
|
|
|
]
|
|
|
|
]
|
2021-12-22 17:36:33 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": "a689e897.689f68",
|
|
|
|
"type": "debug",
|
|
|
|
"z": "34256184.7e2b8e",
|
|
|
|
"name": "Payload for leeto",
|
|
|
|
"active": true,
|
|
|
|
"tosidebar": true,
|
|
|
|
"console": false,
|
|
|
|
"tostatus": false,
|
|
|
|
"complete": "true",
|
|
|
|
"targetType": "full",
|
|
|
|
"statusVal": "",
|
|
|
|
"statusType": "auto",
|
|
|
|
"x": 770,
|
|
|
|
"y": 580,
|
|
|
|
"wires": []
|
2021-02-28 19:34:48 +01:00
|
|
|
}
|
|
|
|
]
|