function open_vnpayqr(bankCode, qrContent, appLink, appName) { var qrpay = {}; qrpay['VIETCOMBANK'] = { packid: "id561433133", scheme: "vietcombankmobile" }; qrpay['AGRIBANK'] = { packid: "id935944952", scheme: "agribankmobile" }; qrpay['BIDV'] = { packid: "id1061867449", scheme: "bidvsmartbanking" }; qrpay['VIETINBANK'] = { packid: "id689963454", scheme: "vietinbankmobile" }; qrpay['VNPAYEWALLET'] = { packid: "vn.vnpay.smartacccount", scheme: "f5smartaccount" }; qrpay['VIETTELPAY'] = { packid: "id1344204781", scheme: "viettelmoney://action/login?command=VnpayApp2App" }; qrpay['VCBPAY'] = { packid: "id1408592505", scheme: "vcbpaymobile" }; qrpay['SCB'] = { packid: "id954973621", scheme: "scbmobilebanking" }; qrpay['ABBANK'] = { packid: "id1137160023", scheme: "abbankmobile" }; qrpay['SEABANK'] = { packid: "id846407152", scheme: "seabankmobile" }; qrpay['IVB'] = { packid: "id1096963960", scheme: "ivbmobilebanking" }; qrpay['NCB'] = { packid: "id1111830467", scheme: "NCB iziMobile" }; qrpay['VIETBANK'] = { packid: "id1187184693", scheme: "vietbankmobilebanking" }; qrpay['EXIMBANKOMNI'] = { packid: "#", scheme: "com.vnpay.eximbankomnimobile" }; qrpay['OJB'] = { packid: "id1469028843", scheme: "oceanbankmobilebanking" }; qrpay['NAMABANK'] = { packid: "id1227187853", scheme: "namabankmobile" }; qrpay['BAOVIETBANK'] = { packid: "com.vnpay.bvbank", scheme: "baovietmobile" }; qrpay['HDBANK'] = { packid: "id510956975", scheme: "hdbankmobile" }; qrpay['SAIGONBANK'] = { packid: "com.vnpay.sgbank", scheme: "saigonbankmobilebanking" }; qrpay['KIENLONGBANK'] = { packid: "com.vnpay.kienlongbanks", scheme: "kienlongbankmobilebanking" }; qrpay['BIDC'] = { packid: "id1043501726", scheme: "bidcvnmobile" }; qrpay['VIETABANK'] = { packid: "vn.com.vietabank.VietAEbanking", scheme: "vabmobilebanking" }; qrpay['MSBANK'] = { packid: "id436134873", scheme: "#" }; qrpay['SHB'] = { packid: "id538278798", scheme: "shbmobile" }; qrpay['VIB'] = { packid: "id949371011", scheme: "vibmobile" }; qrpay['TPBANK'] = { packid: "id1292194225", scheme: "tpbankmobile" }; qrpay['MBBANK'] = { packid: "id1205807363", scheme: "#" }; qrpay['BACABANK'] = { packid: "id1441408786", scheme: "#" }; qrpay['ACB'] = { packid: "id950141024", scheme: "acbapp" }; qrpay['OCB'] = { packid: "id741965344", scheme: "#" }; qrpay['WOORIBANK'] = { packid: "id1187184693", scheme: "#" }; qrpay['PGBANK'] = { packid: "uat.pgbankApp.pgbank.com.vn", scheme: "pgbankmobile" }; qrpay['PVCOMBANK'] = { packid: "id957284067", scheme: "#" }; qrpay['VIETCAPITALBANK'] = { packid: "id783572880", scheme: "#" }; qrpay['COOPBANK'] = { packid: "com.vnpay.coopbank", scheme: "coopbankmobile" }; qrpay['VBSP'] = { packid: "com.vnpay.NHCSXH", scheme: "vbspmobile" }; qrpay['VNPTPAY'] = { packid: "id1294940479", scheme: "vnptmoneymobile" }; qrpay['GALAXYPAY'] = { packid: "vn.galaxypay.app", scheme: "galaxypay" }; qrpay['VINID'] = { packid: "com.vingroup.VinIDApp.sandbox", scheme: "onepaycheckout" }; qrpay['VIMASS'] = { packid: "id959341649", scheme: "#" }; qrpay['VITING'] = { packid: "vn.vidiva.wallet", scheme: "tingappwallet" }; qrpay['1PAY'] = { packid: "id1345776130", scheme: "#" }; qrpay['APPOTAPAY'] = { packid: "com.appota.wallet", scheme: "appotapay" }; qrpay['9PAY'] = { packid: "com.9payjsc.vn.stg", scheme: "ninepaymobile" }; qrpay['VIVIET'] = { packid: "id1294940479", scheme: "vivietvnpaysandbox" }; qrpay['YOLO'] = { packid: "id1294940479", scheme: "#" }; qrpay['VTCPAY'] = { packid: "com.mobile.vtc.smartAgent", scheme: "com.mobile.vtcpay" }; qrpay['MOBIFONEPAY'] = { packid: "id436134873", scheme: "#" }; qrpay['CBBANK'] = { packid: "cbbank.vn.mobile", scheme: "cbbank" }; qrpay['TIMOBVB'] = { packid: "#", scheme: "#" }; var parser = new UAParser(); var x = parser.getResult(); var d = false; if (x.ua.indexOf("VNPAYAPP") > 0) d = true; if (x.browser.name && (x.browser.name === 'Mobile Safari' || x.browser.name === 'Safari' || d) && navigator.maxTouchPoints && navigator.maxTouchPoints > 2) { if (qrpay[bankCode] != undefined) { var scheme = qrpay[bankCode].scheme; if (scheme != '#') { $(':input[name="btnCancel"]').prop('disabled', true); //variable will check app installed or not //setListener(); //var beforeApp = new Date().valueOf(); //window.location.href = scheme + "://" + qrContent; //var afterApp = new Date().valueOf(); //if (afterApp - beforeApp < 100) { // setTimeout(function () { // window.location = appLink; // }, 25); //} else { // if (timer === null) { // timer = setTimeout(function () { // window.location = appLink; // }, 200); // } //} var change = false; var intervalRedirectApp = setInterval(() => { if (!change) { change = true; clearInterval(intervalRedirectApp); window.location = appLink; } }, 1000); if (scheme.includes("?")) { window.location.href = scheme + "&qrcontent=" + qrContent.replace('?callbackurl', '&callbackurl'); } else { window.location = scheme + "://" + qrContent; } //handle event to check app installed or not window.onblur = function() { change = true; }; window.onfocus = function() { change = false; } return true; } else { //Bank not support $("#messageNotify").html("Quý khách vui lòng mở ứng dụng " + appName + " và quét mã VNPAY-QR tại màn hình để thanh toán"); $('#modalNotifySupportQR').modal("show"); return false; } } } else { //Display Errror $("#messageNotify").html("Quý khách vui lòng sử dụng trình duyệt mặc định của thiết bị"); $('#modalNotifySupportQR').modal("show"); } return false; }