Using Visa Alias for P2P

Our company 42flows.tech made a ready-made case of Visa Direct API on the example of sending money from the user to the user by phone number (p2p).

Flow uses a pallet https://www.npmjs.com/package/@42flows/custom-node-visa-api

Questions about this flow send max@42flows.tech

Developed by 42flows.tech team

[{"id":"243cf85e.3e3af8","type":"tab","label":"VISA SEND MONEY FLOW","disabled":false,"info":""},{"id":"dd135725.e41be8","type":"http in","z":"243cf85e.3e3af8","name":"","url":"/sendMoney","method":"post","upload":false,"swaggerDoc":"","x":150,"y":400,"wires":[["9ddbd012.1c81b","817d7d8c.cadcd"]]},{"id":"4815e363.2c4b8c","type":"http response","z":"243cf85e.3e3af8","name":"","statusCode":"401","headers":{},"x":920,"y":420,"wires":[]},{"id":"9ddbd012.1c81b","type":"debug","z":"243cf85e.3e3af8","name":"/createTransaction","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":390,"y":440,"wires":[]},{"id":"50c1d118.afbad","type":"switch","z":"243cf85e.3e3af8","name":"isTokenValid","property":"req.headers.authorization","propertyType":"msg","rules":[{"t":"eq","v":"authorization","vt":"msg"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":530,"y":400,"wires":[["6615d186.b7842"],["afaef9ec.05b8f8"]]},{"id":"afaef9ec.05b8f8","type":"function","z":"243cf85e.3e3af8","name":"error_description","func":"msg.payload = {\n    \"error_code\": 401,\n    \"error_description\": \"Invalid authorization token\"\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":730,"y":420,"wires":[["4815e363.2c4b8c"]]},{"id":"6615d186.b7842","type":"change","z":"243cf85e.3e3af8","name":"set params","rules":[{"t":"set","p":"senderPhone","pt":"msg","to":"payload.senderPhone","tot":"msg"},{"t":"set","p":"receiverPhone","pt":"msg","to":"payload.receiverPhone","tot":"msg"},{"t":"set","p":"currency","pt":"msg","to":"payload.currency","tot":"msg"},{"t":"set","p":"amount","pt":"msg","to":"payload.amount","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":710,"y":380,"wires":[["6e7e2adb.438904"]]},{"id":"5c7c0560.094c4c","type":"comment","z":"243cf85e.3e3af8","name":"Get information(sender) by alias","info":"","x":950,"y":340,"wires":[]},{"id":"c0fd8646.084f48","type":"link out","z":"243cf85e.3e3af8","name":"","links":["4f262db5.50c594"],"x":1195,"y":380,"wires":[]},{"id":"4f262db5.50c594","type":"link in","z":"243cf85e.3e3af8","name":"","links":["c0fd8646.084f48","394c40b4.f96e8"],"x":395,"y":560,"wires":[["7ce0a5a0.69d9fc"]]},{"id":"7922b9ee.798908","type":"link out","z":"243cf85e.3e3af8","name":"","links":["a6642921.1ae898"],"x":815,"y":540,"wires":[]},{"id":"a6642921.1ae898","type":"link in","z":"243cf85e.3e3af8","name":"","links":["7922b9ee.798908"],"x":395,"y":740,"wires":[["5bca0972.5cdd48"]]},{"id":"d795d811.ceb8c8","type":"link out","z":"243cf85e.3e3af8","name":"","links":["1be18cd5.04a8c3"],"x":1215,"y":700,"wires":[]},{"id":"1be18cd5.04a8c3","type":"link in","z":"243cf85e.3e3af8","name":"","links":["d795d811.ceb8c8"],"x":395,"y":920,"wires":[["c04d77ad.a0d888"]]},{"id":"6e641f44.b1f75","type":"http response","z":"243cf85e.3e3af8","name":"","statusCode":"200","headers":{},"x":1560,"y":880,"wires":[]},{"id":"464f9068.4e22c","type":"function","z":"243cf85e.3e3af8","name":"description","func":"msg.payload = {\n    \"description\": \"Funds transactions was successful\"\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1390,"y":880,"wires":[["6e641f44.b1f75"]]},{"id":"9237443.08bb4b8","type":"http response","z":"243cf85e.3e3af8","name":"","statusCode":"200","headers":{},"x":1140,"y":1040,"wires":[]},{"id":"d39ddf3a.0e9b7","type":"function","z":"243cf85e.3e3af8","name":"description","func":"msg.payload = {\n    \"description\": \"Reverse funds transaction was successful\"\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":970,"y":1040,"wires":[["9237443.08bb4b8"]]},{"id":"c9328a27.4f65d8","type":"link out","z":"243cf85e.3e3af8","name":"","links":["a984c766.adb968"],"x":1335,"y":920,"wires":[]},{"id":"a984c766.adb968","type":"link in","z":"243cf85e.3e3af8","name":"","links":["c9328a27.4f65d8"],"x":395,"y":1060,"wires":[["6c792270.5fddec"]]},{"id":"19cbfaf3.e14385","type":"http response","z":"243cf85e.3e3af8","name":"","statusCode":"400","headers":{},"x":1180,"y":1080,"wires":[]},{"id":"612e54ff.646e2c","type":"http response","z":"243cf85e.3e3af8","name":"","statusCode":"400","headers":{},"x":1160,"y":940,"wires":[]},{"id":"9b0a3a4f.9b6638","type":"http response","z":"243cf85e.3e3af8","name":"","statusCode":"400","headers":{},"x":1080,"y":760,"wires":[]},{"id":"47b625eb.d4f16c","type":"http response","z":"243cf85e.3e3af8","name":"","statusCode":"400","headers":{},"x":1460,"y":740,"wires":[]},{"id":"349d5d2.153f0a2","type":"http response","z":"243cf85e.3e3af8","name":"","statusCode":"400","headers":{},"x":1440,"y":420,"wires":[]},{"id":"2d7dc905.6197c6","type":"function","z":"243cf85e.3e3af8","name":"error_description","func":"msg.payload = {\n    \"error_code\": msg.status,\n    \"error_status\": msg.error.errorCode,\n    \"error_description\": msg.error.message\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1270,"y":420,"wires":[["349d5d2.153f0a2"]]},{"id":"9861cd6d.132b8","type":"http response","z":"243cf85e.3e3af8","name":"","statusCode":"400","headers":{},"x":1060,"y":580,"wires":[]},{"id":"3a8cdc11.3c3804","type":"http response","z":"243cf85e.3e3af8","name":"","statusCode":"401","headers":{},"x":940,"y":200,"wires":[]},{"id":"58660c26.275894","type":"debug","z":"243cf85e.3e3af8","name":"/createAlias","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":390,"y":200,"wires":[]},{"id":"a00dcbc6.3ce008","type":"function","z":"243cf85e.3e3af8","name":"error_description","func":"msg.payload = {\n    \"error_code\": 401,\n    \"error_description\": \"Invalid Node-RED authorization token\"\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":750,"y":200,"wires":[["3a8cdc11.3c3804"]]},{"id":"a4a17c20.9151c","type":"http response","z":"243cf85e.3e3af8","name":"","statusCode":"200","headers":{},"x":1420,"y":80,"wires":[]},{"id":"fcaf73f0.0add6","type":"function","z":"243cf85e.3e3af8","name":"description","func":"msg.payload = {\n    \"description\": \"Alias created successful\"\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1250,"y":80,"wires":[["a4a17c20.9151c"]]},{"id":"75df485c.2cf818","type":"http response","z":"243cf85e.3e3af8","name":"","statusCode":"400","headers":{},"x":1460,"y":120,"wires":[]},{"id":"ba867868.318858","type":"function","z":"243cf85e.3e3af8","name":"error_description","func":"msg.payload = {\n    \"error_code\": msg.status,\n    \"error_status\": msg.error.errorCode,\n    \"error_description\": msg.error.message\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1270,"y":120,"wires":[["75df485c.2cf818"]]},{"id":"33c31bfa.00d564","type":"switch","z":"243cf85e.3e3af8","name":"","property":"payload.aliasType","propertyType":"msg","rules":[{"t":"eq","v":"01","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":710,"y":120,"wires":[["b71db3a8.89d38"],["b72302d.ead9f"]]},{"id":"2eca034f.ef7eec","type":"http response","z":"243cf85e.3e3af8","name":"","statusCode":"400","headers":{},"x":1100,"y":160,"wires":[]},{"id":"b72302d.ead9f","type":"function","z":"243cf85e.3e3af8","name":"error_description","func":"msg.payload = {\n    \"error_code\": 400,\n    \"error_description\": \"Incorrect alias type\"\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":910,"y":160,"wires":[["2eca034f.ef7eec"]]},{"id":"684fca9c.878674","type":"comment","z":"243cf85e.3e3af8","name":"Create alias","info":"Request body must contains \n\n    - guid\n    - country\n    - city\n    - consentDateTime\n    - recipientFirstName\n    - recipientLastName\n    - recipientPrimaryAccountNumber\n    - issuerName\n    - alias\n    - cardType\n    - aliasType\n    - expiryDate\n    - postalCode\n","x":130,"y":120,"wires":[]},{"id":"b71db3a8.89d38","type":"function","z":"243cf85e.3e3af8","name":"set req body","func":"msg.reqBody = msg.payload\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":890,"y":100,"wires":[["db4705c1.ffa368"]]},{"id":"8cb7dea8.3ed84","type":"debug","z":"243cf85e.3e3af8","name":"API response","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1250,"y":40,"wires":[]},{"id":"db4705c1.ffa368","type":"Create alias","z":"243cf85e.3e3af8","name":"","body":"reqBody","bodyType":"msg","x":1070,"y":100,"wires":[["fcaf73f0.0add6","8cb7dea8.3ed84"],["ba867868.318858","8cb7dea8.3ed84"]]},{"id":"dcda8716.7814e8","type":"function","z":"243cf85e.3e3af8","name":"get envs","func":"msg.baseUrl = env.get(\"VISA_API_URL\")\nmsg.authorization = env.get(\"AUTH_TOKEN\")\nmsg.sharedSecret = env.get(\"SHARED_SECRET\")\nmsg.apiKey = env.get(\"API_KEY\")\n\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":380,"y":160,"wires":[["c680e39d.cacb8"]]},{"id":"6d9698d4.a89d58","type":"comment","z":"243cf85e.3e3af8","name":"Send Money","info":"Request body must contains \n\n    - senderPhone,\n    - receiverPhone\n    - currency\n    - amount\n \nAlso you must add in enviroment params information about \n\n    - card acceptor \n    - acquiring \n    - trace audit number\n    - business app id\n    - retrieval reference number","x":130,"y":360,"wires":[]},{"id":"6e7e2adb.438904","type":"function","z":"243cf85e.3e3af8","name":"set req body","func":"msg.reqBody = {\n    \"alias\":msg.senderPhone,\n    \"businessApplicationId\": msg.businessApplicationId,\n    \"aliasType\":\"01\"\n}\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":890,"y":380,"wires":[["c7d52c7c.1f9fe"]]},{"id":"c7d52c7c.1f9fe","type":"Resolve","z":"243cf85e.3e3af8","name":"","body":"reqBody","bodyType":"msg","x":1060,"y":380,"wires":[["c0fd8646.084f48","447dac79.35a844"],["2d7dc905.6197c6","447dac79.35a844"]]},{"id":"7ce0a5a0.69d9fc","type":"function","z":"243cf85e.3e3af8","name":"set req body","func":"msg.senderAccountNumber = msg.payload.recipientPrimaryAccountNumber\nmsg.senderExpiryDate = msg.payload.expiryDate\n\nmsg.reqBody = {\n    \"alias\":msg.receiverPhone,\n    \"businessApplicationId\": msg.businessApplicationId,\n    \"aliasType\":\"01\"\n}\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":510,"y":560,"wires":[["34121b3e.561854"]]},{"id":"34121b3e.561854","type":"Resolve","z":"243cf85e.3e3af8","name":"","body":"reqBody","bodyType":"msg","x":680,"y":560,"wires":[["7922b9ee.798908","38970b1f.383c64"],["38970b1f.383c64","3b32157e.8c295a"]]},{"id":"5bca0972.5cdd48","type":"function","z":"243cf85e.3e3af8","name":"set req body","func":"msg.recieverAccountNumber = msg.payload.recipientPrimaryAccountNumber\n\nmsg.reqBody = {\n  \"cardAcceptor\": {\n    \"address\": {\n      \"country\": msg.cardAcceptor.cardAcceptorCountry,\n      \"zipCode\": msg.cardAcceptor.cardAcceptorZipCode,\n      \"city\": msg.cardAcceptor.cardAcceptorCity,\n      \"state\": msg.cardAcceptor.cardAcceptorState\n    },\n    \"idCode\": msg.cardAcceptor.cardAcceptorIdCode,\n    \"name\": msg.cardAcceptor.cardAcceptorName,\n    \"terminalId\": msg.cardAcceptor.cardAcceptorTerminalId\n  },\n  \"primaryAccountNumber\": msg.recieverAccountNumber,\n  \"addressVerificationResults\": {\n    \"postalCode\": msg.cardAcceptor.cardAcceptorZipCode\n  }\n}\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":510,"y":740,"wires":[["e6632c65.3859b"]]},{"id":"e6632c65.3859b","type":"Card validation","z":"243cf85e.3e3af8","name":"","body":"reqBody","bodyType":"msg","x":700,"y":740,"wires":[["e1189ab8.6e7298","42f6721e.bc600c"],["42f6721e.bc600c","27c79eda.38d382"]]},{"id":"e1189ab8.6e7298","type":"function","z":"243cf85e.3e3af8","name":"set req body","func":"msg.reqBody = {\n  \"cardAcceptor\": {\n    \"address\": {\n      \"country\": msg.cardAcceptor.cardAcceptorCountry,\n      \"zipCode\": msg.cardAcceptor.cardAcceptorZipCode,\n      \"city\": msg.cardAcceptor.cardAcceptorCity,\n      \"state\": msg.cardAcceptor.cardAcceptorState\n    },\n    \"idCode\": msg.cardAcceptor.cardAcceptorIdCode,\n    \"name\": msg.cardAcceptor.cardAcceptorName,\n    \"terminalId\": msg.cardAcceptor.cardAcceptorTerminalId\n  },\n  \"primaryAccountNumber\": msg.senderAccountNumber,\n  \"addressVerificationResults\": {\n    \"postalCode\": msg.cardAcceptor.cardAcceptorZipCode\n  }\n}\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":890,"y":720,"wires":[["218b171.b69d7e8"]]},{"id":"218b171.b69d7e8","type":"Card validation","z":"243cf85e.3e3af8","name":"","body":"reqBody","bodyType":"msg","x":1080,"y":720,"wires":[["d795d811.ceb8c8","6ea14557.92ef0c"],["6ea14557.92ef0c","308902f1.b3f36e"]]},{"id":"2ac9c72b.082818","type":"comment","z":"243cf85e.3e3af8","name":"Card Validation","info":"","x":460,"y":700,"wires":[]},{"id":"1f50833f.67779d","type":"comment","z":"243cf85e.3e3af8","name":"Get information(receiver) by alias","info":"","x":510,"y":520,"wires":[]},{"id":"c2c7a91a.c37548","type":"comment","z":"243cf85e.3e3af8","name":"Create transaction","info":"","x":470,"y":880,"wires":[]},{"id":"e02d17a8.948c68","type":"Pull funds transactions","z":"243cf85e.3e3af8","name":"","body":"reqBody","bodyType":"msg","x":730,"y":920,"wires":[["1b299ef5.0f0681","90f12691.cc19c8"],["90f12691.cc19c8","f540992e.6e7538"]]},{"id":"c04d77ad.a0d888","type":"function","z":"243cf85e.3e3af8","name":"set req body ","func":"//msg.senderAccountNumber = \"4895142232120006\"\n//msg.senderExpiryDate = \"2015-10\"\n\nmsg.reqBody = {\n  \"amount\": msg.amount,\n  \"localTransactionDateTime\": new Date(new Date().toLocaleString(\"en-US\", {timeZone: \"Europe/Kiev\"})).toISOString().slice(0, 19),\n  \"cardAcceptor\": {\n    \"address\": {\n      \"country\": msg.cardAcceptor.cardAcceptorCountry,\n      \"zipCode\": msg.cardAcceptor.cardAcceptorZipCode,\n      \"state\": msg.cardAcceptor.cardAcceptorState\n    },\n    \"idCode\": msg.cardAcceptor.cardAcceptorIdCode,\n    \"name\": msg.cardAcceptor.cardAcceptorName,\n    \"terminalId\": msg.cardAcceptor.cardAcceptorTerminalId\n  },\n  \"acquirerCountryCode\": msg.acqInfo.acquirerCountryCode,\n  \"acquiringBin\": msg.acqInfo.acquiringBin,\n  \"senderCurrencyCode\": msg.currency,\n  \"retrievalReferenceNumber\": msg.retNumber,\n  \"systemsTraceAuditNumber\": msg.traceAuditNumber,\n  \"businessApplicationId\": msg.businessApplicationId,\n  \"senderPrimaryAccountNumber\": msg.senderAccountNumber,\n  \"senderCardExpiryDate\": msg.senderExpiryDate\n}\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":510,"y":920,"wires":[["e02d17a8.948c68"]],"info":"Создания платежа по senderPrimaryAccountNumber\n\nДокументация метода - [https://developer.visa.com/capabilities/visa_direct/reference#tag/Funds-Transfer-API/operation/createPullFundsTransaction_v1%20-%20Latest](Pull Funds Transaction)"},{"id":"76156bb2.fa5f44","type":"Push funds transactions","z":"243cf85e.3e3af8","name":"","body":"reqBody","bodyType":"msg","x":1170,"y":900,"wires":[["464f9068.4e22c","8c0dbb54.77faf8"],["c9328a27.4f65d8","8c0dbb54.77faf8"]]},{"id":"1b299ef5.0f0681","type":"function","z":"243cf85e.3e3af8","name":"set req body ","func":"//msg.senderAccountNumber = \"4653459515756154\"\n//msg.recieverAccountNumber =  \"4957030420210496\"\n\nmsg.reqBody = {\n  \"amount\": msg.amount,\n  \"localTransactionDateTime\": new Date(new Date().toLocaleString(\"en-US\", {timeZone: \"Europe/Kiev\"})).toISOString().slice(0, 19),\n  \"recipientPrimaryAccountNumber\": msg.recieverAccountNumber,\n  \"cardAcceptor\": {\n    \"address\": {\n      \"country\": msg.cardAcceptor.cardAcceptorCountry,\n      \"zipCode\": msg.cardAcceptor.cardAcceptorZipCode,\n      \"state\": msg.cardAcceptor.cardAcceptorState\n    },\n    \"idCode\": msg.cardAcceptor.cardAcceptorIdCode,\n    \"name\": msg.cardAcceptor.cardAcceptorName,\n    \"terminalId\": msg.cardAcceptor.cardAcceptorTerminalId\n  },\n  \"acquirerCountryCode\": msg.acqInfo.acquirerCountryCode,\n  \"acquiringBin\": msg.acqInfo.acquiringBin,\n  \"transactionCurrencyCode\": msg.currency,\n  \"retrievalReferenceNumber\": msg.retNumber,\n  \"systemsTraceAuditNumber\": msg.traceAuditNumber,\n  \"businessApplicationId\": msg.businessApplicationId,\n  \"senderAccountNumber\": msg.senderAccountNumber\n\n}\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":950,"y":900,"wires":[["76156bb2.fa5f44"]],"info":"Проведение платежа по senderPrimaryAccountNumber\n\nДокументация метода - [https://developer.visa.com/capabilities/visa_direct/reference#tag/Funds-Transfer-API/operation/createPushFundsTransaction_v1%20-%20Latest](Push Funds Transaction)"},{"id":"c8dd19e.4cb3de8","type":"Reverse funds transactions","z":"243cf85e.3e3af8","name":"","body":"reqBody","bodyType":"msg","x":740,"y":1060,"wires":[["d39ddf3a.0e9b7","937a4fd4.521a"],["937a4fd4.521a","33f6dd29.68d912"]]},{"id":"6c792270.5fddec","type":"function","z":"243cf85e.3e3af8","name":"set req body","func":"msg.reqBody = {\n  \"amount\": msg.amount,\n  \"localTransactionDateTime\": new Date(new Date().toLocaleString(\"en-US\", {timeZone: \"Europe/Kiev\"})).toISOString().slice(0, 19),\n  \"cardAcceptor\": {\n    \"address\": {\n      \"country\": msg.cardAcceptor.cardAcceptorCountry,\n      \"zipCode\": msg.cardAcceptor.cardAcceptorZipCode,\n      \"state\": msg.cardAcceptor.cardAcceptorState\n    },\n    \"idCode\": msg.cardAcceptor.cardAcceptorIdCode,\n    \"name\": msg.cardAcceptor.cardAcceptorName,\n    \"terminalId\": msg.cardAcceptor.cardAcceptorTerminalId\n  },\n  \"transactionIdentifier\": msg.payload.transactionIdentifier,\n  \"acquirerCountryCode\": msg.acqInfo.acquirerCountryCode,\n  \"acquiringBin\": msg.acqInfo.acquiringBin,\n  \"senderCurrencyCode\": msg.currency,\n   \"retrievalReferenceNumber\": msg.retNumber,\n  \"systemsTraceAuditNumber\": msg.traceAuditNumber,\n  \"businessApplicationId\": \"PP\",\n  \"senderPrimaryAccountNumber\": msg.senderAccountNumber,\n  \"originalDataElements\": {\n    \"transmissionDateTime\": msg.payload.transmissionDateTime,\n    \"systemsTraceAuditNumber\": msg.traceAuditNumber,\n    \"approvalCode\": msg.payload.approvalCode,\n    \"acquiringBin\": msg.acqInfo.acquiringBin\n  }\n}\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":510,"y":1060,"wires":[["c8dd19e.4cb3de8"]],"info":"Возвращения предств по транзакции \n\nДокументация метода - [https://developer.visa.com/capabilities/visa_direct/reference#tag/Funds-Transfer-API/operation/Create%20Reverse%20Funds%20Transaction_v1%20-%20Latest](Reverse Funds Transaction)"},{"id":"7a98b81c.8c65b8","type":"comment","z":"243cf85e.3e3af8","name":"Reverse funds","info":"","x":450,"y":1020,"wires":[]},{"id":"540e0f38.06f1a","type":"comment","z":"243cf85e.3e3af8","name":"Confirm transaction","info":"","x":1150,"y":860,"wires":[]},{"id":"447dac79.35a844","type":"debug","z":"243cf85e.3e3af8","name":"API response","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1250,"y":340,"wires":[]},{"id":"38970b1f.383c64","type":"debug","z":"243cf85e.3e3af8","name":"API response","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":870,"y":500,"wires":[]},{"id":"42f6721e.bc600c","type":"debug","z":"243cf85e.3e3af8","name":"API response","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":890,"y":680,"wires":[]},{"id":"6ea14557.92ef0c","type":"debug","z":"243cf85e.3e3af8","name":"API response","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1266.6666259765625,"y":661.111083984375,"wires":[]},{"id":"90f12691.cc19c8","type":"debug","z":"243cf85e.3e3af8","name":"API response","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":950,"y":860,"wires":[]},{"id":"8c0dbb54.77faf8","type":"debug","z":"243cf85e.3e3af8","name":"API response","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1390,"y":840,"wires":[]},{"id":"937a4fd4.521a","type":"debug","z":"243cf85e.3e3af8","name":"API response","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":970,"y":1000,"wires":[]},{"id":"817d7d8c.cadcd","type":"function","z":"243cf85e.3e3af8","name":"get envs","func":"msg.baseUrl = env.get(\"VISA_API_URL\")\nmsg.authorization = env.get(\"AUTH_TOKEN\")\nmsg.sharedSecret = env.get(\"SHARED_SECRET\")\nmsg.apiKey = env.get(\"API_KEY\")\nmsg.host = env.get(\"HOST\")\n\nmsg.cardAcceptor = JSON.parse(env.get(\"CARD_ACCEPTOR\"))\nmsg.acqInfo = JSON.parse(env.get(\"ACQUIRING_INFO\"))\n\nmsg.retNumber = env.get(\"RET_NUMBER\")\nmsg.traceAuditNumber = env.get(\"TRACE_AUDIT_NUMBER\")\nmsg.businessApplicationId = env.get(\"BUSINESS_APP_ID\")\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":360,"y":400,"wires":[["50c1d118.afbad"]]},{"id":"c680e39d.cacb8","type":"switch","z":"243cf85e.3e3af8","name":"isTokenValid","property":"req.headers.authorization","propertyType":"msg","rules":[{"t":"eq","v":"authorization","vt":"msg"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":550,"y":160,"wires":[["33c31bfa.00d564"],["a00dcbc6.3ce008"]]},{"id":"3b32157e.8c295a","type":"function","z":"243cf85e.3e3af8","name":"error_description","func":"msg.payload = {\n    \"error_code\": msg.status,\n    \"error_status\": msg.error.errorCode,\n    \"error_description\": msg.error.message\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":890,"y":580,"wires":[["9861cd6d.132b8"]]},{"id":"27c79eda.38d382","type":"function","z":"243cf85e.3e3af8","name":"error_description","func":"msg.payload = {\n    \"error_code\": msg.status,\n    \"error_status\": msg.error.errorCode,\n    \"error_description\": msg.error.message\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":910,"y":760,"wires":[["9b0a3a4f.9b6638"]]},{"id":"308902f1.b3f36e","type":"function","z":"243cf85e.3e3af8","name":"error_description","func":"msg.payload = {\n    \"error_code\": msg.status,\n    \"error_status\": msg.error.errorCode,\n    \"error_description\": msg.error.message\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1290,"y":740,"wires":[["47b625eb.d4f16c"]]},{"id":"f540992e.6e7538","type":"function","z":"243cf85e.3e3af8","name":"error_description","func":"msg.payload = {\n    \"error_code\": msg.status,\n    \"error_status\": msg.error.errorCode,\n    \"error_description\": msg.error.message\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":970,"y":940,"wires":[["612e54ff.646e2c"]]},{"id":"33f6dd29.68d912","type":"function","z":"243cf85e.3e3af8","name":"error_description","func":"msg.payload = {\n    \"error_code\": msg.status,\n    \"error_status\": msg.error.errorCode,\n    \"error_description\": msg.error.message\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":990,"y":1080,"wires":[["19cbfaf3.e14385"]]},{"id":"1e454de0.eb3512","type":"http in","z":"243cf85e.3e3af8","name":"","url":"/createPhoneAlias","method":"post","upload":false,"swaggerDoc":"","x":170,"y":160,"wires":[["dcda8716.7814e8","58660c26.275894"]]}]

Flow Info

Created 3 months ago
Updated 2 months, 2 weeks ago
Rating: not yet rated

Actions

Rate:

Node Types

Core
  • change (x1)
  • comment (x8)
  • debug (x10)
  • function (x23)
  • http in (x2)
  • http response (x13)
  • link in (x4)
  • link out (x4)
  • switch (x3)
Other

Tags

  • Visa
  • 42flows.tech
  • VisaDirect
  • VisaAlias
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option