Skip to content

Commit

Permalink
Merge pull request #3 from realexpayments-developers/master
Browse files Browse the repository at this point in the history
Refactoring to have consistent naming with Java project
  • Loading branch information
RealexITSO committed Jan 25, 2016
2 parents 6090b1c + f57ffd6 commit 37d7fa3
Show file tree
Hide file tree
Showing 33 changed files with 527 additions and 31 deletions.
45 changes: 40 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,36 @@ You can find more information on how to use this SDK and sign up for a free Real
## Requirements

- Android 4.4+
- Android SDK 14 or later
- Android SDK 19 or later

## Installation
## HPP SDK Installation

### Gradle users
Add this dependency to your project's build file:
```
compile "com.realexpayments.hpp.sdk:rxp-hpp-android:1.0"
```

### Maven users
Add this dependency to your project's POM:
```xml
<dependency>
<groupId>com.realexpayments.hpp.sdk</groupId>
<artifactId>rxp-hpp-android</artifactId>
<version>1.0</version>
</dependency>
```

### Manual

You can integrate the Realex Payments Android SDK into your project manually.

- Download the the latest release from GitHub:

https://github.com/realexpayments/rxp-android/releases

- Add module 'hppmanager' into your project to use the HPP SDK.
- If you want to use the card data validation library, add the module 'realexremote' into your project.

- Add module 'rxp-hpp-android' into your project to use the HPP SDK.
- If you want to use the card data validation library, add the module 'rxp-remote-android' into your project.

## Using the HPP SDK

Expand Down Expand Up @@ -131,6 +148,24 @@ Realex Payments maintain separate endpoints for live and test transactions. You
hppManager.setHppURL("https://hpp.test.realexpayments.com/pay";
```

## Remote API Validation Library Installation

### Gradle users
Add this dependency to your project's build file:
```
compile "com.realexpayments.remote.sdk:rxp-remote-android:1.0"
```

### Maven users
Add this dependency to your project's POM:
```xml
<dependency>
<groupId>com.realexpayments.remote.sdk</groupId>
<artifactId>rxp-remote-android</artifactId>
<version>1.0</version>
</dependency>
```

## License

See the LICENSE file.
File renamed without changes.
9 changes: 5 additions & 4 deletions hppmanager/build.gradle → rxp-hpp-android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ apply plugin: 'com.android.library'

android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
buildToolsVersion "23.0.2"

defaultConfig {
minSdkVersion 14
minSdkVersion 19
targetSdkVersion 23
versionCode 1
versionName "1.0"
Expand All @@ -20,7 +20,8 @@ android {

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.google.code.gson:gson:2.5'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.squareup.retrofit:retrofit:1.7.1'
compile 'httpcomponents-httpcore:httpcore:4.0-alpha6'
compile 'org.apache.httpcomponents:httpcore:4.4.4'
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in C:\Android\sdk/tools/proguard/proguard-android.txt
# in C:\Android\com.realexpayments.hpp.sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package hppmanager.realex.com;

import android.app.Application;
import android.test.ApplicationTestCase;

/**
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
*/
public class ApplicationTest extends ApplicationTestCase<Application> {

public ApplicationTest() {
super(Application.class);
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.realex.hppmanager">
package="com.realexpayments.hpp">

<uses-permission android:name="android.permission.INTERNET" />

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.realex.hppmanager;
package com.realexpayments.hpp;

import com.google.gson.FieldNamingPolicy;
import com.google.gson.Gson;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.realex.hppmanager;
package com.realexpayments.hpp;

/**
* HPPError represents runtime exceptions
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.realex.hppmanager;
package com.realexpayments.hpp;

import android.app.Fragment;
import android.os.Bundle;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.realex.hppmanager;
package com.realexpayments.hpp;

import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.app.Activity;
import android.app.Fragment;
Expand Down Expand Up @@ -212,8 +213,9 @@ public void onReceiveValue(String value) {
}, 100);
}

@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())) {
Expand All @@ -224,6 +226,7 @@ public void onReceivedHttpError(WebView view, WebResourceRequest request, WebRes

}

@SuppressLint("NewApi")
@Override
public void onReceivedError(WebView view, WebResourceRequest request, WebResourceError error) {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.realex.hppmanager;
package com.realexpayments.hpp;

/**
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.realex.hppmanager;
package com.realexpayments.hpp;

import com.google.gson.annotations.SerializedName;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.realex.hppmanager;
package com.realexpayments.hpp;

import java.util.HashMap;

Expand Down
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions realexremote/build.gradle → rxp-remote-android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ apply plugin: 'com.android.library'

android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
buildToolsVersion "23.0.2"

defaultConfig {
minSdkVersion 14
minSdkVersion 19
targetSdkVersion 23
versionCode 1
versionName "1.0"
Expand All @@ -21,5 +21,5 @@ android {
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.android.support:appcompat-v7:23.1.1'
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in C:\Android\sdk/tools/proguard/proguard-android.txt
# in C:\Android\com.realexpayments.hpp.sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
Expand Down
96 changes: 96 additions & 0 deletions rxp-remote-android/rxp-remote-android.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id=":rxp-remote-android" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="com.realexpayments.remote.sdk" external.system.module.version="1.0" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="android-gradle" name="Android-Gradle">
<configuration>
<option name="GRADLE_PROJECT_PATH" value=":rxp-remote-android" />
</configuration>
</facet>
<facet type="android" name="Android">
<configuration>
<option name="SELECTED_BUILD_VARIANT" value="debug" />
<option name="SELECTED_TEST_ARTIFACT" value="_android_test_" />
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
<option name="ASSEMBLE_TEST_TASK_NAME" value="assembleDebugAndroidTest" />
<option name="COMPILE_JAVA_TEST_TASK_NAME" value="compileDebugAndroidTestSources" />
<afterSyncTasks>
<task>generateDebugAndroidTestSources</task>
<task>generateDebugSources</task>
</afterSyncTasks>
<option name="ALLOW_USER_CONFIGURATION" value="false" />
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
<option name="RES_FOLDERS_RELATIVE_PATH" value="" />
<option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
<option name="LIBRARY_PROJECT" value="true" />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/build/intermediates/classes/debug" />
<output-test url="file://$MODULE_DIR$/build/intermediates/classes/androidTest/debug" />
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/debug" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/debug" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/androidTest/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/androidTest/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/aidl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/assets" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/aidl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/build/.DS_Store" />
<excludeFolder url="file://$MODULE_DIR$/build/docs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/annotations" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/bundles" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jniLibs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/lint" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/transforms" />
<excludeFolder url="file://$MODULE_DIR$/build/libs" />
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
<excludeFolder url="file://$MODULE_DIR$/build/poms" />
<excludeFolder url="file://$MODULE_DIR$/build/reports" />
<excludeFolder url="file://$MODULE_DIR$/build/test-results" />
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
</content>
<orderEntry type="jdk" jdkName="Android API 23 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" exported="" name="support-v4-23.1.1" level="project" />
<orderEntry type="library" exported="" name="support-annotations-23.1.1" level="project" />
<orderEntry type="library" exported="" name="appcompat-v7-23.1.1" level="project" />
</component>
</module>
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package com.realexpayments.remote;

import android.app.Application;
import android.test.ApplicationTestCase;
import android.test.suitebuilder.annotation.SmallTest;

public class ValidateAmexCvnTest extends ApplicationTestCase<Application> {

public ValidateAmexCvnTest() {
super(Application.class);
}

@SmallTest
public void testValidAmexCVN() {
assertTrue(RealexRemote.validateAmexCvn("1234"));
}

@SmallTest
public void testEmptyCVN() {
assertFalse(RealexRemote.validateAmexCvn(""));
}

@SmallTest
public void testUndefinedCVN() {
assertFalse(RealexRemote.validateAmexCvn(null));
}

@SmallTest
public void testWhiteSpaceOnly() {
assertFalse(RealexRemote.validateAmexCvn(" "));
}

@SmallTest
public void testAmexCVNof5Numbers() {
assertFalse(RealexRemote.validateAmexCvn("12345"));
}

@SmallTest
public void testAmexCVNof3Numbers() {
assertFalse(RealexRemote.validateAmexCvn("123"));
}

@SmallTest
public void testNonNumericAmexCVNof4Characters() {
assertFalse(RealexRemote.validateAmexCvn("123a"));
}
}
Loading

0 comments on commit 37d7fa3

Please sign in to comment.