var bbox="";function getTongdunFingerPrint(){!(function(){_fmOpt={partner:'pagsmile',appName:'pagsmile_web',token:'pagsmile'+"-"+new Date().getTime()+"-"+Math.random().toString(16).substr(2),fpHost:'https://usfp.tongdun.net',fmb:true,success:function(data){bbox=data;},};var fm=document.createElement('script');fm.type='text/javascript';fm.async=true;fm.src='https://static.tongdun.net/us/fm.js?ver=0.1&t='+(new Date().getTime()/3600000).toFixed(0);var s=document.getElementsByTagName('script')[0];s.parentNode.insertBefore(fm,s);String.prototype.trim||!function(){var e=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;String.prototype.trim=function(){return this.replace(e,"")}}();var JSON=JSON||{};JSON.parse||!function(){JSON.parse=function(obj){"use strict";return eval("("+obj+")")}}(),JSON.stringify||!function(){JSON.stringify=function(e){var t=typeof e;if("object"!=t||null===e)return "string"==t&&(e='"'+e+'"'),String(e);var n,r,o=[],i=e&&e.constructor==Array;for(n in e)r=e[n],t=typeof r,"string"==t?r='"'+r+'"':"object"==t&&null!==r&&(r=JSON.stringify(r)),"function"!==t&&o.push((i?"":'"'+n+'":')+String(r));return(i?"[":"{")+String(o)+(i?"]":"}")}}(),Array.prototype.filter||!function(){Array.prototype.filter=function(e){"use strict";if(void 0===this||null===this)throw new TypeError;var t=Object(this),n=t.length>>>0;if("function"!=typeof e)throw new TypeError;for(var r=[],o=arguments.length>=2?arguments[1]:void 0,i=0;n>i;i++) if(i in t){var a=t[i];e.call(o,a,i,t)&&r.push(a)}return r}}(),Array.prototype.forEach||(Array.prototype.forEach=function(e,t){"use strict";var n,r;if(null==this)throw new TypeError("this is null or not defined");var o,i=Object(this),a=i.length>>>0;if("[object Function]"!=={}.toString.call(e))throw new TypeError(e+" is not a function");for(arguments.length>=2&&(n=t),r=0;a>r;)r in i&&(o=i[r],e.call(n,o,r,i)),r++}),document.querySelectorAll||!function(){document.querySelectorAll=function(e){var t,n=document.createElement("style"),r=[];for(document.documentElement.firstChild.appendChild(n),document._qsa=[],n.styleSheet.cssText=e+"{x-qsa:expression(document._qsa && document._qsa.push(this))}",window.scrollBy(0,0),n.parentNode.removeChild(n);document._qsa.length;)t=document._qsa.shift(),t.style.removeAttribute("x-qsa"),r.push(t);return document._qsa=null,r}}(),document.querySelector||!function(){document.querySelector=function(e){var t=document.querySelectorAll(e);return t.length?t[0]:null}}()})()} function getForterFingerPrint(siteID){try{document.addEventListener("ftr:tokenReady",function(evt){bbox=evt.detail;});(function(){var eu="22g4zl{5jf5fjtlv1forxgiurqw1qhw2vwdwxv";var siteId=siteID;function t(t,e){for(var n=t.split(""),r=0;r0&&l<12?siteId.charAt(l++):F.id.charAt(v);var m=d.split(".");if(m.length>1){var h=m[0],w=m[1];A=c+T+h+"."+s+"."+w;break;} if(r.indexOf(S.toLowerCase())>=0){var p=n.getResponseHeader(S),g=t(p,-_-1);window.ftr__altd=g;} j(E.dUAL),setTimeout(f,U,E.dUAL);}}}}catch(t){}},function(t,e){i(e?E.uAS+E.cP:E.uAS);});} function f(t){try{var e=t===E.uDF?L:A;if(!e)return;c(e,void 0,function(){try{Q(),i(t+E.uS);}catch(t){}},function(e){try{Q(),(F.td=1*new Date()-F.ts),i(e?t+E.uF+E.cP:t+E.uF),t===E.uDF&&d();}catch(t){i(E.eUoe);}});}catch(e){i(t+E.eTlu);}} var s="fort",v="erTo",l="ken",m=s+v+l,h=10,w={write:function(t,e,n,r){void 0===r&&(r=!0);var o,i;if((n?((o=new Date()),o.setTime(o.getTime()+24*n*60*60*1e3),(i="; expires="+o.toGMTString())):(i=""),!r)) return void(document.cookie=escape(t)+"="+escape(e)+i+"; path=/");for(var a=1,c=document.domain.split("."),u=h,d=!0;d&&c.length>=a&&u>0;){var f=c.slice(-a).join(".");document.cookie=escape(t)+"="+escape(e)+i+"; path=/; domain="+f;var s=w.read(t);(null!=s&&s==e)||((f="."+f),(document.cookie=escape(t)+"="+escape(e)+i+"; path=/; domain="+f)),(d=-1===document.cookie.indexOf(t+"="+e)),a++,u--;}},read:function(t){var e=null;try{for(var n=escape(t)+"=",r=document.cookie.split(";"),o=32,i=0;i>8)&255]+ n[(t>>16)&255]+ n[(t>>24)&255]+ a+ n[255&e]+ n[(e>>8)&255]+ a+ n[((e>>16)&15)|64]+ n[(e>>24)&255]+ a+ n[(63&r)|128]+ n[(r>>8)&255]+ a+ n[(r>>16)&255]+ n[(r>>24)&255]+ n[255&o]+ n[(o>>8)&255]+ n[(o>>16)&255]+ n[(o>>24)&255]);},i=function(){if(window.Uint32Array&&window.crypto&&window.crypto.getRandomValues){var t=new window.Uint32Array(4);return(window.crypto.getRandomValues(t),{d0:t[0],d1:t[1],d2:t[2],d3:t[3],});} return{d0:(4294967296*Math.random())>>>0,d1:(4294967296*Math.random())>>>0,d2:(4294967296*Math.random())>>>0,d3:(4294967296*Math.random())>>>0,};},a=function(){var t="",e=function(t,e){for(var n="",r=t;r>0;--r)n+=e.charAt((1e3*Math.random())%e.length);return n;};return(t+=e(2,"0123456789")),(t+=e(1,"123456789")),(t+=e(8,"0123456789"));};return((t.safeGenerateNoDash=function(){try{var t=i();return o(t.d0,t.d1,t.d2,t.d3,!1);}catch(t){try{return e+a();}catch(t){}}}),(t.isValidNumericalToken=function(t){return(t&&t.toString().length<=11&&t.length>=9&&parseInt(t,10).toString().length<=11&&parseInt(t,10).toString().length>=9);}),(t.isValidUUIDToken=function(t){return t&&32===t.toString().length&&/^[a-z0-9]+$/.test(t);}),(t.isValidFGUToken=function(t){return 0==t.indexOf(e)&&t.length>=12;}),t);})(),E={uDF:"UDF",dUAL:"dUAL",uAS:"UAS",mLd:"1",eTlu:"2",eUoe:"3",uS:"4",uF:"9",tmos:["T5","T10","T15","T30","T60"],tmosSecs:[5,10,15,30,60],bIR:"43",uB:"u",uBr:"b",cP:"c",nIL:"i",s:"s",},C=function(t,e){for(var n=E.tmos,r=0;r0){cb({status:-1,message:formErrorRes.join("; ")})}else{var auth=this.state.auth;var pagsmile_env=this.state.pagsmile_env;var data={"app_id":auth.pagsmile_app_id,"version":"2.0","card":{"valid_thru_year":formData._year,"valid_thru_month":formData._month,"cvv":formData._cvv,"card_no":formData._card_no,"holder":{"name":formData._name,"identification":{"type":formData._doc_type,"number":formData._doc_number}}},"timestamp":new Date(+new Date()+8*3600*1000).toJSON().substr(0,19).replace("T"," ")} if(this.state.pagsmileFormSubmit){return false;} this.createXhr(auth,data,pagsmile_env,function(res){var res=JSON.parse(res);if(res.code==10000){document.querySelector("#pagsmileToken").setAttribute('value',res.token) document.querySelector("#pagsmileFingerprint").setAttribute('value',bbox) cb&&cb({status:200,message:"create token success"})}else{cb&&cb({status:res.code,message:res.msg})}})}},createTokenSync(formEle,sync,cb){var formErrorRes=this.verifyFormData().formError;var formData=this.verifyFormData().formData;if(formErrorRes.length>0){cb({status:-1,message:formErrorRes.join("; ")})}else{var auth=this.state.auth;var pagsmile_env=this.state.pagsmile_env;var data={"app_id":auth.pagsmile_app_id,"version":"2.0","card":{"valid_thru_year":formData._year,"valid_thru_month":formData._month,"cvv":formData._cvv,"card_no":formData._card_no,"holder":{"name":formData._name,"identification":{"type":formData._doc_type,"number":formData._doc_number}}},"timestamp":new Date(+new Date()+8*3600*1000).toJSON().substr(0,19).replace("T"," ")} if(this.state.pagsmileFormSubmit){return false;} return this.createXhrSync(auth,data,pagsmile_env,function(res){if(!bbox){return{status:500,message:"Initialization failed, please try again"}} var res=JSON.parse(res);if(res.code==10000){document.querySelector("#pagsmileToken").setAttribute('value',res.token) document.querySelector("#pagsmileFingerprint").setAttribute('value',bbox) cb&&cb({status:200,message:"create token success"}) return{token:res.token,fingerprint:bbox}}else{cb&&cb({status:res.code,message:res.msg}) return{}}},sync)}},preRequisites:{loadScript:function(url,id){return new Promise((resolve,reject)=>{const existingScript=document.getElementById(id);if(!existingScript){const script=document.createElement("script");script.src=url;script.id=id;document.body.appendChild(script);script.onload=()=>{resolve();};script.onerror=()=>{reject();};}else{resolve();}});},loadOneAfterAnother:async function(arr,name){for(let i=0;i