Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jsp/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Realex水电站付款(第6页)_Javascript_Node.js_Angular_Realex Payments Api - Fatal编程技术网

Javascript Realex水电站付款(第6页)

Javascript Realex水电站付款(第6页),javascript,node.js,angular,realex-payments-api,Javascript,Node.js,Angular,Realex Payments Api,我在Angular 6项目中使用rxp js库时遇到问题 所以我在angular.json中添加了rxp js,这样我就可以在组件中使用它,因为库中还没有模块或类型 在我的组件上面 declare let RealexHpp; OnInit我只是从服务器获取JSON来初始化lightbox this.realexJSON = await this.dataService.getRealexJson(); RealexHpp.setHppUrl("https://pay.sandbox.re

我在Angular 6项目中使用rxp js库时遇到问题

所以我在angular.json中添加了rxp js,这样我就可以在组件中使用它,因为库中还没有模块或类型

在我的组件上面

declare let RealexHpp;
OnInit我只是从服务器获取JSON来初始化lightbox

this.realexJSON  = await this.dataService.getRealexJson();

RealexHpp.setHppUrl("https://pay.sandbox.realexpayments.com/pay");
RealexHpp.init("realex-button", 'http://localhost:1337/responseurl', this.realexJSON);
这一切都很完美。我能够添加虚拟卡详细信息并提交付款

这就是问题的症结所在。RXPJS执行一个html post,该post会导致页面重定向到响应url。那么,如何才能不破坏整个用户体验呢

重定向到api响应的任何内容,这样您就可以有一个页面,上面显示重定向回客户端

但这一切都在同一个窗口

因此,我进入了rxp js,添加了一行代码,以便在这样的新窗口中打开表单

//Create a form and submit the hpp response to the merchant's response url
var form = document.createElement("form");
form.setAttribute("method", "POST");
form.setAttribute("action", merchantUrl);
form.setAttribute("target",'_blank');
form.appendChild(internal.createFormHiddenInput("hppResponse", response));
document.body.appendChild(form)
form.submit()
然后它在一个新窗口中打开,服务器响应返回一条消息,说它将重定向回,然后关闭窗口

但现在灯箱还开着

总而言之,对图书馆进行黑客攻击以使其正常工作并不理想

如果不执行html post,就无法处理HPP_托管的_响应。或者至少知道何时收到响应

老实说,Realex并不是真正容易的支付集成