diff --git a/LICENSE.txt b/LICENSE.txt
index d2f584d..0b1bfee 100755
--- a/LICENSE.txt
+++ b/LICENSE.txt
@@ -1,6 +1,6 @@
The MIT License (MIT)
-Copyright (c) 2017 Pay and Shop Ltd t/a Realex Payments
+Copyright (c) 2018 Pay and Shop Ltd t/a Realex Payments
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
\ No newline at end of file
+THE SOFTWARE.
diff --git a/README.md b/README.md
index e851c69..c3d07e3 100755
--- a/README.md
+++ b/README.md
@@ -11,7 +11,7 @@ You can find more information on how to use this SDK and sign up for a free Real
### Gradle users
Add this dependency to your project's build file:
```
-compile "com.realexpayments.hpp.sdk:rxp-hpp-android:1.1"
+compile "com.realexpayments.hpp.sdk:rxp-hpp-android:1.2"
```
### Maven users
@@ -20,7 +20,7 @@ Add this dependency to your project's POM:
com.realexpayments.hpp.sdk
rxp-hpp-android
- 1.1
+ 1.2
```
@@ -153,7 +153,7 @@ hppManager.setHppURL("https://pay.sandbox.realexpayments.com/pay";
### Gradle users
Add this dependency to your project's build file:
```
-compile "com.realexpayments.remote.sdk:rxp-remote-android:1.0"
+compile "com.realexpayments.remote.sdk:rxp-remote-android:1.1"
```
### Maven users
@@ -162,7 +162,7 @@ Add this dependency to your project's POM:
com.realexpayments.remote.sdk
rxp-remote-android
- 1.0
+ 1.1
```
diff --git a/rxp-hpp-android/build.gradle b/rxp-hpp-android/build.gradle
index c39f0e9..b88a204 100644
--- a/rxp-hpp-android/build.gradle
+++ b/rxp-hpp-android/build.gradle
@@ -7,8 +7,8 @@ android {
defaultConfig {
minSdkVersion 19
targetSdkVersion 23
- versionCode 2
- versionName "1.1"
+ versionCode 3
+ versionName "1.2"
}
buildTypes {
release {
diff --git a/rxp-hpp-android/src/main/java/com/realexpayments/hpp/HPPManager.java b/rxp-hpp-android/src/main/java/com/realexpayments/hpp/HPPManager.java
index af7405d..11b7b31 100644
--- a/rxp-hpp-android/src/main/java/com/realexpayments/hpp/HPPManager.java
+++ b/rxp-hpp-android/src/main/java/com/realexpayments/hpp/HPPManager.java
@@ -16,19 +16,14 @@
You set these three URLs as follows;
hppManager.setHppRequestProducerURL("https://myserver.com/HPP_Request_Producer.php");
-
hppManager.setHppResponseConsumerURL("https://myserver.com/HPP_Response_Consumer.php"");
-
hppManager.setHppURL("https://pay.sandbox.realexpayments.com/pay";
Set HPP Properties
hppManager.setMerchantId("realexsandbox");
-
hppManager.setAccount("internet");
-
hppManager.setAmount("100");
-
hppManager.setCurrency("EUR");
it is also possible to set options by createFromBundle function
@@ -50,12 +45,15 @@ public class HPPManager extends HPPResponse {
//Supplementary data to be sent to Realex Payments. This will be returned in the HPP response.
private HashMap supplementaryData = new HashMap();
+ private static boolean isEncoded = false;
- public static boolean isLightBox() {
- return lightBox;
+ public static boolean isEncoded() {
+ return isEncoded;
}
- private static boolean lightBox = true;
+ public static void setIsEncoded(boolean isEncoded) {
+ HPPManager.isEncoded = isEncoded;
+ }
/**
*
@@ -79,6 +77,7 @@ public void setHppRequestProducerURL(String hppRequestProducerURL) {
* @return hpp response consumer url
*/
public String getHppResponseConsumerURL() {
+
return hppResponseConsumerURL;
}
@@ -154,6 +153,8 @@ public static HPPManager createFromBundle(Bundle arg) {
hppManager.variableReference = arg.getString(VAR_REF);
hppManager.productId = arg.getString(PROD_ID);
hppManager.language = arg.getString(HPP_LANG);
+ hppManager.hppVersion = arg.getString(HPP_VERSION);
+ hppManager.hppPostResponse = arg.getString(HPP_POST_RESPONSE);
hppManager.cardPaymentButtonText = arg.getString(CARD_PAYMENT_BUTTON);
hppManager.cardStorageEnable = arg.getString(CARD_STORAGE_ENABLE);
hppManager.offerSaveCard = arg.getString(OFFER_SAVE_CARD);
@@ -203,6 +204,8 @@ public Fragment newInstance() {
args.putString(VAR_REF, variableReference);
args.putString(PROD_ID, productId);
args.putString(HPP_LANG, language);
+ args.putString(HPP_VERSION, hppVersion);
+ args.putString(HPP_POST_RESPONSE, hppPostResponse);
args.putString(CARD_PAYMENT_BUTTON, cardPaymentButtonText);
args.putString(CARD_STORAGE_ENABLE, cardStorageEnable);
args.putString(OFFER_SAVE_CARD, offerSaveCard);
diff --git a/rxp-hpp-android/src/main/java/com/realexpayments/hpp/HPPManagerFragment.java b/rxp-hpp-android/src/main/java/com/realexpayments/hpp/HPPManagerFragment.java
index 18e1fff..1a20895 100644
--- a/rxp-hpp-android/src/main/java/com/realexpayments/hpp/HPPManagerFragment.java
+++ b/rxp-hpp-android/src/main/java/com/realexpayments/hpp/HPPManagerFragment.java
@@ -38,6 +38,7 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import android.util.Base64;
import retrofit.Callback;
import retrofit.RetrofitError;
@@ -47,9 +48,9 @@
/**
* Payment form fragment.
*
- Insert the HppManager fragment into your activity as follows;
- Fragment hppManagerFragment = hppManager.newInstance();
- getFragmentManager()
.beginTransaction().add(R.id.container,hppManagerFrament)
.commit();
+ Insert the HppManager fragment into your activity as follows;
+ Fragment hppManagerFragment = hppManager.newInstance();
+ getFragmentManager()
.beginTransaction().add(R.id.container,hppManagerFrament)
.commit();
**/
@@ -215,7 +216,7 @@ public void onReceiveValue(String value) {
@SuppressLint("NewApi")
@Override
- public void onReceivedHttpError(WebView view, WebResourceRequest request, WebResourceResponse errorResponse) {
+ public void onReceivedHttpError(WebView view, WebResourceRequest request, WebResourceResponse errorResponse) {
super.onReceivedHttpError(view, request, errorResponse);
if (this.url.equals(hppManager.getHppURL())) {
@@ -265,15 +266,26 @@ public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError e
params.put(key, consumer_response_params.get(key));
}
- if (hppManager.isLightBox()) {
- params.put(HPPManager.HPP_TEMPLATE_TYPE, "LIGHTBOX");
- Uri uri = Uri.parse(hppManager.getHppRequestProducerURL());
- params.put(HPPManager.HPP_ORIGIN, uri.getScheme() + "://" + uri.getHost());
- }
+ // default to HPP Version 2
+ nvps.add(new BasicNameValuePair("HPP_VERSION", "2"));
+
+ // determine the target origin to receive the response
+ Uri uri = Uri.parse(hppManager.getHppRequestProducerURL());
+ nvps.add(new BasicNameValuePair("HPP_POST_RESPONSE", uri.getScheme() + "://" + uri.getHost()));
for (String key : params.keySet()) {
- if (params.get(key) != null && params.get(key).length() > 0)
- nvps.add(new BasicNameValuePair(key, params.get(key)));
+ if (params.get(key) != null && params.get(key).length() > 0) {
+ if (hppManager.isEncoded()) {
+ String encodeValue = new String(params.get(key));
+ byte[] decodeValue = Base64.decode(encodeValue.toString(), Base64.DEFAULT);
+ String decodeValues = new String(decodeValue);
+ nvps.add(new BasicNameValuePair(key, decodeValues.toString()));
+ }
+
+ else {
+ nvps.add(new BasicNameValuePair(key, params.get(key)));
+ }
+ }
}
try {
diff --git a/rxp-hpp-android/src/main/java/com/realexpayments/hpp/HPPResponse.java b/rxp-hpp-android/src/main/java/com/realexpayments/hpp/HPPResponse.java
index 39da1c3..10cb788 100644
--- a/rxp-hpp-android/src/main/java/com/realexpayments/hpp/HPPResponse.java
+++ b/rxp-hpp-android/src/main/java/com/realexpayments/hpp/HPPResponse.java
@@ -39,6 +39,8 @@ public class HPPResponse {
public static final String HPP_TEMPLATE_TYPE = "HPP_TEMPLATE_TYPE";
public static final String HPP_ORIGIN = "HPP_ORIGIN";
public static final String SUPPLEMENTARYDATA = "SUPPLEMENTARYDATA";
+ public static final String HPP_VERSION = "HPP_VERSION";
+ public static final String HPP_POST_RESPONSE = "HPP_POST_RESPONSE";
/**
* Getter for merchant ID.
@@ -724,6 +726,12 @@ public void setTemplateType(String templateType) {
@SerializedName(HPP_ORIGIN)
protected String origin;
+ @SerializedName(HPP_VERSION)
+ protected String hppVersion;
+
+ @SerializedName(HPP_POST_RESPONSE)
+ protected String hppPostResponse;
+
public HashMap getMap() {
HashMap parameters = new HashMap<>();
@@ -756,6 +764,8 @@ public HashMap getMap() {
parameters.put(SHA1_HASH, sha1Hash);
parameters.put(HPP_TEMPLATE_TYPE, templateType);
parameters.put(HPP_ORIGIN, origin);
+ parameters.put(HPP_VERSION, hppVersion);
+ parameters.put(HPP_POST_RESPONSE, hppPostResponse);
return parameters;
}
diff --git a/rxp-remote-android/build.gradle b/rxp-remote-android/build.gradle
index 7c6d2d1..7fbd292 100644
--- a/rxp-remote-android/build.gradle
+++ b/rxp-remote-android/build.gradle
@@ -7,8 +7,8 @@ android {
defaultConfig {
minSdkVersion 19
targetSdkVersion 23
- versionCode 1
- versionName "1.0"
+ versionCode 2
+ versionName "1.1"
}
buildTypes {
release {