From 41d0e4655b1d1ddf520a453d95c3cdf04c94db6e Mon Sep 17 00:00:00 2001 From: Andrei Stelian Humulescu Date: Tue, 20 Feb 2024 11:39:45 +0200 Subject: [PATCH] Allow digital wallets payments when the mode is set to lightbox --- examples/hpp/json/process-a-payment.json | 5 ++--- lib/rxp-hpp.js | 12 ++++++++++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/examples/hpp/json/process-a-payment.json b/examples/hpp/json/process-a-payment.json index 65f9409..ab7c127 100644 --- a/examples/hpp/json/process-a-payment.json +++ b/examples/hpp/json/process-a-payment.json @@ -1,10 +1,9 @@ { "MERCHANT_ID": "heartlandgpsandbox", - "ACCOUNT": "3dsecure", - "AMOUNT": "1001", + "ACCOUNT": "hpp", + "AMOUNT": "1000", "CURRENCY": "EUR", "AUTO_SETTLE_FLAG": "1", - "PM_METHODS": "cards", "HPP_CUSTOMER_EMAIL": "test@example.com", "HPP_CUSTOMER_PHONENUMBER_MOBILE": "44|789456123", diff --git a/lib/rxp-hpp.js b/lib/rxp-hpp.js index c658b82..1e470f5 100644 --- a/lib/rxp-hpp.js +++ b/lib/rxp-hpp.js @@ -419,6 +419,7 @@ var RealexHpp = (function () { iFrame.setAttribute("frameBorder", "0"); iFrame.setAttribute("width", "360px"); iFrame.setAttribute("seamless", "seamless"); + iFrame.setAttribute("allow", "payment " + internal.getBaseUrl(hppUrl)); iFrame.style.zIndex = "10001"; iFrame.style.position = "absolute"; @@ -550,6 +551,17 @@ var RealexHpp = (function () { return internal.getUrlParser(url).hostname; }, + /** + * Gets the base URL from a URL. Used to set the 'allow payment' attribute. + * + * @param {string} url + * @returns the base URL of the provided URL + */ + getBaseUrl: function (url) { + var urlParser = internal.getUrlParser(url); + return urlParser.protocol + '//' + urlParser.hostname; + }, + /** * Checks if the origin is HPP. *