From acbf0552ce6c320539291797c574454a3eb5925f Mon Sep 17 00:00:00 2001 From: mbraidot <mbraidot@buenosaires.gob.ar> Date: Thu, 14 Mar 2019 11:45:26 -0300 Subject: [PATCH] =?UTF-8?q?Proponemos=20recibir=20los=20datos=20de=20verif?= =?UTF-8?q?icaci=C3=B3n=20por=20par=C3=A1metros=20url,=20para=20verificar?= =?UTF-8?q?=20autom=C3=A1ticamente=20mediante=20un=20link?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GUI/lib/js/index.js | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/GUI/lib/js/index.js b/GUI/lib/js/index.js index 646c169..49cf39e 100644 --- a/GUI/lib/js/index.js +++ b/GUI/lib/js/index.js @@ -9,7 +9,7 @@ $(document).ready(function(){ }); }); -var tsa_api = 'http://tsaapi.pp.bfa.local/api/tsa/'; +var tsa_api = 'https://tsaapi.bfa.ar/api/tsa/'; var loader_gif = 'lib/images/ajax-loader.gif'; var ots_api = ''; var deadline_date = new Date('2018-09-03 00:00:00'); @@ -100,7 +100,7 @@ function verify_bfa(ots){ $.ajax({ url: tsa_api + "verify/", type: "POST", - data: {"file_hash" : ots.file_hash, "ots": ots.ots}, + data: {"file_hash" : ots.file_hash, "rd": ots.rd}, dataType: "json", success: function(response){ @@ -115,7 +115,7 @@ function verify_bfa(ots){ message = '<span class="glyphicon ' + icon + '"></span> ' + response.messages; if(!pending){ - message += ' - ots definitivo:' + response.permanent_ots; + message += ' - ots definitivo:' + response.permanent_rd; } $('#response').html(message); @@ -138,4 +138,31 @@ function verify_bfa(ots){ function verify_ots(){ +} + + + + +/* + Verifica un documento automáticamente si se reciben los datos por URL + + @param <string>file_hash: El hash del archivo a verificar + @param <string>rd: El recibo (provisorio o definitivo), + obtenido al momento de hacer stamp + + Ejemplo: https://tsagui.bfa.ar/#tab_3?file_hash=a2e8855f8409045c261970fee2cc162bacba6c9bdf250aa362024386e929d3e7&rd=MXgtYTJlODg1NWY4NDA5MDQ1YzI2MTk3MGZlZTJjYzE2MmJhY2JhNmM5YmRmMjUwYWEzNjIwMjQzODZlOTI5ZDNlNy0zMTg5ZjFhNmU5ZjVmZmQ5ZWIzOTRlZmI5ZDMxNzJmNDk5MDI4ZGU0NmZjMjJiN2QwMGNlZjViYWZhMmYyMDIxMDEtMHgxMDVjYWY0YjAwMzYyMTE1NjRhZThkNGM1NTY3MGQ2NmE0Y2I5ZThlMWNlNGRlN2Y2MGZiMjAzYzI2ZjI0ZDlhLTQxMDA1Nw== +*/ +var url = new URL(window.location.href); +var file_hash = url.searchParams.get("file_hash"); +var rd = url.searchParams.get("rd"); + +console.log('file_hash: ' + file_hash); +console.log('rd: ' + rd); + +if(typeof file_hash != "undefined" && typeof rd != "undefined" + && file_hash != '' && rd != '' + && file_hash != null && rd != null){ + var ots = {"file_hash" : file_hash, "rd": rd}; + console.log(ots); + verify_bfa(ots); } \ No newline at end of file -- GitLab