Skip to content

Commit

Permalink
Handle scenarios where HPP_VERSION is sent from the server SDK. Updat…
Browse files Browse the repository at this point in the history
…ed version number.
  • Loading branch information
seanmacdomhnall committed Aug 30, 2018
1 parent 1f19a01 commit e97bfa9
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 16 deletions.
4 changes: 3 additions & 1 deletion LICENSE-MIT
Original file line number Diff line number Diff line change
@@ -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
Expand Down
19 changes: 13 additions & 6 deletions dist/rxp-js.js
Original file line number Diff line number Diff line change
@@ -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
*/
Expand Down Expand Up @@ -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 {
Expand Down
6 changes: 3 additions & 3 deletions dist/rxp-js.min.js

Large diffs are not rendered by default.

15 changes: 11 additions & 4 deletions lib/rxp-hpp.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,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 {
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "rxp-js",
"description": "The official Realex Payments JS SDK",
"version": "1.2.1",
"description": "The official Realex Payments JS Library",
"version": "1.3.1",
"homepage": "https://github.com/realexpayments/rxp-js",
"author": {
"name": "Realex Developer",
Expand Down

0 comments on commit e97bfa9

Please sign in to comment.