From e97bfa9096dea69dc12da955e5b62c22946b9ceb Mon Sep 17 00:00:00 2001 From: seanmacdomhnall Date: Thu, 30 Aug 2018 16:25:36 +0100 Subject: [PATCH] Handle scenarios where HPP_VERSION is sent from the server SDK. Updated version number. --- LICENSE-MIT | 4 +++- dist/rxp-js.js | 19 +++++++++++++------ dist/rxp-js.min.js | 6 +++--- lib/rxp-hpp.js | 15 +++++++++++---- package.json | 4 ++-- 5 files changed, 32 insertions(+), 16 deletions(-) diff --git a/LICENSE-MIT b/LICENSE-MIT index 7343e97..5702772 100644 --- a/LICENSE-MIT +++ b/LICENSE-MIT @@ -1,4 +1,6 @@ -Copyright (c) 2017 Realex Payments Developer +The MIT License (MIT) + +Copyright (c) 2018 Pay and Shop Ltd t/a Global Payments Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/dist/rxp-js.js b/dist/rxp-js.js index 802251a..f9efc4f 100644 --- a/dist/rxp-js.js +++ b/dist/rxp-js.js @@ -1,5 +1,5 @@ -/*! rxp-js - v1.2.1 - 2017-12-05 - * The official Realex Payments JS SDK +/*! rxp-js - v1.3.1 - 2018-08-30 + * The official Realex Payments JS Library * https://github.com/realexpayments/rxp-js * Licensed MIT */ @@ -127,13 +127,20 @@ var RealexHpp = (function () { var form = document.createElement("form"); form.setAttribute("method", "POST"); form.setAttribute("action", hppUrl); - + + var versionSet = false; + for (var key in token) { + if (key === "HPP_VERSION"){ + versionSet = true; + } form.appendChild(internal.createFormHiddenInput(key, token[key])); } - - form.appendChild(internal.createFormHiddenInput("HPP_VERSION", "2")); - + + if (versionSet === false){ + form.appendChild(internal.createFormHiddenInput("HPP_VERSION", "2")); + } + if (ignorePostMessage) { form.appendChild(internal.createFormHiddenInput("MERCHANT_RESPONSE_URL", redirectUrl)); } else { diff --git a/dist/rxp-js.min.js b/dist/rxp-js.min.js index 93046f4..b623ad5 100644 --- a/dist/rxp-js.min.js +++ b/dist/rxp-js.min.js @@ -1,7 +1,7 @@ -/*! rxp-js - v1.2.1 - 2017-12-05 - * The official Realex Payments JS SDK +/*! rxp-js - v1.3.1 - 2018-08-30 + * The official Realex Payments JS Library * https://github.com/realexpayments/rxp-js * Licensed MIT */ -var RealexHpp=function(){"use strict";var e,t,A="https://pay.realexpayments.com/pay",n=n||Math.random().toString(16).substr(2,8),i=/Windows Phone|IEMobile/.test(navigator.userAgent),o=/Android|iPad|iPhone|iPod/.test(navigator.userAgent),r=(window.innerWidth>0?window.innerWidth:screen.width)<=360||(window.innerHeight>0?window.innerHeight:screen.Height)<=360,a=i,d=!i&&(o||r),s={createFormHiddenInput:function(e,t){var A=document.createElement("input");return A.setAttribute("type","hidden"),A.setAttribute("name",e),A.setAttribute("value",t),A},checkDevicesOrientation:function(){return 90===window.orientation||-90===window.orientation},createOverlay:function(){var e=document.createElement("div");return e.setAttribute("id","rxp-overlay-"+n),e.style.position="fixed",e.style.width="100%",e.style.height="100%",e.style.top="0",e.style.left="0",e.style.transition="all 0.3s ease-in-out",e.style.zIndex="100",a&&(e.style.position="absolute !important",e.style.WebkitOverflowScrolling="touch",e.style.overflowX="hidden",e.style.overflowY="scroll"),document.body.appendChild(e),setTimeout(function(){e.style.background="rgba(0, 0, 0, 0.7)"},1),e},closeModal:function(e,t,A,n){e&&e.parentNode&&e.parentNode.removeChild(e),t&&t.parentNode&&t.parentNode.removeChild(t),A&&A.parentNode&&A.parentNode.removeChild(A),n&&(n.className="",setTimeout(function(){n.parentNode&&n.parentNode.removeChild(n)},300))},createCloseButton:function(e){if(null===document.getElementById("rxp-frame-close-"+n)){var t=document.createElement("img");return t.setAttribute("id","rxp-frame-close-"+n),t.setAttribute("src","data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAARCAYAAAA7bUf6AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2Vo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NFHCaC2VgWkIQQsfl/jNJUik8Duzs/XmW9mN7Xb7VRc5vP5zWKxaK5Wq8Zmu72FqobfJG0YQ9M0+/l8/qFQKDzGY1JxENd1288vLy1s786KRZXJZCLber1Wn7MZt4PLarVnWdZ9AmQ8Hncc17UvymVdBMB/MgPQm+cFFcuy6/V6lzqDf57ntWGwYdBIVx0TfkBD6I9M35iRJgfIoAVjBLDZbA4CiJ5+9AdQi/EahibqDTkQx6fRSIHcPwA8Uy9A9Gcc47Xv+w2wzhRDYzqdVihLIbsIiCvP1NNOoX/29FQx3vgOgtt4FyRdCgPRarX4+goB9vkyAMh443cOEsIAAcjncuoI4TXWMAmCIGFhCQLAdZ8jym/cRJ+Y5nC5XCYAhINKpZLgSISZgoqh5iiLQrojAFICVwGS7tCfe5DbZzkP56XS4NVxwvTI/vXVVYIDnqmnnX70ZxzjNS8THHooK5hMpxHQIREA+tEfA9djfHR3MHkdx3Hspe9r3B+VzWaj2RESyR2mlCUE4MoGQDdxiwHURq2t94+PO9bMIYyTyDNLwMoM7g8+BfKeYGniyw2MdfSehF3Qmk1IvCc/AgwAaS86Etp38bUAAAAASUVORK5CYII="),t.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(){t.style.opacity="1"},500),a&&(t.style.position="absolute",t.style.float="right",t.style.top="20px",t.style.left="initial",t.style.marginLeft="0px",t.style.right="20px"),t}},createForm:function(e,n,i){var o=document.createElement("form");o.setAttribute("method","POST"),o.setAttribute("action",A);for(var r in n)o.appendChild(s.createFormHiddenInput(r,n[r]));if(o.appendChild(s.createFormHiddenInput("HPP_VERSION","2")),i)o.appendChild(s.createFormHiddenInput("MERCHANT_RESPONSE_URL",t));else{var a=s.getUrlParser(window.location.href),d=a.protocol+"//"+a.host;o.appendChild(s.createFormHiddenInput("HPP_POST_RESPONSE",d)),o.appendChild(s.createFormHiddenInput("HPP_POST_DIMENSIONS",d))}return o},createSpinner:function(){var e=document.createElement("img");return e.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/C05FVFNDQVBFMi4wAwEAAAAh/hpDcmVhdGVkIHdpdGggYWpheGxvYWQuaW5mbwAh+QQJCgAAACwAAAAAHAAcAAAH/4AAgoOEhYaHiIUKKYmNh0ofjoklL4RLUQ+DVZmSAAswOYIKTE1UglUCVZ0AGBYwPwBHTU44AFU8PKuCEzpARB5OTjYAPEi5jQYNgzE7QS1ET1JTD7iqgi6chAcOFRsmABUQBoQuSAIALjwpMwqHCBYcJyrHhulF9xiJFx0WMo0Y99o18oBCWSIXKZI0eoBhkaQHEA0JIIAAQoYPKiSlwIKFyIAUnAYUSBAhAogVkmZc0aChIz0ACiQQCLFAEhIMKXhkO8RiRqMqBnYe0iAigwoXiah4KMEI0QIII1rQyHeoypUFWH0aWjABAgkPLigIKUIIiQQNrDQs8EC2EAMKBlIV9EBgRAHWFEes1DiWpIjWRDVurCCCBAqUGUhqxEC7yoUNBENg4sChbICVaasw3PCBNAkLHAI1DBEoyQSObDGGZMPyV5egEl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KDhIWGh4iGSYmMh0gzjYkuPIQYRQ+DPA2RgwKUgilFSIICV5ucAEhIn6ECqVgarqhJPDyLRUUKAFRYVI1HMZAALgJIAg8KGDwKGlinAEkKLoU1Tnt1BABVAtOEKb4PBhIMR4c+cU5OaymILiYlCwtHmIcxQU4fjAYMDFjdiApQSGBU5QgGRjOmEFgQCUMKZf8AKLgBAgiZNvkaURkSo8aUI+wAYJDSYcyONloibexIoYQwQS6oEPgxpOGMXPQOPdjCMFESCgcZHdFiYUROQ0dChCgRkRCFOg4cRMCCiIcGAjhCUDgq6AiHDhWyxShAhJACKFweJJHAAgoFQ1dfrAwQlKRMhAwpfnCZMkXEihqCHmAwUIXRkAgRoLiQgsIHABsrVDRl1OPMDQAPZIzAAcAEjRVzOT2gI+XTjREMBF0RUZMThhyyAGyYYGCQhtaoCJVQMjk3ISQafAtHFAgAIfkECQoAAAAsAAAAABwAHAAAB/+AAIKDhIWGh4iGD4mMh1UCjYkNXlWDSQKVgo+Rgkl3HZkCSEmdMwqcgnNOWoI8SDwAD0VFSKgAP05ONgACPLApKUUujAsesABIek46CkmuAjNFp4IPPIuEQ3p2dDgAJBEmhdAuLikDGljDhTY6OjtZM4guAlRYWFSZhmB9cF3Xhxg0aBjw75ABNVYaGcDACEkDA+EaVUmSJJ8gF2AmgDgRBkWkGQwWlJBA5ViSG3PqOHiTIFIDDwtESkhBqAqRKTgoROJRJAUmRlA8MHoggSEjA16yQKiFiEqMGFgSXaETQcsEKoiSYIlRI0YJdYRMuIkgxYcLCSs0gEVyxcq8K1NhhpQwxCDEgEE3WrQggsPHFCpQcGCNlYKIRUNXyrTA4aIHAigArOAYUrDRhgk0yF1YQQBAChwhGqB6IEbJNCMIpggaAOYKKgwXjAJggSAiAANHbBW6kgMsAN+6q7jWTfxQIAA7AAAAAAAAAAAA"),e.setAttribute("id","rxp-loader-"+n),e.style.left="50%",e.style.position="fixed",e.style.background="#FFFFFF",e.style.borderRadius="50%",e.style.width="30px",e.style.zIndex="200",e.style.marginLeft="-15px",e.style.top="120px",e},createIFrame:function(e,t){var A=s.createSpinner();document.body.appendChild(A);var i=document.createElement("iframe");if(i.setAttribute("name","rxp-frame-"+n),i.setAttribute("id","rxp-frame-"+n),i.setAttribute("height","562px"),i.setAttribute("frameBorder","0"),i.setAttribute("width","360px"),i.setAttribute("seamless","seamless"),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",e.appendChild(i),a){i.style.top="0px",i.style.bottom="0px",i.style.left="0px",i.style.marginLeft="0px;",i.style.width="100%",i.style.height="100%",i.style.minHeight="100%",i.style.WebkitTransform="translate3d(0,0,0)",i.style.transform="translate3d(0, 0, 0)";var o=document.createElement("meta");o.name="viewport",o.content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0",document.getElementsByTagName("head")[0].appendChild(o)}else i.style.top="40px",i.style.left="50%",i.style.marginLeft="-180px";var r;i.onload=function(){i.style.opacity="1",i.style.transform="scale(1)",i.style.backgroundColor="#ffffff",A.parentNode&&A.parentNode.removeChild(A),r=s.createCloseButton(),e.appendChild(r),r.addEventListener("click",function(){s.closeModal(r,i,A,e)},!0)};var d=s.createForm(document,t);return i.contentWindow.document.body?i.contentWindow.document.body.appendChild(d):i.contentWindow.document.appendChild(d),d.submit(),{spinner:A,iFrame:i,closeButton:r}},openWindow:function(e){var t=window.open();if(!t)return null;var A=t.document,n=A.createElement("meta"),i=A.createAttribute("name");i.value="viewport",n.setAttributeNode(i);var o=A.createAttribute("content");o.value="width=device-width",n.setAttributeNode(o),A.head.appendChild(n);var r=s.createForm(A,e);return A.body.appendChild(r),r.submit(),t},getUrlParser:function(e){var t=document.createElement("a");return t.href=e,t},getHostnameFromUrl:function(e){return s.getUrlParser(e).hostname},isMessageFromHpp:function(e,t){return s.getHostnameFromUrl(e)===s.getHostnameFromUrl(t)},receiveMessage:function(t,i,o){return function(r){if(s.isMessageFromHpp(r.origin,A))if(r.data&&JSON.parse(r.data).iframe){if(!d){var c,g=JSON.parse(r.data).iframe.width,l=JSON.parse(r.data).iframe.height,I=!1;if(c=o?t.getIframe():document.getElementById("rxp-frame-"+n),"390px"===g&&"440px"===l&&(c.setAttribute("width",g),c.setAttribute("height",l),I=!0),c.style.backgroundColor="#ffffff",a){if(c.style.marginLeft="0px",c.style.WebkitOverflowScrolling="touch",c.style.overflowX="scroll",c.style.overflowY="scroll",!o){var E=document.getElementById("rxp-overlay-"+n);E.style.overflowX="scroll",E.style.overflowY="scroll"}}else!o&&I&&(c.style.marginLeft=parseInt(g.replace("px",""),10)/2*-1+"px");!o&&I&&setTimeout(function(){document.getElementById("rxp-frame-close-"+n).style.marginLeft=parseInt(g.replace("px",""),10)/2-7+"px"},200)}}else{d&&e?e.close():t.close();var u=r.data,C=document.createElement("form");C.setAttribute("method","POST"),C.setAttribute("action",i),C.appendChild(s.createFormHiddenInput("hppResponse",u)),document.body.appendChild(C),C.submit()}}}},c=function(){function t(){var t,A,n,i,o,r=s.checkDevicesOrientation();return a&&window.addEventListener&&window.addEventListener("orientationchange",function(){r=s.checkDevicesOrientation()},!1),{lightbox:function(){if(d)e=s.openWindow(o);else{t=s.createOverlay();var r=s.createIFrame(t,o);A=r.spinner,n=r.iFrame,i=r.closeButton}},close:function(){s.closeModal()},setToken:function(e){o=e}}}var A;return{getInstance:function(e){return A||(A=t()),A.setToken(e),A},init:function(e,t,A){var n=c.getInstance(A);document.getElementById(e).addEventListener?document.getElementById(e).addEventListener("click",n.lightbox,!0):document.getElementById(e).attachEvent("onclick",n.lightbox),window.addEventListener?window.addEventListener("message",s.receiveMessage(n,t),!1):window.attachEvent("message",s.receiveMessage(n,t))}}}(),g=function(){function e(){var e,t;return{embedded:function(){var A=s.createForm(document,t);e&&(e.contentWindow.document.body?e.contentWindow.document.body.appendChild(A):e.contentWindow.document.appendChild(A),A.submit(),e.style.display="inherit")},close:function(){e.style.display="none"},setToken:function(e){t=e},setIframe:function(t){e=document.getElementById(t)},getIframe:function(){return e}}}var t;return{getInstance:function(A){return t||(t=e()),t.setToken(A),t},init:function(e,t,A,n){var i=g.getInstance(n);i.setIframe(t),document.getElementById(e).addEventListener?document.getElementById(e).addEventListener("click",i.embedded,!0):document.getElementById(e).attachEvent("onclick",i.embedded),window.addEventListener?window.addEventListener("message",s.receiveMessage(i,A,!0),!1):window.attachEvent("message",s.receiveMessage(i,A,!0))}}}(),l=function(){function e(){var e,t=s.checkDevicesOrientation();return a&&window.addEventListener&&window.addEventListener("orientationchange",function(){t=s.checkDevicesOrientation()},!1),{redirect:function(){var t=s.createForm(document,e,!0);document.body.append(t),t.submit()},setToken:function(t){e=t}}}var A;return{getInstance:function(t){return A||(A=e()),A.setToken(t),A},init:function(e,A,n){var i=l.getInstance(n);t=A,document.getElementById(e).addEventListener?document.getElementById(e).addEventListener("click",i.redirect,!0):document.getElementById(e).attachEvent("onclick",i.redirect),window.addEventListener?window.addEventListener("message",s.receiveMessage(i,A),!1):window.attachEvent("message",s.receiveMessage(i,A))}}}();return{init:c.init,lightbox:{init:c.init},embedded:{init:g.init},redirect:{init:l.init},setHppUrl:function(e){A=e},_internal:s}}(),RealexRemote=function(){"use strict";var e=function(e){if(!/^\d{4}$/.test(e))return!1;var t=parseInt(e.substring(0,2),10);parseInt(e.substring(2,4),10);return!(t<1||t>12)};return{validateCardNumber:function(e){if(!/^\d{12,19}$/.test(e))return!1;for(var t=0,A=0,n=0,i=!1,o=e.length-1;o>=0;o--)A=parseInt(e.substring(o,o+1),10),i?(n=2*A)>9&&(n-=9):n=A,t+=n,i=!i;return 0==t%10},validateCardHolderName:function(e){return!!e&&!!e.trim()&&!!/^[\u0020-\u007E\u00A0-\u00FF]{1,100}$/.test(e)},validateCvn:function(e){return!!/^\d{3}$/.test(e)},validateAmexCvn:function(e){return!!/^\d{4}$/.test(e)},validateExpiryDateFormat:e,validateExpiryDateNotInPast:function(t){if(!e(t))return!1;var A=parseInt(t.substring(0,2),10),n=parseInt(t.substring(2,4),10),i=new Date,o=i.getMonth()+1,r=i.getFullYear();return!(n