rpay js check order status

master
kira 6 years ago
parent 4d39963f98
commit 2478d14b6e

@ -270,7 +270,7 @@ $(function () {
window.RPayPlus.send("closeLoading", null, null);
pay(resp,function(data){
if(data == 'success'){
location.href = '/api/v1.0/rpay/partners/' + window.client_moniker + '/orders/' + resp.mch_order_id + '/result'
startCheckOrder(window.order_id, '/api/v1.0/rpay/partners/' + window.client_moniker + '/orders/' + resp.mch_order_id + '/result');
}else if(data == 'fail'){
alert('Oops,Network fluctuation,please try again later...');
}
@ -423,6 +423,25 @@ $(function () {
}
function startCheckOrder(orderId, url) {
function checkOrderStd() {
$.ajax({
url: '/api/v1.0/payment/orders/' + orderId + '/status',
method: 'GET',
dataType: 'json',
success: function (res) {
if (res.paid) {
location.href = url;
} else {
setTimeout(checkOrderStd, 500);
}
}
})
}
checkOrderStd();
}
function getUserId(){
window.RPayPlus.send("getUserId", null, function(data){
window.customerId = data;

Loading…
Cancel
Save