diff --git a/src/main/ui/static/templates/rpay/v1/payment.js b/src/main/ui/static/templates/rpay/v1/payment.js index dfc96b138..67b2625a3 100644 --- a/src/main/ui/static/templates/rpay/v1/payment.js +++ b/src/main/ui/static/templates/rpay/v1/payment.js @@ -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;