From 4b00496ca018744b4b5e296276f5539ca39e36c8 Mon Sep 17 00:00:00 2001 From: Mark Stanford Date: Thu, 22 Oct 2015 10:15:04 +0100 Subject: [PATCH 1/2] ATP-790 - Payment window updates for mobile devices --- dist/rxp-js.js | 247 +++++++++++++++++++++++++-------------------- dist/rxp-js.min.js | 4 +- lib/rxp-hpp.js | 245 ++++++++++++++++++++++++-------------------- package.json | 2 +- 4 files changed, 278 insertions(+), 220 deletions(-) diff --git a/dist/rxp-js.js b/dist/rxp-js.js index 3d56c3a..5ae7ddb 100644 --- a/dist/rxp-js.js +++ b/dist/rxp-js.js @@ -1,4 +1,4 @@ -/*! rxp-js - v1.1.1 - 2015-09-25 +/*! rxp-js - v1.2.0 - 2015-10-22 * The official Realex Payments JS SDK * https://github.com/realexpayments/rxp-js * Licensed MIT @@ -15,9 +15,16 @@ var RealexHpp = (function() { hppUrl = url; }; + var isWindowsMobileOs = /Windows Phone|IEMobile/.test(navigator.userAgent); + var isAndroidOrIOs = /Android|iPad|iPhone|iPod/.test(navigator.userAgent); var isMobileXS = ( (((window.innerWidth > 0) ? window.innerWidth : screen.width) <= 360 ? true : false) || (((window.innerHeight > 0) ? window.innerHeight : screen.Height) <= 360 ? true : false)) ; - var isIOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream; - + + // Display IFrame on WIndows Phone OS mobile devices + var isMobileIFrame = isWindowsMobileOs; + + // For IOs/Android and small screen devices always open in new tab/window + var isMobileNewTab = !isWindowsMobileOs && (isAndroidOrIOs || isMobileXS); + var tabWindow; // Initialising some variables used throughout this file. var RxpLightbox = (function() { @@ -29,9 +36,8 @@ var RealexHpp = (function() { var spinner; var iFrame; var closeButton; - var token; - + function checkDevicesOrientation(){ if(window.orientation === 90 || window.orientation === -90){ return true; @@ -39,12 +45,12 @@ var RealexHpp = (function() { return false; } } - + var isLandscape = checkDevicesOrientation(); - - if(isIOS && isMobileXS || isMobileXS){ + + if(isMobileIFrame){ if(window.addEventListener){ - window.addEventListener("orientationchange", function() { + window.addEventListener("orientationchange", function() { isLandscape = checkDevicesOrientation(); }, false); } @@ -61,8 +67,8 @@ var RealexHpp = (function() { overlay.style.left="0"; overlay.style.transition="all 0.3s ease-in-out"; overlay.style.zIndex="100"; - - if(isIOS && isMobileXS){ + + if(isMobileIFrame){ overlay.style.position="absolute !important"; overlay.style.WebkitOverflowScrolling = "touch"; overlay.style.overflowX = "hidden"; @@ -89,27 +95,56 @@ var RealexHpp = (function() { setTimeout(function(){ closeButton.style.opacity = "1"; },500); - - if(isIOS && isMobileXS || isMobileXS){ + + if(isMobileIFrame){ closeButton.style.position = "absolute"; closeButton.style.float = "right"; closeButton.style.top = "20px"; closeButton.style.left = "initial"; closeButton.style.marginLeft = "0px"; - if(isMobileXS && isLandscape){ - closeButton.style.right = "15% !important"; - }else{ - closeButton.style.right = "20px"; - } + closeButton.style.right = "20px"; } - - closeButton.addEventListener("click", closeModal, true); overlayElement.appendChild(closeButton); } } + function createForm(doc){ + var form = document.createElement("form"); + form.setAttribute("method", "POST"); + form.setAttribute("action", hppUrl); + + for ( var key in token) { + + var hiddenField = document.createElement("input"); + hiddenField.setAttribute("type", "hidden"); + hiddenField.setAttribute("name", key); + hiddenField.setAttribute("value", token[key]); + + form.appendChild(hiddenField); + } + + var hppTemplateType = document.createElement("input"); + hppTemplateType.setAttribute("type", "hidden"); + hppTemplateType.setAttribute("name", "HPP_TEMPLATE_TYPE"); + hppTemplateType.setAttribute("value", "LIGHTBOX"); + + form.appendChild(hppTemplateType); + + var parser = document.createElement('a'); + parser.href = window.location.href; + var hppOriginParam = parser.protocol + '//' + parser.host; + + var hppOrigin = document.createElement("input"); + hppOrigin.setAttribute("type", "hidden"); + hppOrigin.setAttribute("name", "HPP_ORIGIN"); + hppOrigin.setAttribute("value", hppOriginParam); + + form.appendChild(hppOrigin); + return form; + } + function createIFrame() { //Create the spinner @@ -126,7 +161,6 @@ var RealexHpp = (function() { spinner.style.marginLeft="-15px"; spinner.style.top="120px"; - document.body.appendChild(spinner); //Create the iframe @@ -136,10 +170,8 @@ var RealexHpp = (function() { iFrame.setAttribute("height", "85%"); iFrame.setAttribute("frameBorder", "0"); iFrame.setAttribute("width", "360px"); - iFrame.setAttribute("seamless", "seamless"); - iFrame.style.zIndex="10001"; iFrame.style.position="absolute"; iFrame.style.transition="transform 0.5s ease-in-out"; @@ -148,8 +180,7 @@ var RealexHpp = (function() { overlayElement.appendChild(iFrame); - - if(isIOS && isMobileXS || isMobileXS){ + if(isMobileIFrame){ iFrame.style.top = "0px"; iFrame.style.bottom = "0px"; iFrame.style.left = "0px"; @@ -168,7 +199,7 @@ var RealexHpp = (function() { iFrame.style.left="50%"; iFrame.style.marginLeft="-180px"; } - + iFrame.onload = function() { iFrame.style.opacity="1"; iFrame.style.transform="scale(1)"; @@ -179,39 +210,7 @@ var RealexHpp = (function() { createCloseButton(); }; - var form = document.createElement("form"); - form.setAttribute("method", "POST"); - form.setAttribute("action", hppUrl); - - for ( var key in token) { - - var hiddenField = document.createElement("input"); - hiddenField.setAttribute("type", "hidden"); - hiddenField.setAttribute("name", key); - hiddenField.setAttribute("value", token[key]); - - form.appendChild(hiddenField); - } - - var hppTemplateType = document.createElement("input"); - hppTemplateType.setAttribute("type", "hidden"); - hppTemplateType.setAttribute("name", "HPP_TEMPLATE_TYPE"); - hppTemplateType.setAttribute("value", "LIGHTBOX"); - - form.appendChild(hppTemplateType); - - var parser = document.createElement('a'); - parser.href = window.location.href; - var hppOriginParam = parser.protocol + '//' + parser.host; - - var hppOrigin = document.createElement("input"); - hppOrigin.setAttribute("type", "hidden"); - hppOrigin.setAttribute("name", "HPP_ORIGIN"); - hppOrigin.setAttribute("value", hppOriginParam); - - form.appendChild(hppOrigin); - - + var form = createForm(document); if (iFrame.contentWindow.document.body) { iFrame.contentWindow.document.body.appendChild(form); } else { @@ -219,7 +218,21 @@ var RealexHpp = (function() { } form.submit(); + } + + function openWindow() { + tabWindow = window.open(); + var doc = tabWindow.document; + var form = createForm(doc); + + if (doc.body) { + doc.body.appendChild(form); + } else { + doc.appendChild(form); + } + + form.submit(); } function closeModal() { @@ -243,20 +256,23 @@ var RealexHpp = (function() { } }, 300); } - + return { lightbox : function() { - createOverlay(); - createIFrame(); + + if(isMobileNewTab){ + openWindow(); + } else { + createOverlay(); + createIFrame(); + } }, close : function() { closeModal(); }, setToken : function(hppToken) { token = hppToken; - }, - isMobileXS : isMobileXS, - isIOS: isIOS + } }; } @@ -292,55 +308,68 @@ var RealexHpp = (function() { } function receiveMessage(event) { - // check for iframe resize values - if (event.data && JSON.parse(event.data).iframe) { - var iframeWidth = JSON.parse(event.data).iframe.width; - var iframeHeight = JSON.parse(event.data).iframe.height; - - var iFrame = document.getElementById("rxp-frame-" + randomId); - iFrame.setAttribute("width", iframeWidth); - iFrame.setAttribute("height", iframeHeight); - iFrame.style.backgroundColor="#ffffff"; - - if(lightboxInstance.isIOS && lightboxInstance.isMobileXS || lightboxInstance.isMobileXS){ - var overlay = document.getElementById("rxp-overlay-" + randomId); - iFrame.style.marginLeft = "0px"; - iFrame.style.WebkitOverflowScrolling = "touch"; - iFrame.style.overflowX = "scroll"; - iFrame.style.overflowY = "scroll"; - overlay.style.overflowX = "scroll"; - overlay.style.overflowY = "scroll"; - - }else{ - iFrame.style.marginLeft = (parseInt(iframeWidth.replace("px", ""), 10)/2 * -1 ) + "px"; - } - - var closeButton = document.getElementById("rxp-frame-close-" + randomId); - closeButton.style.marginLeft = ((parseInt(iframeWidth.replace("px", ""), 10)/2) -7) + "px"; - } + //Check the origin of the response comes from HPP - else if (getHostnameFromUrl(event.origin) === getHostnameFromUrl(hppUrl)) { + if (getHostnameFromUrl(event.origin) === getHostnameFromUrl(hppUrl)) { - //Close the lightbox - lightboxInstance.close(); - - var response = event.data; + // check for iframe resize values + if (event.data && JSON.parse(event.data).iframe) { + if(!isMobileNewTab){ + var iframeWidth = JSON.parse(event.data).iframe.width; + var iframeHeight = JSON.parse(event.data).iframe.height; + + var iFrame = document.getElementById("rxp-frame-" + randomId); + iFrame.setAttribute("width", iframeWidth); + iFrame.setAttribute("height", iframeHeight); + iFrame.style.backgroundColor="#ffffff"; + + if(isMobileIFrame){ + var overlay = document.getElementById("rxp-overlay-" + randomId); + iFrame.style.marginLeft = "0px"; + iFrame.style.WebkitOverflowScrolling = "touch"; + iFrame.style.overflowX = "scroll"; + iFrame.style.overflowY = "scroll"; + overlay.style.overflowX = "scroll"; + overlay.style.overflowY = "scroll"; + + }else{ + iFrame.style.marginLeft = (parseInt(iframeWidth.replace("px", ""), 10)/2 * -1 ) + "px"; + } - //Create a form and submit the hpp response to the merchant's response url - var form = document.createElement("form"); - form.setAttribute("method", "POST"); - form.setAttribute("action", merchantUrl); - - var hiddenField = document.createElement("input"); - hiddenField.setAttribute("type", "hidden"); - hiddenField.setAttribute("name", "hppResponse"); - hiddenField.setAttribute("value", response); + var closeButton = document.getElementById("rxp-frame-close-" + randomId); + closeButton.style.marginLeft = ((parseInt(iframeWidth.replace("px", ""), 10)/2) -7) + "px"; + } - form.appendChild(hiddenField); - - document.body.appendChild(form); + } else { + + if(isMobileNewTab){ + //Close the new window + if(tabWindow){ + tabWindow.close(); + } + } else { + //Close the lightbox + lightboxInstance.close(); + } + + var response = event.data; - form.submit(); + //Create a form and submit the hpp response to the merchant's response url + var form = document.createElement("form"); + form.setAttribute("method", "POST"); + form.setAttribute("action", merchantUrl); + + var hiddenField = document.createElement("input"); + hiddenField.setAttribute("type", "hidden"); + hiddenField.setAttribute("name", "hppResponse"); + hiddenField.setAttribute("value", response); + + form.appendChild(hiddenField); + + document.body.appendChild(form); + + form.submit(); + } } } diff --git a/dist/rxp-js.min.js b/dist/rxp-js.min.js index 798760a..b885272 100644 --- a/dist/rxp-js.min.js +++ b/dist/rxp-js.min.js @@ -1,6 +1,6 @@ -/*! rxp-js - v1.1.1 - 2015-09-25 +/*! rxp-js - v1.2.0 - 2015-10-22 * The official Realex Payments JS SDK * https://github.com/realexpayments/rxp-js * Licensed MIT */ -var RealexHpp=function(){"use strict";function a(a){var b=document.createElement("a");return b.href=a,b.hostname}var b="https://hpp.realexpayments.com/pay",c=c||Math.random().toString(16).substr(2,8),d=function(a){b=a},e=!(((window.innerWidth>0?window.innerWidth:screen.width)<=360?0:1)&&((window.innerHeight>0?window.innerHeight:screen.Height)<=360?0:1)),f=/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,g=function(){function a(){function a(){return 90===window.orientation||-90===window.orientation?!0:!1}function d(){var a=document.createElement("div");a.setAttribute("id","rxp-overlay-"+c),a.style.position="fixed",a.style.width="100%",a.style.height="100%",a.style.top="0",a.style.left="0",a.style.transition="all 0.3s ease-in-out",a.style.zIndex="100",f&&e&&(a.style.position="absolute !important",a.style.WebkitOverflowScrolling="touch",a.style.overflowX="hidden",a.style.overflowY="scroll"),document.body.appendChild(a),setTimeout(function(){a.style.background="rgba(0, 0, 0, 0.7)"},1),j=a}function g(){null===document.getElementById("rxp-frame-close-"+c)&&(m=document.createElement("img"),m.setAttribute("id","rxp-frame-close-"+c),m.setAttribute("src","data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAARCAYAAAA7bUf6AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJ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arX4+goB9vkyAMh443cOEsIAAcjncuoI4TXWMAmCIGFhCQLAdZ8jym/cRJ+Y5nC5XCYAhINKpZLgSISZgoqh5iiLQrojAFICVwGS7tCfe5DbZzkP56XS4NVxwvTI/vXVVYIDnqmnnX70ZxzjNS8THHooK5hMpxHQIREA+tEfA9djfHR3MHkdx3Hspe9r3B+VzWaj2RESyR2mlCUE4MoGQDdxiwHURq2t94+PO9bMIYyTyDNLwMoM7g8+BfKeYGniyw2MdfSehF3Qmk1IvCc/AgwAaS86Etp38bUAAAAASUVORK5CYII="),m.setAttribute("style","transition: all 0.5s ease-in-out; opacity: 0; float: left; position: absolute; left: 50%; margin-left: 173px; z-index: 99999999; top: 30px;"),setTimeout(function(){m.style.opacity="1"},500),(f&&e||e)&&(m.style.position="absolute",m.style["float"]="right",m.style.top="20px",m.style.left="initial",m.style.marginLeft="0px",e&&o?m.style.right="15% !important":m.style.right="20px"),m.addEventListener("click",i,!0),j.appendChild(m))}function h(){if(k=document.createElement("img"),k.setAttribute("src","data:image/gif;base64,R0lGODlhHAAcAPYAAP////OQHv338fzw4frfwPjIkPzx4/nVq/jKlfe7dv337/vo0fvn0Pzy5/WrVv38+vjDhva2bfzq1fe/f/vkyve8d/WoT/nRpP327ve9e/zs2vrWrPWqVPWtWfvmzve5cvazZvrdvPjKlPfAgPnOnPvp0/zx5fawYfe+ff317PnTp/nMmfvgwvfBgv39/PrXsPSeO/vjx/jJkvzz6PnNm/vkyfnUqfjLl/revvnQoPSfPfSgP/348/nPnvratfrYsvWlSvSbNPrZs/vhw/zv4P306vrXrvzq1/359f369vjHjvSjRvOXLfORIfOQHvjDh/rduvSaM/jEifvlzPzu3v37+Pvixfzr2Pzt3Pa1afa3b/nQovnSpfaxYvjFi/rbt/rcufWsWPjGjfSjRPShQfjChPOUJva0aPa2a/awX/e6dPWnTfWkSPScNve4cPWpUfSdOvOSI/OVKPayZPe9efauW/WpUvOYL/SiQ/OZMfScOPOTJfavXfWmSwAAAAAAACH/C05FV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8SDwAD0VFSKgAP05ONgACPLApKUUujAsesABIek46CkmuAjNFp4IPPIuEQ3p2dDgAJBEmhdAuLikDGljDhTY6OjtZM4guAlRYWFSZhmB9cF3Xhxg0aBjw75ABNVYaGcDACEkDA+EaVUmSJJ8gF2AmgDgRBkWkGQwWlJBA5ViSG3PqOHiTIFIDDwtESkhBqAqRKTgoROJRJAUmRlA8MHoggSEjA16yQKiFiEqMGFgSXaETQcsEKoiSYIlRI0YJdYRMuIkgxYcLCSs0gEVyxcq8K1NhhpQwxCDEgEE3WrQggsPHFCpQcGCNlYKIRUNXyrTA4aIHAigArOAYUrDRhgk0yF1YQQBAChwhGqB6IEbJNCMIpggaAOYKKgwXjAJggSAiAANHbBW6kgMsAN+6q7jWTfxQIAA7AAAAAAAAAAAA"),k.setAttribute("id","rxp-loader-"+c),k.style.left="50%",k.style.position="fixed",k.style.background="#FFFFFF",k.style.borderRadius="50%",k.style.width="30px",k.style.marginLeft="-15px",k.style.zIndex="200",k.style.marginLeft="-15px",k.style.top="120px",document.body.appendChild(k),l=document.createElement("iframe"),l.setAttribute("name","rxp-frame-"+c),l.setAttribute("id","rxp-frame-"+c),l.setAttribute("height","85%"),l.setAttribute("frameBorder","0"),l.setAttribute("width","360px"),l.setAttribute("seamless","seamless"),l.style.zIndex="10001",l.style.position="absolute",l.style.transition="transform 0.5s ease-in-out",l.style.transform="scale(0.7)",l.style.opacity="0",j.appendChild(l),f&&e||e){l.style.top="0px",l.style.bottom="0px",l.style.left="0px",l.style.marginLeft="0px;",l.style.width="100%",l.style.height="100%",l.style.minHeight="100%",l.style.WebkitTransform="translate3d(0,0,0)",l.style.transform="translate3d(0, 0, 0)";var a=document.createElement("meta");a.name="viewport",a.content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0",document.getElementsByTagName("head")[0].appendChild(a)}else l.style.top="40px",l.style.left="50%",l.style.marginLeft="-180px";l.onload=function(){l.style.opacity="1",l.style.transform="scale(1)",k.parentNode&&k.parentNode.removeChild(k),g()};var d=document.createElement("form");d.setAttribute("method","POST"),d.setAttribute("action",b);for(var h in n){var i=document.createElement("input");i.setAttribute("type","hidden"),i.setAttribute("name",h),i.setAttribute("value",n[h]),d.appendChild(i)}var m=document.createElement("input");m.setAttribute("type","hidden"),m.setAttribute("name","HPP_TEMPLATE_TYPE"),m.setAttribute("value","LIGHTBOX"),d.appendChild(m);var o=document.createElement("a");o.href=window.location.href;var p=o.protocol+"//"+o.host,q=document.createElement("input");q.setAttribute("type","hidden"),q.setAttribute("name","HPP_ORIGIN"),q.setAttribute("value",p),d.appendChild(q),l.contentWindow.document.body?l.contentWindow.document.body.appendChild(d):l.contentWindow.document.appendChild(d),d.submit()}function i(){m.parentNode&&m.parentNode.removeChild(m),l.parentNode&&l.parentNode.removeChild(l),k.parentNode&&k.parentNode.removeChild(k),j.className="",setTimeout(function(){j.parentNode&&j.parentNode.removeChild(j)},300)}var j,k,l,m,n,o=a();return(f&&e||e)&&window.addEventListener&&window.addEventListener("orientationchange",function(){o=a()},!1),{lightbox:function(){d(),h()},close:function(){i()},setToken:function(a){n=a},isMobileXS:e,isIOS:f}}var d;return{getInstance:function(b){return d||(d=a()),d.setToken(b),d}}}(),h=function(d,e,f){function h(d){if(d.data&&JSON.parse(d.data).iframe){var f=JSON.parse(d.data).iframe.width,g=JSON.parse(d.data).iframe.height,h=document.getElementById("rxp-frame-"+c);if(h.setAttribute("width",f),h.setAttribute("height",g),h.style.backgroundColor="#ffffff",i.isIOS&&i.isMobileXS||i.isMobileXS){var j=document.getElementById("rxp-overlay-"+c);h.style.marginLeft="0px",h.style.WebkitOverflowScrolling="touch",h.style.overflowX="scroll",h.style.overflowY="scroll",j.style.overflowX="scroll",j.style.overflowY="scroll"}else h.style.marginLeft=parseInt(f.replace("px",""),10)/2*-1+"px";var k=document.getElementById("rxp-frame-close-"+c);k.style.marginLeft=parseInt(f.replace("px",""),10)/2-7+"px"}else if(a(d.origin)===a(b)){i.close();var l=d.data,m=document.createElement("form");m.setAttribute("method","POST"),m.setAttribute("action",e);var n=document.createElement("input");n.setAttribute("type","hidden"),n.setAttribute("name","hppResponse"),n.setAttribute("value",l),m.appendChild(n),document.body.appendChild(m),m.submit()}}var i=g.getInstance(f);document.getElementById(d).addEventListener?document.getElementById(d).addEventListener("click",i.lightbox,!0):document.getElementById(d).attachEvent("onclick",i.lightbox),window.addEventListener?window.addEventListener("message",h,!1):window.attachEvent("message",h)};return{init:h,setHppUrl:d}}(),RealexRemote=function(){"use strict";var a=function(a){if(!/^\d{12,19}$/.test(a))return!1;for(var b=0,c=0,d=0,e=!1,f=a.length-1;f>=0;f--)c=parseInt(a.substring(f,f+1),10),e?(d=2*c,d>9&&(d-=9)):d=c,b+=d,e=!e;var g=b%10;return 0!==g?!1:!0},b=function(a){return a&&a.trim()&&/^[\u0020-\u007E\u00A0-\u00FF]{1,100}$/.test(a)?!0:!1},c=function(a){return/^\d{3}$/.test(a)?!0:!1},d=function(a){return/^\d{4}$/.test(a)?!0:!1},e=function(a){if(!/^\d{4}$/.test(a))return!1;var b=parseInt(a.substring(0,2),10);parseInt(a.substring(2,4),10);return 1>b||b>12?!1:!0},f=function(a){if(!e(a))return!1;var b=parseInt(a.substring(0,2),10),c=parseInt(a.substring(2,4),10),d=new Date,f=d.getMonth()+1,g=d.getFullYear();return g%100>c?!1:c===g%100&&f>b?!1:!0};return{validateCardNumber:a,validateCardHolderName:b,validateCvn:c,validateAmexCvn:d,validateExpiryDateFormat:e,validateExpiryDateNotInPast:f}}(); \ No newline at end of file +var RealexHpp=function(){"use strict";function a(a){var b=document.createElement("a");return b.href=a,b.hostname}var b,c="https://hpp.realexpayments.com/pay",d=d||Math.random().toString(16).substr(2,8),e=function(a){c=a},f=/Windows Phone|IEMobile/.test(navigator.userAgent),g=/Android|iPad|iPhone|iPod/.test(navigator.userAgent),h=!(((window.innerWidth>0?window.innerWidth:screen.width)<=360?0:1)&&((window.innerHeight>0?window.innerHeight:screen.Height)<=360?0:1)),i=f,j=!f&&(g||h),k=function(){function a(){function a(){return 90===window.orientation||-90===window.orientation?!0:!1}function e(){var a=document.createElement("div");a.setAttribute("id","rxp-overlay-"+d),a.style.position="fixed",a.style.width="100%",a.style.height="100%",a.style.top="0",a.style.left="0",a.style.transition="all 0.3s ease-in-out",a.style.zIndex="100",i&&(a.style.position="absolute !important",a.style.WebkitOverflowScrolling="touch",a.style.overflowX="hidden",a.style.overflowY="scroll"),document.body.appendChild(a),setTimeout(function(){a.style.background="rgba(0, 0, 0, 0.7)"},1),m=a}function f(){null===document.getElementById("rxp-frame-close-"+d)&&(p=document.createElement("img"),p.setAttribute("id","rxp-frame-close-"+d),p.setAttribute("src","data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAARCAYAAAA7bUf6AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0i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oGQDdxiwHURq2t94+PO9bMIYyTyDNLwMoM7g8+BfKeYGniyw2MdfSehF3Qmk1IvCc/AgwAaS86Etp38bUAAAAASUVORK5CYII="),p.setAttribute("style","transition: all 0.5s ease-in-out; opacity: 0; float: left; position: absolute; left: 50%; margin-left: 173px; z-index: 99999999; top: 30px;"),setTimeout(function(){p.style.opacity="1"},500),i&&(p.style.position="absolute",p.style["float"]="right",p.style.top="20px",p.style.left="initial",p.style.marginLeft="0px",p.style.right="20px"),p.addEventListener("click",l,!0),m.appendChild(p))}function g(a){var b=document.createElement("form");b.setAttribute("method","POST"),b.setAttribute("action",c);for(var d in q){var e=document.createElement("input");e.setAttribute("type","hidden"),e.setAttribute("name",d),e.setAttribute("value",q[d]),b.appendChild(e)}var f=document.createElement("input");f.setAttribute("type","hidden"),f.setAttribute("name","HPP_TEMPLATE_TYPE"),f.setAttribute("value","LIGHTBOX"),b.appendChild(f);var g=document.createElement("a");g.href=window.location.href;var h=g.protocol+"//"+g.host,i=document.createElement("input");return i.setAttribute("type","hidden"),i.setAttribute("name","HPP_ORIGIN"),i.setAttribute("value",h),b.appendChild(i),b}function h(){if(n=document.createElement("img"),n.setAttribute("src","data:image/gif;base64,R0lGODlhHAAcAPYAAP////OQHv338fzw4frfwPjIkPzx4/nVq/jKlfe7dv337/vo0fvn0Pzy5/WrVv38+vjDhva2bfzq1fe/f/vkyve8d/WoT/nRpP327ve9e/zs2vrWrPWqVPWtWfvmzve5cvazZvrdvPjKlPfAgPnOnPvp0/zx5fawYfe+ff317PnTp/nMmfvgwvfBgv39/PrXsPSeO/vjx/jJkvzz6PnNm/vkyfnUqfjLl/revvnQoPSfPfSgP/348/nPnvratfrYsvWlSvSbNPrZs/vhw/zv4P306vrXrvzq1/359f369vjHjvSjRvOXLfORIfOQHvjDh/rduvSaM/jEifvlzPzu3v37+Pvixfzr2Pzt3Pa1afa3b/nQovnSpfaxYvjFi/rbt/rcufWsWPjGjfSjRPShQfjChPOUJva0aPa2a/awX/e6d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kECQoAAAAsAAAAABwAHAAAB/+AAIKDhIWGh4iGD4mMh1UCjYkNXlWDSQKVgo+Rgkl3HZkCSEmdMwqcgnNOWoI8SDwAD0VFSKgAP05ONgACPLApKUUujAsesABIek46CkmuAjNFp4IPPIuEQ3p2dDgAJBEmhdAuLikDGljDhTY6OjtZM4guAlRYWFSZhmB9cF3Xhxg0aBjw75ABNVYaGcDACEkDA+EaVUmSJJ8gF2AmgDgRBkWkGQwWlJBA5ViSG3PqOHiTIFIDDwtESkhBqAqRKTgoROJRJAUmRlA8MHoggSEjA16yQKiFiEqMGFgSXaETQcsEKoiSYIlRI0YJdYRMuIkgxYcLCSs0gEVyxcq8K1NhhpQwxCDEgEE3WrQggsPHFCpQcGCNlYKIRUNXyrTA4aIHAigArOAYUrDRhgk0yF1YQQBAChwhGqB6IEbJNCMIpggaAOYKKgwXjAJggSAiAANHbBW6kgMsAN+6q7jWTfxQIAA7AAAAAAAAAAAA"),n.setAttribute("id","rxp-loader-"+d),n.style.left="50%",n.style.position="fixed",n.style.background="#FFFFFF",n.style.borderRadius="50%",n.style.width="30px",n.style.marginLeft="-15px",n.style.zIndex="200",n.style.marginLeft="-15px",n.style.top="120px",document.body.appendChild(n),o=document.createElement("iframe"),o.setAttribute("name","rxp-frame-"+d),o.setAttribute("id","rxp-frame-"+d),o.setAttribute("height","85%"),o.setAttribute("frameBorder","0"),o.setAttribute("width","360px"),o.setAttribute("seamless","seamless"),o.style.zIndex="10001",o.style.position="absolute",o.style.transition="transform 0.5s ease-in-out",o.style.transform="scale(0.7)",o.style.opacity="0",m.appendChild(o),i){o.style.top="0px",o.style.bottom="0px",o.style.left="0px",o.style.marginLeft="0px;",o.style.width="100%",o.style.height="100%",o.style.minHeight="100%",o.style.WebkitTransform="translate3d(0,0,0)",o.style.transform="translate3d(0, 0, 0)";var a=document.createElement("meta");a.name="viewport",a.content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0",document.getElementsByTagName("head")[0].appendChild(a)}else o.style.top="40px",o.style.left="50%",o.style.marginLeft="-180px";o.onload=function(){o.style.opacity="1",o.style.transform="scale(1)",n.parentNode&&n.parentNode.removeChild(n),f()};var b=g(document);o.contentWindow.document.body?o.contentWindow.document.body.appendChild(b):o.contentWindow.document.appendChild(b),b.submit()}function k(){b=window.open();var a=b.document,c=g(a);a.body?a.body.appendChild(c):a.appendChild(c),c.submit()}function l(){p.parentNode&&p.parentNode.removeChild(p),o.parentNode&&o.parentNode.removeChild(o),n.parentNode&&n.parentNode.removeChild(n),m.className="",setTimeout(function(){m.parentNode&&m.parentNode.removeChild(m)},300)}var m,n,o,p,q,r=a();return i&&window.addEventListener&&window.addEventListener("orientationchange",function(){r=a()},!1),{lightbox:function(){j?k():(e(),h())},close:function(){l()},setToken:function(a){q=a}}}var e;return{getInstance:function(b){return e||(e=a()),e.setToken(b),e}}}(),l=function(e,f,g){function h(e){if(a(e.origin)===a(c))if(e.data&&JSON.parse(e.data).iframe){if(!j){var g=JSON.parse(e.data).iframe.width,h=JSON.parse(e.data).iframe.height,k=document.getElementById("rxp-frame-"+d);if(k.setAttribute("width",g),k.setAttribute("height",h),k.style.backgroundColor="#ffffff",i){var m=document.getElementById("rxp-overlay-"+d);k.style.marginLeft="0px",k.style.WebkitOverflowScrolling="touch",k.style.overflowX="scroll",k.style.overflowY="scroll",m.style.overflowX="scroll",m.style.overflowY="scroll"}else k.style.marginLeft=parseInt(g.replace("px",""),10)/2*-1+"px";var n=document.getElementById("rxp-frame-close-"+d);n.style.marginLeft=parseInt(g.replace("px",""),10)/2-7+"px"}}else{j?b&&b.close():l.close();var o=e.data,p=document.createElement("form");p.setAttribute("method","POST"),p.setAttribute("action",f);var q=document.createElement("input");q.setAttribute("type","hidden"),q.setAttribute("name","hppResponse"),q.setAttribute("value",o),p.appendChild(q),document.body.appendChild(p),p.submit()}}var l=k.getInstance(g);document.getElementById(e).addEventListener?document.getElementById(e).addEventListener("click",l.lightbox,!0):document.getElementById(e).attachEvent("onclick",l.lightbox),window.addEventListener?window.addEventListener("message",h,!1):window.attachEvent("message",h)};return{init:l,setHppUrl:e}}(),RealexRemote=function(){"use strict";var a=function(a){if(!/^\d{12,19}$/.test(a))return!1;for(var b=0,c=0,d=0,e=!1,f=a.length-1;f>=0;f--)c=parseInt(a.substring(f,f+1),10),e?(d=2*c,d>9&&(d-=9)):d=c,b+=d,e=!e;var g=b%10;return 0!==g?!1:!0},b=function(a){return a&&a.trim()&&/^[\u0020-\u007E\u00A0-\u00FF]{1,100}$/.test(a)?!0:!1},c=function(a){return/^\d{3}$/.test(a)?!0:!1},d=function(a){return/^\d{4}$/.test(a)?!0:!1},e=function(a){if(!/^\d{4}$/.test(a))return!1;var b=parseInt(a.substring(0,2),10);parseInt(a.substring(2,4),10);return 1>b||b>12?!1:!0},f=function(a){if(!e(a))return!1;var b=parseInt(a.substring(0,2),10),c=parseInt(a.substring(2,4),10),d=new Date,f=d.getMonth()+1,g=d.getFullYear();return g%100>c?!1:c===g%100&&f>b?!1:!0};return{validateCardNumber:a,validateCardHolderName:b,validateCvn:c,validateAmexCvn:d,validateExpiryDateFormat:e,validateExpiryDateNotInPast:f}}(); \ No newline at end of file diff --git a/lib/rxp-hpp.js b/lib/rxp-hpp.js index 18a5c47..a116f7e 100644 --- a/lib/rxp-hpp.js +++ b/lib/rxp-hpp.js @@ -11,9 +11,16 @@ var RealexHpp = (function() { hppUrl = url; }; + var isWindowsMobileOs = /Windows Phone|IEMobile/.test(navigator.userAgent); + var isAndroidOrIOs = /Android|iPad|iPhone|iPod/.test(navigator.userAgent); var isMobileXS = ( (((window.innerWidth > 0) ? window.innerWidth : screen.width) <= 360 ? true : false) || (((window.innerHeight > 0) ? window.innerHeight : screen.Height) <= 360 ? true : false)) ; - var isIOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream; - + + // Display IFrame on WIndows Phone OS mobile devices + var isMobileIFrame = isWindowsMobileOs; + + // For IOs/Android and small screen devices always open in new tab/window + var isMobileNewTab = !isWindowsMobileOs && (isAndroidOrIOs || isMobileXS); + var tabWindow; // Initialising some variables used throughout this file. var RxpLightbox = (function() { @@ -25,9 +32,8 @@ var RealexHpp = (function() { var spinner; var iFrame; var closeButton; - var token; - + function checkDevicesOrientation(){ if(window.orientation === 90 || window.orientation === -90){ return true; @@ -35,12 +41,12 @@ var RealexHpp = (function() { return false; } } - + var isLandscape = checkDevicesOrientation(); - - if(isIOS && isMobileXS || isMobileXS){ + + if(isMobileIFrame){ if(window.addEventListener){ - window.addEventListener("orientationchange", function() { + window.addEventListener("orientationchange", function() { isLandscape = checkDevicesOrientation(); }, false); } @@ -57,8 +63,8 @@ var RealexHpp = (function() { overlay.style.left="0"; overlay.style.transition="all 0.3s ease-in-out"; overlay.style.zIndex="100"; - - if(isIOS && isMobileXS){ + + if(isMobileIFrame){ overlay.style.position="absolute !important"; overlay.style.WebkitOverflowScrolling = "touch"; overlay.style.overflowX = "hidden"; @@ -85,27 +91,56 @@ var RealexHpp = (function() { setTimeout(function(){ closeButton.style.opacity = "1"; },500); - - if(isIOS && isMobileXS || isMobileXS){ + + if(isMobileIFrame){ closeButton.style.position = "absolute"; closeButton.style.float = "right"; closeButton.style.top = "20px"; closeButton.style.left = "initial"; closeButton.style.marginLeft = "0px"; - if(isMobileXS && isLandscape){ - closeButton.style.right = "15% !important"; - }else{ - closeButton.style.right = "20px"; - } + closeButton.style.right = "20px"; } - - closeButton.addEventListener("click", closeModal, true); overlayElement.appendChild(closeButton); } } + function createForm(doc){ + var form = document.createElement("form"); + form.setAttribute("method", "POST"); + form.setAttribute("action", hppUrl); + + for ( var key in token) { + + var hiddenField = document.createElement("input"); + hiddenField.setAttribute("type", "hidden"); + hiddenField.setAttribute("name", key); + hiddenField.setAttribute("value", token[key]); + + form.appendChild(hiddenField); + } + + var hppTemplateType = document.createElement("input"); + hppTemplateType.setAttribute("type", "hidden"); + hppTemplateType.setAttribute("name", "HPP_TEMPLATE_TYPE"); + hppTemplateType.setAttribute("value", "LIGHTBOX"); + + form.appendChild(hppTemplateType); + + var parser = document.createElement('a'); + parser.href = window.location.href; + var hppOriginParam = parser.protocol + '//' + parser.host; + + var hppOrigin = document.createElement("input"); + hppOrigin.setAttribute("type", "hidden"); + hppOrigin.setAttribute("name", "HPP_ORIGIN"); + hppOrigin.setAttribute("value", hppOriginParam); + + form.appendChild(hppOrigin); + return form; + } + function createIFrame() { //Create the spinner @@ -122,7 +157,6 @@ var RealexHpp = (function() { spinner.style.marginLeft="-15px"; spinner.style.top="120px"; - document.body.appendChild(spinner); //Create the iframe @@ -132,10 +166,8 @@ var RealexHpp = (function() { iFrame.setAttribute("height", "85%"); iFrame.setAttribute("frameBorder", "0"); iFrame.setAttribute("width", "360px"); - iFrame.setAttribute("seamless", "seamless"); - iFrame.style.zIndex="10001"; iFrame.style.position="absolute"; iFrame.style.transition="transform 0.5s ease-in-out"; @@ -144,8 +176,7 @@ var RealexHpp = (function() { overlayElement.appendChild(iFrame); - - if(isIOS && isMobileXS || isMobileXS){ + if(isMobileIFrame){ iFrame.style.top = "0px"; iFrame.style.bottom = "0px"; iFrame.style.left = "0px"; @@ -164,7 +195,7 @@ var RealexHpp = (function() { iFrame.style.left="50%"; iFrame.style.marginLeft="-180px"; } - + iFrame.onload = function() { iFrame.style.opacity="1"; iFrame.style.transform="scale(1)"; @@ -175,39 +206,7 @@ var RealexHpp = (function() { createCloseButton(); }; - var form = document.createElement("form"); - form.setAttribute("method", "POST"); - form.setAttribute("action", hppUrl); - - for ( var key in token) { - - var hiddenField = document.createElement("input"); - hiddenField.setAttribute("type", "hidden"); - hiddenField.setAttribute("name", key); - hiddenField.setAttribute("value", token[key]); - - form.appendChild(hiddenField); - } - - var hppTemplateType = document.createElement("input"); - hppTemplateType.setAttribute("type", "hidden"); - hppTemplateType.setAttribute("name", "HPP_TEMPLATE_TYPE"); - hppTemplateType.setAttribute("value", "LIGHTBOX"); - - form.appendChild(hppTemplateType); - - var parser = document.createElement('a'); - parser.href = window.location.href; - var hppOriginParam = parser.protocol + '//' + parser.host; - - var hppOrigin = document.createElement("input"); - hppOrigin.setAttribute("type", "hidden"); - hppOrigin.setAttribute("name", "HPP_ORIGIN"); - hppOrigin.setAttribute("value", hppOriginParam); - - form.appendChild(hppOrigin); - - + var form = createForm(document); if (iFrame.contentWindow.document.body) { iFrame.contentWindow.document.body.appendChild(form); } else { @@ -215,7 +214,21 @@ var RealexHpp = (function() { } form.submit(); + } + + function openWindow() { + tabWindow = window.open(); + var doc = tabWindow.document; + var form = createForm(doc); + + if (doc.body) { + doc.body.appendChild(form); + } else { + doc.appendChild(form); + } + + form.submit(); } function closeModal() { @@ -239,20 +252,23 @@ var RealexHpp = (function() { } }, 300); } - + return { lightbox : function() { - createOverlay(); - createIFrame(); + + if(isMobileNewTab){ + openWindow(); + } else { + createOverlay(); + createIFrame(); + } }, close : function() { closeModal(); }, setToken : function(hppToken) { token = hppToken; - }, - isMobileXS : isMobileXS, - isIOS: isIOS + } }; } @@ -288,55 +304,68 @@ var RealexHpp = (function() { } function receiveMessage(event) { - // check for iframe resize values - if (event.data && JSON.parse(event.data).iframe) { - var iframeWidth = JSON.parse(event.data).iframe.width; - var iframeHeight = JSON.parse(event.data).iframe.height; - - var iFrame = document.getElementById("rxp-frame-" + randomId); - iFrame.setAttribute("width", iframeWidth); - iFrame.setAttribute("height", iframeHeight); - iFrame.style.backgroundColor="#ffffff"; - - if(lightboxInstance.isIOS && lightboxInstance.isMobileXS || lightboxInstance.isMobileXS){ - var overlay = document.getElementById("rxp-overlay-" + randomId); - iFrame.style.marginLeft = "0px"; - iFrame.style.WebkitOverflowScrolling = "touch"; - iFrame.style.overflowX = "scroll"; - iFrame.style.overflowY = "scroll"; - overlay.style.overflowX = "scroll"; - overlay.style.overflowY = "scroll"; - - }else{ - iFrame.style.marginLeft = (parseInt(iframeWidth.replace("px", ""), 10)/2 * -1 ) + "px"; - } - - var closeButton = document.getElementById("rxp-frame-close-" + randomId); - closeButton.style.marginLeft = ((parseInt(iframeWidth.replace("px", ""), 10)/2) -7) + "px"; - } + //Check the origin of the response comes from HPP - else if (getHostnameFromUrl(event.origin) === getHostnameFromUrl(hppUrl)) { + if (getHostnameFromUrl(event.origin) === getHostnameFromUrl(hppUrl)) { - //Close the lightbox - lightboxInstance.close(); - - var response = event.data; + // check for iframe resize values + if (event.data && JSON.parse(event.data).iframe) { + if(!isMobileNewTab){ + var iframeWidth = JSON.parse(event.data).iframe.width; + var iframeHeight = JSON.parse(event.data).iframe.height; + + var iFrame = document.getElementById("rxp-frame-" + randomId); + iFrame.setAttribute("width", iframeWidth); + iFrame.setAttribute("height", iframeHeight); + iFrame.style.backgroundColor="#ffffff"; + + if(isMobileIFrame){ + var overlay = document.getElementById("rxp-overlay-" + randomId); + iFrame.style.marginLeft = "0px"; + iFrame.style.WebkitOverflowScrolling = "touch"; + iFrame.style.overflowX = "scroll"; + iFrame.style.overflowY = "scroll"; + overlay.style.overflowX = "scroll"; + overlay.style.overflowY = "scroll"; + + }else{ + iFrame.style.marginLeft = (parseInt(iframeWidth.replace("px", ""), 10)/2 * -1 ) + "px"; + } - //Create a form and submit the hpp response to the merchant's response url - var form = document.createElement("form"); - form.setAttribute("method", "POST"); - form.setAttribute("action", merchantUrl); - - var hiddenField = document.createElement("input"); - hiddenField.setAttribute("type", "hidden"); - hiddenField.setAttribute("name", "hppResponse"); - hiddenField.setAttribute("value", response); + var closeButton = document.getElementById("rxp-frame-close-" + randomId); + closeButton.style.marginLeft = ((parseInt(iframeWidth.replace("px", ""), 10)/2) -7) + "px"; + } - form.appendChild(hiddenField); - - document.body.appendChild(form); + } else { + + if(isMobileNewTab){ + //Close the new window + if(tabWindow){ + tabWindow.close(); + } + } else { + //Close the lightbox + lightboxInstance.close(); + } + + var response = event.data; - form.submit(); + //Create a form and submit the hpp response to the merchant's response url + var form = document.createElement("form"); + form.setAttribute("method", "POST"); + form.setAttribute("action", merchantUrl); + + var hiddenField = document.createElement("input"); + hiddenField.setAttribute("type", "hidden"); + hiddenField.setAttribute("name", "hppResponse"); + hiddenField.setAttribute("value", response); + + form.appendChild(hiddenField); + + document.body.appendChild(form); + + form.submit(); + } } } diff --git a/package.json b/package.json index a2984b4..88b38d3 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "rxp-js", "description": "The official Realex Payments JS SDK", - "version": "1.1.1", + "version": "1.2.0", "homepage": "https://github.com/realexpayments/rxp-js", "author": { "name": "Realex Developer", From 417d940bfadb21bd4518bc9816f5afa75c9eb0c4 Mon Sep 17 00:00:00 2001 From: Mark Stanford Date: Wed, 28 Oct 2015 16:47:56 +0000 Subject: [PATCH 2/2] ATP-790 - iOS 8 viewport fix --- dist/rxp-js.js | 21 ++++++++++++++------- dist/rxp-js.min.js | 4 ++-- lib/rxp-hpp.js | 19 +++++++++++++------ 3 files changed, 29 insertions(+), 15 deletions(-) diff --git a/dist/rxp-js.js b/dist/rxp-js.js index 5ae7ddb..7b28370 100644 --- a/dist/rxp-js.js +++ b/dist/rxp-js.js @@ -1,4 +1,4 @@ -/*! rxp-js - v1.2.0 - 2015-10-22 +/*! rxp-js - v1.2.0 - 2015-10-28 * The official Realex Payments JS SDK * https://github.com/realexpayments/rxp-js * Licensed MIT @@ -222,16 +222,23 @@ var RealexHpp = (function() { function openWindow() { + //open new window tabWindow = window.open(); var doc = tabWindow.document; - var form = createForm(doc); - if (doc.body) { - doc.body.appendChild(form); - } else { - doc.appendChild(form); - } + //add meta tag to new window (needed for iOS 8 bug) + var meta = doc.createElement("meta"); + var name = doc.createAttribute("name"); + name.value="viewport"; + meta.setAttributeNode(name); + var content = doc.createAttribute("content"); + content.value="width=device-width"; + meta.setAttributeNode(content); + doc.head.appendChild(meta); + //create form, append to new window and submit + var form = createForm(doc); + doc.body.appendChild(form); form.submit(); } diff --git a/dist/rxp-js.min.js b/dist/rxp-js.min.js index b885272..977bfa7 100644 --- a/dist/rxp-js.min.js +++ b/dist/rxp-js.min.js @@ -1,6 +1,6 @@ -/*! rxp-js - v1.2.0 - 2015-10-22 +/*! rxp-js - v1.2.0 - 2015-10-28 * The official Realex Payments JS SDK * https://github.com/realexpayments/rxp-js * Licensed MIT */ -var RealexHpp=function(){"use strict";function a(a){var b=document.createElement("a");return b.href=a,b.hostname}var b,c="https://hpp.realexpayments.com/pay",d=d||Math.random().toString(16).substr(2,8),e=function(a){c=a},f=/Windows Phone|IEMobile/.test(navigator.userAgent),g=/Android|iPad|iPhone|iPod/.test(navigator.userAgent),h=!(((window.innerWidth>0?window.innerWidth:screen.width)<=360?0:1)&&((window.innerHeight>0?window.innerHeight:screen.Height)<=360?0:1)),i=f,j=!f&&(g||h),k=function(){function a(){function a(){return 90===window.orientation||-90===window.orientation?!0:!1}function e(){var a=document.createElement("div");a.setAttribute("id","rxp-overlay-"+d),a.style.position="fixed",a.style.width="100%",a.style.height="100%",a.style.top="0",a.style.left="0",a.style.transition="all 0.3s ease-in-out",a.style.zIndex="100",i&&(a.style.position="absolute !important",a.style.WebkitOverflowScrolling="touch",a.style.overflowX="hidden",a.style.overflowY="scroll"),document.body.appendChild(a),setTimeout(function(){a.style.background="rgba(0, 0, 0, 0.7)"},1),m=a}function f(){null===document.getElementById("rxp-frame-close-"+d)&&(p=document.createElement("img"),p.setAttribute("id","rxp-frame-close-"+d),p.setAttribute("src","data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAARCAYAAAA7bUf6AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHR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gfIoAVjBLDZbA4CiJ5+9AdQi/EahibqDTkQx6fRSIHcPwA8Uy9A9Gcc47Xv+w2wzhRDYzqdVihLIbsIiCvP1NNOoX/29FQx3vgOgtt4FyRdCgPRarX4+goB9vkyAMh443cOEsIAAcjncuoI4TXWMAmCIGFhCQLAdZ8jym/cRJ+Y5nC5XCYAhINKpZLgSISZgoqh5iiLQrojAFICVwGS7tCfe5DbZzkP56XS4NVxwvTI/vXVVYIDnqmnnX70ZxzjNS8THHooK5hMpxHQIREA+tEfA9djfHR3MHkdx3Hspe9r3B+VzWaj2RESyR2mlCUE4MoGQDdxiwHURq2t94+PO9bMIYyTyDNLwMoM7g8+BfKeYGniyw2MdfSehF3Qmk1IvCc/AgwAaS86Etp38bUAAAAASUVORK5CYII="),p.setAttribute("style","transition: all 0.5s ease-in-out; opacity: 0; float: left; position: absolute; left: 50%; margin-left: 173px; z-index: 99999999; top: 30px;"),setTimeout(function(){p.style.opacity="1"},500),i&&(p.style.position="absolute",p.style["float"]="right",p.style.top="20px",p.style.left="initial",p.style.marginLeft="0px",p.style.right="20px"),p.addEventListener("click",l,!0),m.appendChild(p))}function g(a){var b=document.createElement("form");b.setAttribute("method","POST"),b.setAttribute("action",c);for(var d in q){var e=document.createElement("input");e.setAttribute("type","hidden"),e.setAttribute("name",d),e.setAttribute("value",q[d]),b.appendChild(e)}var f=document.createElement("input");f.setAttribute("type","hidden"),f.setAttribute("name","HPP_TEMPLATE_TYPE"),f.setAttribute("value","LIGHTBOX"),b.appendChild(f);var g=document.createElement("a");g.href=window.location.href;var h=g.protocol+"//"+g.host,i=document.createElement("input");return i.setAttribute("type","hidden"),i.setAttribute("name","HPP_ORIGIN"),i.setAttribute("value",h),b.appendChild(i),b}function h(){if(n=document.createElement("img"),n.setAttribute("src","data:image/gif;base64,R0lGODlhHAAcAPYAAP////OQHv338fzw4frfwPjIkPzx4/nVq/jKlfe7dv337/vo0fvn0Pzy5/WrVv38+vjDhva2bfzq1fe/f/vkyve8d/WoT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CwtHmIcxQU4fjAYMDFjdiApQSGBU5QgGRjOmEFgQCUMKZf8AKLgBAgiZNvkaURkSo8aUI+wAYJDSYcyONloibexIoYQwQS6oEPgxpOGMXPQOPdjCMFESCgcZHdFiYUROQ0dChCgRkRCFOg4cRMCCiIcGAjhCUDgq6AiHDhWyxShAhJACKFweJJHAAgoFQ1dfrAwQlKRMhAwpfnCZMkXEihqCHmAwUIXRkAgRoLiQgsIHABsrVDRl1OPMDQAPZIzAAcAEjRVzOT2gI+XTjREMBF0RUZMThhyyAGyYYGCQhtaoCJVQMjk3ISQafAtHFAgAIfkECQoAAAAsAAAAABwAHAAAB/+AAIKDhIWGh4iGD4mMh1UCjYkNXlWDSQKVgo+Rgkl3HZkCSEmdMwqcgnNOWoI8SDwAD0VFSKgAP05ONgACPLApKUUujAsesABIek46CkmuAjNFp4IPPIuEQ3p2dDgAJBEmhdAuLikDGljDhTY6OjtZM4guAlRYWFSZhmB9cF3Xhxg0aBjw75ABNVYaGcDACEkDA+EaVUmSJJ8gF2AmgDgRBkWkGQwWlJBA5ViSG3PqOHiTIFIDDwtESkhBqAqRKTgoROJRJAUmRlA8MHoggSEjA16yQKiFiEqMGFgSXaETQcsEKoiSYIlRI0YJdYRMuIkgxYcLCSs0gEVyxcq8K1NhhpQwxCDEgEE3WrQggsPHFCpQcGCNlYKIRUNXyrTA4aIHAigArOAYUrDRhgk0yF1YQQBAChwhGqB6IEbJNCMIpggaAOYKKgwXjAJggSAiAANHbBW6kgMsAN+6q7jWTfxQIAA7AAAAAAAAAAAA"),n.setAttribute("id","rxp-loader-"+d),n.style.left="50%",n.style.position="fixed",n.style.background="#FFFFFF",n.style.borderRadius="50%",n.style.width="30px",n.style.marginLeft="-15px",n.style.zIndex="200",n.style.marginLeft="-15px",n.style.top="120px",document.body.appendChild(n),o=document.createElement("iframe"),o.setAttribute("name","rxp-frame-"+d),o.setAttribute("id","rxp-frame-"+d),o.setAttribute("height","85%"),o.setAttribute("frameBorder","0"),o.setAttribute("width","360px"),o.setAttribute("seamless","seamless"),o.style.zIndex="10001",o.style.position="absolute",o.style.transition="transform 0.5s ease-in-out",o.style.transform="scale(0.7)",o.style.opacity="0",m.appendChild(o),i){o.style.top="0px",o.style.bottom="0px",o.style.left="0px",o.style.marginLeft="0px;",o.style.width="100%",o.style.height="100%",o.style.minHeight="100%",o.style.WebkitTransform="translate3d(0,0,0)",o.style.transform="translate3d(0, 0, 0)";var a=document.createElement("meta");a.name="viewport",a.content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0",document.getElementsByTagName("head")[0].appendChild(a)}else o.style.top="40px",o.style.left="50%",o.style.marginLeft="-180px";o.onload=function(){o.style.opacity="1",o.style.transform="scale(1)",n.parentNode&&n.parentNode.removeChild(n),f()};var b=g(document);o.contentWindow.document.body?o.contentWindow.document.body.appendChild(b):o.contentWindow.document.appendChild(b),b.submit()}function k(){b=window.open();var a=b.document,c=g(a);a.body?a.body.appendChild(c):a.appendChild(c),c.submit()}function l(){p.parentNode&&p.parentNode.removeChild(p),o.parentNode&&o.parentNode.removeChild(o),n.parentNode&&n.parentNode.removeChild(n),m.className="",setTimeout(function(){m.parentNode&&m.parentNode.removeChild(m)},300)}var m,n,o,p,q,r=a();return i&&window.addEventListener&&window.addEventListener("orientationchange",function(){r=a()},!1),{lightbox:function(){j?k():(e(),h())},close:function(){l()},setToken:function(a){q=a}}}var e;return{getInstance:function(b){return e||(e=a()),e.setToken(b),e}}}(),l=function(e,f,g){function h(e){if(a(e.origin)===a(c))if(e.data&&JSON.parse(e.data).iframe){if(!j){var g=JSON.parse(e.data).iframe.width,h=JSON.parse(e.data).iframe.height,k=document.getElementById("rxp-frame-"+d);if(k.setAttribute("width",g),k.setAttribute("height",h),k.style.backgroundColor="#ffffff",i){var m=document.getElementById("rxp-overlay-"+d);k.style.marginLeft="0px",k.style.WebkitOverflowScrolling="touch",k.style.overflowX="scroll",k.style.overflowY="scroll",m.style.overflowX="scroll",m.style.overflowY="scroll"}else k.style.marginLeft=parseInt(g.replace("px",""),10)/2*-1+"px";var n=document.getElementById("rxp-frame-close-"+d);n.style.marginLeft=parseInt(g.replace("px",""),10)/2-7+"px"}}else{j?b&&b.close():l.close();var o=e.data,p=document.createElement("form");p.setAttribute("method","POST"),p.setAttribute("action",f);var q=document.createElement("input");q.setAttribute("type","hidden"),q.setAttribute("name","hppResponse"),q.setAttribute("value",o),p.appendChild(q),document.body.appendChild(p),p.submit()}}var l=k.getInstance(g);document.getElementById(e).addEventListener?document.getElementById(e).addEventListener("click",l.lightbox,!0):document.getElementById(e).attachEvent("onclick",l.lightbox),window.addEventListener?window.addEventListener("message",h,!1):window.attachEvent("message",h)};return{init:l,setHppUrl:e}}(),RealexRemote=function(){"use strict";var a=function(a){if(!/^\d{12,19}$/.test(a))return!1;for(var b=0,c=0,d=0,e=!1,f=a.length-1;f>=0;f--)c=parseInt(a.substring(f,f+1),10),e?(d=2*c,d>9&&(d-=9)):d=c,b+=d,e=!e;var g=b%10;return 0!==g?!1:!0},b=function(a){return a&&a.trim()&&/^[\u0020-\u007E\u00A0-\u00FF]{1,100}$/.test(a)?!0:!1},c=function(a){return/^\d{3}$/.test(a)?!0:!1},d=function(a){return/^\d{4}$/.test(a)?!0:!1},e=function(a){if(!/^\d{4}$/.test(a))return!1;var b=parseInt(a.substring(0,2),10);parseInt(a.substring(2,4),10);return 1>b||b>12?!1:!0},f=function(a){if(!e(a))return!1;var b=parseInt(a.substring(0,2),10),c=parseInt(a.substring(2,4),10),d=new Date,f=d.getMonth()+1,g=d.getFullYear();return g%100>c?!1:c===g%100&&f>b?!1:!0};return{validateCardNumber:a,validateCardHolderName:b,validateCvn:c,validateAmexCvn:d,validateExpiryDateFormat:e,validateExpiryDateNotInPast:f}}(); \ No newline at end of file +var RealexHpp=function(){"use strict";function a(a){var b=document.createElement("a");return b.href=a,b.hostname}var b,c="https://hpp.realexpayments.com/pay",d=d||Math.random().toString(16).substr(2,8),e=function(a){c=a},f=/Windows Phone|IEMobile/.test(navigator.userAgent),g=/Android|iPad|iPhone|iPod/.test(navigator.userAgent),h=!(((window.innerWidth>0?window.innerWidth:screen.width)<=360?0:1)&&((window.innerHeight>0?window.innerHeight:screen.Height)<=360?0:1)),i=f,j=!f&&(g||h),k=function(){function a(){function a(){return 90===window.orientation||-90===window.orientation?!0:!1}function e(){var a=document.createElement("div");a.setAttribute("id","rxp-overlay-"+d),a.style.position="fixed",a.style.width="100%",a.style.height="100%",a.style.top="0",a.style.left="0",a.style.transition="all 0.3s ease-in-out",a.style.zIndex="100",i&&(a.style.position="absolute !important",a.style.WebkitOverflowScrolling="touch",a.style.overflowX="hidden",a.style.overflowY="scroll"),document.body.appendChild(a),setTimeout(function(){a.style.background="rgba(0, 0, 0, 0.7)"},1),m=a}function f(){null===document.getElementById("rxp-frame-close-"+d)&&(p=document.createElement("img"),p.setAttribute("id","rxp-frame-close-"+d),p.setAttribute("src","data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAARCAYAAAA7bUf6AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlL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ISZgoqh5iiLQrojAFICVwGS7tCfe5DbZzkP56XS4NVxwvTI/vXVVYIDnqmnnX70ZxzjNS8THHooK5hMpxHQIREA+tEfA9djfHR3MHkdx3Hspe9r3B+VzWaj2RESyR2mlCUE4MoGQDdxiwHURq2t94+PO9bMIYyTyDNLwMoM7g8+BfKeYGniyw2MdfSehF3Qmk1IvCc/AgwAaS86Etp38bUAAAAASUVORK5CYII="),p.setAttribute("style","transition: all 0.5s ease-in-out; opacity: 0; float: left; position: absolute; left: 50%; margin-left: 173px; z-index: 99999999; top: 30px;"),setTimeout(function(){p.style.opacity="1"},500),i&&(p.style.position="absolute",p.style["float"]="right",p.style.top="20px",p.style.left="initial",p.style.marginLeft="0px",p.style.right="20px"),p.addEventListener("click",l,!0),m.appendChild(p))}function g(a){var b=document.createElement("form");b.setAttribute("method","POST"),b.setAttribute("action",c);for(var d in q){var e=document.createElement("input");e.setAttribute("type","hidden"),e.setAttribute("name",d),e.setAttribute("value",q[d]),b.appendChild(e)}var f=document.createElement("input");f.setAttribute("type","hidden"),f.setAttribute("name","HPP_TEMPLATE_TYPE"),f.setAttribute("value","LIGHTBOX"),b.appendChild(f);var g=document.createElement("a");g.href=window.location.href;var h=g.protocol+"//"+g.host,i=document.createElement("input");return i.setAttribute("type","hidden"),i.setAttribute("name","HPP_ORIGIN"),i.setAttribute("value",h),b.appendChild(i),b}function h(){if(n=document.createElement("img"),n.setAttribute("src","data:image/gif;base64,R0lGODlhHAAcAPYAAP////OQHv338fzw4frfwPjIkPzx4/nVq/jKlfe7dv337/vo0fvn0Pzy5/WrVv38+vjDhva2bfzq1fe/f/vkyve8d/WoT/nRpP327ve9e/zs2vrWrPWqVPWtWfvmzve5cvazZvrdvPjKlPfAgPnOnPvp0/zx5fawYfe+ff317PnTp/nMmfvgwvfBgv39/PrXsPSeO/vjx/jJkvzz6PnNm/vkyfnUqfjLl/revvnQoPSfPfSgP/348/nPnvratfrYsvWlSvSbNPrZs/vhw/zv4P306vrXrvzq1/359f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AwQlKRMhAwpfnCZMkXEihqCHmAwUIXRkAgRoLiQgsIHABsrVDRl1OPMDQAPZIzAAcAEjRVzOT2gI+XTjREMBF0RUZMThhyyAGyYYGCQhtaoCJVQMjk3ISQafAtHFAgAIfkECQoAAAAsAAAAABwAHAAAB/+AAIKDhIWGh4iGD4mMh1UCjYkNXlWDSQKVgo+Rgkl3HZkCSEmdMwqcgnNOWoI8SDwAD0VFSKgAP05ONgACPLApKUUujAsesABIek46CkmuAjNFp4IPPIuEQ3p2dDgAJBEmhdAuLikDGljDhTY6OjtZM4guAlRYWFSZhmB9cF3Xhxg0aBjw75ABNVYaGcDACEkDA+EaVUmSJJ8gF2AmgDgRBkWkGQwWlJBA5ViSG3PqOHiTIFIDDwtESkhBqAqRKTgoROJRJAUmRlA8MHoggSEjA16yQKiFiEqMGFgSXaETQcsEKoiSYIlRI0YJdYRMuIkgxYcLCSs0gEVyxcq8K1NhhpQwxCDEgEE3WrQggsPHFCpQcGCNlYKIRUNXyrTA4aIHAigArOAYUrDRhgk0yF1YQQBAChwhGqB6IEbJNCMIpggaAOYKKgwXjAJggSAiAANHbBW6kgMsAN+6q7jWTfxQIAA7AAAAAAAAAAAA"),n.setAttribute("id","rxp-loader-"+d),n.style.left="50%",n.style.position="fixed",n.style.background="#FFFFFF",n.style.borderRadius="50%",n.style.width="30px",n.style.marginLeft="-15px",n.style.zIndex="200",n.style.marginLeft="-15px",n.style.top="120px",document.body.appendChild(n),o=document.createElement("iframe"),o.setAttribute("name","rxp-frame-"+d),o.setAttribute("id","rxp-frame-"+d),o.setAttribute("height","85%"),o.setAttribute("frameBorder","0"),o.setAttribute("width","360px"),o.setAttribute("seamless","seamless"),o.style.zIndex="10001",o.style.position="absolute",o.style.transition="transform 0.5s ease-in-out",o.style.transform="scale(0.7)",o.style.opacity="0",m.appendChild(o),i){o.style.top="0px",o.style.bottom="0px",o.style.left="0px",o.style.marginLeft="0px;",o.style.width="100%",o.style.height="100%",o.style.minHeight="100%",o.style.WebkitTransform="translate3d(0,0,0)",o.style.transform="translate3d(0, 0, 0)";var a=document.createElement("meta");a.name="viewport",a.content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0",document.getElementsByTagName("head")[0].appendChild(a)}else o.style.top="40px",o.style.left="50%",o.style.marginLeft="-180px";o.onload=function(){o.style.opacity="1",o.style.transform="scale(1)",n.parentNode&&n.parentNode.removeChild(n),f()};var b=g(document);o.contentWindow.document.body?o.contentWindow.document.body.appendChild(b):o.contentWindow.document.appendChild(b),b.submit()}function k(){b=window.open();var a=b.document,c=a.createElement("meta"),d=a.createAttribute("name");d.value="viewport",c.setAttributeNode(d);var e=a.createAttribute("content");e.value="width=device-width",c.setAttributeNode(e),a.head.appendChild(c);var f=g(a);a.body.appendChild(f),f.submit()}function l(){p.parentNode&&p.parentNode.removeChild(p),o.parentNode&&o.parentNode.removeChild(o),n.parentNode&&n.parentNode.removeChild(n),m.className="",setTimeout(function(){m.parentNode&&m.parentNode.removeChild(m)},300)}var m,n,o,p,q,r=a();return i&&window.addEventListener&&window.addEventListener("orientationchange",function(){r=a()},!1),{lightbox:function(){j?k():(e(),h())},close:function(){l()},setToken:function(a){q=a}}}var e;return{getInstance:function(b){return e||(e=a()),e.setToken(b),e}}}(),l=function(e,f,g){function h(e){if(a(e.origin)===a(c))if(e.data&&JSON.parse(e.data).iframe){if(!j){var g=JSON.parse(e.data).iframe.width,h=JSON.parse(e.data).iframe.height,k=document.getElementById("rxp-frame-"+d);if(k.setAttribute("width",g),k.setAttribute("height",h),k.style.backgroundColor="#ffffff",i){var m=document.getElementById("rxp-overlay-"+d);k.style.marginLeft="0px",k.style.WebkitOverflowScrolling="touch",k.style.overflowX="scroll",k.style.overflowY="scroll",m.style.overflowX="scroll",m.style.overflowY="scroll"}else k.style.marginLeft=parseInt(g.replace("px",""),10)/2*-1+"px";var n=document.getElementById("rxp-frame-close-"+d);n.style.marginLeft=parseInt(g.replace("px",""),10)/2-7+"px"}}else{j?b&&b.close():l.close();var o=e.data,p=document.createElement("form");p.setAttribute("method","POST"),p.setAttribute("action",f);var q=document.createElement("input");q.setAttribute("type","hidden"),q.setAttribute("name","hppResponse"),q.setAttribute("value",o),p.appendChild(q),document.body.appendChild(p),p.submit()}}var l=k.getInstance(g);document.getElementById(e).addEventListener?document.getElementById(e).addEventListener("click",l.lightbox,!0):document.getElementById(e).attachEvent("onclick",l.lightbox),window.addEventListener?window.addEventListener("message",h,!1):window.attachEvent("message",h)};return{init:l,setHppUrl:e}}(),RealexRemote=function(){"use strict";var a=function(a){if(!/^\d{12,19}$/.test(a))return!1;for(var b=0,c=0,d=0,e=!1,f=a.length-1;f>=0;f--)c=parseInt(a.substring(f,f+1),10),e?(d=2*c,d>9&&(d-=9)):d=c,b+=d,e=!e;var g=b%10;return 0!==g?!1:!0},b=function(a){return a&&a.trim()&&/^[\u0020-\u007E\u00A0-\u00FF]{1,100}$/.test(a)?!0:!1},c=function(a){return/^\d{3}$/.test(a)?!0:!1},d=function(a){return/^\d{4}$/.test(a)?!0:!1},e=function(a){if(!/^\d{4}$/.test(a))return!1;var b=parseInt(a.substring(0,2),10);parseInt(a.substring(2,4),10);return 1>b||b>12?!1:!0},f=function(a){if(!e(a))return!1;var b=parseInt(a.substring(0,2),10),c=parseInt(a.substring(2,4),10),d=new Date,f=d.getMonth()+1,g=d.getFullYear();return g%100>c?!1:c===g%100&&f>b?!1:!0};return{validateCardNumber:a,validateCardHolderName:b,validateCvn:c,validateAmexCvn:d,validateExpiryDateFormat:e,validateExpiryDateNotInPast:f}}(); \ No newline at end of file diff --git a/lib/rxp-hpp.js b/lib/rxp-hpp.js index a116f7e..f6bd7e1 100644 --- a/lib/rxp-hpp.js +++ b/lib/rxp-hpp.js @@ -218,16 +218,23 @@ var RealexHpp = (function() { function openWindow() { + //open new window tabWindow = window.open(); var doc = tabWindow.document; - var form = createForm(doc); - if (doc.body) { - doc.body.appendChild(form); - } else { - doc.appendChild(form); - } + //add meta tag to new window (needed for iOS 8 bug) + var meta = doc.createElement("meta"); + var name = doc.createAttribute("name"); + name.value="viewport"; + meta.setAttributeNode(name); + var content = doc.createAttribute("content"); + content.value="width=device-width"; + meta.setAttributeNode(content); + doc.head.appendChild(meta); + //create form, append to new window and submit + var form = createForm(doc); + doc.body.appendChild(form); form.submit(); }