-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from realexpayments-developers/master
Realex Payments HPP Java SDK v1.0
- Loading branch information
Showing
28 changed files
with
5,622 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/target/ | ||
.classpath | ||
.project | ||
.settings/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2015 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 | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,39 @@ | ||
# rxp-hpp-java | ||
The official Realex Payments HPP Java SDK | ||
# Realex HPP Java SDK | ||
You can sign up for a Realex account at https://www.realexpayments.com. | ||
## Requirements | ||
Java 1.6 and later. | ||
## Installation | ||
### Maven users | ||
Add this dependency to your project's POM: | ||
```xml | ||
<dependency> | ||
<groupId>com.realexpayments.hpp.sdk</groupId> | ||
<artifactId>rxp-hpp-java</artifactId> | ||
<version>1.0</version> | ||
</dependency> | ||
``` | ||
|
||
### Gradle users | ||
Add this dependency to your project's build file: | ||
``` | ||
compile "com.realexpayments.hpp.sdk:rxp-hpp-java:1.0" | ||
``` | ||
|
||
## Usage | ||
### Creating Request JSON for Realex JS SDK | ||
```java | ||
HppRequest hppRequest = new HppRequest() | ||
.addAmount(100) | ||
.addCurrency("EUR") | ||
.addMerchantId("merchantId"); | ||
|
||
RealexHpp realexHpp = new RealexHpp("mySecret"); | ||
String requestJson = realexHpp.requestToJson(hppRequest); | ||
``` | ||
### Consuming Response JSON from Realex JS SDK | ||
```java | ||
RealexHpp realexHpp = new RealexHpp("mySecret"); | ||
HppResponse hppResponse = realexHpp.responseFromJson(responseJson); | ||
``` | ||
## License | ||
See the LICENSE file. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,174 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>com.realexpayments.hpp.sdk</groupId> | ||
<artifactId>rxp-hpp-java</artifactId> | ||
<version>1.0</version> | ||
<name>Realex Payments HPP Java SDK</name> | ||
<description>The official Realex Payments HPP Java SDK</description> | ||
<url>http://www.realexpayments.com</url> | ||
|
||
<licenses> | ||
<license> | ||
<name>MIT License</name> | ||
<url>https://github.com/realexpayments/rxp-hpp-java/blob/master/LICENSE.txt</url> | ||
</license> | ||
</licenses> | ||
<developers> | ||
<developer> | ||
<name>Realex Developer</name> | ||
<organization>Realex Payments</organization> | ||
<organizationUrl>http://www.realexpayments.com</organizationUrl> | ||
</developer> | ||
</developers> | ||
<scm> | ||
<connection>scm:git:[email protected]:realexpayments/rxp-hpp-java.git</connection> | ||
<developerConnection>scm:git:[email protected]:realexpayments/rxp-hpp-java.git</developerConnection> | ||
<url>https://github.com/realexpayments/rxp-hpp-java.git</url> | ||
</scm> | ||
|
||
<properties> | ||
<maven.compiler.source>1.6</maven.compiler.source> | ||
<maven.compiler.target>1.6</maven.compiler.target> | ||
<junit.version>4.12</junit.version> | ||
<slf4j.version>1.7.12</slf4j.version> | ||
<jackson.version>2.5.4</jackson.version> | ||
<jackson-annotations.version>2.5.4</jackson-annotations.version> | ||
<hibernate-validator.version>5.1.3.Final</hibernate-validator.version> | ||
<javax.el.version>2.2.5</javax.el.version> | ||
<logback-classic.version>1.1.3</logback-classic.version> | ||
<apache-commons-codec.version>1.10</apache-commons-codec.version> | ||
<mockito.version>1.10.19</mockito.version> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
</properties> | ||
|
||
<distributionManagement> | ||
<snapshotRepository> | ||
<id>ossrh</id> | ||
<name>Development Snapshots</name> | ||
<url>https://oss.sonatype.org/content/repositories/snapshots/</url> | ||
</snapshotRepository> | ||
<repository> | ||
<id>ossrh</id> | ||
<name>Releases</name> | ||
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url> | ||
</repository> | ||
</distributionManagement> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>commons-codec</groupId> | ||
<artifactId>commons-codec</artifactId> | ||
<version>${apache-commons-codec.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.slf4j</groupId> | ||
<artifactId>slf4j-api</artifactId> | ||
<version>${slf4j.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.fasterxml.jackson.core</groupId> | ||
<artifactId>jackson-core</artifactId> | ||
<version>${jackson.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.fasterxml.jackson.core</groupId> | ||
<artifactId>jackson-databind</artifactId> | ||
<version>${jackson.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.fasterxml.jackson.core</groupId> | ||
<artifactId>jackson-annotations</artifactId> | ||
<version>${jackson-annotations.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.hibernate</groupId> | ||
<artifactId>hibernate-validator</artifactId> | ||
<version>${hibernate-validator.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>javax.el</groupId> | ||
<artifactId>javax.el-api</artifactId> | ||
<version>${javax.el.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.glassfish.web</groupId> | ||
<artifactId>javax.el</artifactId> | ||
<version>${javax.el.version}</version> | ||
</dependency> | ||
|
||
<!-- test dependencies --> | ||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<version>${junit.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.mockito</groupId> | ||
<artifactId>mockito-core</artifactId> | ||
<version>${mockito.version}</version> | ||
<scope>test</scope> | ||
<exclusions> | ||
<exclusion> | ||
<artifactId>hamcrest-core</artifactId> | ||
<groupId>org.hamcrest</groupId> | ||
</exclusion> | ||
</exclusions> | ||
</dependency> | ||
<dependency> | ||
<groupId>ch.qos.logback</groupId> | ||
<artifactId>logback-classic</artifactId> | ||
<version>${logback-classic.version}</version> | ||
<scope>test</scope> | ||
<exclusions> | ||
<exclusion> | ||
<artifactId>slf4j-api</artifactId> | ||
<groupId>org.slf4j</groupId> | ||
</exclusion> | ||
</exclusions> | ||
</dependency> | ||
</dependencies> | ||
<build> | ||
<pluginManagement> | ||
<plugins> | ||
<plugin> | ||
<artifactId>maven-deploy-plugin</artifactId> | ||
<version>2.8.1</version> | ||
</plugin> | ||
</plugins> | ||
</pluginManagement> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-javadoc-plugin</artifactId> | ||
<version>2.10.3</version> | ||
<configuration> | ||
<encoding>UTF-8</encoding> | ||
</configuration> | ||
<executions> | ||
<execution> | ||
<id>attach-javadocs</id> | ||
<goals> | ||
<goal>jar</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-source-plugin</artifactId> | ||
<version>2.4</version> | ||
<executions> | ||
<execution> | ||
<id>attach-sources</id> | ||
<goals> | ||
<goal>jar-no-fork</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
</project> |
31 changes: 31 additions & 0 deletions
31
src/main/java/com/realexpayments/hpp/sdk/RealexException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package com.realexpayments.hpp.sdk; | ||
|
||
/** | ||
* An exception class for general Realex SDK errors. All other SDK exceptions will extend this class. | ||
* | ||
* @author markstanford | ||
*/ | ||
public class RealexException extends RuntimeException { | ||
|
||
private static final long serialVersionUID = -2270549234447218179L; | ||
|
||
/** | ||
* Constructor for RealexException. | ||
* | ||
* @param message | ||
* @param throwable | ||
*/ | ||
public RealexException(String message, Throwable throwable) { | ||
super(message, throwable); | ||
} | ||
|
||
/** | ||
* Constructor for RealexException. | ||
* | ||
* @param message | ||
*/ | ||
public RealexException(String message) { | ||
super(message); | ||
} | ||
|
||
} |
Oops, something went wrong.