elGringo Posted April 16, 2017 Share Posted April 16, 2017 Hello everyone, need an advice, having code from bank - script + html form I want to open new window from UniGUI APP with script <html> <head> <meta charset="utf-8"> <script src="https://securepay.tinkoff.ru/html/payForm/js/tinkoff.js"></script> <script type="text/javascript"> function makePayment(amount, orderId, description, name, email, phone) { var params = { //Код терминала (обязательный параметр), выдается банком. TerminalKey: "1491989692671DEMO", //Сумма заказа в копейках (обязательный параметр) Amount: amount, //Номер заказа (если не передан, принудительно устанавливается timestamp) OrderId: orderId, //Описание заказа (не обязательный параметр) Description: description, //Дополнительные параметры платежа DATA: "Email=" + email + "|Phone=" + phone + "|Name=" + name, //Флаг открытия платежной формы во фрейме Frame: false }; doPay(params); } makePayment('123', '123', '123', '123', '123', '123'); </script> </html> and give to this window params in spite of '123' - how to do that full code example <html> <head> <script src="https://securepay.tinkoff.ru/html/payForm/js/tinkoff.js"></script> <script type="text/javascript"> function makePayment(amount, orderId, description, name, email, phone) { var params = { //Код терминала (обязательный параметр), выдается банком. TerminalKey: "1491989692671DEMO", //Сумма заказа в копейках (обязательный параметр) Amount: amount, //Номер заказа (если не передан, принудительно устанавливается timestamp) OrderId: orderId, //Описание заказа (не обязательный параметр) Description: description, //Дополнительные параметры платежа DATA: "Email=" + email + "|Phone=" + phone + "|Name=" + name, //Флаг открытия платежной формы во фрейме Frame: false }; doPay(params); } </script> <style> .tinkoffPayRow { display: block; margin: 1%; width: 160px; } </style> </head> <body> <form name="TinkoffPayForm"> <input class="tinkoffPayRow" type="text" placeholder="Сумма заказа" name="paySum"> <input class="tinkoffPayRow" type="hidden" placeholder="Номер заказа" name="payOrder"> <textarea class="tinkoffPayRow" type="text" placeholder="Описание заказа" name="payDesc"></textarea> <input class="tinkoffPayRow" type="text" placeholder="ФИО плательщика" name="payName"> <input class="tinkoffPayRow" type="text" placeholder="E-mail" name="payEmail"> <input class="tinkoffPayRow" type="text" placeholder="Контактный телефон" name="payPhone"> <input class="tinkoffPayRow" type="button" onclick="makePayment(document.TinkoffPayForm.paySum.value.replace(/,/ig,'.') * 100, document.TinkoffPayForm.payOrder.value, document.TinkoffPayForm.payDesc.value, document.TinkoffPayForm.payName.value, document.TinkoffPayForm.payEmail.value, document.TinkoffPayForm.payPhone.value)" value="Оплатить"> </form> </body> </html> Quote Link to comment Share on other sites More sharing options...
mhmda Posted April 16, 2017 Share Posted April 16, 2017 ASK them for a web server, SOAP... more easy for you. Quote Link to comment Share on other sites More sharing options...
elGringo Posted April 16, 2017 Author Share Posted April 16, 2017 doing like this but doesn't work - just need open new window and transfer params there <html> <head> <meta charset="utf-8"> <script src="https://securepay.tinkoff.ru/html/payForm/js/tinkoff.js"></script> <script type="text/javascript"> function makePayment(amount, orderId, description, name, email, phone) { var params = { //Код терминала (обязательный параметр), выдается банком. TerminalKey: "1491989692671DEMO", //Сумма заказа в копейках (обязательный параметр) Amount: amount, //Номер заказа (если не передан, принудительно устанавливается timestamp) OrderId: orderId, //Описание заказа (не обязательный параметр) Description: description, //Дополнительные параметры платежа DATA: "Email=" + email + "|Phone=" + phone + "|Name=" + name, //Флаг открытия платежной формы во фрейме Frame: false }; doPay(params); } function GetParam(search, name){ name=name+"="; var gp=""; if (search!='') { if (search.indexOf (name, 0)!=-1){ var startpos=search.indexOf(name, 0)+name.length; var endpos=search.indexOf("&",startpos); if (endpos<startpos) {endpos=search.length;} var gp=p.substring(startpos,endpos); } else { gp=""; } } else { gp=""; } return gp; } var p=window.location.search; var myAmount=GetParam(p, "amount"); makePayment(myAmount, '123', '123', '123', '123', '123'); </script> </html> Quote Link to comment Share on other sites More sharing options...
elGringo Posted April 16, 2017 Author Share Posted April 16, 2017 Form UniGUI call like that UniSession.AddJS('window.open("/tinkoff.html?amount=123")'); Quote Link to comment Share on other sites More sharing options...
elGringo Posted April 16, 2017 Author Share Posted April 16, 2017 I'm not a very good js coder - what are the ways to transfer params to new window to use them there? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted April 16, 2017 Share Posted April 16, 2017 Hi, Can you try to use this?!: http://forums.unigui.com/index.php?/topic/6739-open-url-on-its-parent-page-by-click-button/&do=findComment&comment=34354 Quote Link to comment Share on other sites More sharing options...
Sherzod Posted April 16, 2017 Share Posted April 16, 2017 Or this: http://forums.unigui.com/index.php?/topic/7629-hide-parameter/&do=findComment&comment=38970 Quote Link to comment Share on other sites More sharing options...
elGringo Posted April 16, 2017 Author Share Posted April 16, 2017 Thnks! I have read it already - I can open new window for the moment, just can't transfer params there and use them to call makePayment(myAmount, '123', '123', '123', '123', '123'); with my params Quote Link to comment Share on other sites More sharing options...
elGringo Posted April 16, 2017 Author Share Posted April 16, 2017 ok, 1 step closer, when I call like this UniSession.AddJS('window.open("/tinkoff.html?amount=123/")'); getting error (see pic) Quote Link to comment Share on other sites More sharing options...
Sherzod Posted April 16, 2017 Share Posted April 16, 2017 Or this: http://forums.unigui.com/index.php?/topic/7629-hide-parameter/&do=findComment&comment=38970 Have you tried to use this approach too? Quote Link to comment Share on other sites More sharing options...
elGringo Posted April 16, 2017 Author Share Posted April 16, 2017 Not yet but i think it will work better then my))) For the moment my approach works if to set ampersand to the end UniSession.AddJS('window.open("/tinkoff.html?amount=123&")'); Now I will test your approach - don't want to give params in the URL! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.