/* Copyright (c) 2014 Zuora, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to use copy, * modify, merge, publish the Software and to distribute, and sublicense copies of * the Software, provided no fee is charged for the Software. In addition the * rights specified above are conditioned upon the following: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * Zuora, Inc. or any other trademarks of Zuora, Inc. may not be used to endorse * or promote products derived from this Software without specific prior written * permission from Zuora, Inc. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL * ZUORA, INC. BE LIABLE FOR ANY DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ var __z_version="1.3.1";var ifrmId="z_hppm_iframe";var threedRedirected=false;if(!String.prototype.trim){(function(){var a=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;String.prototype.trim=function(){return this.replace(a,"")}})()}if(!Object.keys){Object.keys=(function(){var c=Object.prototype.hasOwnProperty,d=!({toString:null}).propertyIsEnumerable("toString"),b=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],a=b.length;return function(g){if(typeof g!=="object"&&(typeof g!=="function"||g===null)){throw new TypeError("Object.keys called on non-object")}var e=[],h,f;for(h in g){if(c.call(g,h)){e.push(h)}}if(d){for(f=0;f=0){return r}}return e}function k(){return i(g())>=i(a)}function f(){return i(g())>=i(b)}return{getLevel:function(){return g()},debug:function(l){if(console&&console.log&&k()){console.log(l)}},info:function(l){if(console&&console.info&&f()){console.info(l)}},warn:function(l){if(console&&console.warn){console.warn(l)}},error:function(l){if(console&&console.error){console.error(l)}}}})();var ZXD=function(){var f,d,b=1,c,a=this;var e=function(h,g){h=h?h.toLowerCase():h;g=g?g.toLowerCase():g;return h===g};return{postMessage:function(g,i,h){if(!i){return}ZLOG.debug("Posting message[O]: target_url="+i+", payload="+g);h=h||parent;if(a.postMessage){h.postMessage(g,i.replace(/([^:]+:\/\/[^\/]+).*/,"$1"))}else{if(i){h.location=i.replace(/#.*$/,"")+"#"+(+new Date)+(b++)+"&"+g}}},receiveMessage:function(i,h,g){ZLOG.info("Registering callback[O]: source_origin="+h+", allowSubDomain="+g);if(a.postMessage){if(i){c=function(n){function k(s){var t=/^https:\/\/([a-z0-9]+(-[a-z0-9]+)*\.)*zuora\.com$/;if(!t.test(s.toLowerCase())){return false}return true}var m=/^https?:\/\/localhost(:\d{4,5})?$/;function q(s){return m.test(s)}ZLOG.debug("Received message[O]: origin="+n.origin);if(typeof n.origin==="string"&&!(k(n.origin)||q(n.origin))){ZLOG.info("Stopped processing none-zuora message.");return !1}if(Object.prototype.toString.call(h)==="[object Function]"&&h(n.origin)===!1){return !1}if(typeof h==="string"&&!e(n.origin,h)){if(!g){return !1 }else{if(g==="true"){try{if(typeof h==="string"){var r=n.origin.split(".");if(r){var j=r.slice(-2).join(".");var l=h.split(".");var p=l.slice(-2).join(".");if(p.indexOf(j)<=-1){return !1}}}}catch(o){return !1}}else{return !1}}}i(n)}}if(a.addEventListener){a[i?"addEventListener":"removeEventListener"]("message",c,!1)}else{a[i?"attachEvent":"detachEvent"]("onmessage",c)}}else{f&&clearInterval(f);f=null;if(i){f=setInterval(function(){var k=document.location.hash,j=/^#?\d+&/;if(k!==d&&j.test(k)){d=k;i({data:k.replace(j,"")})}},100)}}}}}();var Z=function(){var i="#z-overlay {filter: alpha(opacity=50);opacity:0.5;display:inline-block;position:fixed;top:0;left:0;width:100%;height:100%;background-color: #000;z-index: 1001;}";var u="#z-container {border:1px;float:left; overflow: visible; position: absolute;padding: 0px; display: inline-block; top:5%; left:34%; margin: 0 auto;-webkit-border-radius: 5px;-moz-border-radius: 5px;border-radius:5px;background-color: #FAFAFA; border:1px solid #FAFAFA;border-top-color:#EDEDED;behavior: url(js/PIE.htc);z-index: 1002;}";var h="#z-data {height: 100%; outline: 0px; width: 100%; overflow: visible;display: inline-block;border:1px; -webkit-border-radius: 5px;-moz-border-radius: 5px;border-radius:5px;}";var t="#reset{*, *:before, *:after {display: inline-block;-webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box;}}";var l="#z_hppm_iframe {background-color: #FAFAFA;vertical-align:bottom;z-index:9999;display:block;padding:0px;margin: 0px; border:0px solid #DDD;}";var e="requestPage";var d;var s;var c,o;var b;var n;var w=["tenantId","id","token","signature","key","style","submitEnabled","url"];var j=["creditCardNumber","cardSecurityCode","creditCardExpirationYear","creditCardExpirationMonth","bankAccountNumber","bankAccountName","ipAddress","achBankAccountNumber","achBankABACode"];var r=false;var m={};var f=null;var v=null;function a(x){return x&&typeof x==="function"}function p(x){var y={};for(var z in x){if(x.hasOwnProperty(z)){y[z]=x[z]}}return y}function k(){if(s){s() }}function g(){s=null}function q(x){if(x.currentStyle){return x.currentStyle.display!="none"}else{if(document.defaultView&&document.defaultView.getComputedStyle){return document.defaultView.getComputedStyle(x,null).getPropertyValue("display")!="none"}else{return true}}}ZXD.receiveMessage(function(y){try{var x=y.data;ZLOG.debug("Received message[O]: payload="+x);x=JSON.parse(x);if(x.success){if(a(m.init)){m.init(x)}}else{if(x.success==false){Z.deactivateOverlay("z-overlay");Z.deactivateOverlay("z-container");if(m.init){m.init(x)}}else{if(x.action=="close"){Z.deactivateOverlay("z-overlay");Z.deactivateOverlay("z-container")}else{if(x.action=="resize"){Z.receive(x)}else{if(x.action=="allowScroll"){Z.allowScroll(x)}else{if(x.action=="cardBinInfo"){if(m[x.action]){m[x.action](x)}}}}}}}if(x.action==="validate"&&a(m.validate)){m.validate(x)}else{if(x.action=="customizeErrorMessage"&&a(m.customizeErrorMessage)){m.customizeErrorMessage(x.key,x.code,x.message,x.rawGatewayInfo)}else{if(x.action&&a(m[x.action])){m[x.action](x)}}}}catch(z){return}});return{validateRequiredParams:function(z){var x=w.length;for(index=0;index0){return true}if(x>0){var A=z.indexOf("rv:");return true}return false},validatePCIParams:function(A){var x=j.length;for(index=0;index=0&&n.hasOwnProperty("customizeErrorRequired")&&n.customizeErrorRequired=="true")){var x=JSON.stringify(z,function(B,D){if(B!=""){var C="setField("+B+":"+D+")";Z.post(ifrmId,C)}return D});var y="setField(key:"+b+")";Z.post(ifrmId,y);Z.post(ifrmId,"setField(style:"+n.style+")");if(n.hasOwnProperty("customizeErrorRequired")&&n.customizeErrorRequired=="true"){Z.post(ifrmId,"customizeErrorRequired");n.customizeErrorRequired="false"}}},contains:function(x,z){for(var y=0;y=0.1?20:0; return{resizeCaller:function(j,i,d,h,g,e){ZFB.resizeIframe(j,i,d,h,g,e);if((document.all||document.getElementById)&&b=="no"){var f=document.all?document.all[j]:document.getElementById(j);f.style.display="block"}},resizeIframe:function(g,j,e,i,h,f){var d=document.getElementById(g);if(d){d.style.display="block";d.width=h>0?h:Number(i);d.height=f>0?f:Number(e)}}}}();