您好我已经在我的离子应用中集成了PayU Money网关。问题是在付款成功之后,我想调用服务器来更新付款状态但是它不会在函数内调用服务:
function iabLoadStop(event,$ionicLoading,$http) {
if (event.url.match("https://payu.herokuapp.com/success")) {
iabRef.executeScript({
code: "document.body.innerHTML"
}, function(values) {
alert(values);
//incase values[0] contains result string
var payId = getValue(values[0], 'mihpayid');
var response = getValue(values[0], 'status');
var c = getValue(values[0], 'unmappedstatus');
//Calling function pyament status
updatePaymentStatus($ionicLoading,$http,payId,response);
});
iabRef.close();
}
}
function updatePaymentStatus($ionicLoading,$http,payId,response){
var apiUrl = 'http://148.251.158.141/EduboldPortalApp/eduboldportal/web/app_dev.php/api/';
$http.post(apiUrl+'student/result/term',{
studentId: '56456456466',
term: 'Term1'
}).then (function (res){ alert(res);
if (res.data.ResponseCode == "1") {
//$scope.showp("Message","Massage Send successfully","Okay")
//$state.go('dashboard')
} else if(res.data.ResponseCode == "0"){
//$state.go('login')
}
})
}
所以在上面的代码中声明:
$http.post(apiUrl+'student/result/term',{});
无效。请帮助解决本
中的问题感谢提前
答案 0 :(得分:0)
将transactionId传递给updatePaymentStatus
if (event.url.match("https://payu.herokuapp.com/success")!== -1) {
//Calling function pyament status
updatePaymentStatus($ionicLoading,$http,$scope.transaction.id,response)
$scope.goBack = false;
iabRef.close();
}