diff --git a/node_red_data/flows.json b/node_red_data/flows.json index 23ec862..2897f79 100644 --- a/node_red_data/flows.json +++ b/node_red_data/flows.json @@ -280,8 +280,8 @@ "topic": "", "payload": "", "payloadType": "date", - "x": 180, - "y": 120, + "x": 120, + "y": 40, "wires": [ [ "ac7c6734.52f8f" @@ -303,8 +303,8 @@ "type": "msg" } ], - "x": 380, - "y": 300, + "x": 150, + "y": 220, "wires": [ [ "e1a3a869.cb50a8" @@ -321,8 +321,8 @@ "noerr": 0, "initialize": "", "finalize": "", - "x": 600, - "y": 300, + "x": 370, + "y": 220, "wires": [ [ "38582789.81bb28" @@ -342,11 +342,11 @@ "persist": false, "proxy": "", "authType": "", - "x": 820, - "y": 300, + "x": 590, + "y": 220, "wires": [ [ - "10c5487b.65eea8" + "8a8f2737.aa3d" ] ] }, @@ -360,97 +360,14 @@ "chunk": false, "sendError": false, "encoding": "none", - "x": 340, - "y": 120, + "x": 270, + "y": 40, "wires": [ [ "ee1a1e10.8655a8" ] ] }, - { - "id": "d7867c95.86491", - "type": "join", - "z": "34256184.7e2b8e", - "name": "", - "mode": "custom", - "build": "object", - "property": "payload", - "propertyType": "msg", - "key": "topic", - "joiner": "\\n", - "joinerType": "str", - "accumulate": false, - "timeout": "", - "count": "3", - "reduceRight": false, - "reduceExp": "", - "reduceInit": "", - "reduceInitType": "num", - "reduceFixup": "", - "x": 560, - "y": 580, - "wires": [ - [ - "17d03aa5.9a232d" - ] - ] - }, - { - "id": "10c5487b.65eea8", - "type": "change", - "z": "34256184.7e2b8e", - "name": "Mark as leetoUser", - "rules": [ - { - "t": "set", - "p": "topic", - "pt": "msg", - "to": "leetoUser", - "tot": "str" - } - ], - "action": "", - "property": "", - "from": "", - "to": "", - "reg": false, - "x": 1040, - "y": 340, - "wires": [ - [ - "d7867c95.86491", - "8e087080.9c07c8" - ] - ] - }, - { - "id": "65bdcfce.0c10e8", - "type": "change", - "z": "34256184.7e2b8e", - "name": "Mark as invoice", - "rules": [ - { - "t": "set", - "p": "topic", - "pt": "msg", - "to": "invoice", - "tot": "str" - } - ], - "action": "", - "property": "", - "from": "", - "to": "", - "reg": false, - "x": 390, - "y": 420, - "wires": [ - [ - "d7867c95.86491" - ] - ] - }, { "id": "f5429dca.a2783", "type": "http request", @@ -464,8 +381,8 @@ "persist": false, "proxy": "", "authType": "", - "x": 780, - "y": 660, + "x": 650, + "y": 420, "wires": [ [ "337393c6.282844" @@ -477,13 +394,13 @@ "type": "function", "z": "34256184.7e2b8e", "name": "Leeto payload for reimbursement", - "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.payload.leetoUser.token;\nmsg.payload = {\n 'reimbursement_request[user_id]': msg.payload.leetoUser.id,\n 'reimbursement_request[grantable_id]': msg.payload.leetoUser.id,\n 'reimbursement_request[grantable_type]': 'User',\n 'reimbursement_request[amount]': msg.payload.invoice.amount,\n 'reimbursement_request[quotum_id]': msg.payload.benefit.data.period.quota[0].id,\n 'reimbursement_request[receipts_attributes][][image]': {\n value: msg.payload.invoice.file,\n options: {\n filename: msg.payload.invoice.filename,\n contentType: msg.payload.invoice.contentType,\n }\n }\n}\nreturn msg;", + "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;\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[amount]': msg.invoice.amount,\n 'reimbursement_request[quotum_id]': msg.benefit.data.period.quota[0].id,\n 'reimbursement_request[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;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", - "x": 490, - "y": 660, + "x": 340, + "y": 420, "wires": [ [ "f5429dca.a2783" @@ -503,8 +420,8 @@ "targetType": "full", "statusVal": "", "statusType": "auto", - "x": 980, - "y": 660, + "x": 910, + "y": 420, "wires": [] }, { @@ -520,38 +437,11 @@ "persist": false, "proxy": "", "authType": "", - "x": 1080, - "y": 440, + "x": 550, + "y": 320, "wires": [ [ - "6cb603b8.f9a93c" - ] - ] - }, - { - "id": "6cb603b8.f9a93c", - "type": "change", - "z": "34256184.7e2b8e", - "name": "Mark as benefit", - "rules": [ - { - "t": "set", - "p": "topic", - "pt": "msg", - "to": "benefit", - "tot": "str" - } - ], - "action": "", - "property": "", - "from": "", - "to": "", - "reg": false, - "x": 1090, - "y": 520, - "wires": [ - [ - "d7867c95.86491" + "9eb06fc.6d8cb1" ] ] }, @@ -560,13 +450,13 @@ "type": "function", "z": "34256184.7e2b8e", "name": "Leeto payload for get Benefit", - "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.payload.token;\nreturn msg;", + "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;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", - "x": 850, - "y": 440, + "x": 320, + "y": 320, "wires": [ [ "38445ef0.73a4ca" @@ -582,10 +472,10 @@ "fieldType": "msg", "format": "handlebars", "syntax": "mustache", - "template": "https://api.leeto.co/api/v2/organisations/{{payload.organisationId}}/users/{{payload.id}}/benefits/{{payload.authorizedBenefitIds.0}}?locale=fr", + "template": "https://api.leeto.co/api/v2/organisations/{{leetoUser.organisationId}}/users/{{leetoUser.id}}/benefits/{{leetoUser.authorizedBenefitIds.0}}?locale=fr", "output": "str", - "x": 650, - "y": 440, + "x": 120, + "y": 320, "wires": [ [ "c63deac6.d6ff18" @@ -601,10 +491,10 @@ "fieldType": "msg", "format": "handlebars", "syntax": "mustache", - "template": "https://api.leeto.co/api/v2/organisations/{{payload.leetoUser.organisationId}}/reimbursement_requests?locale=fr", + "template": "https://api.leeto.co/api/v2/organisations/{{leetoUser.organisationId}}/reimbursement_requests?locale=fr", "output": "str", - "x": 270, - "y": 660, + "x": 120, + "y": 420, "wires": [ [ "5571d225.8e12dc" @@ -617,12 +507,11 @@ "z": "34256184.7e2b8e", "name": "Trigged from Netflix Last Invoice", "links": [], - "x": 195, - "y": 360, + "x": 475, + "y": 120, "wires": [ [ - "65bdcfce.0c10e8", - "cfd9259a.79e2a8" + "8a75e7ed.ee7658" ] ] }, @@ -673,12 +562,11 @@ "from": "", "to": "", "reg": false, - "x": 580, - "y": 120, + "x": 430, + "y": 40, "wires": [ [ - "cfd9259a.79e2a8", - "65bdcfce.0c10e8" + "8a75e7ed.ee7658" ] ] }, @@ -911,5 +799,86 @@ "797b306d.21639" ] ] + }, + { + "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" + } + ], + "action": "", + "property": "", + "from": "", + "to": "", + "reg": false, + "x": 790, + "y": 320, + "wires": [ + [ + "17d03aa5.9a232d" + ] + ] } ] \ No newline at end of file