From 24146aaacb8b928e6015f19e1e74d3c2201790e5 Mon Sep 17 00:00:00 2001 From: Wilmer Rojas Date: Fri, 25 Sep 2015 10:00:22 +0100 Subject: [PATCH 1/2] Mobile fixed some problems --- lib/rxp-hpp.js | 257 ++++++++++++++++++++++++++++++++++++++++++++++--- package.json | 2 +- 2 files changed, 242 insertions(+), 17 deletions(-) diff --git a/lib/rxp-hpp.js b/lib/rxp-hpp.js index a61b1be..7a1c6d1 100644 --- a/lib/rxp-hpp.js +++ b/lib/rxp-hpp.js @@ -1,9 +1,7 @@ -/* - * rxp-hpp.js - * https://github.com/realexpayments-developers/rxp-js - * - * Copyright (c) 2015 Realex Developer - * Licensed under the MIT license. +/*! rxp-js - v1.1.1 - 2015-08-17 + * The official Realex Payments JS SDK + * https://github.com/realexpayments/rxp-js + * Licensed MIT */ /*jslint browser:true */ var RealexHpp = (function() { @@ -18,6 +16,10 @@ var RealexHpp = (function() { hppUrl = url; }; + 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; + + // Initialising some variables used throughout this file. var RxpLightbox = (function() { @@ -30,10 +32,27 @@ var RealexHpp = (function() { var closeButton; var token; + + var isLandscape = checkDevicesOrientation(); + + if(isIOS && isMobileXS || isMobileXS){ + if(window.addEventListener){ + window.addEventListener("orientationchange", function() { + isLandscape = checkDevicesOrientation(); + }, false); + } + } + + function checkDevicesOrientation(){ + if(window.orientation === 90 || window.orientation === -90){ + return true; + }else{ + return false; + } + } // Initialising some variables used throughout this function. function createOverlay() { - var overlay = document.createElement("div"); overlay.setAttribute("id", "rxp-overlay-" + randomId); overlay.style.position="fixed"; @@ -44,6 +63,13 @@ var RealexHpp = (function() { overlay.style.transition="all 0.3s ease-in-out"; overlay.style.zIndex="100"; + if(isIOS && isMobileXS){ + overlay.style.position="absolute !important"; + overlay.style.WebkitOverflowScrolling = "touch"; + overlay.style.overflowX = "hidden"; + overlay.style.overflowY = "scroll"; + } + document.body.appendChild(overlay); setTimeout(function() { @@ -65,6 +91,21 @@ var RealexHpp = (function() { closeButton.style.opacity = "1"; },500); + if(isIOS && isMobileXS || isMobileXS){ + 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.addEventListener("click", closeModal, true); overlayElement.appendChild(closeButton); } @@ -86,6 +127,7 @@ var RealexHpp = (function() { spinner.style.marginLeft="-15px"; spinner.style.top="120px"; + document.body.appendChild(spinner); //Create the iframe @@ -98,9 +140,7 @@ var RealexHpp = (function() { iFrame.setAttribute("seamless", "seamless"); - iFrame.style.top="40px"; - iFrame.style.left="50%"; - iFrame.style.marginLeft="-180px"; + iFrame.style.zIndex="10001"; iFrame.style.position="absolute"; iFrame.style.transition="transform 0.5s ease-in-out"; @@ -109,6 +149,27 @@ var RealexHpp = (function() { overlayElement.appendChild(iFrame); + + if(isIOS && isMobileXS || isMobileXS){ + iFrame.style.top = "0px"; + iFrame.style.bottom = "0px"; + iFrame.style.left = "0px"; + iFrame.style.marginLeft = "0px;"; + iFrame.style.width = "100%"; + iFrame.style.height = "100%"; + iFrame.style.minHeight = "100%"; + iFrame.style.WebkitTransform = "translate3d(0,0,0)"; + iFrame.style.transform = "translate3d(0, 0, 0)"; + var metaTag=document.createElement('meta'); + metaTag.name = "viewport" + metaTag.content = "width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" + document.getElementsByTagName('head')[0].appendChild(metaTag); + }else{ + iFrame.style.top="40px"; + iFrame.style.left="50%"; + iFrame.style.marginLeft="-180px"; + } + iFrame.onload = function() { iFrame.style.opacity="1"; iFrame.style.transform="scale(1)"; @@ -151,6 +212,7 @@ var RealexHpp = (function() { form.appendChild(hppOrigin); + if (iFrame.contentWindow.document.body) { iFrame.contentWindow.document.body.appendChild(form); } else { @@ -193,7 +255,9 @@ var RealexHpp = (function() { }, setToken : function(hppToken) { token = hppToken; - } + }, + isMobileXS : isMobileXS, + isIOS: isIOS }; } @@ -229,18 +293,29 @@ var RealexHpp = (function() { } function receiveMessage(event) { - + console.log(event); // check for iframe resize values if (event.data && JSON.parse(event.data).iframe) { - var jsonData = JSON.parse(event.data); - var iframeWidth = jsonData.iframe.width; - var iframeHeight = jsonData.iframe.height; + 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"; - iFrame.style.marginLeft = (parseInt(iframeWidth.replace("px", ""), 10)/2 * -1 ) + "px"; + + 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"; @@ -291,3 +366,153 @@ var RealexHpp = (function() { }; }()); + +var RealexRemote = (function() { + + 'use strict'; + + /* + * Validate Card Number. Returns true if card number valid. Only allows + * non-empty numeric values between 12 and 19 characters. A Luhn check is + * also run against the card number. + */ + var validateCardNumber = function(cardNumber) { + // test numeric and length between 12 and 19 + if (!/^\d{12,19}$/.test(cardNumber)) { + return false; + } + + // luhn check + var sum = 0; + var digit = 0; + var addend = 0; + var timesTwo = false; + + for (var i = cardNumber.length - 1; i >= 0; i--) { + digit = parseInt(cardNumber.substring(i, i + 1), 10); + if (timesTwo) { + addend = digit * 2; + if (addend > 9) { + addend -= 9; + } + } else { + addend = digit; + } + sum += addend; + timesTwo = !timesTwo; + } + + var modulus = sum % 10; + if (modulus !== 0) { + return false; + } + + return true; + }; + + /* + * Validate Card Holder Name. Returns true if card holder valid. Only allows + * non-empty ISO/IEC 8859-1 values 100 characters or less. + */ + var validateCardHolderName = function(cardHolderName) { + // test for undefined + if (!cardHolderName) { + return false; + } + + // test white space only + if (!cardHolderName.trim()) { + return false; + } + + // test ISO/IEC 8859-1 characters between 1 and 100 + if (!/^[\u0020-\u007E\u00A0-\u00FF]{1,100}$/.test(cardHolderName)) { + return false; + } + + return true; + }; + + /* + * Validate CVN. Applies to non-Amex card types. Only allows 3 numeric + * characters. + */ + var validateCvn = function(cvn) { + // test numeric length 3 + if (!/^\d{3}$/.test(cvn)) { + return false; + } + + return true; + }; + + /* + * Validate Amex CVN. Applies to Amex card types. Only allows 4 numeric + * characters. + */ + var validateAmexCvn = function(cvn) { + // test numeric length 4 + if (!/^\d{4}$/.test(cvn)) { + return false; + } + + return true; + }; + + /* + * Validate Expiry Date Format. Only allows 4 numeric characters. Month must + * be between 1 and 12. + */ + var validateExpiryDateFormat = function(expiryDate) { + + // test numeric of length 4 + if (!/^\d{4}$/.test(expiryDate)) { + return false; + } + + var month = parseInt(expiryDate.substring(0, 2), 10); + var year = parseInt(expiryDate.substring(2, 4), 10); + + // test month range is 1-12 + if (month < 1 || month > 12) { + return false; + } + + return true; + }; + + /* + * Validate Expiry Date Not In Past. Also runs checks from + * validateExpiryDateFormat. + */ + var validateExpiryDateNotInPast = function(expiryDate) { + // test valid format + if (!validateExpiryDateFormat(expiryDate)) { + return false; + } + + var month = parseInt(expiryDate.substring(0, 2), 10); + var year = parseInt(expiryDate.substring(2, 4), 10); + + // test date is not in the past + var now = new Date(); + var currentMonth = now.getMonth() + 1; + var currentYear = now.getFullYear(); + if (year < (currentYear % 100)) { + return false; + } else if (year === (currentYear % 100) && month < currentMonth) { + return false; + } + + return true; + }; + + return { + validateCardNumber : validateCardNumber, + validateCardHolderName : validateCardHolderName, + validateCvn : validateCvn, + validateAmexCvn : validateAmexCvn, + validateExpiryDateFormat : validateExpiryDateFormat, + validateExpiryDateNotInPast : validateExpiryDateNotInPast + }; +}()); diff --git a/package.json b/package.json index da4ec6e..a2984b4 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "rxp-js", "description": "The official Realex Payments JS SDK", - "version": "1.1.0", + "version": "1.1.1", "homepage": "https://github.com/realexpayments/rxp-js", "author": { "name": "Realex Developer", From ad72cd05d8fe07fda24ab84495f7805c3ef33e49 Mon Sep 17 00:00:00 2001 From: Mark Stanford Date: Fri, 25 Sep 2015 10:20:17 +0100 Subject: [PATCH 2/2] Fixed some jshint errors and generated dist files --- dist/rxp-js.js | 97 +++++++++++++++++++++--- dist/rxp-js.min.js | 4 +- lib/rxp-hpp.js | 182 ++++----------------------------------------- 3 files changed, 101 insertions(+), 182 deletions(-) diff --git a/dist/rxp-js.js b/dist/rxp-js.js index f6c2ba7..3d56c3a 100644 --- a/dist/rxp-js.js +++ b/dist/rxp-js.js @@ -1,9 +1,8 @@ -/*! rxp-js - v1.1.0 - 2015-08-17 +/*! rxp-js - v1.1.1 - 2015-09-25 * The official Realex Payments JS SDK * https://github.com/realexpayments/rxp-js * Licensed MIT */ -/*jslint browser:true */ var RealexHpp = (function() { 'use strict'; @@ -16,6 +15,10 @@ var RealexHpp = (function() { hppUrl = url; }; + 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; + + // Initialising some variables used throughout this file. var RxpLightbox = (function() { @@ -28,10 +31,27 @@ var RealexHpp = (function() { var closeButton; var token; - + + function checkDevicesOrientation(){ + if(window.orientation === 90 || window.orientation === -90){ + return true; + }else{ + return false; + } + } + + var isLandscape = checkDevicesOrientation(); + + if(isIOS && isMobileXS || isMobileXS){ + if(window.addEventListener){ + window.addEventListener("orientationchange", function() { + isLandscape = checkDevicesOrientation(); + }, false); + } + } + // Initialising some variables used throughout this function. function createOverlay() { - var overlay = document.createElement("div"); overlay.setAttribute("id", "rxp-overlay-" + randomId); overlay.style.position="fixed"; @@ -42,6 +62,13 @@ var RealexHpp = (function() { overlay.style.transition="all 0.3s ease-in-out"; overlay.style.zIndex="100"; + if(isIOS && isMobileXS){ + overlay.style.position="absolute !important"; + overlay.style.WebkitOverflowScrolling = "touch"; + overlay.style.overflowX = "hidden"; + overlay.style.overflowY = "scroll"; + } + document.body.appendChild(overlay); setTimeout(function() { @@ -63,6 +90,21 @@ var RealexHpp = (function() { closeButton.style.opacity = "1"; },500); + if(isIOS && isMobileXS || isMobileXS){ + 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.addEventListener("click", closeModal, true); overlayElement.appendChild(closeButton); } @@ -84,6 +126,7 @@ var RealexHpp = (function() { spinner.style.marginLeft="-15px"; spinner.style.top="120px"; + document.body.appendChild(spinner); //Create the iframe @@ -96,9 +139,7 @@ var RealexHpp = (function() { iFrame.setAttribute("seamless", "seamless"); - iFrame.style.top="40px"; - iFrame.style.left="50%"; - iFrame.style.marginLeft="-180px"; + iFrame.style.zIndex="10001"; iFrame.style.position="absolute"; iFrame.style.transition="transform 0.5s ease-in-out"; @@ -107,6 +148,27 @@ var RealexHpp = (function() { overlayElement.appendChild(iFrame); + + if(isIOS && isMobileXS || isMobileXS){ + iFrame.style.top = "0px"; + iFrame.style.bottom = "0px"; + iFrame.style.left = "0px"; + iFrame.style.marginLeft = "0px;"; + iFrame.style.width = "100%"; + iFrame.style.height = "100%"; + iFrame.style.minHeight = "100%"; + iFrame.style.WebkitTransform = "translate3d(0,0,0)"; + iFrame.style.transform = "translate3d(0, 0, 0)"; + var metaTag=document.createElement('meta'); + metaTag.name = "viewport"; + metaTag.content = "width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"; + document.getElementsByTagName('head')[0].appendChild(metaTag); + }else{ + iFrame.style.top="40px"; + iFrame.style.left="50%"; + iFrame.style.marginLeft="-180px"; + } + iFrame.onload = function() { iFrame.style.opacity="1"; iFrame.style.transform="scale(1)"; @@ -149,6 +211,7 @@ var RealexHpp = (function() { form.appendChild(hppOrigin); + if (iFrame.contentWindow.document.body) { iFrame.contentWindow.document.body.appendChild(form); } else { @@ -191,7 +254,9 @@ var RealexHpp = (function() { }, setToken : function(hppToken) { token = hppToken; - } + }, + isMobileXS : isMobileXS, + isIOS: isIOS }; } @@ -227,7 +292,6 @@ 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; @@ -237,7 +301,19 @@ var RealexHpp = (function() { iFrame.setAttribute("width", iframeWidth); iFrame.setAttribute("height", iframeHeight); iFrame.style.backgroundColor="#ffffff"; - iFrame.style.marginLeft = (parseInt(iframeWidth.replace("px", ""), 10)/2 * -1 ) + "px"; + + 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"; @@ -288,7 +364,6 @@ var RealexHpp = (function() { }; }()); - var RealexRemote = (function() { 'use strict'; diff --git a/dist/rxp-js.min.js b/dist/rxp-js.min.js index 1e9a99f..798760a 100644 --- a/dist/rxp-js.min.js +++ b/dist/rxp-js.min.js @@ -1,6 +1,6 @@ -/*! rxp-js - v1.1.0 - 2015-08-17 +/*! rxp-js - v1.1.1 - 2015-09-25 * 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=function(){function a(){function a(){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",document.body.appendChild(a),setTimeout(function(){a.style.background="rgba(0, 0, 0, 0.7)"},1),g=a}function d(){null===document.getElementById("rxp-frame-close-"+c)&&(j=document.createElement("img"),j.setAttribute("id","rxp-frame-close-"+c),j.setAttribute("src","data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAARCAYAAAA7bUf6AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L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/EahibqDTkQx6fRSIHcPwA8Uy9A9Gcc47Xv+w2wzhRDYzqdVihLIbsIiCvP1NNOoX/29FQx3vgOgtt4FyRdCgPRarX4+goB9vkyAMh443cOEsIAAcjncuoI4TXWMAmCIGFhCQLAdZ8jym/cRJ+Y5nC5XCYAhINKpZLgSISZgoqh5iiLQrojAFICVwGS7tCfe5DbZzkP56XS4NVxwvTI/vXVVYIDnqmnnX70ZxzjNS8THHooK5hMpxHQIREA+tEfA9djfHR3MHkdx3Hspe9r3B+VzWaj2RESyR2mlCUE4MoGQDdxiwHURq2t94+PO9bMIYyTyDNLwMoM7g8+BfKeYGniyw2MdfSehF3Qmk1IvCc/AgwAaS86Etp38bUAAAAASUVORK5CYII="),j.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(){j.style.opacity="1"},500),j.addEventListener("click",f,!0),g.appendChild(j))}function e(){h=document.createElement("img"),h.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/C05FVFNDQV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D0VFSKgAP05ONgACPLApKUUujAsesABIek46CkmuAjNFp4IPPIuEQ3p2dDgAJBEmhdAuLikDGljDhTY6OjtZM4guAlRYWFSZhmB9cF3Xhxg0aBjw75ABNVYaGcDACEkDA+EaVUmSJJ8gF2AmgDgRBkWkGQwWlJBA5ViSG3PqOHiTIFIDDwtESkhBqAqRKTgoROJRJAUmRlA8MHoggSEjA16yQKiFiEqMGFgSXaETQcsEKoiSYIlRI0YJdYRMuIkgxYcLCSs0gEVyxcq8K1NhhpQwxCDEgEE3WrQggsPHFCpQcGCNlYKIRUNXyrTA4aIHAigArOAYUrDRhgk0yF1YQQBAChwhGqB6IEbJNCMIpggaAOYKKgwXjAJggSAiAANHbBW6kgMsAN+6q7jWTfxQIAA7AAAAAAAAAAAA"),h.setAttribute("id","rxp-loader-"+c),h.style.left="50%",h.style.position="fixed",h.style.background="#FFFFFF",h.style.borderRadius="50%",h.style.width="30px",h.style.marginLeft="-15px",h.style.zIndex="200",h.style.marginLeft="-15px",h.style.top="120px",document.body.appendChild(h),i=document.createElement("iframe"),i.setAttribute("name","rxp-frame-"+c),i.setAttribute("id","rxp-frame-"+c),i.setAttribute("height","85%"),i.setAttribute("frameBorder","0"),i.setAttribute("width","360px"),i.setAttribute("seamless","seamless"),i.style.top="40px",i.style.left="50%",i.style.marginLeft="-180px",i.style.zIndex="10001",i.style.position="absolute",i.style.transition="transform 0.5s ease-in-out",i.style.transform="scale(0.7)",i.style.opacity="0",g.appendChild(i),i.onload=function(){i.style.opacity="1",i.style.transform="scale(1)",h.parentNode&&h.parentNode.removeChild(h),d()};var a=document.createElement("form");a.setAttribute("method","POST"),a.setAttribute("action",b);for(var e in k){var f=document.createElement("input");f.setAttribute("type","hidden"),f.setAttribute("name",e),f.setAttribute("value",k[e]),a.appendChild(f)}var j=document.createElement("input");j.setAttribute("type","hidden"),j.setAttribute("name","HPP_TEMPLATE_TYPE"),j.setAttribute("value","LIGHTBOX"),a.appendChild(j);var l=document.createElement("a");l.href=window.location.href;var m=l.protocol+"//"+l.host,n=document.createElement("input");n.setAttribute("type","hidden"),n.setAttribute("name","HPP_ORIGIN"),n.setAttribute("value",m),a.appendChild(n),i.contentWindow.document.body?i.contentWindow.document.body.appendChild(a):i.contentWindow.document.appendChild(a),a.submit()}function f(){j.parentNode&&j.parentNode.removeChild(j),i.parentNode&&i.parentNode.removeChild(i),h.parentNode&&h.parentNode.removeChild(h),g.className="",setTimeout(function(){g.parentNode&&g.parentNode.removeChild(g)},300)}var g,h,i,j,k;return{lightbox:function(){a(),e()},close:function(){f()},setToken:function(a){k=a}}}var d;return{getInstance:function(b){return d||(d=a()),d.setToken(b),d}}}(),f=function(d,f,g){function h(d){if(d.data&&JSON.parse(d.data).iframe){var e=JSON.parse(d.data).iframe.width,g=JSON.parse(d.data).iframe.height,h=document.getElementById("rxp-frame-"+c);h.setAttribute("width",e),h.setAttribute("height",g),h.style.backgroundColor="#ffffff",h.style.marginLeft=parseInt(e.replace("px",""),10)/2*-1+"px";var j=document.getElementById("rxp-frame-close-"+c);j.style.marginLeft=parseInt(e.replace("px",""),10)/2-7+"px"}else if(a(d.origin)===a(b)){i.close();var k=d.data,l=document.createElement("form");l.setAttribute("method","POST"),l.setAttribute("action",f);var m=document.createElement("input");m.setAttribute("type","hidden"),m.setAttribute("name","hppResponse"),m.setAttribute("value",k),l.appendChild(m),document.body.appendChild(l),l.submit()}}var i=e.getInstance(g);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:f,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="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,iVBORw0KGgoAAAANSUhEUgAAABEAAAARCAYAAAA7bUf6AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0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GVuZD0iciI/PlHco5QAAAHpSURBVHjafFRdTsJAEF42JaTKn4glGIg++qgX4AAchHAJkiZcwnAQD8AF4NFHCaC2VgWkIQQsfl/jNJUik8Duzs/XmW9mN7Xb7VRc5vP5zWKxaK5Wq8Zmu72FqobfJG0YQ9M0+/l8/qFQKDzGY1JxENd1288vLy1s786KRZXJZCLber1Wn7MZt4PLarVnWdZ9AmQ8Hncc17UvymVdBMB/MgPQm+cFFcuy6/V6lzqDf57ntWGwYdBIVx0TfkBD6I9M35iRJgfIoAVjBLDZbA4CiJ5+9AdQi/EahibqDTkQx6fRSIHcPwA8Uy9A9Gcc47Xv+w2wzhRDYzqdVihLIbsIiCvP1NNOoX/29FQx3vgOgtt4FyRdCgPRarX4+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/zs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AYMDFjdiApQSGBU5QgGRjOmEFgQCUMKZf8AKLgBAgiZNvkaURkSo8aUI+wAYJDSYcyONloibexIoYQwQS6oEPgxpOGMXPQOPdjCMFESCgcZHdFiYUROQ0dChCgRkRCFOg4cRMCCiIcGAjhCUDgq6AiHDhWyxShAhJACKFweJJHAAgoFQ1dfrAwQlKRMhAwpfnCZMkXEihqCHmAwUIXRkAgRoLiQgsIHABsrVDRl1OPMDQAPZIzAAcAEjRVzOT2gI+XTjREMBF0RUZMThhyyAGyYYGCQhtaoCJVQMjk3ISQafAtHFAgAIfkECQoAAAAsAAAAABwAHAAAB/+AAIKDhIWGh4iGD4mMh1UCjYkNXlWDSQKVgo+Rgkl3HZkCSEmdMwqcgnNOWoI8SDwAD0VFSKgAP05ONgACPLApKUUujAsesABIek46CkmuAjNFp4IPPIuEQ3p2dDgAJBEmhdAuLikDGljDhTY6OjtZM4guAlRYWFSZhmB9cF3Xhxg0aBjw75ABNVYaGcDACEkDA+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 diff --git a/lib/rxp-hpp.js b/lib/rxp-hpp.js index 7a1c6d1..18a5c47 100644 --- a/lib/rxp-hpp.js +++ b/lib/rxp-hpp.js @@ -1,8 +1,3 @@ -/*! rxp-js - v1.1.1 - 2015-08-17 - * The official Realex Payments JS SDK - * https://github.com/realexpayments/rxp-js - * Licensed MIT - */ /*jslint browser:true */ var RealexHpp = (function() { @@ -33,24 +28,24 @@ var RealexHpp = (function() { var token; + function checkDevicesOrientation(){ + if(window.orientation === 90 || window.orientation === -90){ + return true; + }else{ + return false; + } + } + var isLandscape = checkDevicesOrientation(); if(isIOS && isMobileXS || isMobileXS){ - if(window.addEventListener){ + if(window.addEventListener){ window.addEventListener("orientationchange", function() { isLandscape = checkDevicesOrientation(); - }, false); + }, false); } } - function checkDevicesOrientation(){ - if(window.orientation === 90 || window.orientation === -90){ - return true; - }else{ - return false; - } - } - // Initialising some variables used throughout this function. function createOverlay() { var overlay = document.createElement("div"); @@ -161,8 +156,8 @@ var RealexHpp = (function() { iFrame.style.WebkitTransform = "translate3d(0,0,0)"; iFrame.style.transform = "translate3d(0, 0, 0)"; var metaTag=document.createElement('meta'); - metaTag.name = "viewport" - metaTag.content = "width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" + metaTag.name = "viewport"; + metaTag.content = "width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"; document.getElementsByTagName('head')[0].appendChild(metaTag); }else{ iFrame.style.top="40px"; @@ -293,7 +288,6 @@ var RealexHpp = (function() { } function receiveMessage(event) { - console.log(event); // check for iframe resize values if (event.data && JSON.parse(event.data).iframe) { var iframeWidth = JSON.parse(event.data).iframe.width; @@ -365,154 +359,4 @@ var RealexHpp = (function() { setHppUrl : setHppUrl }; -}()); - -var RealexRemote = (function() { - - 'use strict'; - - /* - * Validate Card Number. Returns true if card number valid. Only allows - * non-empty numeric values between 12 and 19 characters. A Luhn check is - * also run against the card number. - */ - var validateCardNumber = function(cardNumber) { - // test numeric and length between 12 and 19 - if (!/^\d{12,19}$/.test(cardNumber)) { - return false; - } - - // luhn check - var sum = 0; - var digit = 0; - var addend = 0; - var timesTwo = false; - - for (var i = cardNumber.length - 1; i >= 0; i--) { - digit = parseInt(cardNumber.substring(i, i + 1), 10); - if (timesTwo) { - addend = digit * 2; - if (addend > 9) { - addend -= 9; - } - } else { - addend = digit; - } - sum += addend; - timesTwo = !timesTwo; - } - - var modulus = sum % 10; - if (modulus !== 0) { - return false; - } - - return true; - }; - - /* - * Validate Card Holder Name. Returns true if card holder valid. Only allows - * non-empty ISO/IEC 8859-1 values 100 characters or less. - */ - var validateCardHolderName = function(cardHolderName) { - // test for undefined - if (!cardHolderName) { - return false; - } - - // test white space only - if (!cardHolderName.trim()) { - return false; - } - - // test ISO/IEC 8859-1 characters between 1 and 100 - if (!/^[\u0020-\u007E\u00A0-\u00FF]{1,100}$/.test(cardHolderName)) { - return false; - } - - return true; - }; - - /* - * Validate CVN. Applies to non-Amex card types. Only allows 3 numeric - * characters. - */ - var validateCvn = function(cvn) { - // test numeric length 3 - if (!/^\d{3}$/.test(cvn)) { - return false; - } - - return true; - }; - - /* - * Validate Amex CVN. Applies to Amex card types. Only allows 4 numeric - * characters. - */ - var validateAmexCvn = function(cvn) { - // test numeric length 4 - if (!/^\d{4}$/.test(cvn)) { - return false; - } - - return true; - }; - - /* - * Validate Expiry Date Format. Only allows 4 numeric characters. Month must - * be between 1 and 12. - */ - var validateExpiryDateFormat = function(expiryDate) { - - // test numeric of length 4 - if (!/^\d{4}$/.test(expiryDate)) { - return false; - } - - var month = parseInt(expiryDate.substring(0, 2), 10); - var year = parseInt(expiryDate.substring(2, 4), 10); - - // test month range is 1-12 - if (month < 1 || month > 12) { - return false; - } - - return true; - }; - - /* - * Validate Expiry Date Not In Past. Also runs checks from - * validateExpiryDateFormat. - */ - var validateExpiryDateNotInPast = function(expiryDate) { - // test valid format - if (!validateExpiryDateFormat(expiryDate)) { - return false; - } - - var month = parseInt(expiryDate.substring(0, 2), 10); - var year = parseInt(expiryDate.substring(2, 4), 10); - - // test date is not in the past - var now = new Date(); - var currentMonth = now.getMonth() + 1; - var currentYear = now.getFullYear(); - if (year < (currentYear % 100)) { - return false; - } else if (year === (currentYear % 100) && month < currentMonth) { - return false; - } - - return true; - }; - - return { - validateCardNumber : validateCardNumber, - validateCardHolderName : validateCardHolderName, - validateCvn : validateCvn, - validateAmexCvn : validateAmexCvn, - validateExpiryDateFormat : validateExpiryDateFormat, - validateExpiryDateNotInPast : validateExpiryDateNotInPast - }; -}()); +}()); \ No newline at end of file